66 #ifndef __INTREPID2_CELLTOPOLOGYTAGS_HPP__
67 #define __INTREPID2_CELLTOPOLOGYTAGS_HPP__
69 #include "Intrepid2_ConfigDefs.hpp"
90 typedef struct Line<2> base_cell_topology_type;
91 enum :
int { dimension = 1,
97 static constexpr
double coords[2][3]{ {-1.0, 0.0, 0.0}, { 1.0, 0.0, 0.0} };
100 template<
typename Po
intViewType>
101 KOKKOS_INLINE_FUNCTION
103 checkPointInclusion(
const PointViewType &point,
104 const double threshold) {
105 const double minus_one = -1.0 - threshold, plus_one = 1.0 + threshold;
106 return (minus_one <= point(0) && point(0) <= plus_one);
115 typedef struct Line<2> base_cell_topology_type;
116 enum :
int { dimension = 1,
122 static constexpr
double coords[3][3]{ {-1.0, 0.0, 0.0}, { 1.0, 0.0, 0.0}, { 0.0, 0.0, 0.0} };
124 template<
typename Po
intViewType>
125 KOKKOS_INLINE_FUNCTION
127 checkPointInclusion(
const PointViewType &point,
128 const double threshold) {
129 return base_cell_topology_type::checkPointInclusion(point, threshold);
143 typedef struct Triangle<3> base_cell_topology_type;
144 enum :
int { dimension = 2,
150 static constexpr
double coords[3][3]{ { 0.0, 0.0, 0.0}, { 1.0, 0.0, 0.0}, { 0.0, 1.0, 0.0} };
152 template<
typename Po
intViewType>
153 KOKKOS_INLINE_FUNCTION
155 checkPointInclusion(
const PointViewType &point,
156 const double threshold) {
157 const double distance = max( max( -point(0), -point(1) ), point(0) + point(1) - 1.0 );
158 return distance < threshold;
167 typedef struct Triangle<3> base_cell_topology_type;
168 enum :
int { dimension = 2,
174 static constexpr
double coords[4][3]{ { 0.0, 0.0, 0.0}, { 1.0, 0.0, 0.0}, { 0.0, 1.0, 0.0}, { 1.0/3.0, 1.0/3.0, 0.0} };
176 template<
typename Po
intViewType>
177 KOKKOS_INLINE_FUNCTION
179 checkPointInclusion(
const PointViewType &point,
180 const double threshold) {
181 return base_cell_topology_type::checkPointInclusion(point, threshold);
190 typedef struct Triangle<3> base_cell_topology_type;
191 enum :
int { dimension = 2,
197 static constexpr
double coords[6][3]{ { 0.0, 0.0, 0.0}, { 1.0, 0.0, 0.0}, { 0.0, 1.0, 0.0},
198 { 0.5, 0.0, 0.0}, { 0.5, 0.5, 0.0}, { 0.0, 0.5, 0.0} };
200 template<
typename Po
intViewType>
201 KOKKOS_INLINE_FUNCTION
203 checkPointInclusion(
const PointViewType &point,
204 const double threshold) {
205 return base_cell_topology_type::checkPointInclusion(point, threshold);
220 enum :
int { dimension = 2,
226 static constexpr
double coords[4][3]{ {-1.0,-1.0, 0.0}, { 1.0,-1.0, 0.0}, { 1.0, 1.0, 0.0}, {-1.0, 1.0, 0.0} };
228 template<
typename Po
intViewType>
229 KOKKOS_INLINE_FUNCTION
231 checkPointInclusion(
const PointViewType &point,
232 const double threshold) {
233 const double minus_one = -1.0 - threshold, plus_one = 1.0 + threshold;
234 return ((minus_one <= point(0) && point(0) <= plus_one) &&
235 (minus_one <= point(1) && point(1) <= plus_one));
245 enum :
int { dimension = 2,
251 static constexpr
double coords[8][3]{ {-1.0,-1.0, 0.0}, { 1.0,-1.0, 0.0}, { 1.0, 1.0, 0.0}, {-1.0, 1.0, 0.0},
252 { 0.0,-1.0, 0.0}, { 1.0, 0.0, 0.0}, { 0.0, 1.0, 0.0}, {-1.0, 0.0, 0.0} };
254 template<
typename Po
intViewType>
255 KOKKOS_INLINE_FUNCTION
257 checkPointInclusion(
const PointViewType &point,
258 const double threshold) {
259 return base_cell_topology_type::checkPointInclusion(point, threshold);
269 enum :
int { dimension = 2,
275 static constexpr
double coords[9][3]{ {-1.0,-1.0, 0.0}, { 1.0,-1.0, 0.0}, { 1.0, 1.0, 0.0}, {-1.0, 1.0, 0.0},
276 { 0.0,-1.0, 0.0}, { 1.0, 0.0, 0.0}, { 0.0, 1.0, 0.0}, {-1.0, 0.0, 0.0}, { 0.0, 0.0, 0.0} };
278 template<
typename Po
intViewType>
279 KOKKOS_INLINE_FUNCTION
281 checkPointInclusion(
const PointViewType &point,
282 const double threshold) {
283 return base_cell_topology_type::checkPointInclusion(point, threshold);
297 typedef struct Tetrahedron<4> base_cell_topology_type;
298 enum :
int { dimension = 3,
304 static constexpr
double coords[4][3]{ { 0.0, 0.0, 0.0}, { 1.0, 0.0, 0.0}, { 0.0, 1.0, 0.0}, { 0.0, 0.0, 1.0} };
306 template<
typename Po
intViewType>
307 KOKKOS_INLINE_FUNCTION
309 checkPointInclusion(
const PointViewType &point,
310 const double threshold) {
311 const double distance = max( max(-point(0),-point(1)),
312 max(-point(2), point(0) + point(1) + point(2) - 1) );
314 return distance < threshold;
323 typedef struct Tetrahedron<4> base_cell_topology_type;
324 enum :
int { dimension = 3,
330 static constexpr
double coords[8][3]{ { 0.0, 0.0, 0.0}, { 1.0, 0.0, 0.0}, { 0.0, 1.0, 0.0}, { 0.0, 0.0, 1.0},
331 { 1/3, 0.0, 1/3}, { 1/3, 1/3, 1/3}, { 1/3, 1/3, 0.0}, { 0.0, 1/3, 1/3} };
333 template<
typename Po
intViewType>
334 KOKKOS_INLINE_FUNCTION
336 checkPointInclusion(
const PointViewType &point,
337 const double threshold) {
338 return base_cell_topology_type::checkPointInclusion(point, threshold);
347 typedef struct Tetrahedron<4> base_cell_topology_type;
348 enum :
int { dimension = 3,
354 static constexpr
double coords[10][3]{ { 0.0, 0.0, 0.0}, { 1.0, 0.0, 0.0}, { 0.0, 1.0, 0.0}, { 0.0, 0.0, 1.0},
355 { 0.5, 0.0, 0.0}, { 0.5, 0.5, 0.0}, { 0.0, 0.5, 0.0}, { 0.0, 0.0, 0.5}, { 0.5, 0.0, 0.5}, { 0.0, 0.5, 0.5} };
357 template<
typename Po
intViewType>
358 KOKKOS_INLINE_FUNCTION
360 checkPointInclusion(
const PointViewType &point,
361 const double threshold) {
362 return base_cell_topology_type::checkPointInclusion(point, threshold);
371 typedef struct Tetrahedron<4> base_cell_topology_type;
372 enum :
int { dimension = 3,
378 static constexpr
double coords[11][3]{ { 0.0, 0.0, 0.0}, { 1.0, 0.0, 0.0}, { 0.0, 1.0, 0.0}, { 0.0, 0.0, 1.0},
379 { 0.5, 0.0, 0.0}, { 0.5, 0.5, 0.0}, { 0.0, 0.5, 0.0}, { 0.0, 0.0, 0.5}, { 0.5, 0.0, 0.5}, { 0.0, 0.5, 0.5} };
381 template<
typename Po
intViewType>
382 KOKKOS_INLINE_FUNCTION
384 checkPointInclusion(
const PointViewType &point,
385 const double threshold) {
386 return base_cell_topology_type::checkPointInclusion(point, threshold);
400 typedef struct Hexahedron<8> base_cell_topology_type;
401 enum :
int { dimension = 3,
407 static constexpr
double coords[8][3]{ {-1.0,-1.0,-1.0}, { 1.0,-1.0,-1.0}, { 1.0, 1.0,-1.0}, {-1.0, 1.0,-1.0},
408 {-1.0,-1.0, 1.0}, { 1.0,-1.0, 1.0}, { 1.0, 1.0, 1.0}, {-1.0, 1.0, 1.0} };
410 template<
typename Po
intViewType>
411 KOKKOS_INLINE_FUNCTION
413 checkPointInclusion(
const PointViewType &point,
414 const double threshold) {
415 const double minus_one = -1.0 - threshold, plus_one = 1.0 + threshold;
416 return ((minus_one <= point(0) && point(0) <= plus_one) &&
417 (minus_one <= point(1) && point(1) <= plus_one) &&
418 (minus_one <= point(2) && point(2) <= plus_one));
427 typedef struct Hexahedron<8> base_cell_topology_type;
428 enum :
int { dimension = 3,
434 static constexpr
double coords[20][3]{ {-1.0,-1.0,-1.0}, { 1.0,-1.0,-1.0}, { 1.0, 1.0,-1.0}, {-1.0, 1.0,-1.0},
435 {-1.0,-1.0, 1.0}, { 1.0,-1.0, 1.0}, { 1.0, 1.0, 1.0}, {-1.0, 1.0, 1.0},
436 { 0.0,-1.0,-1.0}, { 1.0, 0.0,-1.0}, { 0.0, 1.0,-1.0}, {-1.0, 0.0,-1.0},
437 {-1.0,-1.0, 0.0}, { 1.0,-1.0, 0.0}, { 1.0, 1.0, 0.0}, {-1.0, 1.0, 0.0},
438 { 0.0,-1.0, 1.0}, { 1.0, 0.0, 1.0}, { 0.0, 1.0, 1.0}, {-1.0, 0.0, 1.0} };
440 template<
typename Po
intViewType>
441 KOKKOS_INLINE_FUNCTION
443 checkPointInclusion(
const PointViewType &point,
444 const double threshold) {
445 return base_cell_topology_type::checkPointInclusion(point, threshold);
455 typedef struct Hexahedron<8> base_cell_topology_type;
456 enum :
int { dimension = 3,
462 static constexpr
double coords[27][3]{ {-1.0,-1.0,-1.0}, { 1.0,-1.0,-1.0}, { 1.0, 1.0,-1.0}, {-1.0, 1.0,-1.0},
463 {-1.0,-1.0, 1.0}, { 1.0,-1.0, 1.0}, { 1.0, 1.0, 1.0}, {-1.0, 1.0, 1.0},
464 { 0.0,-1.0,-1.0}, { 1.0, 0.0,-1.0}, { 0.0, 1.0,-1.0}, {-1.0, 0.0,-1.0},
465 {-1.0,-1.0, 0.0}, { 1.0,-1.0, 0.0}, { 1.0, 1.0, 0.0}, {-1.0, 1.0, 0.0},
466 { 0.0,-1.0, 1.0}, { 1.0, 0.0, 1.0}, { 0.0, 1.0, 1.0}, {-1.0, 0.0, 1.0},
468 { 0.0, 0.0,-1.0}, { 0.0, 0.0, 1.0}, {-1.0, 0.0, 0.0}, { 1.0, 0.0, 0.0}, {0.0,-1.0, 0.0}, {0.0, 1.0, 0.0} };
470 template<
typename Po
intViewType>
471 KOKKOS_INLINE_FUNCTION
473 checkPointInclusion(
const PointViewType &point,
474 const double threshold) {
475 return base_cell_topology_type::checkPointInclusion(point, threshold);
489 typedef struct Pyramid<5> base_cell_topology_type;
490 enum :
int { dimension = 3,
496 static constexpr
double coords[5][3]{ {-1.0,-1.0, 0.0}, { 1.0,-1.0, 0.0}, { 1.0, 1.0, 0.0}, {-1.0, 1.0, 0.0}, { 0.0, 0.0, 1.0} };
498 template<
typename Po
intViewType>
499 KOKKOS_INLINE_FUNCTION
501 checkPointInclusion(
const PointViewType &point,
502 const double threshold) {
503 const double minus_one = -1.0 - threshold, plus_one = 1.0 + threshold, minus_zero = -threshold;
504 const double left = minus_one + point(2);
505 const double right = plus_one - point(2);
506 return ((left <= point(0) && point(0) <= right) &&
507 (left <= point(1) && point(1) <= right) &&
508 (minus_zero <= point(2) && point(2) <= plus_one));
517 typedef struct Pyramid<5> base_cell_topology_type;
518 enum :
int { dimension = 3,
524 static constexpr
double coords[13][3]{ {-1.0,-1.0, 0.0}, { 1.0,-1.0, 0.0}, { 1.0, 1.0, 0.0}, {-1.0, 1.0, 0.0}, { 0.0, 0.0, 1.0},
525 { 0.0,-1.0, 0.0}, { 1.0, 0.0, 0.0}, { 0.0, 1.0, 0.0}, {-1.0, 0.0, 0.0},
526 {-0.5,-0.5, 0.5}, { 0.5,-0.5, 0.5}, { 0.5, 0.5, 0.5}, {-0.5, 0.5, 0.5} };
528 template<
typename Po
intViewType>
529 KOKKOS_INLINE_FUNCTION
531 checkPointInclusion(
const PointViewType &point,
532 const double threshold) {
533 return base_cell_topology_type::checkPointInclusion(point, threshold);
542 typedef struct Pyramid<5> base_cell_topology_type;
543 enum :
int { dimension = 3,
549 static constexpr
double coords[14][3]{ {-1.0,-1.0, 0.0}, { 1.0,-1.0, 0.0}, { 1.0, 1.0, 0.0}, {-1.0, 1.0, 0.0}, { 0.0, 0.0, 1.0},
550 { 0.0,-1.0, 0.0}, { 1.0, 0.0, 0.0}, { 0.0, 1.0, 0.0}, {-1.0, 0.0, 0.0},
551 {-0.5,-0.5, 0.5}, { 0.5,-0.5, 0.5}, { 0.5, 0.5, 0.5}, {-0.5, 0.5, 0.5}, { 0.0, 0.0, 0.0} };
553 template<
typename Po
intViewType>
554 KOKKOS_INLINE_FUNCTION
556 checkPointInclusion(
const PointViewType &point,
557 const double threshold) {
558 return base_cell_topology_type::checkPointInclusion(point, threshold);
572 typedef struct Wedge<6> base_cell_topology_type;
573 enum :
int { dimension = 3,
579 static constexpr
double coords[6][3]{ { 0.0, 0.0,-1.0}, { 1.0, 0.0,-1.0}, { 0.0, 1.0,-1.0}, { 0.0, 0.0, 1.0}, { 1.0, 0.0, 1.0}, { 0.0, 1.0, 1.0} };
581 template<
typename Po
intViewType>
582 KOKKOS_INLINE_FUNCTION
584 checkPointInclusion(
const PointViewType &point,
585 const double threshold) {
586 const double minus_one = -1.0 - threshold, plus_one = 1.0 + threshold;
587 const double distance = max( max( -point(0), -point(1) ), point(0) + point(1) - 1 );
588 return (distance < threshold && (minus_one <= point(2) && point(2) <= plus_one));
597 typedef struct Wedge<6> base_cell_topology_type;
598 enum :
int { dimension = 3,
604 static constexpr
double coords[15][3]{ { 0.0, 0.0,-1.0}, { 1.0, 0.0,-1.0}, { 0.0, 1.0,-1.0}, { 0.0, 0.0, 1.0}, { 1.0, 0.0, 1.0}, { 0.0, 1.0, 1.0},
605 { 0.5, 0.0,-1.0}, { 0.5, 0.5,-1.0}, { 0.0, 0.5,-1.0}, { 0.0, 0.0, 0.0}, { 1.0, 0.0, 0.0}, { 0.0, 1.0, 0.0},
606 { 0.5, 0.0, 1.0}, { 0.5, 0.5, 1.0}, { 0.0, 0.5, 1.0} };
608 template<
typename Po
intViewType>
609 KOKKOS_INLINE_FUNCTION
611 checkPointInclusion(
const PointViewType &point,
612 const double threshold) {
613 return base_cell_topology_type::checkPointInclusion(point, threshold);
622 typedef struct Wedge<6> base_cell_topology_type;
623 enum :
int { dimension = 3,
629 static constexpr
double coords[18][3]{ { 0.0, 0.0,-1.0}, { 1.0, 0.0,-1.0}, { 0.0, 1.0,-1.0}, { 0.0, 0.0, 1.0}, { 1.0, 0.0, 1.0}, { 0.0, 1.0, 1.0},
630 { 0.5, 0.0,-1.0}, { 0.5, 0.5,-1.0}, { 0.0, 0.5,-1.0}, { 0.0, 0.0, 0.0}, { 1.0, 0.0, 0.0}, { 0.0, 1.0, 0.0},
631 { 0.5, 0.0, 1.0}, { 0.5, 0.5, 1.0}, { 0.0, 0.5, 1.0},
632 { 0.5, 0.0, 0.0}, { 0.5, 0.5, 0.0}, { 0.0, 0.5, 0.0} };
635 template<
typename Po
intViewType>
636 KOKKOS_INLINE_FUNCTION
638 checkPointInclusion(
const PointViewType &point,
639 const double threshold) {
640 return base_cell_topology_type::checkPointInclusion(point, threshold);
Header function for Intrepid2::Util class and other utility functions.