Public Member Functions | List of all members
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) noexcept
 operator bool () const noexcept
OverlapIteratoroperator++ ()
size_t volume_offset () const noexcept
 Offset into a DataVector that holds full volume data.
size_t overlap_offset () const noexcept
 Offset into a DataVector that holds data only on the overlap region.
void reset () noexcept

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,
overlap_iterator; ++overlap_iterator) {
CHECK(overlap_iterator.volume_offset() ==
gsl::at(expected_volume_offsets, i));
CHECK(overlap_iterator.overlap_offset() == i);
CHECK(i == expected_volume_offsets.size());

The documentation for this class was generated from the following file:
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) noexcept
The number of points that an overlap extends into the volume_extent
Definition: Index.hpp:31
static Direction< VolumeDim > lower_xi() noexcept
Helper functions for creating specific Directions. These are labeled by the logical-coordinate names ...