11#ifndef INP_RESTARTDECK_H
12#define INP_RESTARTDECK_H
41 RestartDeck(std::string file,
size_t step = 0,
bool changeRefFreeDofs =
false)
57 static const std::vector<Field<RestartDeck>> &
fields() {
58 static const std::vector<Field<RestartDeck>> f = {
60 "File the state is read from"),
62 "Step the state was written at"),
64 "Change_Reference_Free_Dofs",
false,
65 "Move only the bodies that have a free degree of freedom"),
81 if (j.at(
"File").get<std::string>().empty())
112 json j = json::object();
124 std::string
printStr(
int nt = 0,
int lvl = 0)
const {
126 std::ostringstream oss;
127 oss << tabS <<
"------- RestartDeck --------" << std::endl << std::endl;
129 oss << tabS << std::endl;
140 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 writeFields(const Deck &d, json &j, const std::vector< Field< Deck > > &fs)
Writes every field of the table into 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 restart related data input.
static json getExampleJson(const char *)=delete
Rejects a value given where a set of named values is expected.
json writeToJson() const
Returns this deck as a JSON object.
std::string d_file
restart filename
static json getExampleJson(const std::string &)=delete
Rejects a value given where a set of named values is expected.
std::string printStr(int nt=0, int lvl=0) const
Returns the string containing printable information about the object.
static const std::vector< Field< RestartDeck > > & fields()
Returns example JSON object for ModelDeck configuration.
RestartDeck(std::string file, size_t step=0, bool changeRefFreeDofs=false)
Constructor.
void readFromJson(const json &j)
Reads from json object.
static json getExampleJson(const json &given=json::object())
Returns the block with the given fields set.
void print(int nt=0, int lvl=0) const
Prints the information about the object.
size_t d_step
Restart time step.
bool d_changeRefFreeDofs
Change only those particles/walls which have any one of its nodes dof free.
RestartDeck(const json &j=json({}))
Constructor.