NLMech  0.1.0
modelDeck.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_MODELDECK_H
10 #define INP_MODELDECK_H
11 
12 #include <string>
13 #include "util/utilIO.h"
14 
15 namespace inp {
16 
23 struct ModelDeck {
24 
32  std::string d_simType;
33 
36 
47 
56  std::string d_timeDiscretization;
57 
59  size_t d_dim;
60 
62  double d_tFinal;
63 
65  double d_dt;
66 
68  size_t d_Nt;
69 
71  double d_horizon;
72 
78  int d_rh;
79 
81  double d_h;
82 
87  : d_dim(0), d_isRestartActive(false), d_tFinal(0.), d_dt(0.), d_Nt(0),
88  d_horizon(0.), d_rh(0), d_h(0.){};
89 
99  std::string printStr(int nt = 0, int lvl = 0) const {
100  auto tabS = util::io::getTabS(nt);
101  std::ostringstream oss;
102  oss << tabS << "------- ModelDeck --------" << std::endl << std::endl;
103  oss << tabS << "Dimension = " << d_dim << std::endl;
104  oss << tabS << "Simulation type = " << d_simType << std::endl;
105  oss << tabS << "Spatial discretization type = " << d_spatialDiscretization << std::endl;
106  oss << tabS << "Time discretization type = " << d_timeDiscretization <<
107  std::endl;
108  oss << tabS << "Final time = " << d_tFinal << std::endl;
109  oss << tabS << "Number of time steps = " << d_Nt << std::endl;
110  oss << tabS << "Size time steps = " << d_dt << std::endl;
111  oss << tabS << "Mesh size = " << d_h << std::endl;
112  oss << tabS << "Horizon = " << d_horizon << std::endl;
113  oss << tabS << std::endl;
114 
115  return oss.str();
116  };
117 
125  void print(int nt = 0, int lvl = 0) const { std::cout << printStr(nt, lvl); };
126 };
127 
130 } // namespace inp
131 
132 #endif // INP_MODELDECK_H
Collection of methods and database related to input.
Definition: main.cpp:21
std::string getTabS(int nt)
Generate a string contaning nt tabs.
Definition: utilIO.h:26
Structure to read and store model related input data.
Definition: modelDeck.h:23
int d_rh
Ratio of Horizon to mesh size.
Definition: modelDeck.h:78
size_t d_Nt
Number of time steps.
Definition: modelDeck.h:68
size_t d_dim
Dimension.
Definition: modelDeck.h:59
double d_tFinal
Final simulation time.
Definition: modelDeck.h:62
double d_h
Mesh size.
Definition: modelDeck.h:81
std::string d_simType
Simulation type.
Definition: modelDeck.h:32
ModelDeck()
Constructor.
Definition: modelDeck.h:86
std::string d_spatialDiscretization
Tag for spatial discretization.
Definition: modelDeck.h:46
double d_dt
Size of time steps.
Definition: modelDeck.h:65
bool d_isRestartActive
Flag indicating if this restart problem.
Definition: modelDeck.h:35
std::string printStr(int nt=0, int lvl=0) const
Returns the string containing information about the instance of the object.
Definition: modelDeck.h:99
void print(int nt=0, int lvl=0) const
Prints the information about the instance of the object.
Definition: modelDeck.h:125
std::string d_timeDiscretization
Tag for time discretization.
Definition: modelDeck.h:56
double d_horizon
Horizon.
Definition: modelDeck.h:71