NLMech  0.1.0
outputDeck.h
1 // Copyright (c) 2019 Prashant K. Jha
3 // Copyright (c) 2019 Patrick Diehl
4 //
5 // Distributed under the Boost Software License, Version 1.0. (See accompanying
6 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 
9 #ifndef INP_OUTPUTDECK_H
10 #define INP_OUTPUTDECK_H
11 
12 #include <string>
13 #include <vector>
14 #include "util/utilIO.h"
15 
16 namespace inp {
17 
24 struct OutputDeck {
25 
30  std::string d_outFormat;
31 
36  std::string d_path;
37 
39  std::vector<std::string> d_outTags;
40 
42  size_t d_dtOut;
43 
45  size_t d_dtOutOld;
46 
48  size_t d_debug;
49 
57 
59  std::string d_compressType;
60 
71  std::string d_outCriteria;
72 
78 
80  std::vector<double> d_outCriteriaParams;
81 
86  : d_outFormat("vtu"), d_path("./"), d_dtOut(0), d_dtOutOld(0), d_debug(0),
87  d_performFEOut(true), d_dtOutCriteria(0){};
88 
95  bool isTagInOutput(const std::string &tag) {
96 
97  // search for tag in output tag list
98  for (const auto &type : d_outTags)
99  if (tag == type)
100  return true;
101 
102  return false;
103  };
104 
114  std::string printStr(int nt = 0, int lvl = 0) const {
115  auto tabS = util::io::getTabS(nt);
116  std::ostringstream oss;
117  oss << tabS << "------- OutputDeck --------" << std::endl << std::endl;
118  oss << tabS << "Output format = " << d_outFormat << std::endl;
119  oss << tabS << "Output path = " << d_path << std::endl;
120  oss << tabS << "Output tags = " << util::io::printStr(d_outTags) << std::endl;
121  oss << tabS << "Output interval = " << d_dtOut << std::endl;
122  oss << tabS << "Debug level = " << d_debug << std::endl;
123  oss << tabS << std::endl;
124 
125  return oss.str();
126  };
127 
135  void print(int nt = 0, int lvl = 0) const { std::cout << printStr(nt, lvl); };
136 };
137 
140 } // namespace inp
141 
142 #endif // INP_OUTPUTDECK_H
Collection of methods and database related to input.
Definition: main.cpp:21
std::string printStr(const std::vector< T > &list, int nt=0)
Concatenates the elements of the vector separated with a comma.
Definition: utilIO.h:40
std::string getTabS(int nt)
Generate a string contaning nt tabs.
Definition: utilIO.h:26
Structure to read input data for performing simulation output.
Definition: outputDeck.h:24
std::vector< std::string > d_outTags
List of tags of data to be dumped.
Definition: outputDeck.h:39
void print(int nt=0, int lvl=0) const
Prints the information about the instance of the object.
Definition: outputDeck.h:135
std::string d_compressType
Compressor type for .vtu files.
Definition: outputDeck.h:59
size_t d_dtOutCriteria
Specify output frequency if output criteria is met.
Definition: outputDeck.h:77
std::string printStr(int nt=0, int lvl=0) const
Returns the string containing information about the instance of the object.
Definition: outputDeck.h:114
OutputDeck()
Constructor.
Definition: outputDeck.h:85
std::string d_outCriteria
Specify output criteria to change output frequency.
Definition: outputDeck.h:71
size_t d_dtOut
Size of time steps (or frequency) for output operation.
Definition: outputDeck.h:42
bool d_performFEOut
Flag specifying if element-node connectivity should not be dumped.
Definition: outputDeck.h:56
std::string d_outFormat
Output format: currently supports vtu, msh, legacy_vtk output.
Definition: outputDeck.h:30
std::string d_path
Output Path where the files will be written.
Definition: outputDeck.h:36
size_t d_debug
Flag specifying debug level.
Definition: outputDeck.h:48
size_t d_dtOutOld
Size of time steps (or frequency) for output operation.
Definition: outputDeck.h:45
std::vector< double > d_outCriteriaParams
List of parameters required in checking output criteria.
Definition: outputDeck.h:80
bool isTagInOutput(const std::string &tag)
Searches list of tags and returns true if the asked tag is in the list.
Definition: outputDeck.h:95