Skip to content

Commit

Permalink
Fix Advection_AmrCore test (AMReX-Codes#3690)
Browse files Browse the repository at this point in the history
The particle container should not be a static member, because it's a
member of a class derived from AmrCore, not AmrLevel. The issue of its
being a static member is that it is not deleted properly (unless we
explicitly do it).

Note that in the AmrLevel case we must make it a static member because
all AmrLevel objects need to share the same particle container.
  • Loading branch information
WeiqunZhang authored Jan 8, 2024
1 parent f1ec8df commit e0b77e1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
6 changes: 3 additions & 3 deletions Tests/Amr/Advection_AmrCore/Source/AmrCoreAdv.H
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public:
amrex::Real EstTimeStep (int lev, amrex::Real time);

#ifdef AMREX_PARTICLES
static amrex::AmrTracerParticleContainer* theTracerPC () { return TracerPC.get(); }
amrex::AmrTracerParticleContainer* theTracerPC () { return TracerPC.get(); }
#endif


Expand Down Expand Up @@ -217,8 +217,8 @@ private:

#ifdef AMREX_PARTICLES
void init_particles ();
static int do_tracers;
static std::unique_ptr<amrex::AmrTracerParticleContainer> TracerPC;
int do_tracers = 0;
std::unique_ptr<amrex::AmrTracerParticleContainer> TracerPC;
#endif
};

Expand Down
8 changes: 0 additions & 8 deletions Tests/Amr/Advection_AmrCore/Source/AmrCoreAdv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,6 @@

using namespace amrex;



#ifdef AMREX_PARTICLES
std::unique_ptr<AmrTracerParticleContainer> AmrCoreAdv::TracerPC = nullptr;
int AmrCoreAdv::do_tracers = 0;
#endif


// constructor - reads in parameters from inputs file
// - sizes multilevel arrays and data structures
// - initializes BCRec boundary condition object
Expand Down

0 comments on commit e0b77e1

Please sign in to comment.