56 BCDeck(
size_t nForceSets,
size_t nDispSets = 0,
size_t nICSets = 0,
80 checkNames(given, {
"Force_BC_Sets",
"Displacement_BC_Sets",
"IC_Sets",
83 const auto nForceSets = given.value(
"Force_BC_Sets",
size_t(0));
84 const auto nDispSets = given.value(
"Displacement_BC_Sets",
size_t(0));
85 const auto nICSets = given.value(
"IC_Sets",
size_t(0));
86 const bool gravityActive = given.find(
"Gravity") != given.end();
88 if (nForceSets + nDispSets + nICSets == 0 and !gravityActive)
94 j[
"Force_BC"][
"Gravity"] = given.at(
"Gravity");
97 j[
"Force_BC"][
"Sets"] = nForceSets;
100 j[
"Displacement_BC"] = {{
"Sets", nDispSets}};
103 j[
"IC"] = {{
"Sets", nICSets}};
117 if (j.find(
"Force_BC") != j.end()) {
118 if (j.at(
"Force_BC").find(
"Gravity") != j.at(
"Force_BC").end()) {
128 for (
auto tag : std::vector<std::string>({
"Force_BC",
"Displacement_BC",
"IC"})) {
129 if (j.find(tag) == j.end())
132 auto nSets = j.at(tag).value(
"Sets", 0);
134 for (
size_t i = 0; i < nSets; i++) {
136 auto set = j.at(tag).at(
"Set_" + std::to_string(i + 1));
138 if (tag ==
"Force_BC") {
142 }
else if (tag ==
"Displacement_BC") {
146 }
else if (tag ==
"IC") {
162 std::string
printStr(
int nt = 0,
int lvl = 0)
const {
164 std::ostringstream oss;
165 oss << tabS <<
"------- BCDeck --------" << std::endl << std::endl;
166 oss << tabS <<
"Force loading deck size = " <<
d_forceDeck.size() << std::endl;
167 oss << tabS <<
"Force loading data:" << std::endl;
169 oss << tabS <<
"Force data for set = " << i << std::endl;
173 oss << tabS <<
"Displacement loading deck size = " <<
d_dispDeck.size() << std::endl;
174 oss << tabS <<
"Displacement loading data:" << std::endl;
175 for (
size_t i = 0; i <
d_dispDeck.size(); i++) {
176 oss << tabS <<
"Displacement data for set = " << i << std::endl;
180 oss << tabS <<
"Initial condition deck size = " <<
d_icDeck.size() << std::endl;
181 oss << tabS <<
"Initial condition data:" << std::endl;
182 for (
size_t i = 0; i <
d_icDeck.size(); i++) {
183 oss << tabS <<
"Initial condition for set = " << i << std::endl;
184 oss <<
d_icDeck[i].printStr(nt + 1, lvl);
187 oss << tabS <<
"Gravity loading active = " <<
d_gravityActive << std::endl;
188 oss << tabS <<
"Gravity loading value = " <<
d_gravity.
printStr(0, 0) << std::endl;
189 oss << tabS << std::endl;
200 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.
void checkNames(const json &given, const std::vector< std::string > &names)
Rejects a key that is not among those named.
std::string getTabS(int nt)
Returns tab spaces of a given size.
User-input data for particle neighbor search.
void readFromJson(const json &j, std::string type)
Reads from json object.
Structure to read and store test-related input data.
std::vector< inp::BCBaseDeck > d_icDeck
Initial condition deck.
std::vector< inp::BCBaseDeck > d_dispDeck
Displacement loading deck.
BCDeck(const json &j=json({}))
Constructor.
void print(int nt=0, int lvl=0) const
Prints the information about the object.
void readFromJson(const json &j)
Reads from json object.
std::vector< inp::BCBaseDeck > d_forceDeck
Force loading deck.
BCDeck(size_t nForceSets, size_t nDispSets=0, size_t nICSets=0, bool gravityActive=false, util::Point gravity=util::Point())
Constructor.
util::Point d_gravity
Gravity loading value.
static json getExampleJson(const json &given=json::object())
Returns example JSON object for ModelDeck configuration.
bool d_gravityActive
Gravity loading value.
std::string printStr(int nt=0, int lvl=0) const
Returns the string containing printable information about the object.
A structure to represent 3d vectors.
std::string printStr(int nt=0, int lvl=0) const
Returns the string containing printable information about the object.