15#include <unordered_map>
38 s_.reserve(s_.size() + 2 + name.size() + val.size());
58 ParamArgListBuilder &
param(std::string_view name,
float val) {
return update_(name,
to_string_exact(val)); }
59 ParamArgListBuilder &
param(std::string_view name,
double val) {
return update_(name,
to_string_exact(val)); }
60 ParamArgListBuilder &
param(std::string_view name, std::string_view val)
63 return update_(name, val);
93class SystemTestRunner;
115 void runTest(
bool const &compute_L2_norm_only =
false,
double const &maxAllowedL1Error = 0.0,
116 double const &maxAllowedError = 0.0);
126 void runL1ErrorTest(
double const &maxAllowedL1Error,
double const &maxAllowedError = 1E-7);
134 void openHydroTestData();
187 H5::H5File
getTestFile(
size_t const &i = 0) {
return _testHydroFieldsFileVec[i]; };
212 void setDataSetsToTest(std::vector<std::string>
const &dataSetNames) { _fiducialDataSetNames = dataSetNames; };
229 void setFiducialData(std::string
const &fieldName, std::vector<double>
const &dataVec);
252 std::vector<double>
generateConstantData(
double const &value,
size_t const &nx = 1,
size_t const &ny = 1,
253 size_t const &nz = 1);
265 std::vector<double>
loadTestFieldData(std::string dataSetName, std::vector<size_t> &testDims,
266 std::vector<H5::H5File> file = {});
289 std::vector<double>
generateSineData(
double const &offset,
double const &litude,
double const &kx,
290 double const &ky,
double const &kz,
double const &phase,
size_t const &nx = 1,
291 size_t const &ny = 1,
size_t const &nz = 1);
308 SystemTestRunner(
bool const &particleData =
false,
bool const &hydroData =
true,
bool const &useFiducialFile =
true,
309 bool const &useSettingsFile =
true,
bool const &gravityData =
false);
314 H5::H5File _fiducialFile;
316 std::vector<H5::H5File> _testHydroFieldsFileVec;
318 std::vector<H5::H5File> _testParticlesFileVec;
320 std::vector<H5::H5File> _testGravityFileVec;
323 std::string _chollaPath;
326 std::string _fullTestFileName;
328 std::string _chollaSettingsPath;
330 std::string _fiducialFilePath;
332 std::string _outputDirectory;
334 std::string _consoleOutputPath;
337 std::vector<std::string> _fiducialDataSetNames;
339 std::vector<std::string> _testDataSetNames;
342 int _numFiducialTimeSteps;
344 std::unordered_map<std::string, std::vector<double>> _fiducialDataSets;
347 std::vector<double> _testParticleIDs;
349 size_t _testTotalNumParticles = 0;
351 std::vector<double> _fiducialParticleIDs;
353 size_t _fiducialTotalNumParticles = 0;
357 double _fixedEpsilon = 5.0E-12;
365 bool _fiducialFileExists =
false;
367 bool _compareNumTimeSteps =
true;
373 bool _hydroDataExists =
true;
378 bool _particleDataExists =
false;
384 bool _gravityDataExists =
false;
391 void _checkNumTimeSteps();
401 std::vector<double> _loadTestParticleData(std::string
const &dataSetName);
411 std::vector<double> _loadFiducialFieldData(std::string
const &dataSetName);
413 std::vector<double> _loadGravityPotential(H5::H5File
const &data_file);
422 std::vector<double> _loadFiducialParticleData(std::string
const &dataSetName);
430 std::vector<std::string> _findDataSetNames(H5::H5File
const &inputFile);
Definition system_tester.h:31
const std::string & getCombinedArgList() const
Definition system_tester.h:48
ParamArgListBuilder & param(std::string_view name, int val)
Definition system_tester.h:56
Definition system_tester.h:97
H5::H5File getTestFile(size_t const &i=0)
Get the Test File object.
Definition system_tester.h:187
std::string getOutputDirectory()
Get the Output Directory object.
Definition system_tester.h:164
void runTest(bool const &compute_L2_norm_only=false, double const &maxAllowedL1Error=0.0, double const &maxAllowedError=0.0)
Run the system test that has been set up.
Definition system_tester.cpp:34
void setFixedEpsilon(double const &newVal)
Set the Fixed Epsilon value.
Definition system_tester.h:201
void setDataSetsToTest(std::vector< std::string > const &dataSetNames)
Choose which datasets to test. By default it tests all the datasets in the fiducial data....
Definition system_tester.h:212
void setFiducialNumTimeSteps(int const &numTimeSteps)
Set the Fiducial Num Time Steps object.
Definition system_tester.h:236
size_t numMpiRanks
The number of MPI ranks, defaults to 1.
Definition system_tester.h:100
std::vector< double > loadTestFieldData(std::string dataSetName, std::vector< size_t > &testDims, std::vector< H5::H5File > file={})
Load the test data for physical fields from the HDF5 file(s). If there is more than one HDF5 file the...
Definition system_tester.cpp:562
void setFiducialData(std::string const &fieldName, std::vector< double > const &dataVec)
Set or add a fiducial dataset.
Definition system_tester.cpp:397
void runL1ErrorTest(double const &maxAllowedL1Error, double const &maxAllowedError=1E-7)
Compute the L1 error for each field compared to the initial conditions. Doesn't work with particle da...
Definition system_tester.cpp:226
std::vector< double > generateConstantData(double const &value, size_t const &nx=1, size_t const &ny=1, size_t const &nz=1)
Generate an vector of the specified size populated by the specified value.
Definition system_tester.cpp:412
system_test::ParamArgListBuilder chollaLaunchParams
Set the parameters that Cholla launches with, potentially entirely replacing the need for a settings ...
Definition system_tester.h:109
std::string getConsoleOutputPath()
Get the Console Output Path object.
Definition system_tester.h:172
std::string getChollaPath()
Get the Cholla Path object.
Definition system_tester.h:141
std::vector< std::string > getDataSetsToTest()
Get the vector of datasets that will be tested.
Definition system_tester.h:194
double getL2Norm()
Get the L2Norm.
Definition system_tester.h:156
std::vector< double > generateSineData(double const &offset, double const &litude, double const &kx, double const &ky, double const &kz, double const &phase, size_t const &nx=1, size_t const &ny=1, size_t const &nz=1)
Generate a std::vector of the specified size populated by a sine wave. The equation used to generate ...
Definition system_tester.cpp:425
H5::H5File getFiducialFile()
Get the Fiducial File object.
Definition system_tester.h:179
void setCompareNumTimeSteps(bool const &compare)
Set the Compare Num Time Steps object.
Definition system_tester.h:220
std::string getChollaSettingsFilePath()
Get the Cholla Settings File Path object.
Definition system_tester.h:149
void launchCholla()
Launch Cholla as it is set up.
Definition system_tester.cpp:357
std::string to_string_exact(T const &input)
Convert a floating point number to a string such that it can be exactly deserialized back from a stri...
Definition io.h:51
This namespace defines SystemTestRunner (and all relevant machinery).
Definition system_tester.h:27