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