|
MADNESS 0.10.1
|
Iterator class for lazy generation of surface points. More...

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 () |
| Perform advance, repeating if you are at a filtered point. | |
| const std::optional< Displacement > & | displacement () const |
| bool | next_surface_layer () |
| void | reset_along_dim (size_t dim) |
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. | |
| 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. | |
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.
| using madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::difference_type = std::ptrdiff_t |
| using madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::iterator_category = std::input_iterator_tag |
| using madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::pointer = const Point* |
| using madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::reference = const Point& |
| using madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::value_type = Point |
| enum madness::BoxSurfaceDisplacementRange::Iterator::Type |
|
inline |
Constructs an iterator.
| p | Pointer to the parent BoxSurfaceDisplacementRange |
| type | the type of iterator (Begin or End) |
References madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::advance_till_valid(), madness::BoxSurfaceDisplacementRange< NDIM >::box_, madness::BoxSurfaceDisplacementRange< NDIM >::box_radius_, d, madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::End, madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::fixed_dim, NDIM, madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::parent, madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::reset_along_dim(), madness::BoxSurfaceDisplacementRange< NDIM >::surface_thickness_, madness::type(), and madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::unprocessed_bounds.
|
inlineprivate |
Advances the iterator to the next surface point.
This function implements the logic for traversing the box surface by: (1) Incrementing displacement in non-fixed dimensions (2) Switching sides in the fixed dimension when needed (3) Moving to the next fixed dimension when current one is exhausted
We filter out layers in (2) but not points within a layer in (1).
References madness::BoxSurfaceDisplacementRange< NDIM >::box_, madness::BoxSurfaceDisplacementRange< NDIM >::box_radius_, madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::disp, madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::done, madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::fixed_dim, madness::BoxSurfaceDisplacementRange< NDIM >::hollowness_, MADNESS_ASSERT, NDIM, madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::next_surface_layer(), madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::parent, madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::point, madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::reset_along_dim(), madness::BoxSurfaceDisplacementRange< NDIM >::surface_thickness_, madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::unprocessed_bounds, and madness::BoxSurfaceDisplacementRange< NDIM >::validator_.
Referenced by madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::advance_till_valid().
|
inlineprivate |
Perform advance, repeating if you are at a filtered point.
References madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::advance(), madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::disp, madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::displacement(), madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::done, madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::parent, madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::point, and madness::BoxSurfaceDisplacementRange< NDIM >::validator_.
Referenced by madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::Iterator(), and madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::operator++().
|
inlineprivate |
References madness::BoxSurfaceDisplacementRange< NDIM >::center_, madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::disp, madness::displacement(), madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::parent, and madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::point.
Referenced by madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::advance_till_valid(), and madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::operator*().
|
inlineprivate |
References madness::BoxSurfaceDisplacementRange< NDIM >::box_, madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::disp, madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::fixed_dim, madness::BoxSurfaceDisplacementRange< NDIM >::hollowness_, madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::parent, madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::point, and madness::BoxSurfaceDisplacementRange< NDIM >::surface_thickness_.
Referenced by madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::advance(), and madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::reset_along_dim().
|
inline |
Dereferences the iterator.
References madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::displacement().
|
inline |
Pre-increment operator.
References madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::advance_till_valid().
|
inline |
Post-increment operator.
|
inline |
Arrow operator for member access.
|
inlineprivate |
References madness::BoxSurfaceDisplacementRange< NDIM >::box_, madness::BoxSurfaceDisplacementRange< NDIM >::center_, madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::disp, madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::fixed_dim, madness::BoxSurfaceDisplacementRange< NDIM >::is_lattice_summed_, MADNESS_ASSERT, madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::next_surface_layer(), madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::parent, madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::point, madness::BoxSurfaceDisplacementRange< NDIM >::surface_thickness_, madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::unprocessed_bounds, and madness::BoxSurfaceDisplacementRange< NDIM >::validator_.
Referenced by madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::Iterator(), and madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::advance().
Inequality comparison operator.
| a | First iterator |
| b | Second iterator |
Equality comparison operator.
| a | First iterator |
| b | Second iterator |
|
mutableprivate |
Memoized displacement from parent->center_ to point, computed by displacement(), reset by advance()
Referenced by madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::advance(), madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::advance_till_valid(), madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::displacement(), madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::next_surface_layer(), and madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::reset_along_dim().
|
private |
Flag indicating iteration completion.
Referenced by madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::advance(), and madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::advance_till_valid().
|
private |
Current fixed dimension (i.e. faces perpendicular to this axis are being iterated over)
Referenced by madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::Iterator(), madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::advance(), madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::next_surface_layer(), and madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::reset_along_dim().
|
private |
Pointer to parent surface.
Referenced by madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::Iterator(), madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::advance(), madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::advance_till_valid(), madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::displacement(), madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::next_surface_layer(), and madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::reset_along_dim().
|
private |
Current point / box. This is always free to leave the simulation cell.
Referenced by madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::advance(), madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::advance_till_valid(), madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::displacement(), madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::next_surface_layer(), and madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::reset_along_dim().
|
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(), and madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::reset_along_dim().