48 TestDeck(std::string testName,
size_t particleIdCompressiveTest = 0,
49 size_t particleForceDirectionCompressiveTest = 0)
58 static const std::vector<Field<TestDeck>> &
fields() {
59 static const std::vector<Field<TestDeck>> f = {
61 "Post-processing applied after the run"),
72 return name ==
"Compressive_Test" || name ==
"compressive_test";
87 const auto name = j.at(
"Test_Name").get<std::string>();
90 if (
isCompressive(name) && j.find(
"Compressive_Test") == j.end())
91 j[
"Compressive_Test"] =
92 json{{
"Wall_Id", size_t(0)}, {
"Wall_Force_Direction", size_t(0)}};
127 if (j.find(
"Compressive_Test") == j.end())
128 throw std::runtime_error(
"Compressive test requires Compressive_Test section");
142 std::string
printStr(
int nt = 0,
int lvl = 0)
const {
144 std::ostringstream oss;
145 oss << tabS <<
"------- TestDeck --------" << std::endl << std::endl;
150 oss << tabS << std::endl;
161 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.
Field< Deck > field(T Deck::*m, std::string key, T def, std::string doc, Accepts< T > accepts={}, std::function< bool(const T &)> emitIf=[](const T &) { return true;})
Declares a field that maps one key to one member.
void readFields(Deck &d, const json &j, const std::vector< Field< Deck > > &fs)
Reads every field of the table from the block.
void printFields(const Deck &d, std::ostringstream &oss, const std::vector< Field< Deck > > &fs, const std::string &tab="")
Appends every field of the table to a stream.
json applyGiven(const json &given, const std::vector< Field< Deck > > &fs, const std::vector< std::string > &extra={})
The default block with the given keys replaced.
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(const char *)=delete
Returns the block with the given fields set.
static json getExampleJson(const std::string &)=delete
Returns the block with the given fields set.
void readFromJson(const json &j)
Reads from json object.
TestDeck(const json &j=json({}))
Constructor.
static const std::vector< Field< TestDeck > > & fields()
Returns example JSON object for ModelDeck configuration.
std::string printStr(int nt=0, int lvl=0) const
Returns the string containing printable information about the object.
static json getExampleJson(const json &given=json::object())
Returns the block with the given fields set.
static bool isCompressive(const std::string &name)
True when the name selects the compressive test.
std::string d_testName
Specify test name (if any)
size_t d_particleIdCompressiveTest
if it is a compressive test, specify wall id and direction