CEPS  24.01
Cardiac ElectroPhysiology Simulator
CepsEnums.hpp
Go to the documentation of this file.
1 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2  This file is part of CEPS.
3 
4  CEPS is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  CEPS is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with CEPS (see file LICENSE at root of project).
16  If not, see <https://www.gnu.org/licenses/>.
17 
18 
19  Copyright 2019-2024 Inria, Universite de Bordeaux
20 
21  Authors, in alphabetical order:
22 
23  Pierre-Elliott BECUE, Florian CARO, Yves COUDIERE(*), Andjela DAVIDOVIC,
24  Charlie DOUANLA-LONTSI, Marc FUENTES, Mehdi JUHOOR, Michael LEGUEBE(*),
25  Pauline MIGERDITICHAN, Valentin PANNETIER(*), Nejib ZEMZEMI.
26  * : currently active authors
27 
28 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
30 #pragma once
31 
33 
34 namespace ceps
35 {
40  template <typename _Enum>
41  constexpr auto
42  toIntegral(_Enum e) -> typename std::underlying_type<_Enum>::type
43  {
44  return static_cast<typename std::underlying_type<_Enum>::type>(e);
45  }
46 } // namespace ceps
47 
48 #define CEPS_DECL_ENUM_OPERATORS(ENUM) \
49  \
50  constexpr CepsEnum operator| (const ENUM &a, const ENUM &b) \
51  { \
52  return ceps::toIntegral(a) | ceps::toIntegral(b); \
53  } \
54  \
55  constexpr CepsEnum operator| (const ENUM &a, const CepsEnum &b) \
56  { \
57  return ceps::toIntegral(a) | b; \
58  } \
59  \
60  constexpr CepsEnum operator| (const CepsEnum &a, const ENUM &b) \
61  { \
62  return a | ceps::toIntegral(b); \
63  } \
64  \
65  constexpr CepsEnum operator& (const ENUM &a, const ENUM &b) \
66  { \
67  return ceps::toIntegral(a) & ceps::toIntegral(b); \
68  } \
69  \
70  constexpr CepsEnum operator& (const ENUM &a, const CepsEnum &b) \
71  { \
72  return ceps::toIntegral(a) & b; \
73  } \
74  \
75  constexpr CepsEnum operator& (const CepsEnum &a, const ENUM &b) \
76  { \
77  return a & ceps::toIntegral(b); \
78  } \
79  \
80  constexpr CepsBool isEnabledOption (const ENUM& value, const ENUM& option) \
81  { \
82  return (value & option) == ceps::toIntegral(option); \
83  } \
84  \
85  constexpr CepsBool isEnabledOption (const CepsEnum& value, const ENUM& option) \
86  { \
87  return (value & option) == ceps::toIntegral(option); \
88  }
89 
92 {
93  Const,
94  C4,
95  C5,
96  CInf,
97  SRectangle
98  // GAUSSIAN = 'g', ///< Gaussian bell
99  // HEAVISIDE = 'h', ///< Heaviside
100  // RECTANGLE = 'r' ///< Rectangle
101 };
104 
108 {
109  ZeroD = 0,
110  Point = 1,
111  Cell = 2,
112 };
115 
119 {
120  Owned = 0,
121  Halo = 1
122 };
125 
127 enum class CepsCellType : CepsEnum
128 {
129  Simplex = 1,
130  Quad = 100
131 };
133 constexpr CepsUInt CepsCellTypeSize = 200;
134 
137 {
138  None = 1 << 1,
139  Time = 1 << 2,
140  Space = 1 << 3,
141  Solution = 1 << 4,
142  Attribute = 1 << 5,
143  DofIndex = 1 << 6,
144  CellIndex = 1 << 7,
145  NodeIndex = 1 << 8,
146  UnknownIndex = 1 << 9
147 };
148 
150 constexpr CepsUInt CepsFunctionFlagSize = 1 << 9;
152 
155 {
156  Dirichlet,
157  Neumann,
158  Robin
159 };
160 
163 {
164  Default = 1 << 1,
165  Stimulation = 1 << 2,
166  Laplace = 1 << 3
167 };
169 
170 enum class CepsAssemblingFlag : CepsEnum
172 {
175 };
176 
179 {
180  VTKLegacy = (1 << 1),
181  VTU = (1 << 2),
182  Music = (1 << 3) | VTKLegacy,
183  ParaviewSeries = (1 << 4) | VTU,
184  VTKCeps = (1 << 5),
185  Medit = (1 << 6)
186 };
CepsSourceTermFlag
Source terms flags.
Definition: CepsEnums.hpp:163
@ Laplace
A source term that multiplies grad phi (for FE)
@ Default
Simply add the source term.
@ Stimulation
Apply cardiac specific treatment before adding.
CepsGhostFlag
PartitionLocation: an enum that will be used by various elements of the code (pde,...
Definition: CepsEnums.hpp:119
@ Owned
Data is owned.
@ Halo
Data is in the halo.
CepsLocationFlag
DataLocation: an enum that will be used by various elements of the code (pde, readers,...
Definition: CepsEnums.hpp:108
@ Cell
Data is defined at cell centers.
@ Point
Data is defined on each point.
@ ZeroD
Data is defined once.
constexpr CepsUInt CepsLocationFlagSize
Size of enum CepsLocationFlag.
Definition: CepsEnums.hpp:114
#define CEPS_DECL_ENUM_OPERATORS(ENUM)
Definition: CepsEnums.hpp:48
CepsOutputFormat
Style of output files.
Definition: CepsEnums.hpp:179
@ VTKCeps
vtk_ceps format, use contrib/CepsParaviewPlugin.py (5.11)
@ ParaviewSeries
Paraview files series, JSON + VTU/PVTU.
@ Music
MUSIC files, VTKLegacy and xml.
@ Medit
.mesh outputs. Sucks.
@ VTU
VTU/PVTU files, one by time steps and by procs.
@ VTKLegacy
VTK Legacy, one by time steps.
constexpr CepsUInt CepsCompactSupportFlagSize
Size of enum CepsCompactSupportFlags.
Definition: CepsEnums.hpp:103
CepsCompactSupportFlag
Compact Support type enum.
Definition: CepsEnums.hpp:92
@ Const
Rectangle with amplitude 1.
@ SRectangle
Smooth rectangle.
CepsBoundaryConditionFlag
Enumeration for boundary condition type.
Definition: CepsEnums.hpp:155
@ Dirichlet
Dirichlet BC.
CepsAssemblingFlag
Source terms flags.
Definition: CepsEnums.hpp:172
@ TimeDerivative
Compute matrix of time derivatives.
@ SpatialOperator
Compute matrix of spatial operators.
constexpr CepsUInt CepsGhostFlagSize
Size of enum CepsGhostFlag.
Definition: CepsEnums.hpp:124
CepsFunctionFlag
Enum for CepsStandardArgs functions.
Definition: CepsEnums.hpp:137
@ CellIndex
Use cell index to determine position.
@ NodeIndex
Use node index to determine position.
@ Solution
Depends on the content of a solution vector with values at dofs.
@ None
No dependance, constant functions.
@ Time
Depends on time.
@ UnknownIndex
Use unknown index to compute result.
@ Space
Depends on position x.
@ Attribute
Depends on the attribute of the region of evaluation.
@ DofIndex
Use dof index to determine position.
constexpr CepsUInt CepsFunctionFlagSize
Number of function flags.
Definition: CepsEnums.hpp:150
constexpr CepsUInt CepsCellTypeSize
Size of enum CepsCellType.
Definition: CepsEnums.hpp:133
CepsCellType
Enum for different shapes of cells.
Definition: CepsEnums.hpp:128
@ Simplex
Simplices.
@ Quad
Quadrilaterals.
int CepsEnum
Enum type.
Definition: CepsTypes.hpp:216
std::make_unsigned_t< CepsInt > CepsUInt
Unsigned version on CepsInt.
Definition: CepsTypes.hpp:109
A namespace for all utility methods.
constexpr auto toIntegral(_Enum e) -> typename std::underlying_type< _Enum >::type
Converts an enum type variable to an integer.
Definition: CepsEnums.hpp:42