|
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 () |
| 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. | |
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 >::Iterator::done, madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::End, madness::BoxSurfaceDisplacementRange< NDIM >::initial_bounds_, madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::next_face(), madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::parent, madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::select_face(), madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::start_face(), 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 >::Iterator::disp, madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::fixed_dim, MADNESS_ASSERT, NDIM, madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::next_face(), madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::next_surface_layer(), madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::point, madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::reset_along_dim(), madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::unprocessed_bounds, and madness::BoxSurfaceDisplacementRange< NDIM >::validator_.
Referenced by madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::advance_till_valid().
|
inlineprivate |
Leave the current point (if positioned on one) and advance to the next point that passes the filter.
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, madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::positioned, 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 |
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.
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().
|
inlineprivate |
Leaves the current face (finished, or without any layer to offer) for the next one that has a point to offer, excluding the layers of the faces left behind from the remaining ones. Sets done if none remains.
References madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::done, madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::exclude_face(), madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::fixed_dim, madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::select_face(), and madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::start_face().
Referenced by madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::Iterator(), and madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::advance().
|
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 >::Iterator::disp, madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::fixed_dim, madness::BoxSurfaceDisplacementRange< NDIM >::is_lattice_summed_, 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::advance(), and madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::start_face().
|
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().
|
inlineprivate |
Positions the iterator on the first point of the current face (fixed_dim)
References NDIM, and madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::reset_along_dim().
Referenced by madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::Iterator(), and madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::next_face().
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::Iterator(), madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::advance_till_valid(), madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::next_face(), and madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::select_face().
|
private |
Current fixed dimension (i.e. faces perpendicular to this axis are being iterated over)
Referenced by madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::advance(), madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::next_face(), madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::next_surface_layer(), madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::reset_along_dim(), and madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::select_face().
|
private |
Pointer to parent surface.
Referenced by madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::Iterator(), madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::advance_till_valid(), madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::displacement(), madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::exclude_face(), madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::next_surface_layer(), madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::reset_along_dim(), and madness::BoxSurfaceDisplacementRange< NDIM >::Iterator::select_face().
|
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 |
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().
|
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().