Skip to content

Commit

Permalink
Merge pull request #36 from DataAnalyticsEngineering/feature_result_p…
Browse files Browse the repository at this point in the history
…refix

added results_prefix field in input json
  • Loading branch information
sanathkeshav authored Nov 5, 2024
2 parents e185190 + fed1280 commit 91d1e13
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class Reader {
// contents of input file:
char ms_filename[4096]; // Name of Micro-structure hdf5 file
char ms_datasetname[4096]; // Absolute path of Micro-structure in hdf5 file
char results_prefix[4096];
int n_mat;
json materialProperties;
double TOL;
Expand Down
4 changes: 4 additions & 0 deletions include/solver.h
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,10 @@ void Solver<howmany>::postprocess(Reader reader, const char resultsFileName[], i
printf(") \n\n");
}

// Concatenate reader.ms_datasetname and reader.results_prefix into reader.ms_datasetname
strcat(reader.ms_datasetname, "/");
strcat(reader.ms_datasetname, reader.results_prefix);

// Write results to results h5 file
auto writeData = [&](const char *resultName, const char *resultPrefix, auto *data, hsize_t *dims, int ndims) {
if (std::find(reader.resultsToWrite.begin(), reader.resultsToWrite.end(), resultName) != reader.resultsToWrite.end()) {
Expand Down
6 changes: 6 additions & 0 deletions src/reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ void Reader ::ReadInputFile(char fn[])
strcpy(ms_filename, j["ms_filename"].get<string>().c_str());
strcpy(ms_datasetname, j["ms_datasetname"].get<string>().c_str());

if (j.contains("results_prefix")) {
strcpy(results_prefix, j["results_prefix"].get<string>().c_str());
} else {
strcpy(results_prefix, "");
}

L = j["ms_L"].get<vector<double>>();

errorParameters = j["error_parameters"];
Expand Down

0 comments on commit 91d1e13

Please sign in to comment.