NLMech  0.1.0
initialConditionDeck.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 #ifndef INP_INITIALCONDITIONDECK_H
9 #define INP_INITIALCONDITIONDECK_H
10 
11 #include <string>
12 #include <vector>
13 #include "util/utilIO.h"
14 
15 namespace inp {
16 
18 struct ICData {
19 
21  std::string d_file;
22 
31  std::string d_type;
32 
34  std::vector<double> d_params;
35 
39  ICData() = default;
40 
50  std::string printStr(int nt = 0, int lvl = 0) const {
51  auto tabS = util::io::getTabS(nt);
52  std::ostringstream oss;
53  oss << tabS << "------- ICData --------" << std::endl << std::endl;
54  oss << tabS << "Initial condition file = " << d_file << std::endl;
55  oss << tabS << "Initial condition type = " << d_type << std::endl;
56  oss << tabS << "Number of parameters = " << d_params.size() << std::endl;
57  oss << tabS << std::endl;
58 
59  return oss.str();
60  };
61 
69  void print(int nt = 0, int lvl = 0) const { std::cout << printStr(nt, lvl); };
70 };
71 
79 
82 
85 
90 
100  std::string printStr(int nt = 0, int lvl = 0) const {
101  auto tabS = util::io::getTabS(nt);
102  std::ostringstream oss;
103  oss << tabS << "------- InitialConditionDeck --------" << std::endl << std::endl;
104  oss << tabS << "Displacement initial condition data " << std::endl;
105  oss << d_uICData.printStr(nt+1, lvl);
106  oss << tabS << "Velocity initial condition data " << std::endl;
107  oss << d_vICData.printStr(nt+1, lvl);
108  oss << tabS << std::endl;
109 
110  return oss.str();
111  };
112 
120  void print(int nt = 0, int lvl = 0) const { std::cout << printStr(nt, lvl); };
121 };
122 
125 } // namespace inp
126 
127 #endif // INP_INITIALCONDITIONDECK_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 store initial condition input data.
Definition: initialConditionDeck.h:18
ICData()=default
Constructor.
std::vector< double > d_params
List of parameters.
Definition: initialConditionDeck.h:34
void print(int nt=0, int lvl=0) const
Prints the information about the instance of the object.
Definition: initialConditionDeck.h:69
std::string d_type
Tag specifying the formula to compute initial displacement and velocity.
Definition: initialConditionDeck.h:31
std::string printStr(int nt=0, int lvl=0) const
Returns the string containing information about the instance of the object.
Definition: initialConditionDeck.h:50
std::string d_file
Filename (if any) to read velocity/displacement.
Definition: initialConditionDeck.h:21
Structure to read and store policy data.
Definition: initialConditionDeck.h:78
InitialConditionDeck()
Constructor.
Definition: initialConditionDeck.h:89
void print(int nt=0, int lvl=0) const
Prints the information about the instance of the object.
Definition: initialConditionDeck.h:120
inp::ICData d_vICData
Initial condition data for velocity.
Definition: initialConditionDeck.h:84
std::string printStr(int nt=0, int lvl=0) const
Returns the string containing information about the instance of the object.
Definition: initialConditionDeck.h:100
inp::ICData d_uICData
Initial condition data for displacement.
Definition: initialConditionDeck.h:81