Block-Structured AMR Software Framework
AMReX_AmrCore.H
Go to the documentation of this file.
1 #ifndef BL_AMRCORE_H_
2 #define BL_AMRCORE_H_
3 #include <AMReX_Config.H>
4 
5 #include <AMReX_AmrMesh.H>
6 
7 #include <iosfwd>
8 #include <memory>
9 
10 namespace amrex {
11 
12 #ifdef AMREX_PARTICLES
13 class AmrParGDB;
14 #endif
15 
23 class AmrCore
24  : public AmrMesh
25 {
26 public:
27 
28  AmrCore ();
29 
30  AmrCore (const RealBox* rb, int max_level_in,
31  const Vector<int>& n_cell_in, int coord=-1,
32  Vector<IntVect> ref_ratios = Vector<IntVect>(),
33  const int* is_per = nullptr);
34 
35  AmrCore (const RealBox& rb, int max_level_in,
36  const Vector<int>& n_cell_in, int coord,
37  Vector<IntVect> const& ref_ratios,
38  Array<int,AMREX_SPACEDIM> const& is_per);
39 
40  AmrCore (Geometry const& level_0_geom, AmrInfo const& amr_info);
41 
42  AmrCore (AmrCore&& rhs) noexcept;
43  AmrCore& operator= (AmrCore&& rhs) noexcept;
44 
45  AmrCore (const AmrCore& rhs) = delete;
46  AmrCore& operator= (const AmrCore& rhs) = delete;
47 
48  ~AmrCore () override;
49 
50 #ifdef AMREX_PARTICLES
51  [[nodiscard]] AmrParGDB* GetParGDB () const noexcept { return m_gdb.get(); }
52 #endif
53 
60  void InitFromScratch (Real time);
61 
63  virtual void regrid (int lbase, Real time, bool initial=false);
64 
65  void printGridSummary (std::ostream& os, int min_lev, int max_lev) const noexcept;
66 
67 protected:
68 
70  void ErrorEst (int lev, TagBoxArray& tags, Real time, int ngrow) override = 0;
71 
74  void MakeNewLevelFromScratch (int lev, Real time, const BoxArray& ba, const DistributionMapping& dm) override = 0;
75 
77  virtual void MakeNewLevelFromCoarse (int lev, Real time, const BoxArray& ba, const DistributionMapping& dm) = 0;
78 
80  virtual void RemakeLevel (int lev, Real time, const BoxArray& ba, const DistributionMapping& dm) = 0;
81 
83  virtual void ClearLevel (int lev) = 0;
84 
85 #ifdef AMREX_PARTICLES
86  std::unique_ptr<AmrParGDB> m_gdb;
87 #endif
88 
89 private:
90  void InitAmrCore ();
91 };
92 
93 }
94 
95 #endif
Provide basic functionalities to set up an AMR hierarchy.
Definition: AMReX_AmrCore.H:25
void MakeNewLevelFromScratch(int lev, Real time, const BoxArray &ba, const DistributionMapping &dm) override=0
virtual void ClearLevel(int lev)=0
Delete level data.
void InitFromScratch(Real time)
Initialize BoxArray, DistributionMapping and data from scratch. Calling this function requires the de...
Definition: AMReX_AmrCore.cpp:79
AmrCore()
Definition: AMReX_AmrCore.cpp:18
~AmrCore() override
Definition: AMReX_AmrCore.cpp:57
void printGridSummary(std::ostream &os, int min_lev, int max_lev) const noexcept
Definition: AMReX_AmrCore.cpp:140
AmrCore & operator=(AmrCore &&rhs) noexcept
Definition: AMReX_AmrCore.cpp:59
void ErrorEst(int lev, TagBoxArray &tags, Real time, int ngrow) override=0
Tag cells for refinement. TagBoxArray tags is built on level lev grids.
virtual void RemakeLevel(int lev, Real time, const BoxArray &ba, const DistributionMapping &dm)=0
Remake an existing level using provided BoxArray and DistributionMapping and fill with existing fine ...
AmrCore(const AmrCore &rhs)=delete
virtual void regrid(int lbase, Real time, bool initial=false)
Rebuild levels finer than lbase.
Definition: AMReX_AmrCore.cpp:85
virtual void MakeNewLevelFromCoarse(int lev, Real time, const BoxArray &ba, const DistributionMapping &dm)=0
Make a new level using provided BoxArray and DistributionMapping and fill with interpolated coarse le...
void InitAmrCore()
Definition: AMReX_AmrCore.cpp:71
Definition: AMReX_AmrMesh.H:62
Definition: AMReX_AmrParGDB.H:12
A collection of Boxes stored in an Array.
Definition: AMReX_BoxArray.H:549
Calculates the distribution of FABs to MPI processes.
Definition: AMReX_DistributionMapping.H:41
Rectangular problem domain geometry.
Definition: AMReX_Geometry.H:73
A Box with real dimensions. A RealBox is OK iff volume >= 0.
Definition: AMReX_RealBox.H:21
An array of TagBoxes.
Definition: AMReX_TagBox.H:150
Definition: AMReX_Amr.cpp:49
std::array< T, N > Array
Definition: AMReX_Array.H:24
Definition: AMReX_AmrMesh.H:20