forked from idaholab/moose
/
MooseTypes.h
423 lines (366 loc) · 12.6 KB
/
MooseTypes.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
/****************************************************************/
/* DO NOT MODIFY THIS HEADER */
/* MOOSE - Multiphysics Object Oriented Simulation Environment */
/* */
/* (c) 2010 Battelle Energy Alliance, LLC */
/* ALL RIGHTS RESERVED */
/* */
/* Prepared by Battelle Energy Alliance, LLC */
/* Under Contract No. DE-AC07-05ID14517 */
/* With the U. S. Department of Energy */
/* */
/* See COPYRIGHT for full restrictions */
/****************************************************************/
#ifndef MOOSETYPES_H
#define MOOSETYPES_H
#include "Moose.h"
#include "libmesh/libmesh.h"
#include "libmesh/id_types.h"
#include "libmesh/stored_range.h"
#include "libmesh/elem.h"
#include "libmesh/petsc_macro.h"
#include "libmesh/boundary_info.h"
#include <string>
#include <vector>
#include <memory>
// DO NOT USE (Deprecated)
#define MooseSharedPointer std::shared_ptr
#define MooseSharedNamespace std
/**
* Macro for inferring the proper type of a normal loop index compatible
* with the "auto" keyword.
* Usage:
* for (auto i = beginIndex(v); i < v.size(); ++i) // default index is zero
* for (auto i = beginIndex(v, 1); i < v.size(); ++i) // index is supplied
*/
// The multiple macros that you would need anyway [as per: Crazy Eddie (stack overflow)]
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
#endif
#define beginIndex_0() ERROR-- > "beginIndex() requires one or two arguments"
#define beginIndex_1(A) decltype(A.size())(0)
#define beginIndex_2(A, B) decltype(A.size())(B)
#define beginIndex_3(A, B, C) ERROR-- > "beginIndex() requires one or two arguments"
#define beginIndex_4(A, B, C, D) ERROR-- > "beginIndex() requires one or two arguments"
// The interim macro that simply strips the excess and ends up with the required macro
#define beginIndex_X(x, A, B, C, D, FUNC, ...) FUNC
// The macro that the programmer uses
#define beginIndex(...) \
beginIndex_X(, \
##__VA_ARGS__, \
beginIndex_4(__VA_ARGS__), \
beginIndex_3(__VA_ARGS__), \
beginIndex_2(__VA_ARGS__), \
beginIndex_1(__VA_ARGS__), \
beginIndex_0(__VA_ARGS__))
#ifdef __clang__
#pragma clang diagnostic pop
#endif
/**
* MOOSE typedefs
*/
typedef Real PostprocessorValue;
typedef std::vector<Real> VectorPostprocessorValue;
typedef boundary_id_type BoundaryID;
typedef unsigned int InterfaceID;
typedef subdomain_id_type SubdomainID;
typedef unsigned int MooseObjectID;
typedef unsigned int THREAD_ID;
typedef StoredRange<std::vector<dof_id_type>::iterator, dof_id_type> NodeIdRange;
typedef StoredRange<std::vector<const Elem *>::iterator, const Elem *> ConstElemPointerRange;
/// Execution flags - when is the object executed/evaluated
// Note: If this enum is changed, make sure to modify:
// (1) the local function populateExecTypes in Moose.C.
// (2) the function in Conversion.C: initExecStoreType()
// (3) the method SetupInterface::getExecuteOptions
// (4) the function Output::getExecuteOptions
enum ExecFlagType
{
EXEC_NONE = 0x00, // 0
/// Object is evaluated only once at the beginning of the simulation
EXEC_INITIAL = 0x01, // 1
/// Object is evaluated in every residual computation
EXEC_LINEAR = 0x02, // 2
/// Object is evaluated in every jacobian computation
EXEC_NONLINEAR = 0x04, // 4
/// Object is evaluated at the end of every time step
EXEC_TIMESTEP_END = 0x08, // 8
/// Object is evaluated at the beginning of every time step
EXEC_TIMESTEP_BEGIN = 0x10, // 16
/// Object is evaluated at the end of the simulations (output only)
EXEC_FINAL = 0x20, // 32
/// Forces execution to occur (output only)
EXEC_FORCED = 0x40, // 64
/// Forces execution on failed solve (output only)
EXEC_FAILED = 0x80, // 128
/// For use with custom executioners that want to fire objects at a specific time
EXEC_CUSTOM = 0x100, // 256
/// Objects is evaluated on subdomain
EXEC_SUBDOMAIN = 0x200 // 512
};
namespace Moose
{
const SubdomainID ANY_BLOCK_ID = libMesh::Elem::invalid_subdomain_id - 1;
const SubdomainID INVALID_BLOCK_ID = libMesh::Elem::invalid_subdomain_id;
const BoundaryID ANY_BOUNDARY_ID = static_cast<BoundaryID>(-1);
const BoundaryID INVALID_BOUNDARY_ID = libMesh::BoundaryInfo::invalid_id;
/**
* MaterialData types
*
* @see FEProblemBase, MaterialPropertyInterface
*/
enum MaterialDataType
{
BLOCK_MATERIAL_DATA,
BOUNDARY_MATERIAL_DATA,
FACE_MATERIAL_DATA,
NEIGHBOR_MATERIAL_DATA
};
/**
* Flag for AuxKernel related exeuction type.
*/
enum AuxGroup
{
PRE_IC = 0,
PRE_AUX = 1,
POST_AUX = 2,
ALL = 3
};
/**
* A static list of all the exec types.
*/
extern const std::vector<ExecFlagType> exec_types;
/**
* Framework-wide stuff
*/
enum VarKindType
{
VAR_NONLINEAR,
VAR_AUXILIARY
};
enum KernelType
{
KT_TIME = 0,
KT_NONTIME = 1,
KT_NONEIGEN = 2,
KT_EIGEN = 3,
KT_ALL
};
enum CouplingType
{
COUPLING_DIAG,
COUPLING_FULL,
COUPLING_CUSTOM
};
enum ConstraintSideType
{
SIDE_MASTER,
SIDE_SLAVE
};
enum DGResidualType
{
Element,
Neighbor
};
enum DGJacobianType
{
ElementElement,
ElementNeighbor,
NeighborElement,
NeighborNeighbor
};
enum ConstraintType
{
Slave = Element,
Master = Neighbor
};
enum ConstraintJacobianType
{
SlaveSlave = ElementElement,
SlaveMaster = ElementNeighbor,
MasterSlave = NeighborElement,
MasterMaster = NeighborNeighbor
};
enum CoordinateSystemType
{
COORD_XYZ,
COORD_RZ,
COORD_RSPHERICAL
};
/**
* Preconditioning side
*/
enum PCSideType
{
PCS_LEFT,
PCS_RIGHT,
PCS_SYMMETRIC,
PCS_DEFAULT ///< Use whatever we have in PETSc
};
/**
* Norm type for converge test
*/
enum MooseKSPNormType
{
KSPN_NONE,
KSPN_PRECONDITIONED,
KSPN_UNPRECONDITIONED,
KSPN_NATURAL,
KSPN_DEFAULT ///< Use whatever we have in PETSc
};
/**
* Type of the solve
*/
enum SolveType
{
ST_PJFNK, ///< Preconditioned Jacobian-Free Newton Krylov
ST_JFNK, ///< Jacobian-Free Newton Krylov
ST_NEWTON, ///< Full Newton Solve
ST_FD, ///< Use finite differences to compute Jacobian
ST_LINEAR ///< Solving a linear problem
};
/**
* Type of the eigen solve
*/
enum EigenSolveType
{
EST_POWER, ///< Power / Inverse / RQI
EST_ARNOLDI, ///< Arnoldi
EST_KRYLOVSCHUR, ///< Krylov-Schur
EST_JACOBI_DAVIDSON, ///< Jacobi-Davidson
EST_NONLINEAR_POWER, ///< Nonlinear inverse power
EST_MF_NONLINEAR_POWER, ///< Matrix-free nonlinear inverse power
EST_MONOLITH_NEWTON, ///< Newton-based eigen solver
EST_MF_MONOLITH_NEWTON, ///< Matrix-free Newton-based eigen solver
};
/**
* Type of the eigen problem
*/
enum EigenProblemType
{
EPT_HERMITIAN, ///< Hermitian
EPT_NON_HERMITIAN, ///< Non-Hermitian
EPT_GEN_HERMITIAN, ///< Generalized Hermitian
EPT_GEN_INDEFINITE, ///< Generalized Hermitian indefinite
EPT_GEN_NON_HERMITIAN, ///< Generalized Non-Hermitian
EPT_POS_GEN_NON_HERMITIAN, ///< Generalized Non-Hermitian with positive (semi-)definite B
EPT_SLEPC_DEFAULT ///< use whatever SLPEC has by default
};
/**
* Which eigen pairs
*/
enum WhichEigenPairs
{
WEP_LARGEST_MAGNITUDE, ///< largest magnitude
WEP_SMALLEST_MAGNITUDE, ///< smallest magnitude
WEP_LARGEST_REAL, ///< largest real
WEP_SMALLEST_REAL, ///< smallest real
WEP_LARGEST_IMAGINARY, ///< largest imaginary
WEP_SMALLEST_IMAGINARY, ///< smallest imaginary
WEP_TARGET_MAGNITUDE, ///< target magnitude
WEP_TARGET_REAL, ///< target real
WEP_TARGET_IMAGINARY, ///< target imaginary
WEP_ALL_EIGENVALUES, ///< all eigenvalues
WEP_SLEPC_DEFAULT ///< use whatever we have in SLEPC
};
/**
* Type of constraint formulation
*/
enum ConstraintFormulationType
{
Penalty,
Kinematic
};
/**
* Type of the line search
*/
enum LineSearchType
{
LS_INVALID, ///< means not set
LS_DEFAULT,
LS_NONE,
LS_BASIC,
#ifdef LIBMESH_HAVE_PETSC
#if PETSC_VERSION_LESS_THAN(3, 3, 0)
LS_CUBIC,
LS_QUADRATIC,
LS_BASICNONORMS,
#else
LS_SHELL,
LS_L2,
LS_BT,
LS_CP
#endif
#endif
};
/**
* Type of the matrix-free finite-differencing parameter
*/
enum MffdType
{
MFFD_INVALID, ///< means not set
MFFD_WP,
MFFD_DS
};
}
/**
* This Macro is used to generate std::string derived types useful for
* strong type checking and special handling in the GUI. It does not
* extend std::string in any way so it is generally "safe"
*/
#define DerivativeStringClass(TheName) \
class TheName : public std::string \
{ \
public: \
TheName() : std::string() {} \
TheName(const std::string & str) : std::string(str) {} \
TheName(const std::string & str, size_t pos, size_t n = npos) : std::string(str, pos, n) {} \
TheName(const char * s, size_t n) : std::string(s, n) {} \
TheName(const char * s) : std::string(s) {} \
TheName(size_t n, char c) : std::string(n, c) {} \
} /* No semicolon here because this is a macro */
// Instantiate new Types
/// This type is for expected filenames, it can be used to trigger open file dialogs in the GUI
DerivativeStringClass(FileName);
/// This type is for expected filenames where the extension is unwanted, it can be used to trigger open file dialogs in the GUI
DerivativeStringClass(FileNameNoExtension);
/// This type is similar to "FileName", but is used to further filter file dialogs on known file mesh types
DerivativeStringClass(MeshFileName);
/// This type is for output file base
DerivativeStringClass(OutFileBase);
/// This type is used for objects that expect nonlinear variable names (i.e. Kernels, BCs)
DerivativeStringClass(NonlinearVariableName);
/// This type is used for objects that expect Auxiliary variable names (i.e. AuxKernels, AuxBCs)
DerivativeStringClass(AuxVariableName);
/// This type is used for objects that expect either Nonlinear or Auxiliary Variables such as postprocessors
DerivativeStringClass(VariableName);
/// This type is used for objects that expect Boundary Names/Ids read from or generated on the current mesh
DerivativeStringClass(BoundaryName);
/// This type is similar to BoundaryName but is used for "blocks" or subdomains in the current mesh
DerivativeStringClass(SubdomainName);
/// This type is used for objects that expect Postprocessor objects
DerivativeStringClass(PostprocessorName);
/// This type is used for objects that expect VectorPostprocessor objects
DerivativeStringClass(VectorPostprocessorName);
/// This type is used for objects that expect Moose Function objects
DerivativeStringClass(FunctionName);
/// This type is used for objects that expect Moose Distribution objects
DerivativeStringClass(DistributionName);
/// This type is used for objects that expect Moose Sampler objects
DerivativeStringClass(SamplerName);
/// This type is used for objects that expect "UserObject" names
DerivativeStringClass(UserObjectName);
/// This type is used for objects that expect an Indicator object name
DerivativeStringClass(IndicatorName);
/// This type is used for objects that expect an Marker object name
DerivativeStringClass(MarkerName);
/// This type is used for objects that expect an MultiApp object name
DerivativeStringClass(MultiAppName);
/// Used for objects the require Output object names
DerivativeStringClass(OutputName);
/// Used for objects that expect MaterialProperty names
DerivativeStringClass(MaterialPropertyName);
/// User for accessing Material objects
DerivativeStringClass(MaterialName);
#endif // MOOSETYPES_H