SpECTRE Documentation Coverage Report
Current view: top level - Domain/Structure - MaxNumberOfNeighbors.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 66.7 % 3 2
Test Date: 2026-10-22 17:29:42
Legend: Lines:     hit not hit

            Line data    Source code
       1            0 : // Distributed under the MIT License.
       2              : // See LICENSE.txt for details.
       3              : 
       4              : #pragma once
       5              : 
       6              : #include <cstddef>
       7              : 
       8              : #include "Utilities/ConstantExpressions.hpp"
       9              : 
      10              : /// \ingroup ComputationalDomainGroup
      11              : /// Returns the maximum number of neighbors an element can have in `dim`
      12              : /// dimensions.
      13              : ///
      14              : /// \note Assumes a maximum 2-to-1 refinement between two adjacent Elements.
      15            1 : constexpr size_t maximum_number_of_neighbors(const size_t dim) {
      16              :   switch (dim) {
      17              :     case 1:
      18              :       return 2;
      19              :     case 2:
      20              :       return 8;
      21              :     case 3:
      22              :       return 24;
      23              :     default:
      24              :       // need to throw because we cannot ERROR in constexpr
      25              :       throw "Invalid dim specified";
      26              :   };
      27              : }
      28              : 
      29              : /// \ingroup ComputationalDomainGroup
      30              : /// Returns the maximum number of neighbors in each direction an element can
      31              : /// have in `dim` dimensions.
      32              : ///
      33              : /// \note Assumes a maximum 2-to-1 refinement between two adjacent Elements.
      34            1 : constexpr size_t maximum_number_of_neighbors_per_direction(const size_t dim) {
      35              :   switch (dim) {
      36              :     case 0:
      37              :       return 0;
      38              :     default:
      39              :       return two_to_the(dim - 1);
      40              :   };
      41              : }
        

Generated by: LCOV version 2.0-1