MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
fvcartesiansyseqntraits.h
Go to the documentation of this file.
1// Copyright (C) 2024 The m-AIA AUTHORS
2//
3// This file is part of m-AIA (https://git.rwth-aachen.de/aia/m-AIA/m-AIA)
4//
5// SPDX-License-Identifier: LGPL-3.0-only
6
7#ifndef FVCARTESIANSYSEQNTRAITS_H
8#define FVCARTESIANSYSEQNTRAITS_H
9
12#include "fvcartesiansyseqnns.h"
14
15// SFINAE tests. Used for constexpr checks if certain PVs exist.
16
18template <class SysEqn>
19constexpr bool isNS = std::is_same_v<SysEqn, FvSysEqnNS<2>> || std::is_same_v<SysEqn, FvSysEqnNS<3>>;
20
22template <class SysEqn>
23constexpr bool
25 std::is_same_v<SysEqn,
26 FvSysEqnRANS<2, RANSModelConstants<RANS_SA_DV>>> || std::is_same_v<SysEqn, FvSysEqnRANS<3, RANSModelConstants<RANS_SA_DV>>> || std::is_same_v<SysEqn, FvSysEqnRANS<2, RANSModelConstants<RANS_FS>>> || std::is_same_v<SysEqn, FvSysEqnRANS<3, RANSModelConstants<RANS_FS>>> || std::is_same_v<SysEqn, FvSysEqnRANS<2, RANSModelConstants<RANS_KOMEGA>>> || std::is_same_v<SysEqn, FvSysEqnRANS<3, RANSModelConstants<RANS_KOMEGA>>>;
27
29template <class SysEqn>
30constexpr bool isEEGas = std::is_same_v<SysEqn, FvSysEqnEEGas<2>> || std::is_same_v<SysEqn, FvSysEqnEEGas<3>>;
31
33template <class SysEqn>
34constexpr bool isDetChem = std::is_same_v<SysEqn, FvSysEqnDetChem<2>> || std::is_same_v<SysEqn, FvSysEqnDetChem<3>>;
35
37template <class SysEqn_>
38class hasPV_C {
39 typedef char one;
40 struct two {
41 char x[2];
42 };
43 // the function test returns a char if PV->C exists, two chars else. These functions are never actually called.
44 template <class SysEqn>
45 static one test(decltype(&SysEqn::PV->C));
46 template <class SysEqn>
47 static two test(...);
48
49 public:
50 enum { value = sizeof(test<SysEqn_>(0)) == sizeof(one) }; // ::value is constexpr true if PV->C exists, else false
51};
52
54template <class SysEqn_>
55class hasPV_N {
56 typedef char one;
57 struct two {
58 char x[2];
59 };
60 // the function test returns a char if PV->N exists, two chars else. These functions are never actually called.
61 template <class SysEqn>
62 static one test(decltype(&SysEqn::PV->N));
63 template <class SysEqn>
64 static two test(...);
65
66 public:
67 enum { value = sizeof(test<SysEqn_>(0)) == sizeof(one) }; // ::value is constexpr true if PV->N exists, else false
68};
69
70template <class SysEqn_>
71class hasPV_A {
72 typedef char one;
73 struct two {
74 char x[2];
75 };
76 // the function test returns a char if PV->A exists, two chars else. These functions are never actually called.
77 template <class SysEqn>
78 static one test(decltype(&SysEqn::PV->A));
79 template <class SysEqn>
80 static two test(...);
81
82 public:
83 enum { value = sizeof(test<SysEqn_>(0)) == sizeof(one) }; // ::value is constexpr true if PV->A exists, else false
84};
85
86template <class SysEqn>
87constexpr bool hasE = SysEqn::ConservativeVariables::RHO_E > -1;
88
89#endif // FVCARTESIANSYSEQNTRAITS_H
static two test(...)
static one test(decltype(&SysEqn::PV->A))
Checks if the primitive variable C exists.
static one test(decltype(&SysEqn::PV->C))
static two test(...)
Checks if the primitive variable N exists.
static two test(...)
static one test(decltype(&SysEqn::PV->N))
constexpr bool hasE
constexpr bool isRANS
Checks if the SysEqn is SysEqnRANS.
constexpr bool isDetChem
Checks if the SysEqn is SysEqnDetChem.
constexpr bool isNS
Checks if the SysEqn is SysEqnNS.
constexpr bool isEEGas
Checks if the SysEqn is SysEqnEEGas.