IndexToSliceAt.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cstddef>
7 
9 #include "Domain/Direction.hpp"
10 #include "Domain/Side.hpp"
11 
12 /// \ingroup ComputationalDomainGroup
13 /// Finds the index in the perpendicular dimension of an element boundary
14 template <size_t Dim>
15 size_t index_to_slice_at(const Index<Dim>& extents,
16  const Direction<Dim>& direction) noexcept {
17  return direction.side() == Side::Lower ? 0
18  : extents[direction.dimension()] - 1;
19 }
Defines class template Direction.
size_t index_to_slice_at(const Index< Dim > &extents, const Direction< Dim > &direction) noexcept
Finds the index in the perpendicular dimension of an element boundary.
Definition: IndexToSliceAt.hpp:15
Defines class template Index.
A particular Side along a particular coordinate Axis.
Definition: Direction.hpp:23
An integer multi-index.
Definition: Index.hpp:28
Defines enum class Side.