44template <
class IndexType>
50 Construct<CIncEulerVariable::template CIndices<IndexType>>(nDim, nSpecies);
53 Construct<CNEMOEulerVariable::template CIndices<IndexType>>(nDim, nSpecies);
56 Construct<CEulerVariable::template CIndices<IndexType>>(nDim, nSpecies);
62#define GET_INDEX_IMPL(NAME) \
63 inline IndexType NAME() const { \
66 return reinterpret_cast<const CIncEulerVariable::template CIndices<IndexType>*>(data_)->NAME(); \
68 return reinterpret_cast<const CNEMOEulerVariable::template CIndices<IndexType>*>(data_)->NAME(); \
70 return reinterpret_cast<const CEulerVariable::template CIndices<IndexType>*>(data_)->NAME(); \
90 template <
class ConcreteIndices>
91 void Construct(IndexType nDim, IndexType nSpecies) {
93 static_assert(
sizeof(ConcreteIndices) <= 2 *
sizeof(IndexType));
94 new(data_) ConcreteIndices(nDim, nSpecies);
97 alignas(
sizeof(IndexType))
char data_[2 *
sizeof(IndexType)]{};
106template <
class IndexType>
108 std::map<std::string, IndexType> nameToIndex;
109 const auto notAvailable = std::numeric_limits<IndexType>::max();
110#define INSERT_VAR_INDEX_PAIR(STRING, FUNCTION) \
111 if (idx.FUNCTION() != notAvailable) nameToIndex[STRING] = idx.FUNCTION();
122#undef INSERT_VAR_INDEX_PAIR
123 nameToIndex[
"VELOCITY_X"] = idx.
Velocity();
124 nameToIndex[
"VELOCITY_Y"] = idx.
Velocity() + 1;
125 if (idx.
NDim() == 3) {
126 nameToIndex[
"VELOCITY_Z"] = idx.
Velocity() + 2;
128 for (IndexType iSpecies = 0; iSpecies < idx.
NSpecies(); ++iSpecies) {
129 nameToIndex[
"DENSITY_" + std::to_string(iSpecies)] = idx.
SpeciesDensities() + iSpecies;
Class for defining the variables of the compressible Euler solver.
Class for defining the variables of the incompressible Euler solver.
Class for defining the variables of the compressible NEMO Euler solver.
#define GET_INDEX_IMPL(NAME)
Definition CPrimitiveIndices.hpp:62
#define INSERT_VAR_INDEX_PAIR(STRING, FUNCTION)
std::map< std::string, IndexType > PrimitiveNameToIndexMap(const CPrimitiveIndices< IndexType > &idx)
Maps primitive variable names to their indices based on a CPrimitiveIndices object.
Definition CPrimitiveIndices.hpp:107
Abstract wrapper for the CIndices classes of CEulerVariable, CIncEulerVariable, etc....
Definition CPrimitiveIndices.hpp:45
IndexType Density() const
Definition CPrimitiveIndices.hpp:79
IndexType NSpecies() const
Definition CPrimitiveIndices.hpp:74
IndexType SoundSpeed() const
Definition CPrimitiveIndices.hpp:81
IndexType EddyViscosity() const
Definition CPrimitiveIndices.hpp:83
IndexType NDim() const
Definition CPrimitiveIndices.hpp:73
IndexType Temperature() const
Definition CPrimitiveIndices.hpp:76
IndexType LaminarViscosity() const
Definition CPrimitiveIndices.hpp:82
IndexType ThermalConductivity() const
Definition CPrimitiveIndices.hpp:84
CPrimitiveIndices(bool incompressible, bool nemo, IndexType nDim, IndexType nSpecies)
Definition CPrimitiveIndices.hpp:46
IndexType Pressure() const
Definition CPrimitiveIndices.hpp:78
IndexType CpTotal() const
Definition CPrimitiveIndices.hpp:85
IndexType Velocity() const
Definition CPrimitiveIndices.hpp:77
IndexType SpeciesDensities() const
Definition CPrimitiveIndices.hpp:75
IndexType Temperature_ve() const
Definition CPrimitiveIndices.hpp:86
IndexType Enthalpy() const
Definition CPrimitiveIndices.hpp:80