Alamo
IC.H
Go to the documentation of this file.
1 #ifndef IC_IC_H_
2 #define IC_IC_H_
3 
4 #include <AMReX.H>
5 #include <AMReX_MultiFab.H>
6 #include "Util/Util.H"
7 #include "Set/Set.H"
8 
9 namespace IC
10 {
11 /// \brief Pure abstract IC object from which all other IC objects inherit.
12 class IC
13 {
14 public:
15  IC (amrex::Vector<amrex::Geometry> &_geom)
16  : geom(_geom) {} ;
17  virtual ~IC() {}
18 
19  virtual void Add(const int &lev, Set::Field<Set::Scalar> &field, Set::Scalar time) = 0;
20  virtual void Add(const int &lev, Set::Field<Set::Scalar> &field)
21  {
22  Add(lev,field,0.0);
23  }
24  virtual void Add(const int &, Set::Field<Set::Vector> &, Set::Scalar)
25  {Util::Abort(INFO,"Not yet implemented");};
26  void Initialize(const int &a_lev,
27  Set::Field<Set::Scalar> &a_field,
28  Set::Scalar a_time = 0.0)
29  {
30  Util::Assert(INFO,TEST(a_lev < a_field.size())," a_lev=",a_lev," size=",a_field.size());
31  a_field[a_lev]->setVal(0.0);
32  Add(a_lev,a_field,a_time);
33  };
34  void Initialize(const int &a_lev,
35  Set::Field<Set::Vector> &a_field,
36  Set::Scalar a_time = 0.0)
37  {
38  Util::Assert(INFO,TEST(a_lev < a_field.size())," a_lev=",a_lev," size=",a_field.size());
39  a_field[a_lev]->setVal(Set::Vector::Zero());
40  Add(a_lev,a_field,a_time);
41  };
42 
43  virtual void SetComp(int a_comp) final {comp = a_comp;}
44 protected:
45  amrex::Vector<amrex::Geometry> &geom;
46  int comp = 0;
47 };
48 }
49 #endif
IC::IC::Add
virtual void Add(const int &lev, Set::Field< Set::Scalar > &field)
Definition: IC.H:20
IC::IC::geom
amrex::Vector< amrex::Geometry > & geom
Definition: IC.H:45
IC::IC::Initialize
void Initialize(const int &a_lev, Set::Field< Set::Scalar > &a_field, Set::Scalar a_time=0.0)
Definition: IC.H:26
Util.H
IC::IC::~IC
virtual ~IC()
Definition: IC.H:17
TEST
#define TEST(x)
Definition: Util.H:21
IC::IC::IC
IC(amrex::Vector< amrex::Geometry > &_geom)
Definition: IC.H:15
Set::Field< Set::Scalar >
Definition: Set.H:236
Set::Scalar
amrex::Real Scalar
Definition: Base.H:19
IC::IC::Add
virtual void Add(const int &, Set::Field< Set::Vector > &, Set::Scalar)
Definition: IC.H:24
IC::IC::Initialize
void Initialize(const int &a_lev, Set::Field< Set::Vector > &a_field, Set::Scalar a_time=0.0)
Definition: IC.H:34
Util::Assert
AMREX_FORCE_INLINE void Assert(std::string file, std::string func, int line, std::string smt, bool pass, Args const &... args)
Definition: Util.H:65
Util::Abort
void Abort(const char *msg)
Definition: Util.cpp:165
Set.H
IC
Definition: Affine.H:18
INFO
#define INFO
Definition: Util.H:20
IC::IC::SetComp
virtual void SetComp(int a_comp) final
Definition: IC.H:43
Set::Field< Set::Vector >