11#ifndef INP_OUTPUTDECK_H
12#define INP_OUTPUTDECK_H
123 std::string path =
"./",
124 std::vector<std::string> outTags = {
"Displacement"},
125 size_t outputInterval = 1,
127 bool performFEOut =
true,
128 std::string compressType =
"zlib",
129 bool performOut =
true,
130 size_t dtTestOut = 1,
131 std::string tagPPFile =
"",
132 bool pvdCollection =
false)
164 static const std::vector<Field<OutputDeck>> &
fields() {
165 static const std::vector<Field<OutputDeck>> f = {
167 "Directory the output is written to"),
169 "Write output at all"),
171 "Fields written at each output step"),
173 "Steps between outputs", {{}, size_t(1), {}}),
175 "How much is written to the log"),
177 "Write the finite element mesh as well as the nodes"),
179 std::string(
"zlib"),
"Compression used in the output files"),
181 "Output file format"),
183 "Steps between post-processing outputs"),
185 "Suffix of the post-processing file"),
189 "PVD_Collection",
false,
190 "Write a PVD file indexing the time steps",
191 {}, [](
const bool &v) {
return v; }),
222 if (j.contains(
"Output_Criteria")) {
223 d_outCriteria = j.at(
"Output_Criteria").value(
"Type", std::string(
""));
224 d_dtOutCriteria = j.at(
"Output_Criteria").value(
"New_Interval",
size_t(1));
227 throw std::runtime_error(
228 "Output_Criteria.New_Interval must be >= 1 (use 1 to write every step).");
239 std::string
printStr(
int nt = 0,
int lvl = 0)
const {
241 std::ostringstream oss;
242 oss << tabS <<
"------- OutputDeck --------" << std::endl << std::endl;
244 oss << tabS <<
"Output_Interval before the criteria = " <<
d_dtOutOld
246 oss << tabS <<
"Output_Criteria.Type = " <<
d_outCriteria << std::endl;
249 oss << tabS <<
"Output_Criteria.Parameters = "
251 oss << tabS << std::endl;
262 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 input data for performing simulation output.
size_t d_dtTestOut
Size of time steps (or frequency) for output operation.
std::vector< std::string > d_outTags
List of tags of data to be dumped.
static json getExampleJson(const char *)=delete
Returns example JSON object for ModelDeck configuration.
void print(int nt=0, int lvl=0) const
Prints the information about the object.
std::string d_compressType
Compressor type for .vtu files.
size_t d_dtOutCriteria
Specify output frequency if output criteria is met.
void readFromJson(const json &j)
Reads from json object.
std::string printStr(int nt=0, int lvl=0) const
Returns the string containing printable information about the object.
std::string d_outCriteria
Specify output criteria to change output frequency.
size_t d_dtOut
Size of time steps (or frequency) for output operation.
bool d_performFEOut
Flag specifying if element-node connectivity should not be dumped.
static const std::vector< Field< OutputDeck > > & fields()
The fields of this deck, declared once.
std::string d_outFormat
Output format. Allowed values are vtu, msh, legacy_vtk.
std::string d_path
Output Path where the files will be written.
std::string d_tagPPFile
Tag for postprocessing file.
size_t d_debug
Level below which a message is logged.
bool d_performOut
Perform vtu output.
size_t d_dtOutOld
Size of time steps (or frequency) for output operation.
std::vector< double > d_outCriteriaParams
List of parameters required in checking output criteria.
OutputDeck(std::string outFormat, std::string path="./", std::vector< std::string > outTags={"Displacement"}, size_t outputInterval=1, size_t debug=2, bool performFEOut=true, std::string compressType="zlib", bool performOut=true, size_t dtTestOut=1, std::string tagPPFile="", bool pvdCollection=false)
Constructor.
static json getExampleJson(const std::string &)=delete
Returns example JSON object for ModelDeck configuration.
OutputDeck(const json &j=json({}))
Constructor.
bool d_pvdCollection
If true, write a ParaView .pvd collection alongside VTU files so one file can be opened to animate al...
static json getExampleJson(const json &given=json::object())
Returns the block with the given fields set.