1 #ifndef KRATOS_SPACE_TIME_RULE_H
2 #define KRATOS_SPACE_TIME_RULE_H
23 #include "../real_functions.h"
24 #include "../real_field.h"
46 virtual bool CheckIfRuleIsMet(
const double time,
const double coor_x,
const double coor_y,
const double coor_z){
return true;}
61 virtual std::string
Info()
const
63 return "SpaceTimeRule";
68 virtual void PrintInfo(std::ostream& rOStream)
const{}
72 virtual void PrintData(std::ostream& rOStream)
const{}
236 bool CheckIfRuleIsMet(
const double time,
const double coor_x,
const double coor_y,
const double coor_z)
override
238 bool low =
time < mLowTime || coor_x < mLowX || coor_y < mLowY || coor_z < mLowZ;
239 bool high =
time > mHighTime || coor_x > mHighX || coor_y > mHighY || coor_z > mHighZ;
241 return !(high || low);
244 virtual std::string
Info()
const override
246 std::ostringstream os;
247 os <<
"Bounding box limits : " << std::endl
248 <<
"min time: " << mLowTime << std::endl
249 <<
"max time: " << mHighTime << std::endl
250 <<
"min x : " << mLowX << std::endl
251 <<
"max x : " << mHighX << std::endl
252 <<
"min y : " << mLowY << std::endl
253 <<
"max y : " << mHighY << std::endl
254 <<
"min z : " << mLowZ << std::endl
255 <<
"max z : " << mHighZ << std::endl;
257 std::string info = os.str();
262 void PrintData( std::ostream& rOStream = std::cout )
const override
264 rOStream <<
"Bounding box limits : " << std::endl
265 <<
"min time: " << mLowTime << std::endl
266 <<
"max time: " << mHighTime << std::endl
267 <<
"min x : " << mLowX << std::endl
268 <<
"max x : " << mHighX << std::endl
269 <<
"min y : " << mLowY << std::endl
270 <<
"max y : " << mHighY << std::endl
271 <<
"min z : " << mLowZ << std::endl
272 <<
"max z : " << mHighZ << std::endl;
280 KRATOS_ERROR_IF(mHighTime < mLowTime || mHighX < mLowX || mHighY < mLowY || mHighZ < mLowZ) <<
"Entered low bounds greater than corresponding bounds" << std::endl;
316 MoreThanRule(RealField::Pointer field_high, RealField::Pointer field_low)
319 mpLowField(field_low),
324 bool CheckIfRuleIsMet(
const double time,
const double coor_x,
const double coor_y,
const double coor_z)
override
332 return mpField->Evaluate(
time, coor) > mValue;
335 else if (mCase == 2){
336 return mpField->Evaluate(
time, coor) < mValue;
340 return mpField->Evaluate(
time, coor) > mpLowField->Evaluate(
time, coor);
351 RealField::Pointer mpField;
352 RealField::Pointer mpLowField;
372 EqualToRule(RealField::Pointer field_1, RealField::Pointer field_2,
const double tol)
384 bool CheckIfRuleIsMet(
const double time,
const double coor_x,
const double coor_y,
const double coor_z)
override
391 double valuation_1 = mpField1->Evaluate(
time, coor);
394 return valuation_1 < mValue + mTol && valuation_1 > mValue - mTol;
398 double valuation_2 = mpField2->Evaluate(
time, coor);
399 return valuation_1 < valuation_2 + mTol && valuation_1 > valuation_2 - mTol;
408 KRATOS_ERROR_IF(mTol < 0.0) <<
"Entered tolerance must be a positive number" << std::endl;
417 RealField::Pointer mpField1;
418 RealField::Pointer mpField2;
Definition: space_time_rule.h:159
~BoundingBoxRule()
Definition: space_time_rule.h:193
BoundingBoxRule()
Definition: space_time_rule.h:162
void SetXBoundingInterval(const double &low, const double &high)
Definition: space_time_rule.h:202
virtual std::string Info() const override
Turn back information as a stemplate<class T, std::size_t dim> tring.
Definition: space_time_rule.h:244
BoundingBoxRule(const double min_time, const double max_time, const double min_x, const double max_x, const double min_y, const double max_y, const double min_z, const double max_z)
Definition: space_time_rule.h:174
void SetYBoundingInterval(const double &low, const double &high)
Definition: space_time_rule.h:209
bool CheckIfRuleIsMet(const double time, const double coor_x, const double coor_y, const double coor_z) override
Definition: space_time_rule.h:236
void PrintData(std::ostream &rOStream=std::cout) const override
Print object's data.
Definition: space_time_rule.h:262
void Check()
Definition: space_time_rule.h:276
void SetTimeBoundingInterval(const double &low, const double &high)
Definition: space_time_rule.h:195
void SetSpaceTimeBoundingBox(const array_1d< double, 4 > &low, const array_1d< double, 4 > &high)
Definition: space_time_rule.h:223
void SetZBoundingInterval(const double &low, const double &high)
Definition: space_time_rule.h:216
Definition: space_time_rule.h:360
EqualToRule(RealField::Pointer field, const double value, const double tol)
Definition: space_time_rule.h:362
bool CheckIfRuleIsMet(const double time, const double coor_x, const double coor_y, const double coor_z) override
Definition: space_time_rule.h:384
~EqualToRule()
Definition: space_time_rule.h:382
EqualToRule(RealField::Pointer field_1, RealField::Pointer field_2, const double tol)
Definition: space_time_rule.h:372
void Check()
Definition: space_time_rule.h:405
Definition: space_time_rule.h:301
bool CheckIfRuleIsMet(const double time, const double coor_x, const double coor_y, const double coor_z) override
Definition: space_time_rule.h:324
~MoreThanRule()
Definition: space_time_rule.h:322
void Check()
Definition: space_time_rule.h:346
MoreThanRule(RealField::Pointer field, const double value)
Definition: space_time_rule.h:304
MoreThanRule(const double value, RealField::Pointer field)
Definition: space_time_rule.h:310
MoreThanRule(RealField::Pointer field_high, RealField::Pointer field_low)
Definition: space_time_rule.h:316
Definition: space_time_rule.h:30
KRATOS_CLASS_POINTER_DEFINITION(SpaceTimeRule)
virtual ~SpaceTimeRule()
Destructor.
Definition: space_time_rule.h:41
SpaceTimeRule()
Default constructor.
Definition: space_time_rule.h:37
virtual std::string Info() const
Turn back information as a stemplate<class T, std::size_t dim> tring.
Definition: space_time_rule.h:61
virtual bool CheckIfRuleIsMet(const double time, const double coor_x, const double coor_y, const double coor_z)
Definition: space_time_rule.h:46
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: space_time_rule.h:68
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: space_time_rule.h:72
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
static double max(double a, double b)
Definition: GeometryFunctions.h:79
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
float max_time
Definition: ProjectParameters.py:8
time
Definition: face_heat.py:85
int tol
Definition: hinsberg_optimization.py:138