SpECTRE  v2024.04.12
LinearSolver::Schwarz::OverlapIterator Class Reference

Iterate over grid points in a region that extends partially into the volume. More...

#include <OverlapHelpers.hpp>

Public Member Functions

template<size_t Dim>
 OverlapIterator (const Index< Dim > &volume_extents, size_t overlap_extent, const Direction< Dim > &direction)
 
 operator bool () const
 
OverlapIteratoroperator++ ()
 
size_t volume_offset () const
 Offset into a DataVector that holds full volume data.
 
size_t overlap_offset () const
 Offset into a DataVector that holds data only on the overlap region.
 
void reset ()
 

Detailed Description

Iterate over grid points in a region that extends partially into the volume.

Here's an example how to use this iterator:

// Overlap region:
// + - - - + -xi->
// | X X O |
// | X X O |
// + - - - +
// v eta
const Index<2> volume_extents{{{3, 2}}};
const size_t overlap_extent = 2;
const auto direction = Direction<2>::lower_xi();
const std::array<size_t, 4> expected_volume_offsets{{0, 1, 3, 4}};
size_t i = 0;
for (OverlapIterator overlap_iterator{volume_extents, overlap_extent,
direction};
overlap_iterator; ++overlap_iterator) {
CHECK(overlap_iterator.volume_offset() ==
gsl::at(expected_volume_offsets, i));
CHECK(overlap_iterator.overlap_offset() == i);
++i;
}
CHECK(i == expected_volume_offsets.size());
static Direction< VolumeDim > lower_xi()
Helper functions for creating specific Directions. These are labeled by the logical-coordinate names ...
An integer multi-index.
Definition: Index.hpp:31
constexpr T & at(std::array< T, N > &arr, Size index)
Retrieve a entry from a container, with checks in Debug mode that the index being retrieved is valid.
Definition: Gsl.hpp:125
size_t overlap_extent(size_t volume_extent, size_t max_overlap)
The number of points that an overlap extends into the volume_extent

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