MADNESS 0.10.1
Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
madness::BoxSurfaceDisplacementRange< NDIM >::Iterator Class Reference

Iterator class for lazy generation of surface points. More...

Collaboration diagram for madness::BoxSurfaceDisplacementRange< NDIM >::Iterator:
Collaboration graph
[legend]

Public Types

using difference_type = std::ptrdiff_t
 
using iterator_category = std::input_iterator_tag
 
using pointer = const Point *
 
using reference = const Point &
 
enum  Type { Begin , End }
 
using value_type = Point
 

Public Member Functions

 Iterator (const BoxSurfaceDisplacementRange *p, Type type)
 Constructs an iterator.
 
reference operator* () const
 Dereferences the iterator.
 
Iterator & operator++ ()
 Pre-increment operator.
 
Iterator operator++ (int)
 Post-increment operator.
 
pointer operator-> () const
 Arrow operator for member access.
 

Private Member Functions

void advance ()
 Advances the iterator to the next surface point.
 
void advance_till_valid ()
 Leave the current point (if positioned on one) and advance to the next point that passes the filter.
 
const std::optional< Displacement > & displacement () const
 
bool exclude_face (size_t dim)
 
void next_face ()
 
bool next_surface_layer ()
 
bool reset_along_dim (size_t dim)
 
void select_face (size_t from)
 
bool start_face ()
 

Private Attributes

std::optional< Displacement > disp
 Memoized displacement from parent->center_ to point, computed by displacement(), reset by advance()
 
bool done
 Flag indicating iteration completion.
 
size_t fixed_dim
 Current fixed dimension (i.e. faces perpendicular to this axis are being iterated over)
 
const BoxSurfaceDisplacementRange * parent
 Pointer to parent surface.
 
Point point
 Current point / box. This is always free to leave the simulation cell.
 
bool positioned = false
 whether the iterator is positioned on a point that has been (or is about to be) yielded; false until the first advance_till_valid() completes
 
Box unprocessed_bounds
 

Friends

bool operator!= (const Iterator &a, const Iterator &b)
 Inequality comparison operator.
 
bool operator== (const Iterator &a, const Iterator &b)
 Equality comparison operator.
 

Detailed Description

template<std::size_t NDIM>
class madness::BoxSurfaceDisplacementRange< NDIM >::Iterator

Iterator class for lazy generation of surface points.

This iterator generates surface points on-demand by tracking the current fixed dimension and positions in each dimension. It implements the InputIterator concept.

Member Typedef Documentation

◆ difference_type

template<std::size_t NDIM>
using madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::difference_type = std::ptrdiff_t

◆ iterator_category

template<std::size_t NDIM>
using madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::iterator_category = std::input_iterator_tag

◆ pointer

template<std::size_t NDIM>
using madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::pointer = const Point*

◆ reference

template<std::size_t NDIM>
using madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::reference = const Point&

◆ value_type

template<std::size_t NDIM>
using madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::value_type = Point

Member Enumeration Documentation

◆ Type

Enumerator
Begin 
End 

Constructor & Destructor Documentation

◆ Iterator()

template<std::size_t NDIM>
madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::Iterator ( const BoxSurfaceDisplacementRange *  p,
Type  type 
)
inline

Member Function Documentation

◆ advance()

template<std::size_t NDIM>
void madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::advance ( )
inlineprivate

◆ advance_till_valid()

template<std::size_t NDIM>
void madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::advance_till_valid ( )
inlineprivate

◆ displacement()

template<std::size_t NDIM>
const std::optional< Displacement > & madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::displacement ( ) const
inlineprivate

◆ exclude_face()

template<std::size_t NDIM>
bool madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::exclude_face ( size_t  dim)
inlineprivate

Excludes the layers of the faces normal to dim from the faces that remain to be processed, so that the edge boxes shared with them are not visited twice.

Returns
false if nothing remains, i.e. the box along dim is not hollow and every remaining box lies on these faces

References madness::BoxSurfaceDisplacementRange< NDIM >::hollowness_, madness::BoxSurfaceDisplacementRange< NDIM >::is_lattice_summed_, madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::parent, madness::BoxSurfaceDisplacementRange< NDIM >::surface_thickness_, and madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::unprocessed_bounds.

Referenced by madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::next_face().

◆ next_face()

template<std::size_t NDIM>
void madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::next_face ( )
inlineprivate

◆ next_surface_layer()

template<std::size_t NDIM>
bool madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::next_surface_layer ( )
inlineprivate

◆ operator*()

template<std::size_t NDIM>
reference madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::operator* ( ) const
inline

Dereferences the iterator.

Returns
A const reference to the current displacement

References madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::displacement().

◆ operator++() [1/2]

template<std::size_t NDIM>
Iterator & madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::operator++ ( )
inline

Pre-increment operator.

Returns
Reference to this iterator after advancement

References madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::advance_till_valid().

◆ operator++() [2/2]

template<std::size_t NDIM>
Iterator madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::operator++ ( int  )
inline

Post-increment operator.

Returns
Copy of the iterator before advancement

◆ operator->()

template<std::size_t NDIM>
pointer madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::operator-> ( ) const
inline

Arrow operator for member access.

Returns
A const pointer to the current displacement

◆ reset_along_dim()

template<std::size_t NDIM>
bool madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::reset_along_dim ( size_t  dim)
inlineprivate

◆ select_face()

template<std::size_t NDIM>
void madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::select_face ( size_t  from)
inlineprivate

Sets fixed_dim to the first finite-radius dimension at or after from whose faces are not skipped. Sets done if no face remains. N.B. skipped faces are not excluded from the remaining faces (unlike processed ones), so the edge boxes they share with them are still visited through them; hence a box is visited iff it lies on at least one face that is not skipped, regardless of the order in which faces are visited.

References madness::BoxSurfaceDisplacementRange< NDIM >::box_radius_, madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::done, madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::fixed_dim, NDIM, madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::parent, and madness::BoxSurfaceDisplacementRange< NDIM >::skip_face_.

Referenced by madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::Iterator(), and madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::next_face().

◆ start_face()

template<std::size_t NDIM>
bool madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::start_face ( )
inlineprivate

Positions the iterator on the first point of the current face (fixed_dim)

Returns
false if every layer of the face is filtered out, i.e. the face has no point to offer

References NDIM, and madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::reset_along_dim().

Referenced by madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::Iterator(), and madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::next_face().

Friends And Related Symbol Documentation

◆ operator!=

template<std::size_t NDIM>
bool operator!= ( const Iterator &  a,
const Iterator &  b 
)
friend

Inequality comparison operator.

Parameters
aFirst iterator
bSecond iterator
Returns
true if iterators are not equivalent

◆ operator==

template<std::size_t NDIM>
bool operator== ( const Iterator &  a,
const Iterator &  b 
)
friend

Equality comparison operator.

Parameters
aFirst iterator
bSecond iterator
Returns
true if iterators are equivalent

Member Data Documentation

◆ disp

template<std::size_t NDIM>
std::optional<Displacement> madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::disp
mutableprivate

◆ done

template<std::size_t NDIM>
bool madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::done
private

◆ fixed_dim

template<std::size_t NDIM>
size_t madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::fixed_dim
private

◆ parent

template<std::size_t NDIM>
const BoxSurfaceDisplacementRange* madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::parent
private

◆ point

template<std::size_t NDIM>
Point madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::point
private

◆ positioned

template<std::size_t NDIM>
bool madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::positioned = false
private

whether the iterator is positioned on a point that has been (or is about to be) yielded; false until the first advance_till_valid() completes

Referenced by madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::advance_till_valid().

◆ unprocessed_bounds

template<std::size_t NDIM>
Box madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::unprocessed_bounds
private

The bounds for all unprocessed displacements in the finite-thickness surface. Updated as displacements are processed. For the dimensions of the parent box, without thickness or regard for displacement processing, use parent->box_. Tracking unprocessed_bounds allows us to avoid double-counting 'edge' boxes that are on multiple hyperfaces. e.g., if radius is [5, 5], center is [0, 0] and thickness is [1, 1], the bounds are [-6, 6] x [-6, 6]. We first evaluate the hyperfaces [-6, -4] x [-5, 5] and then [4, 6] x [-5, 5]. It remains to evaluate hyperfaces [-5, 5] x [-6, -4] and [-5, 5] x [4, 6], excluding the edge points shared with the processed hyperfaces. So, we need to evaluate effective hyperfaces [-3, 3] x [-6, -4] and [-3, 3] x [4, 6]. The unprocessed_bounds are reset to [-3, 3] x [-6, 6].

Referenced by madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::Iterator(), madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::advance(), madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::exclude_face(), and madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::reset_along_dim().


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