WARPXM v1.10.0
Loading...
Searching...
No Matches
timestep_constraint.h
Go to the documentation of this file.
1#pragma once
2
3#include <iostream>
4#include <memory>
5#include <array>
6#include <string>
7#include <limits>
8
9#include "warpxm/warpxm_config.h"
10
17{
18private:
19 real _dt;
20 std::array<real, 3> _x;
21 std::shared_ptr<std::string> _physics;
22
23public:
25 {
26 _dt = std::numeric_limits<real>::infinity();
27 _x = {0, 0, 0};
28 _physics = std::make_shared<std::string>("nothing");
29 };
30
31 TimestepConstraint(real dt, std::shared_ptr<std::string> physics)
32 : _dt(dt), _physics(physics)
33 {
34 _x = {0, 0, 0};
35 }
36
38 std::array<real, 3> x,
39 std::shared_ptr<std::string> physics)
40 : _dt(dt), _x(x), _physics(physics)
41 {
42 }
43
44 // Minimum dt
46 const TimestepConstraint& b)
47 {
48 return a._dt < b._dt ? a : b;
49 }
50
51 // Setters
52 void setDt(const real dt)
53 {
54 _dt = dt;
55 }
56
57 // Getters
58 real getDt() const
59 {
60 return _dt;
61 }
62
63 const std::array<real, 3>& getX() const
64 {
65 return _x;
66 }
67
68 const std::shared_ptr<std::string>& getPhysics() const
69 {
70 return _physics;
71 }
72
73 std::string str() const;
74};
Information that constrain the time step.
Definition: timestep_constraint.h:17
const std::array< real, 3 > & getX() const
Definition: timestep_constraint.h:63
TimestepConstraint(real dt, std::array< real, 3 > x, std::shared_ptr< std::string > physics)
Definition: timestep_constraint.h:37
void setDt(const real dt)
Definition: timestep_constraint.h:52
TimestepConstraint()
Definition: timestep_constraint.h:24
real getDt() const
Definition: timestep_constraint.h:58
static const TimestepConstraint & minDt(const TimestepConstraint &a, const TimestepConstraint &b)
Definition: timestep_constraint.h:45
TimestepConstraint(real dt, std::shared_ptr< std::string > physics)
Definition: timestep_constraint.h:31
const std::shared_ptr< std::string > & getPhysics() const
Definition: timestep_constraint.h:68
std::string str() const
#define real
Definition: wmoclunstructuredreconstruction.h:11