Peano
Loading...
Searching...
No Matches
FaceAoSLexicographicEnumerator.h
Go to the documentation of this file.
1// This file is part of the ExaHyPE2 project. For conditions of distribution and
2// use, please see the copyright notice at www.peano-framework.org
3#pragma once
4
5#include <functional>
6#include <string>
7
11#include "tarch/la/Vector.h"
13
14namespace exahype2::enumerator {
80 constexpr GPUCallableInlineMethod FaceAoSLexicographicEnumerator(int faceNumber, int numberOfDoFsPerAxisInCell, int haloSize, int unknowns, int numberOfAuxiliaryVariables):
81 _faceNumber(faceNumber),
82 _numberOfDoFsPerAxisInCell(numberOfDoFsPerAxisInCell),
83 _haloSize(haloSize),
84 _unknowns(unknowns),
85 _numberOfAuxiliaryVariables(numberOfAuxiliaryVariables) {}
86
91 int base = 1;
92 int result = 0;
93 for (int d = 0; d < Dimensions; d++) {
94 result += dofIndex(d) * base;
95 if (d == _faceNumber % Dimensions) {
96#if defined(GPUOffloadingOff)
97 assertion2(dofIndex(d) >= 0, toString(), dofIndex);
98 assertion2(dofIndex(d) < 2 * _haloSize, toString(), dofIndex);
99#endif
100 base *= (2 * _haloSize);
101 } else {
102#if defined(GPUOffloadingOff)
103 assertion2(dofIndex(d) >= 0, toString(), dofIndex);
104 assertion2(dofIndex(d) < _numberOfDoFsPerAxisInCell, toString(), dofIndex);
105#endif
107 }
108 }
109 return result * (_unknowns + _numberOfAuxiliaryVariables) + unknown;
110 }
111
112#if defined(GPUOffloadingOff)
113 std::string toString() const;
114#endif
115
117 if constexpr (Dimensions == 2) {
119 } else {
121 }
122 }
123
124 const int _faceNumber;
126 const int _haloSize;
127 const int _unknowns;
129 };
130} // namespace exahype2::enumerator
#define assertion2(expr, param0, param1)
std::string toString(exahype2::RefinementCommand value)
#define GPUCallableInlineMethod
Definition accelerator.h:37
GPUCallableInlineMethod int operator()(const tarch::la::Vector< Dimensions, int > &dofIndex, int unknown) const
Access a dof.
constexpr GPUCallableInlineMethod FaceAoSLexicographicEnumerator(int faceNumber, int numberOfDoFsPerAxisInCell, int haloSize, int unknowns, int numberOfAuxiliaryVariables)
Simple vector class.
Definition Vector.h:159