From e0b77e1fce491021696d22f1496138e8d9942d65 Mon Sep 17 00:00:00 2001 From: Weiqun Zhang Date: Mon, 8 Jan 2024 09:18:49 -0800 Subject: [PATCH] Fix Advection_AmrCore test (#3690) 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. --- Tests/Amr/Advection_AmrCore/Source/AmrCoreAdv.H | 6 +++--- Tests/Amr/Advection_AmrCore/Source/AmrCoreAdv.cpp | 8 -------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/Tests/Amr/Advection_AmrCore/Source/AmrCoreAdv.H b/Tests/Amr/Advection_AmrCore/Source/AmrCoreAdv.H index fff3de9fea..eee16a7ace 100644 --- a/Tests/Amr/Advection_AmrCore/Source/AmrCoreAdv.H +++ b/Tests/Amr/Advection_AmrCore/Source/AmrCoreAdv.H @@ -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 @@ -217,8 +217,8 @@ private: #ifdef AMREX_PARTICLES void init_particles (); - static int do_tracers; - static std::unique_ptr TracerPC; + int do_tracers = 0; + std::unique_ptr TracerPC; #endif }; diff --git a/Tests/Amr/Advection_AmrCore/Source/AmrCoreAdv.cpp b/Tests/Amr/Advection_AmrCore/Source/AmrCoreAdv.cpp index 48a5d96e37..e79d8615c1 100644 --- a/Tests/Amr/Advection_AmrCore/Source/AmrCoreAdv.cpp +++ b/Tests/Amr/Advection_AmrCore/Source/AmrCoreAdv.cpp @@ -15,14 +15,6 @@ using namespace amrex; - - -#ifdef AMREX_PARTICLES -std::unique_ptr 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