Skip to content

Commit

Permalink
Merge pull request #366 from streeve/fixup_analysis_args
Browse files Browse the repository at this point in the history
Clarify input args for analysis
  • Loading branch information
streeve authored Jul 31, 2024
2 parents 3a01630 + 1b121ce commit 91fccbc
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions analysis/bin/runGA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,36 @@ int main(int argc, char *argv[]) {
using memory_space = typename Kokkos::DefaultExecutionSpace::memory_space;
// Read command line input to obtain name of analysis file
std::string analysis_file;
if (argc < 2) {
throw std::runtime_error("Error: Full path to and name of analysis file must be given on the command line");
if (argc < 3) {
throw std::runtime_error("Error: Full path to analysis file and path to ExaCA log/microstructure file "
"(without file endings) must be given on "
"the command line. Alternatively, paths to log (with .json) and microstructure "
"output (with .vtk) can be given.\n\nUsage:\n "
"./ExaCA-Analysis analysis/examples/analysis.json output\n\nOR\n\n "
"./ExaCA-Analysis analysis/examples/analysis.json output.json output.vtk\n");
}
analysis_file = argv[1];
std::string base_filename = argv[2];
std::string log_file = base_filename + ".json";
std::string microstructure_file = base_filename + ".vtk";
std::string log_file;
std::string microstructure_file;

// JSON file (and VTK) were passed
if (base_filename.find(".json") != std::string::npos) {
log_file = base_filename;
base_filename = base_filename.substr(0, base_filename.find(".json"));
if (argc < 4) {
throw std::runtime_error(
"Error: Full path to ExaCA log file was given: path to microstructure file required."
"\n\nUsage:\n "
"./ExaCA-Analysis analysis/examples/analysis.json out.json out.vtk\n");
}
microstructure_file = argv[3];
}
// Base file was passed
else {
log_file = base_filename + ".json";
microstructure_file = base_filename + ".vtk";
}
std::cout << "Performing analysis of " << microstructure_file << " , using the log file " << log_file
<< " and the options specified in " << analysis_file << std::endl;

Expand Down

0 comments on commit 91fccbc

Please sign in to comment.