Skip to content

Commit

Permalink
Simplify Finalize (#524)
Browse files Browse the repository at this point in the history
  • Loading branch information
ax3l committed Feb 8, 2024
1 parent 5127908 commit 7259a22
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/ImpactX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,24 @@ namespace impactx {

ImpactX::~ImpactX()
{
if (m_grids_initialized)
{
this->finalize();
m_grids_initialized = false;
}

this->finalize();
}

void ImpactX::finalize ()
{
m_lattice.clear();
if (m_grids_initialized)
{
m_lattice.clear();

// this one last
amr_data.reset();

// this one last
amr_data.reset();
if (amrex::Initialized())
amrex::Finalize();

if (amrex::Initialized())
amrex::Finalize();
// only finalize once
m_grids_initialized = false;
}
}

void ImpactX::init_grids ()
Expand Down

0 comments on commit 7259a22

Please sign in to comment.