GEOSX
MeshFields.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2018-2020 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University
7  * Copyright (c) 2018-2020 TotalEnergies
8  * Copyright (c) 2019- GEOSX Contributors
9  * All rights reserved
10  *
11  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
12  * ------------------------------------------------------------------------------------------------------------
13  */
14 
19 #ifndef GEOS_MESH_FIELDS_HPP_
20 #define GEOS_MESH_FIELDS_HPP_
21 
22 #include "codingUtilities/traits.hpp"
24 #include "common/DataTypes.hpp"
25 
38 #define DECLARE_FIELD( NAME, \
39  KEY, \
40  TYPE, \
41  DEFAULT, \
42  PLOTLEVEL, \
43  RESTARTFLAG, \
44  DESCRIPTION ) \
45  \
46  \
47  struct NAME \
48  { \
49  \
50  static constexpr char const * key() \
51  { return KEY; } \
52  \
53  using type = TYPE; \
54  \
55  using dataType = internal::typeHelper_t< TYPE >; \
56  \
57  static constexpr dataType defaultValue() \
58  { return DEFAULT; } \
59  \
60  static constexpr dataRepository::PlotLevel plotLevel = dataRepository::PlotLevel::PLOTLEVEL; \
61  \
62  static constexpr dataRepository::RestartFlags restartFlag = dataRepository::RestartFlags::RESTARTFLAG; \
63  \
64  static constexpr char const * description = DESCRIPTION; \
65  }
66 
67 namespace geos
68 {
72 namespace fields
73 {
74 
75 namespace internal
76 {
77 template< typename TYPE, bool HAS_TYPE = std::enable_if_t< traits::HasAlias_value_type< TYPE >, std::true_type >::value >
78 struct typeHelper
79 {
80  using type = typename TYPE::value_type;
81 };
82 
83 template< typename TYPE >
84 struct typeHelper< TYPE, false >
85 {
86  using type = TYPE; //typename std::enable_if< std::is_fundamental<TYPE>::value, TYPE>::type;
87 };
88 
89 template< typename T >
90 using typeHelper_t = typename typeHelper< T >::type;
91 }
92 
94  "ghostRank",
96  -2,
97  LEVEL_0,
99  "Ghost rank." );
100 
102  "elementVolume",
104  0,
105  LEVEL_1,
106  WRITE_AND_READ,
107  "Element volume." );
108 
110  "elementAperture",
112  1e-5,
113  LEVEL_0,
114  WRITE_AND_READ,
115  "Element aperture." );
116 
118  "elementArea",
120  0,
121  LEVEL_0,
122  WRITE_AND_READ,
123  "Element area." );
124 
126  "parentIndex",
128  -1,
129  LEVEL_2,
130  WRITE_AND_READ,
131  "Index of parent within the mesh object it is registered on." );
132 
134  "parentEdgeIndex",
136  -1,
137  LEVEL_2,
138  WRITE_AND_READ,
139  "Index of parent edge within the mesh object it is registered on." );
140 
142  "childIndex",
144  -1,
145  LEVEL_2,
146  WRITE_AND_READ,
147  "Index of child within the mesh object it is registered on." );
148 
150  "ruptureTime",
152  1.0e9,
153  LEVEL_0,
154  WRITE_AND_READ,
155  "Time that the object was ruptured/split." );
156 
158  "normalVector",
160  0.0,
161  LEVEL_0,
162  WRITE_AND_READ,
163  "Unit normal vector to the surface." );
164 
166  "tangentVector1",
168  0.0,
169  LEVEL_0,
170  WRITE_AND_READ,
171  "Unit vector in the first tangent direction to the surface." );
172 
174  "tangentVector2",
176  0.0,
177  LEVEL_0,
178  WRITE_AND_READ,
179  "Unit vector in the second tangent direction to the surface." );
180 
181 
182 } // namespace fields
183 } // namespace geos
184 
185 #endif /* GEOS_MESH_FIELDS_HPP_ */
#define DECLARE_FIELD(NAME, KEY, TYPE, DEFAULT, PLOTLEVEL, RESTARTFLAG, DESCRIPTION)
Generates a traits struct.
Definition: MeshFields.hpp:38
@ LEVEL_0
Write to plot always.
@ WRITE_AND_READ
Write and read from restart.
Array< T, 2, PERMUTATION > array2d
Alias for 2D array.
Definition: DataTypes.hpp:232
Array< T, 1 > array1d
Alias for 1D array.
Definition: DataTypes.hpp:216
Trait struct for childIndex data.
Definition: MeshFields.hpp:147
Trait struct for elementAperture data.
Definition: MeshFields.hpp:115
Trait struct for elementArea data.
Definition: MeshFields.hpp:123
Trait struct for elementVolume data.
Definition: MeshFields.hpp:107
Trait struct for ghostRank data.
Definition: MeshFields.hpp:99
Trait struct for normalVector data.
Definition: MeshFields.hpp:163
Trait struct for parentEdgeIndex data.
Definition: MeshFields.hpp:139
Trait struct for parentIndex data.
Definition: MeshFields.hpp:131
Trait struct for ruptureTime data.
Definition: MeshFields.hpp:155
Trait struct for tangentVector1 data.
Definition: MeshFields.hpp:171
Trait struct for tangentVector2 data.
Definition: MeshFields.hpp:179