MaxNumberOfNeighbors.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cstddef>
7 
8 /// \ingroup ComputationalDomainGroup
9 /// Returns the maximum number of neighbors an element can have in `dim`
10 /// dimensions.
11 ///
12 /// \note Assumes a maximum 2-to-1 refinement between two adjacent Elements.
13 constexpr size_t maximum_number_of_neighbors(const size_t dim) {
14  switch (dim) {
15  case 1:
16  return 2;
17  case 2:
18  return 8;
19  case 3:
20  return 24;
21  default:
22  // need to throw because we cannot ERROR in constexpr
23  throw "Invalid dim specified";
24  };
25 }
constexpr size_t maximum_number_of_neighbors(const size_t dim)
Returns the maximum number of neighbors an element can have in dim dimensions.
Definition: MaxNumberOfNeighbors.hpp:13