Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MFIter::Finalize #2983

Merged
merged 3 commits into from
Oct 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Src/Base/AMReX_MFIter.H
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ protected:
IndexType typ;

bool dynamic;
bool finalized = false;

struct DeviceSync {
DeviceSync () = default;
Expand All @@ -201,6 +202,7 @@ protected:
static AMREX_EXPORT int allow_multiple_mfiters;

void Initialize ();
void Finalize ();
};

//! Is it safe to have these two MultiFabs in the same MFiter?
Expand Down
9 changes: 9 additions & 0 deletions Src/Base/AMReX_MFIter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,15 @@ MFIter::MFIter (const FabArrayBase& fabarray_, const MFItInfo& info)

MFIter::~MFIter ()
{
Finalize();
}

void
MFIter::Finalize ()
{
if (finalized) return;
finalized = true;

#ifdef AMREX_USE_OMP
#pragma omp master
#endif
Expand Down