Block-Structured AMR Software Framework
 
Loading...
Searching...
No Matches
amrex::BoxIteratorND< dim > Class Template Reference

iterates through the IntVects of a Box More...

#include <AMReX_BoxIterator.H>

Public Member Functions

 BoxIteratorND () noexcept=default
 
 BoxIteratorND (const BoxND< dim > &a_bx) noexcept
 
void setBox (const BoxND< dim > &a_bx) noexcept
 
void define (const BoxND< dim > &a_bx) noexcept
 
BoxIteratorND begin () noexcept
 
BoxIteratorND end () const noexcept
 
void reset () noexcept
 
BoxIteratorNDoperator++ () noexcept
 
void next () noexcept
 
const IntVectND< dim > & operator() () const noexcept
 
IntVectND< dim > operator* () const noexcept
 
bool ok () const noexcept
 

Private Attributes

IntVectND< dim > m_current = IntVectND<dim>::TheUnitVector()
 
IntVectND< dim > m_boxLo = IntVectND<dim>::TheUnitVector()
 
IntVectND< dim > m_boxHi = IntVectND<dim>::TheZeroVector()
 

Friends

bool operator!= (const BoxIteratorND &b1, const BoxIteratorND &b2) noexcept
 

Detailed Description

template<int dim>
class amrex::BoxIteratorND< dim >

iterates through the IntVects of a Box

BoxIteratorND iterates through the IntVects of a box in the same order as a series of nested for loops with the innermost loop iterating over the first dimension.

Typical usage using a range-based for loop:

...
for (IntVect iv : b.iterator()) {
// do operations involving iv
}

Using a traditional for loop:

...
BoxIterator bit (b);
for (bit.begin(); bit.ok(); ++bit)
{
IntVect iv = bit();
// do operations involving iv
}

Note that while regular iteration of the range-based version is reasonably performant, neither version is compatible with omp parallel for or simd autovectorization.

Constructor & Destructor Documentation

◆ BoxIteratorND() [1/2]

template<int dim>
amrex::BoxIteratorND< dim >::BoxIteratorND ( )
defaultnoexcept

Default constructor. This constructs an invalid iterator. The user must call define before using.

◆ BoxIteratorND() [2/2]

template<int dim>
amrex::BoxIteratorND< dim >::BoxIteratorND ( const BoxND< dim > &  a_bx)
inlineexplicitnoexcept

Constructs a BoxIteratorND and associates it with a Box. Arguments: a_bx (not modified) the Box to iterate over.

Member Function Documentation

◆ begin()

template<int dim>
BoxIteratorND amrex::BoxIteratorND< dim >::begin ( )
inlinenoexcept

Sets this BoxIteratorND to the first IntVect in its Box. This is the smallEnd vector of the Box.

◆ define()

template<int dim>
void amrex::BoxIteratorND< dim >::define ( const BoxND< dim > &  a_bx)
inlinenoexcept

Associates a Box with this BoxIteratorND. Arguments: a_bx (not modified) the Box to iterate over.

◆ end()

template<int dim>
BoxIteratorND amrex::BoxIteratorND< dim >::end ( ) const
inlinenoexcept

Get a BoxIteratorND with its vector set to the end of the Box. Should only be used internally by a range-based for loop.

◆ next()

template<int dim>
void amrex::BoxIteratorND< dim >::next ( )
inlinenoexcept

Modifies this BoxIteratorND to set it to the next location in its Box.

◆ ok()

template<int dim>
bool amrex::BoxIteratorND< dim >::ok ( ) const
inlinenoexcept

Returns true if this BoxIteratorND's location is within its Box.

◆ operator()()

template<int dim>
const IntVectND< dim > & amrex::BoxIteratorND< dim >::operator() ( ) const
inlinenoexcept

Returns the value of the InVect for the current location of this BoxIteratorND.

◆ operator*()

template<int dim>
IntVectND< dim > amrex::BoxIteratorND< dim >::operator* ( ) const
inlinenoexcept

Returns the value of the InVect for the current location of this BoxIteratorND.

◆ operator++()

template<int dim>
BoxIteratorND & amrex::BoxIteratorND< dim >::operator++ ( )
inlinenoexcept

Modifies this BoxIteratorND to set it to the next location in its Box.

◆ reset()

template<int dim>
void amrex::BoxIteratorND< dim >::reset ( )
inlinenoexcept

Sets this BoxIteratorND to the first IntVect in its Box. This is the smallEnd vector of the Box.

◆ setBox()

template<int dim>
void amrex::BoxIteratorND< dim >::setBox ( const BoxND< dim > &  a_bx)
inlinenoexcept

Friends And Related Symbol Documentation

◆ operator!=

template<int dim>
bool operator!= ( const BoxIteratorND< dim > &  b1,
const BoxIteratorND< dim > &  b2 
)
friend

Special operator for range-based for loops. Only checks inequality of the last dimension of the current position for better performance. Should only be used internally by a range-based for loop.

Member Data Documentation

◆ m_boxHi

template<int dim>
IntVectND<dim> amrex::BoxIteratorND< dim >::m_boxHi = IntVectND<dim>::TheZeroVector()
private

◆ m_boxLo

template<int dim>
IntVectND<dim> amrex::BoxIteratorND< dim >::m_boxLo = IntVectND<dim>::TheUnitVector()
private

◆ m_current

template<int dim>
IntVectND<dim> amrex::BoxIteratorND< dim >::m_current = IntVectND<dim>::TheUnitVector()
private

The documentation for this class was generated from the following files: