NLMech  0.1.0
loadingDeck.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_LOADINGDECK_H
10 #define INP_LOADINGDECK_H
11 
12 #include <iostream> // error handling
13 #include <vector>
14 #include "util/utilIO.h"
15 
16 namespace inp {
17 
19 struct BCData {
20 
32  std::string d_regionType;
33 
44  std::string d_timeFnType;
45 
56  std::string d_spatialFnType;
57 
59  double d_x1;
60 
62  double d_y1;
63 
65  double d_z1;
66 
68  double d_x2;
69 
71  double d_y2;
72 
74  double d_z2;
75 
77  double d_theta;
78 
80  double d_r1;
81 
83  double d_r2;
84 
92  std::vector<size_t> d_direction;
93 
95  std::vector<double> d_timeFnParams;
96 
98  std::vector<double> d_spatialFnParams;
99 
103  BCData() : d_x1(0.), d_y1(0.), d_x2(0.), d_y2(0.), d_theta(0.),d_r1(0.),d_r2(0.){};
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 << "------- BCData --------" << std::endl << std::endl;
118  oss << tabS << "Region type = " << d_regionType << std::endl;
119  oss << tabS << "Time function type = " << d_timeFnType << std::endl;
120  oss << tabS << "Spatial function type = " << d_spatialFnType << std::endl;
121  oss << tabS << "DOFs affected = " << util::io::printStr(d_direction)
122  << 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 
144 struct LoadingDeck {
145 
147  std::vector<inp::BCData> d_uBCData;
148 
150  std::vector<inp::BCData> d_fBCData;
151 
155  LoadingDeck() = default;
156 
166  std::string printStr(int nt = 0, int lvl = 0) const {
167  auto tabS = util::io::getTabS(nt);
168  std::ostringstream oss;
169  oss << tabS << "------- LoadingDeck --------" << std::endl << std::endl;
170  oss << tabS << "Displacement loading data " << std::endl;
171  for (size_t i=0; i<d_uBCData.size(); i++) {
172  oss << tabS << "Data " << i+1 << " information " << std::endl;
173  oss << d_uBCData[i].printStr(nt+1, lvl);
174  }
175  oss << tabS << "Force loading data " << std::endl;
176  for (size_t i=0; i<d_fBCData.size(); i++) {
177  oss << tabS << "Data " << i+1 << " information " << std::endl;
178  oss << d_fBCData[i].printStr(nt+1, lvl);
179  }
180  oss << tabS << std::endl;
181 
182  return oss.str();
183  };
184 
192  void print(int nt = 0, int lvl = 0) const { std::cout << printStr(nt, lvl); };
193 };
194 
197 } // namespace inp
198 
199 #endif // INP_LOADINGDECK_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 for displacement/force boundary condition input data.
Definition: loadingDeck.h:19
void print(int nt=0, int lvl=0) const
Prints the information about the instance of the object.
Definition: loadingDeck.h:135
BCData()
Constructor.
Definition: loadingDeck.h:103
double d_r1
Radius (for circle and outer for torus)
Definition: loadingDeck.h:80
double d_r2
Inner radius (for torus)
Definition: loadingDeck.h:83
std::string d_timeFnType
Name of the formula with respect to time.
Definition: loadingDeck.h:44
std::vector< double > d_spatialFnParams
List of parameters for function wrt spatial coordinate.
Definition: loadingDeck.h:98
double d_x2
X coordinate of right-top point of rectangle/angled rectangle.
Definition: loadingDeck.h:68
std::string printStr(int nt=0, int lvl=0) const
Returns the string containing information about the instance of the object.
Definition: loadingDeck.h:114
std::string d_regionType
Type of region over which the bc will be applied.
Definition: loadingDeck.h:32
std::vector< size_t > d_direction
List of dofs on which this BC will be applied.
Definition: loadingDeck.h:92
double d_z1
Z coordinate of left-bottom-back point of cuboid.
Definition: loadingDeck.h:65
double d_theta
Angle of the rectangle (for angled rectangle)
Definition: loadingDeck.h:77
double d_y1
Y coordinate of left-bottom point of rectangle/angled rectangle.
Definition: loadingDeck.h:62
double d_z2
Z coordinate of right-top-front point of cuboid.
Definition: loadingDeck.h:74
std::vector< double > d_timeFnParams
List of parameters for function wrt time.
Definition: loadingDeck.h:95
std::string d_spatialFnType
Name of the formula of with respect to spatial coordinate.
Definition: loadingDeck.h:56
double d_y2
Y coordinate of right-top point of rectangle/angled rectangle.
Definition: loadingDeck.h:71
double d_x1
X coordinate of left-bottom point of rectangle/angled rectangle.
Definition: loadingDeck.h:59
Structure to read and store policy data.
Definition: loadingDeck.h:144
std::vector< inp::BCData > d_uBCData
List of displacement bcs.
Definition: loadingDeck.h:147
std::string printStr(int nt=0, int lvl=0) const
Returns the string containing information about the instance of the object.
Definition: loadingDeck.h:166
LoadingDeck()=default
Constructor.
void print(int nt=0, int lvl=0) const
Prints the information about the instance of the object.
Definition: loadingDeck.h:192
std::vector< inp::BCData > d_fBCData
List of force bcs.
Definition: loadingDeck.h:150