KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
space_time_set.h
Go to the documentation of this file.
1 #ifndef KRATOS_SPACE_TIME_SET_H
2 #define KRATOS_SPACE_TIME_SET_H
3 
4 // /* External includes */
5 
6 // System includes
7 
8 // Project includes
9 #include "includes/variables.h"
10 
11 /* System includes */
12 #include <limits>
13 #include <iostream>
14 #include <iomanip>
15 
16 /* External includes */
17 #ifdef _OPENMP
18 #include <omp.h>
19 #endif
20 
21 /* Project includes */
22 #include "includes/define.h"
23 #include "utilities/openmp_utils.h"
24 #include "../real_functions.h"
25 #include "../real_field.h"
26 #include "space_time_rule.h"
27 
28 
29 namespace Kratos
30 {
32 {
33 public:
34 
36 
38 
39 SpaceTimeSet(const double min_time,
40  const double max_time,
41  const double min_x,
42  const double min_y,
43  const double min_z,
44  const double max_x,
45  const double max_y,
46  const double max_z)
47 {
48  BoundingBoxRule::Pointer b_box_rule(new BoundingBoxRule(min_time,
49  max_time,
50  min_x,
51  min_y,
52  min_z,
53  max_x,
54  max_y,
55  max_z));
56  std::vector<SpaceTimeRule::Pointer> union_rules;
57  union_rules.push_back(b_box_rule);
58  mUnionOfRules.push_back(union_rules);
59 }
60 
62 {
63  BoundingBoxRule::Pointer b_box_rule(new BoundingBoxRule());
64  std::vector<SpaceTimeRule::Pointer> union_rules;
65  union_rules.push_back(b_box_rule);
66  mUnionOfRules.push_back(union_rules);
67 }
68 
70 
71 virtual ~SpaceTimeSet(){}
72 
73 //***************************************************************************************************************
74 //***************************************************************************************************************
75 
76 void AddAndRule(SpaceTimeRule::Pointer p_rule)
77 {
78  for (unsigned int i = 0; i < mUnionOfRules.size(); ++i){
79  mUnionOfRules[i].push_back(p_rule);
80  }
81 }
82 
83 //***************************************************************************************************************
84 //***************************************************************************************************************
85 
86 void AddOrRule(SpaceTimeRule::Pointer p_rule)
87 {
88 std::vector<SpaceTimeRule::Pointer> p_rule_array;
89 p_rule_array.push_back(p_rule);
90 mUnionOfRules.push_back(p_rule_array);
91 
92 }
93 
94 //***************************************************************************************************************
95 //***************************************************************************************************************
96 
97 void AddAndRules(std::vector<SpaceTimeRule::Pointer> p_rules)
98 {
99  for (unsigned int i = 0; i < mUnionOfRules.size(); ++i){
100 
101  for (unsigned int j = 0; j < p_rules.size(); ++j){
102  mUnionOfRules[i].push_back(p_rules[j]);
103  }
104  }
105 }
106 
107 //***************************************************************************************************************
108 //***************************************************************************************************************
109 
110 void AddOrRules(std::vector<SpaceTimeRule::Pointer> p_rules)
111 {
112  mUnionOfRules.push_back(p_rules);
113 }
114 
115 //***************************************************************************************************************
116 //***************************************************************************************************************
117 
118 bool IsIn(const double time, const double coor_x, const double coor_y, const double coor_z)
119 {
120  bool rules_are_met = true;
121 
122  for (unsigned int i = 0; i < mUnionOfRules.size(); ++i){
123 
124  for (unsigned int j = 0; j < mUnionOfRules[i].size(); ++j){
125  rules_are_met = rules_are_met && mUnionOfRules[i][j]->CheckIfRuleIsMet(time, coor_x, coor_y, coor_z);
126  }
127 
128  if (rules_are_met){
129  return true;
130  }
131 
132  }
133 
134  return false;
135 }
136 
137 //***************************************************************************************************************
138 //***************************************************************************************************************
139 
143 double GetLowTime(){return mLowTime;}
144 double GetHighTime(){return mHighTime;}
145 double GetLowX(){return mLowX;}
146 double GetHighX(){return mHighX;}
147 double GetLowY(){return mLowY;}
148 double GetHighY(){return mHighY;}
149 double GetLowZ(){return mLowZ;}
150 double GetHighZ(){return mHighZ;}
151 std::vector<std::vector<SpaceTimeRule::Pointer> > GetRules(){return mUnionOfRules;}
152 
153 
157 
159 
160 virtual std::string Info() const
161 {
162  return "";
163 }
164 
166 
167 virtual void PrintInfo(std::ostream& rOStream) const
168 {
169 }
170 
172 
173 virtual void PrintData(std::ostream& rOStream) const
174 {
175 }
176 
177 
181 
183 
184 protected:
187 
188 
192 
193 
197 
198 
202 
206 
210 
211 
215 
216 
218 
219 private:
220 
223 
224 
228 double mLowTime;
229 double mHighTime;
230 double mLowX;
231 double mHighX;
232 double mLowY;
233 double mHighY;
234 double mLowZ;
235 double mHighZ;
236 std::vector<std::vector<SpaceTimeRule::Pointer> > mUnionOfRules;
237 
241 
245 
246 
250 
251 
255 
256 
260 
262 SpaceTimeSet & operator=(SpaceTimeSet const& rOther);
263 
264 
266 
267 }; // Class SpaceTimeSet
268 
269 SpaceTimeSet::Pointer SetUnion(SpaceTimeSet::Pointer set_1, SpaceTimeSet::Pointer set_2);
270 SpaceTimeSet::Pointer SetIntersection(SpaceTimeSet::Pointer set_1, SpaceTimeSet::Pointer set_2);
271 
273 
276 
277 
281 
282 } // namespace Kratos.
283 #endif // KRATOS_SPACE_TIME_SET_H
Definition: space_time_rule.h:159
Definition: space_time_set.h:32
double GetHighTime()
Definition: space_time_set.h:144
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: space_time_set.h:173
void AddOrRules(std::vector< SpaceTimeRule::Pointer > p_rules)
Definition: space_time_set.h:110
void AddAndRule(SpaceTimeRule::Pointer p_rule)
Definition: space_time_set.h:76
double GetLowZ()
Definition: space_time_set.h:149
std::vector< std::vector< SpaceTimeRule::Pointer > > GetRules()
Definition: space_time_set.h:151
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: space_time_set.h:167
void AddOrRule(SpaceTimeRule::Pointer p_rule)
Definition: space_time_set.h:86
double GetLowX()
Definition: space_time_set.h:145
double GetHighZ()
Definition: space_time_set.h:150
SpaceTimeSet()
Definition: space_time_set.h:61
double GetHighY()
Definition: space_time_set.h:148
virtual std::string Info() const
Turn back information as a stemplate<class T, std::size_t dim> tring.
Definition: space_time_set.h:160
double GetLowY()
Definition: space_time_set.h:147
double GetHighX()
Definition: space_time_set.h:146
double GetLowTime()
Definition: space_time_set.h:143
KRATOS_CLASS_POINTER_DEFINITION(SpaceTimeSet)
SpaceTimeSet(const double min_time, const double max_time, const double min_x, const double min_y, const double min_z, const double max_x, const double max_y, const double max_z)
Default constructor.
Definition: space_time_set.h:39
void AddAndRules(std::vector< SpaceTimeRule::Pointer > p_rules)
Definition: space_time_set.h:97
virtual ~SpaceTimeSet()
Destructor.
Definition: space_time_set.h:71
bool IsIn(const double time, const double coor_x, const double coor_y, const double coor_z)
Definition: space_time_set.h:118
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
SpaceTimeSet::Pointer SetIntersection(SpaceTimeSet::Pointer set_1, SpaceTimeSet::Pointer set_2)
Definition: space_time_set.cpp:22
SpaceTimeSet::Pointer SetUnion(SpaceTimeSet::Pointer set_1, SpaceTimeSet::Pointer set_2)
Definition: space_time_set.cpp:5
float max_time
Definition: ProjectParameters.py:8
time
Definition: face_heat.py:85
int j
Definition: quadrature.py:648
integer i
Definition: TensorModule.f:17