47 TestDeck(std::string testName,
size_t particleIdCompressiveTest = 0,
48 size_t particleForceDirectionCompressiveTest = 0)
58 size_t particleForceDirectionCompressiveTest = 0) {
63 auto j =
json({
"Test_Name", testName});
65 if (testName ==
"Compressive_Test") {
66 j[
"Compressive_Test"] =
json{{
"Wall_Id", particleIdCompressiveTest},
67 {
"Wall_Force_Direction", particleForceDirectionCompressiveTest}};
81 const bool compressive =
84 if (j.find(
"Compressive_Test") == j.end())
85 throw std::runtime_error(
"Compressive test requires Compressive_Test section");
99 std::string
printStr(
int nt = 0,
int lvl = 0)
const {
101 std::ostringstream oss;
102 oss << tabS <<
"------- TestDeck --------" << std::endl << std::endl;
103 oss << tabS <<
"Test name = " <<
d_testName << std::endl;
107 oss << tabS << std::endl;
118 void print(
int nt = 0,
int lvl = 0)
const { std::cout <<
printStr(nt, lvl); }
nlohmann::ordered_json json
Collection of methods and database related to input.
std::string getTabS(int nt)
Returns tab spaces of a given size.
Structure to read and store test-related input data.
void print(int nt=0, int lvl=0) const
Prints the information about the object.
size_t d_particleForceDirectionCompressiveTest
if it is a compressive test, specify force direction on wall
TestDeck(std::string testName, size_t particleIdCompressiveTest=0, size_t particleForceDirectionCompressiveTest=0)
Constructor.
static json getExampleJson(std::string testName="", size_t particleIdCompressiveTest=0, size_t particleForceDirectionCompressiveTest=0)
Returns example JSON object for ModelDeck configuration.
void readFromJson(const json &j)
Reads from json object.
TestDeck(const json &j=json({}))
Constructor.
std::string printStr(int nt=0, int lvl=0) const
Returns the string containing printable information about the object.
std::string d_testName
Specify test name (if any)
size_t d_particleIdCompressiveTest
if it is a compressive test, specify wall id and direction