|
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 >::BoxSurfaceDisplacementRange(), advance_till_valid(), madness::BoxSurfaceDisplacementRange< NDIM >::center_, done, End, fixed_dim, NDIM, next_face(), p(), parent, point, select_face(), start_face(), and unprocessed_bounds.
Referenced by operator!=, operator++(), operator++(), and operator==.
|
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 disp, fixed_dim, MADNESS_ASSERT, NDIM, next_face(), next_surface_layer(), point, reset_along_dim(), unprocessed_bounds, and madness::BoxSurfaceDisplacementRange< NDIM >::validator_.
Referenced by advance_till_valid().
|
inlineprivate |
Leave the current point (if positioned on one) and advance to the next point that passes the filter.
References advance(), disp, displacement(), done, parent, point, positioned, and madness::BoxSurfaceDisplacementRange< NDIM >::validator_.
Referenced by Iterator(), and operator++().
|
inlineprivate |
References disp, madness::displacement(), parent, and point.
Referenced by advance_till_valid(), and 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.
References parent, and unprocessed_bounds.
Referenced by 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 done, exclude_face(), fixed_dim, select_face(), and start_face().
Referenced by Iterator(), and advance().
|
inlineprivate |
|
inline |
Dereferences the iterator.
References displacement().
|
inline |
Pre-increment operator.
References Iterator(), and advance_till_valid().
|
inline |
|
inline |
Arrow operator for member access.
|
inlineprivate |
References disp, fixed_dim, next_surface_layer(), parent, point, unprocessed_bounds, and madness::BoxSurfaceDisplacementRange< NDIM >::validator_.
Referenced by advance(), and 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 done, fixed_dim, NDIM, and parent.
Referenced by Iterator(), and next_face().
|
inlineprivate |
Positions the iterator on the first point of the current face (fixed_dim)
References NDIM, and reset_along_dim().
Referenced by Iterator(), and next_face().
Inequality comparison operator.
| a | First iterator |
| b | Second iterator |
References Iterator(), a, and b.
Equality comparison operator.
| a | First iterator |
| b | Second iterator |
References Iterator(), a, and b.
|
mutableprivate |
Memoized displacement from parent->center_ to point, computed by displacement(), reset by advance().
Referenced by advance(), advance_till_valid(), displacement(), next_surface_layer(), and reset_along_dim().
|
private |
Flag indicating iteration completion.
Referenced by Iterator(), advance_till_valid(), next_face(), and select_face().
|
private |
Current fixed dimension (i.e. faces perpendicular to this axis are being iterated over).
Referenced by Iterator(), advance(), next_face(), next_surface_layer(), reset_along_dim(), and select_face().
|
private |
Pointer to parent surface.
Referenced by Iterator(), advance_till_valid(), displacement(), exclude_face(), next_surface_layer(), reset_along_dim(), and select_face().
|
private |
Current point / box. This is always free to leave the simulation cell.
Referenced by Iterator(), advance(), advance_till_valid(), displacement(), next_surface_layer(), and 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 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 Iterator(), advance(), exclude_face(), and reset_along_dim().