15 #ifndef __INTREPID2_TYPES_HPP__
16 #define __INTREPID2_TYPES_HPP__
18 #include <Kokkos_Core.hpp>
19 #include <Kokkos_DynRankView.hpp>
26 typedef int ordinal_type;
27 typedef size_t size_type;
29 template<
typename ValueType>
30 KOKKOS_FORCEINLINE_FUNCTION
36 KOKKOS_FORCEINLINE_FUNCTION
37 double epsilon<double>() {
46 return (s.i64 < 0 ? 1 - s.d64 : s.d64 - 1);
50 KOKKOS_FORCEINLINE_FUNCTION
51 float epsilon<float>() {
60 return (s.i32 < 0 ? 1 - s.f32 : s.f32 - 1);
63 KOKKOS_FORCEINLINE_FUNCTION
65 return epsilon<double>();
68 template<
typename ValueType>
69 KOKKOS_FORCEINLINE_FUNCTION
70 ValueType tolerence() {
71 return 100.0*epsilon<ValueType>();
74 KOKKOS_FORCEINLINE_FUNCTION
76 return tolerence<double>();
79 template<
typename ValueType>
80 KOKKOS_FORCEINLINE_FUNCTION
81 ValueType threshold() {
82 return 10.0*epsilon<ValueType>();
85 KOKKOS_FORCEINLINE_FUNCTION
87 return threshold<double>();
144 POLYTYPE_GAUSS_RADAU_LEFT,
145 POLYTYPE_GAUSS_RADAU_RIGHT,
146 POLYTYPE_GAUSS_LOBATTO,
150 KOKKOS_INLINE_FUNCTION
151 const char* EPolyTypeToString(
const EPolyType polytype) {
153 case POLYTYPE_GAUSS:
return "Gauss";
154 case POLYTYPE_GAUSS_RADAU_LEFT:
return "GaussRadauLeft";
155 case POLYTYPE_GAUSS_RADAU_RIGHT:
return "GaussRadauRight";
156 case POLYTYPE_GAUSS_LOBATTO:
return "GaussRadauLobatto";
157 case POLYTYPE_MAX:
return "Max PolyType";
159 return "INVALID EPolyType";
167 KOKKOS_FORCEINLINE_FUNCTION
168 bool isValidPolyType(
const EPolyType polytype){
169 return( polytype == POLYTYPE_GAUSS ||
170 polytype == POLYTYPE_GAUSS_RADAU_LEFT ||
171 polytype == POLYTYPE_GAUSS_RADAU_RIGHT ||
172 polytype == POLYTYPE_GAUSS_LOBATTO );
180 COORDINATES_CARTESIAN=0,
182 COORDINATES_CYLINDRICAL,
183 COORDINATES_SPHERICAL,
187 KOKKOS_INLINE_FUNCTION
188 const char* ECoordinatesToString(
const ECoordinates coords) {
190 case COORDINATES_CARTESIAN:
return "Cartesian";
191 case COORDINATES_POLAR:
return "Polar";
192 case COORDINATES_CYLINDRICAL:
return "Cylindrical";
193 case COORDINATES_SPHERICAL:
return "Spherical";
194 case COORDINATES_MAX:
return "Max. Coordinates";
196 return "INVALID ECoordinates";
204 KOKKOS_FORCEINLINE_FUNCTION
205 bool isValidCoordinate(
const ECoordinates coordinateType){
206 return( coordinateType == COORDINATES_CARTESIAN ||
207 coordinateType == COORDINATES_POLAR ||
208 coordinateType == COORDINATES_CYLINDRICAL ||
209 coordinateType == COORDINATES_SPHERICAL );
223 KOKKOS_INLINE_FUNCTION
224 const char* ENormToString(
const ENorm norm) {
226 case NORM_ONE:
return "1-Norm";
227 case NORM_TWO:
return "2-Norm";
228 case NORM_INF:
return "Infinity Norm";
229 case NORM_FRO:
return "Frobenius Norm";
230 case NORM_MAX:
return "Max. Norm";
232 return "INVALID ENorm";
240 KOKKOS_FORCEINLINE_FUNCTION
241 bool isValidNorm(
const ENorm normType){
242 return( normType == NORM_ONE ||
243 normType == NORM_TWO ||
244 normType == NORM_INF ||
245 normType == NORM_FRO ||
246 normType == NORM_MAX );
254 enum EOperator :
int {
270 OPERATOR_MAX = OPERATOR_Dn
273 KOKKOS_INLINE_FUNCTION
274 const char* EOperatorToString(
const EOperator op) {
276 case OPERATOR_VALUE:
return "Value";
277 case OPERATOR_GRAD:
return "Grad";
278 case OPERATOR_CURL:
return "Curl";
279 case OPERATOR_DIV:
return "Div";
280 case OPERATOR_D1:
return "D1";
281 case OPERATOR_D2:
return "D2";
282 case OPERATOR_D3:
return "D3";
283 case OPERATOR_D4:
return "D4";
284 case OPERATOR_D5:
return "D5";
285 case OPERATOR_D6:
return "D6";
286 case OPERATOR_D7:
return "D7";
287 case OPERATOR_D8:
return "D8";
288 case OPERATOR_D9:
return "D9";
289 case OPERATOR_D10:
return "D10";
290 case OPERATOR_MAX:
return "Dn Operator";
292 return "INVALID EOperator";
300 KOKKOS_FORCEINLINE_FUNCTION
301 bool isValidOperator(
const EOperator operatorType){
302 return ( operatorType == OPERATOR_VALUE ||
303 operatorType == OPERATOR_GRAD ||
304 operatorType == OPERATOR_CURL ||
305 operatorType == OPERATOR_DIV ||
306 operatorType == OPERATOR_D1 ||
307 operatorType == OPERATOR_D2 ||
308 operatorType == OPERATOR_D3 ||
309 operatorType == OPERATOR_D4 ||
310 operatorType == OPERATOR_D5 ||
311 operatorType == OPERATOR_D6 ||
312 operatorType == OPERATOR_D7 ||
313 operatorType == OPERATOR_D8 ||
314 operatorType == OPERATOR_D9 ||
315 operatorType == OPERATOR_D10 );
322 enum EFunctionSpace {
323 FUNCTION_SPACE_HGRAD = 0,
324 FUNCTION_SPACE_HCURL = 1,
325 FUNCTION_SPACE_HDIV = 2,
326 FUNCTION_SPACE_HVOL = 3,
327 FUNCTION_SPACE_VECTOR_HGRAD = 4,
328 FUNCTION_SPACE_TENSOR_HGRAD = 5,
332 KOKKOS_INLINE_FUNCTION
333 const char* EFunctionSpaceToString(
const EFunctionSpace space) {
335 case FUNCTION_SPACE_HGRAD:
return "H(grad)";
336 case FUNCTION_SPACE_HCURL:
return "H(curl)";
337 case FUNCTION_SPACE_HDIV:
return "H(div)";
338 case FUNCTION_SPACE_HVOL:
return "H(vol)";
339 case FUNCTION_SPACE_VECTOR_HGRAD:
return "Vector H(grad)";
340 case FUNCTION_SPACE_TENSOR_HGRAD:
return "Tensor H(grad)";
341 case FUNCTION_SPACE_MAX:
return "Max. Function space";
343 return "INVALID EFunctionSpace";
351 KOKKOS_FORCEINLINE_FUNCTION
352 bool isValidFunctionSpace(
const EFunctionSpace spaceType){
353 return ( spaceType == FUNCTION_SPACE_HGRAD ||
354 spaceType == FUNCTION_SPACE_HCURL ||
355 spaceType == FUNCTION_SPACE_HDIV ||
356 spaceType == FUNCTION_SPACE_HVOL ||
357 spaceType == FUNCTION_SPACE_VECTOR_HGRAD ||
358 spaceType == FUNCTION_SPACE_TENSOR_HGRAD );
369 enum EDiscreteSpace {
370 DISCRETE_SPACE_COMPLETE = 0,
371 DISCRETE_SPACE_INCOMPLETE,
372 DISCRETE_SPACE_BROKEN,
376 KOKKOS_INLINE_FUNCTION
377 const char* EDiscreteSpaceToString(
const EDiscreteSpace space) {
379 case DISCRETE_SPACE_COMPLETE:
return "Complete";
380 case DISCRETE_SPACE_INCOMPLETE:
return "Incomplete";
381 case DISCRETE_SPACE_BROKEN:
return "Broken";
382 case DISCRETE_SPACE_MAX:
return "Max. Rec. Space";
384 return "INVALID EDiscreteSpace";
392 KOKKOS_FORCEINLINE_FUNCTION
393 bool isValidDiscreteSpace(
const EDiscreteSpace spaceType){
394 return ( spaceType == DISCRETE_SPACE_COMPLETE ||
395 spaceType == DISCRETE_SPACE_INCOMPLETE ||
396 spaceType == DISCRETE_SPACE_BROKEN );
403 POINTTYPE_EQUISPACED = 0,
409 KOKKOS_INLINE_FUNCTION
410 const char* EPointTypeToString(
const EPointType pointType) {
412 case POINTTYPE_EQUISPACED:
return "Equispaced Points";
413 case POINTTYPE_WARPBLEND:
return "WarpBlend Points";
414 case POINTTYPE_GAUSS:
return "Gauss Points";
415 case POINTTYPE_DEFAULT:
return "Default Points";
417 return "INVALID EPointType";
424 KOKKOS_FORCEINLINE_FUNCTION
425 bool isValidPointType(
const EPointType pointType) {
426 return ( pointType == POINTTYPE_EQUISPACED ||
427 pointType == POINTTYPE_WARPBLEND ||
428 pointType == POINTTYPE_GAUSS );
435 BASIS_FEM_DEFAULT = 0,
436 BASIS_FEM_HIERARCHICAL,
437 BASIS_FEM_LAGRANGIAN,
444 KOKKOS_INLINE_FUNCTION
445 const char* EBasisToString(
const EBasis basis) {
447 case BASIS_FEM_DEFAULT:
return "FEM Default";
448 case BASIS_FEM_HIERARCHICAL:
return "FEM Hierarchical";
449 case BASIS_FEM_LAGRANGIAN:
return "FEM FIAT";
450 case BASIS_FVD_DEFAULT:
return "FVD Default";
451 case BASIS_FVD_COVOLUME:
return "FVD Covolume";
452 case BASIS_FVD_MIMETIC:
return "FVD Mimetic";
453 case BASIS_MAX:
return "Max. Basis";
455 return "INVALID EBasis";
463 KOKKOS_FORCEINLINE_FUNCTION
464 bool isValidBasis(
const EBasis basisType){
465 return ( basisType == BASIS_FEM_DEFAULT ||
466 basisType == BASIS_FEM_HIERARCHICAL ||
467 basisType == BASIS_FEM_LAGRANGIAN ||
468 basisType == BASIS_FVD_DEFAULT ||
469 basisType == BASIS_FVD_COVOLUME ||
470 basisType == BASIS_FVD_MIMETIC );
static constexpr ordinal_type MaxDimension
The maximum ambient space dimension.
static constexpr ordinal_type MaxCubatureDegreeTri
The maximum degree of the polynomial that can be integrated exactly by a direct triangle rule...
static constexpr ordinal_type MaxCubatureDegreeTet
The maximum degree of the polynomial that can be integrated exactly by a direct tetrahedron rule...
static constexpr ordinal_type MaxNewton
Maximum number of Newton iterations used internally in methods such as computing the action of the in...
static constexpr ordinal_type MaxNumPtsPerBasisEval
The maximum number of points to eval in serial mode.
static constexpr ordinal_type MaxCubatureDegreePyr
The maximum degree of the polynomial that can be integrated exactly by a direct pyramid rule...
static constexpr ordinal_type MaxVectorComponents
Maximum number of components that a VectorData object will store – 66 corresponds to OPERATOR_D10 on ...
static constexpr ordinal_type MaxIntegrationPoints
The maximum number of integration points for direct cubature rules.
static constexpr ordinal_type MaxCubatureDegreeEdge
The maximum degree of the polynomial that can be integrated exactly by a direct edge rule...
static constexpr ordinal_type MaxOrder
The maximum reconstruction order.
static constexpr ordinal_type MaxDerivative
Maximum order of derivatives allowed in intrepid.
static constexpr ordinal_type MaxTensorComponents
Maximum number of tensor/Cartesian products that can be taken: this allows hypercube basis in 7D to b...