Skip to content

Commit ed1ecd6

Browse files
authored
MFIter: Make Finalize Public (#2985)
Follow-up to #2983
1 parent 5acfe07 commit ed1ecd6

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Src/Base/AMReX_MFIter.H

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ public:
164164

165165
static int allowMultipleMFIters (int allow);
166166

167+
void Finalize ();
168+
167169
protected:
168170

169171
std::unique_ptr<FabArrayBase> m_fa; //!< This must be the first member!
@@ -202,7 +204,6 @@ protected:
202204
static AMREX_EXPORT int allow_multiple_mfiters;
203205

204206
void Initialize ();
205-
void Finalize ();
206207
};
207208

208209
//! Is it safe to have these two MultiFabs in the same MFiter?

Src/Base/AMReX_MFIter.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,13 @@ MFIter::~MFIter ()
215215
void
216216
MFIter::Finalize ()
217217
{
218+
// avoid double finalize
218219
if (finalized) return;
219220
finalized = true;
220221

222+
// mark as invalid
223+
currentIndex = endIndex;
224+
221225
#ifdef AMREX_USE_OMP
222226
#pragma omp master
223227
#endif

0 commit comments

Comments
 (0)