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

FabArray::isDefined #2997

Merged
merged 2 commits into from
Oct 26, 2022
Merged
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
17 changes: 17 additions & 0 deletions Src/Base/AMReX_FabArray.H
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,15 @@ public:
*/
bool ok () const;

/** Has define() been called on this rank?
*
* \return true if `define` has been called on this `FabArray`. Note that all constructors except `FabArray ()`
* and `FabArray(Arena*a)` call `define`, even if the `MFInfo` argument has `alloc=false`. One could
* also use `FabArrayBase::empty()` to find whether `define` is called or not, although they are not exactly
* the same.
*/
bool isDefined () const;

//! Return a constant reference to the FAB associated with mfi.
const FAB& operator[] (const MFIter& mfi) const noexcept { return *(this->fabPtr(mfi)); }

Expand Down Expand Up @@ -1128,6 +1137,7 @@ protected:
std::unique_ptr<FabFactory<FAB> > m_factory;
DataAllocator m_dallocator;

//! has define() been called?
bool define_function_called = false;

//
Expand Down Expand Up @@ -1768,6 +1778,13 @@ FabArray<FAB>::ok () const
return isok == 1;
}

template <class FAB>
bool
FabArray<FAB>::isDefined () const
{
return define_function_called;
}

template <class FAB>
void
FabArray<FAB>::define (const BoxArray& bxs,
Expand Down