Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added results_prefix field in input json #36

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading