19 #ifndef __INTREPID2_CELLDATA_DEF_HPP__
20 #define __INTREPID2_CELLDATA_DEF_HPP__
24 template<
typename DeviceType>
28 switch ( cellTopoKey ) {
29 case shards::Line<2>::key:
30 case shards::Line<3>::key:
31 case shards::ShellLine<2>::key:
32 case shards::ShellLine<3>::key:
33 case shards::Beam<2>::key:
34 case shards::Beam<3>::key:
35 case shards::Triangle<3>::key:
36 case shards::Triangle<4>::key:
37 case shards::Triangle<6>::key:
40 case shards::Quadrilateral<4>::key:
41 case shards::Quadrilateral<8>::key:
42 case shards::Quadrilateral<9>::key:
46 case shards::Tetrahedron<4>::key:
47 case shards::Tetrahedron<8>::key:
48 case shards::Tetrahedron<10>::key:
49 case shards::Tetrahedron<11>::key:
50 case shards::Hexahedron<8>::key:
51 case shards::Hexahedron<20>::key:
52 case shards::Hexahedron<27>::key:
53 case shards::Pyramid<5>::key:
54 case shards::Pyramid<13>::key:
55 case shards::Pyramid<14>::key:
56 case shards::Wedge<6>::key:
57 case shards::Wedge<15>::key:
58 case shards::Wedge<18>::key:
65 template<
typename DeviceType>
67 typename RefSubcellParametrization<DeviceType>::ConstViewType
69 get(
const ordinal_type subcellDim,
70 const unsigned parentCellKey ) {
72 if(!isSubcellParametrizationSet_)
77 switch (parentCellKey ) {
78 case shards::Tetrahedron<4>::key:
79 case shards::Tetrahedron<8>::key:
80 case shards::Tetrahedron<10>::key:
81 case shards::Tetrahedron<11>::key: subcellParam = ( subcellDim == 2 ? tetFacesParam : tetEdgesParam );
break;
83 case shards::Hexahedron<8>::key:
84 case shards::Hexahedron<20>::key:
85 case shards::Hexahedron<27>::key: subcellParam = ( subcellDim == 2 ? hexFacesParam : hexEdgesParam );
break;
87 case shards::Pyramid<5>::key:
88 case shards::Pyramid<13>::key:
89 case shards::Pyramid<14>::key: subcellParam = ( subcellDim == 2 ? pyrFacesParam : pyrEdgesParam );
break;
91 case shards::Wedge<6>::key:
92 case shards::Wedge<15>::key:
93 case shards::Wedge<18>::key: subcellParam = ( subcellDim == 2 ? wedgeFacesParam : wedgeEdgesParam );
break;
95 case shards::Triangle<3>::key:
96 case shards::Triangle<4>::key:
97 case shards::Triangle<6>::key: subcellParam = triEdgesParam;
break;
99 case shards::Quadrilateral<4>::key:
100 case shards::Quadrilateral<8>::key:
101 case shards::Quadrilateral<9>::key: subcellParam = quadEdgesParam;
break;
110 case shards::ShellLine<2>::key:
111 case shards::ShellLine<3>::key:
112 case shards::Beam<2>::key:
113 case shards::Beam<3>::key: subcellParam = lineEdgesParam;
break;
115 INTREPID2_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
116 ">>> ERROR (Intrepid2::RefSubcellParametrization::get): invalid cell topology.");
122 template<
typename DeviceType>
126 if(isSubcellParametrizationSet_)
129 ordinal_type subcellDim;
131 const auto tet = shards::CellTopology(shards::getCellTopologyData<shards::Tetrahedron<4> >());
134 tetFacesParam =
ViewType(
"CellTools::SubcellParametrization::tetFaces", tet.getSubcellCount(subcellDim), tet.getDimension(), subcellDim+1);
135 auto subcell2dParamHost = Kokkos::create_mirror_view(tetFacesParam);
136 set( subcell2dParamHost, subcellDim, tet );
137 deep_copy(tetFacesParam,subcell2dParamHost);
140 tetEdgesParam =
ViewType(
"CellTools::SubcellParametrization::tetEdges", tet.getSubcellCount(subcellDim), tet.getDimension(), subcellDim+1);
141 auto subcellParamHost = Kokkos::create_mirror_view(tetEdgesParam);
142 set( subcellParamHost, subcellDim, tet );
143 deep_copy(tetEdgesParam,subcellParamHost);
146 const auto hex = shards::CellTopology(shards::getCellTopologyData<shards::Hexahedron<8> >());
149 hexFacesParam =
ViewType(
"CellTools::SubcellParametrization::hexFaces", hex.getSubcellCount(subcellDim), hex.getDimension(), subcellDim+1);
150 auto subcell2dParamHost = Kokkos::create_mirror_view(hexFacesParam);
151 set( subcell2dParamHost, subcellDim, hex );
152 deep_copy(hexFacesParam,subcell2dParamHost);
155 hexEdgesParam =
ViewType(
"CellTools::SubcellParametrization::hexEdges", hex.getSubcellCount(subcellDim), hex.getDimension(), subcellDim+1);
156 auto subcellParamHost = Kokkos::create_mirror_view(hexEdgesParam);
157 set( subcellParamHost, subcellDim, hex );
158 deep_copy(hexEdgesParam,subcellParamHost);
161 const auto pyr = shards::CellTopology(shards::getCellTopologyData<shards::Pyramid<5> >());
164 pyrFacesParam =
ViewType(
"CellTools::SubcellParametrization::pyrFaces", pyr.getSubcellCount(subcellDim), pyr.getDimension(), subcellDim+1);
165 auto subcell2dParamHost = Kokkos::create_mirror_view(pyrFacesParam);
166 set( subcell2dParamHost, subcellDim, pyr );
167 deep_copy(pyrFacesParam,subcell2dParamHost);
170 pyrEdgesParam =
ViewType(
"CellTools::SubcellParametrization::pyrEdges", pyr.getSubcellCount(subcellDim), pyr.getDimension(), subcellDim+1);
171 auto subcellParamHost = Kokkos::create_mirror_view(pyrEdgesParam);
172 set( subcellParamHost, subcellDim, pyr );
173 deep_copy(pyrEdgesParam,subcellParamHost);
176 const auto wedge = shards::CellTopology(shards::getCellTopologyData<shards::Wedge<6> >());
179 wedgeFacesParam =
ViewType(
"CellTools::SubcellParametrization::wedgeFaces", wedge.getSubcellCount(subcellDim), wedge.getDimension(), subcellDim+1);
180 auto subcell2dParamHost = Kokkos::create_mirror_view(wedgeFacesParam);
181 set( subcell2dParamHost, subcellDim, wedge );
182 deep_copy(wedgeFacesParam,subcell2dParamHost);
185 wedgeEdgesParam =
ViewType(
"CellTools::SubcellParametrization::wedgeEdges", wedge.getSubcellCount(subcellDim), wedge.getDimension(), subcellDim+1);
186 auto subcellParamHost = Kokkos::create_mirror_view(wedgeEdgesParam);
187 set( subcellParamHost, subcellDim, wedge );
188 deep_copy(wedgeEdgesParam,subcellParamHost);
191 const auto tri = shards::CellTopology(shards::getCellTopologyData<shards::Triangle<3> >());
194 triEdgesParam =
ViewType(
"CellTools::SubcellParametrization::triEdges", tri.getSubcellCount(subcellDim), tri.getDimension(), subcellDim+1);
195 auto subcellParamHost = Kokkos::create_mirror_view(triEdgesParam);
196 set( subcellParamHost, subcellDim, tri );
197 deep_copy(triEdgesParam,subcellParamHost);
200 const auto quad = shards::CellTopology(shards::getCellTopologyData<shards::Quadrilateral<4> >());
203 quadEdgesParam =
ViewType(
"CellTools::SubcellParametrization::quadEdges", quad.getSubcellCount(subcellDim), quad.getDimension(), subcellDim+1);
204 auto subcellParamHost = Kokkos::create_mirror_view(quadEdgesParam);
205 set( subcellParamHost, subcellDim, quad );
206 deep_copy(quadEdgesParam,subcellParamHost);
210 const auto line = shards::CellTopology(shards::getCellTopologyData<shards::ShellLine<2> >());
213 lineEdgesParam =
ViewType(
"CellTools::SubcellParametrization::lineEdges", line.getSubcellCount(subcellDim), line.getDimension(), subcellDim+1);
214 auto subcellParamHost = Kokkos::create_mirror_view(lineEdgesParam);
215 set( subcellParamHost, subcellDim, line );
216 deep_copy(lineEdgesParam,subcellParamHost);
219 Kokkos::push_finalize_hook( [=] {
237 isSubcellParametrizationSet_=
true;
240 template<
typename DeviceType>
241 template <
typename HostViewType>
244 set( HostViewType subcellParam,
245 const ordinal_type subcellDim,
246 const shards::CellTopology parentCell ) {
265 const auto sc = parentCell.getSubcellCount(subcellDim);
266 const auto pcd = parentCell.getDimension();
268 INTREPID2_TEST_FOR_EXCEPTION( subcellDim < 1 || subcellDim > static_cast<ordinal_type>(pcd-1), std::invalid_argument,
269 ">>> ERROR (Intrepid2::RefSubcellParametrization::set): Parametrizations defined in a range between 1 and (dim-1)");
273 if (subcellDim == 1) {
275 for (size_type subcellOrd=0;subcellOrd<sc;++subcellOrd) {
278 const auto v0ord = parentCell.getNodeMap(subcellDim, subcellOrd, 0);
279 const auto v1ord = parentCell.getNodeMap(subcellDim, subcellOrd, 1);
281 const auto v0 = Kokkos::subview(refNodes, v0ord, Kokkos::ALL());
282 const auto v1 = Kokkos::subview(refNodes, v1ord, Kokkos::ALL());
285 subcellParam(subcellOrd, 0, 0) = (v0(0) + v1(0))/2.0;
286 subcellParam(subcellOrd, 0, 1) = (v1(0) - v0(0))/2.0;
289 subcellParam(subcellOrd, 1, 0) = (v0(1) + v1(1))/2.0;
290 subcellParam(subcellOrd, 1, 1) = (v1(1) - v0(1))/2.0;
294 subcellParam(subcellOrd, 2, 0) = (v0(2) + v1(2))/2.0;
295 subcellParam(subcellOrd, 2, 1) = (v1(2) - v0(2))/2.0;
299 else if (subcellDim == 2) {
303 for (size_type subcellOrd=0;subcellOrd<sc;++subcellOrd) {
305 switch (parentCell.getKey(subcellDim,subcellOrd)) {
307 case shards::Triangle<3>::key:
308 case shards::Triangle<4>::key:
309 case shards::Triangle<6>::key: {
310 const auto v0ord = parentCell.getNodeMap(subcellDim, subcellOrd, 0);
311 const auto v1ord = parentCell.getNodeMap(subcellDim, subcellOrd, 1);
312 const auto v2ord = parentCell.getNodeMap(subcellDim, subcellOrd, 2);
314 const auto v0 = Kokkos::subview(refNodes, v0ord, Kokkos::ALL());
315 const auto v1 = Kokkos::subview(refNodes, v1ord, Kokkos::ALL());
316 const auto v2 = Kokkos::subview(refNodes, v2ord, Kokkos::ALL());
319 subcellParam(subcellOrd, 0, 0) = v0(0);
320 subcellParam(subcellOrd, 0, 1) = v1(0) - v0(0);
321 subcellParam(subcellOrd, 0, 2) = v2(0) - v0(0);
324 subcellParam(subcellOrd, 1, 0) = v0(1);
325 subcellParam(subcellOrd, 1, 1) = v1(1) - v0(1);
326 subcellParam(subcellOrd, 1, 2) = v2(1) - v0(1);
329 subcellParam(subcellOrd, 2, 0) = v0(2);
330 subcellParam(subcellOrd, 2, 1) = v1(2) - v0(2);
331 subcellParam(subcellOrd, 2, 2) = v2(2) - v0(2);
334 case shards::Quadrilateral<4>::key:
335 case shards::Quadrilateral<8>::key:
336 case shards::Quadrilateral<9>::key: {
337 const auto v0ord = parentCell.getNodeMap(subcellDim, subcellOrd, 0);
338 const auto v1ord = parentCell.getNodeMap(subcellDim, subcellOrd, 1);
339 const auto v2ord = parentCell.getNodeMap(subcellDim, subcellOrd, 2);
340 const auto v3ord = parentCell.getNodeMap(subcellDim, subcellOrd, 3);
342 const auto v0 = Kokkos::subview(refNodes, v0ord, Kokkos::ALL());
343 const auto v1 = Kokkos::subview(refNodes, v1ord, Kokkos::ALL());
344 const auto v2 = Kokkos::subview(refNodes, v2ord, Kokkos::ALL());
345 const auto v3 = Kokkos::subview(refNodes, v3ord, Kokkos::ALL());
348 subcellParam(subcellOrd, 0, 0) = ( v0(0) + v1(0) + v2(0) + v3(0))/4.0;
349 subcellParam(subcellOrd, 0, 1) = (-v0(0) + v1(0) + v2(0) - v3(0))/4.0;
350 subcellParam(subcellOrd, 0, 2) = (-v0(0) - v1(0) + v2(0) + v3(0))/4.0;
353 subcellParam(subcellOrd, 1, 0) = ( v0(1) + v1(1) + v2(1) + v3(1))/4.0;
354 subcellParam(subcellOrd, 1, 1) = (-v0(1) + v1(1) + v2(1) - v3(1))/4.0;
355 subcellParam(subcellOrd, 1, 2) = (-v0(1) - v1(1) + v2(1) + v3(1))/4.0;
358 subcellParam(subcellOrd, 2, 0) = ( v0(2) + v1(2) + v2(2) + v3(2))/4.0;
359 subcellParam(subcellOrd, 2, 1) = (-v0(2) + v1(2) + v2(2) - v3(2))/4.0;
360 subcellParam(subcellOrd, 2, 2) = (-v0(2) - v1(2) + v2(2) + v3(2))/4.0;
364 INTREPID2_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
365 ">>> ERROR (Intrepid2::RefSubcellParametrization::set): parametrization not defined for the specified face topology.");
374 template<
typename DeviceType>
377 isSubcellParametrizationSet_ =
false;
379 #define DefineStaticRefParametrization(obj) template<typename DeviceType> \
380 typename RefSubcellParametrization<DeviceType>::ViewType \
381 RefSubcellParametrization<DeviceType>:: \
382 obj = typename RefSubcellParametrization<DeviceType>::ViewType();
384 DefineStaticRefParametrization(lineEdgesParam)
385 DefineStaticRefParametrization(triEdgesParam)
386 DefineStaticRefParametrization(quadEdgesParam)
387 DefineStaticRefParametrization(shellTriEdgesParam)
388 DefineStaticRefParametrization(shellQuadEdgesParam)
389 DefineStaticRefParametrization(tetEdgesParam)
390 DefineStaticRefParametrization(hexEdgesParam)
391 DefineStaticRefParametrization(pyrEdgesParam)
392 DefineStaticRefParametrization(wedgeEdgesParam)
393 DefineStaticRefParametrization(shellTriFacesParam)
394 DefineStaticRefParametrization(shellQuadFacesParam)
395 DefineStaticRefParametrization(tetFacesParam)
396 DefineStaticRefParametrization(hexFacesParam)
397 DefineStaticRefParametrization(pyrFacesParam)
398 DefineStaticRefParametrization(wedgeFacesParam)
401 template<typename DeviceType>
405 if(isReferenceNodeDataSet_)
408 auto createDataViewFromHostArray = [](
const std::string& view_name,
double const * source_array, ordinal_type dim){
409 ViewType dest_view(view_name, dim, 3);
410 auto host_view = Kokkos::create_mirror_view(dest_view);
411 for(ordinal_type i=0; i<dim; ++i)
412 for(ordinal_type j=0; j<3; ++j)
413 host_view(i,j) = source_array[3*i+j];
414 Kokkos::deep_copy(dest_view,host_view);
420 lineNodes = createDataViewFromHostArray(
"CellTools::ReferenceNodeData::line", &refNodeDataStatic_.line[0][0], 2);
421 line3Nodes = createDataViewFromHostArray(
"CellTools::ReferenceNodeData::line_3", &refNodeDataStatic_.line_3[0][0], 3);
423 triangleNodes = createDataViewFromHostArray(
"CellTools::ReferenceNodeData::triangle", &refNodeDataStatic_.triangle[0][0], 3);
424 triangle4Nodes = createDataViewFromHostArray(
"CellTools::ReferenceNodeData::triangle_4", &refNodeDataStatic_.triangle_4[0][0], 4);
425 triangle6Nodes = createDataViewFromHostArray(
"CellTools::ReferenceNodeData::triangle_6", &refNodeDataStatic_.triangle_6[0][0], 6);
427 quadrilateralNodes = createDataViewFromHostArray(
"CellTools::ReferenceNodeData::quad", &refNodeDataStatic_.quadrilateral[0][0], 4);
428 quadrilateral8Nodes = createDataViewFromHostArray(
"CellTools::ReferenceNodeData::quad_8", &refNodeDataStatic_.quadrilateral_8[0][0], 8);
429 quadrilateral9Nodes = createDataViewFromHostArray(
"CellTools::ReferenceNodeData::quad_9", &refNodeDataStatic_.quadrilateral_9[0][0], 9);
431 tetrahedronNodes = createDataViewFromHostArray(
"CellTools::ReferenceNodeData::tet", &refNodeDataStatic_.tetrahedron[0][0], 4);
432 tetrahedron8Nodes = createDataViewFromHostArray(
"CellTools::ReferenceNodeData::tet_8", &refNodeDataStatic_.tetrahedron_8[0][0], 8);
433 tetrahedron10Nodes = createDataViewFromHostArray(
"CellTools::ReferenceNodeData::tet_10", &refNodeDataStatic_.tetrahedron_10[0][0], 10);
434 tetrahedron11Nodes = createDataViewFromHostArray(
"CellTools::ReferenceNodeData::tet_11", &refNodeDataStatic_.tetrahedron_11[0][0], 11);
436 hexahedronNodes = createDataViewFromHostArray(
"CellTools::ReferenceNodeData::hex", &refNodeDataStatic_.hexahedron[0][0], 8);
437 hexahedron20Nodes = createDataViewFromHostArray(
"CellTools::ReferenceNodeData::hex_20", &refNodeDataStatic_.hexahedron_20[0][0], 20);
438 hexahedron27Nodes = createDataViewFromHostArray(
"CellTools::ReferenceNodeData::hex_27", &refNodeDataStatic_.hexahedron_27[0][0], 27);
440 pyramidNodes = createDataViewFromHostArray(
"CellTools::ReferenceNodeData::pyr", &refNodeDataStatic_.pyramid[0][0], 5);
441 pyramid13Nodes = createDataViewFromHostArray(
"CellTools::ReferenceNodeData::pyr_13", &refNodeDataStatic_.pyramid_13[0][0], 13);
442 pyramid14Nodes = createDataViewFromHostArray(
"CellTools::ReferenceNodeData::pyr_14", &refNodeDataStatic_.pyramid_14[0][0], 14);
444 wedgeNodes = createDataViewFromHostArray(
"CellTools::ReferenceNodeData::wedge", &refNodeDataStatic_.wedge[0][0], 6);
445 wedge15Nodes = createDataViewFromHostArray(
"CellTools::ReferenceNodeData::wedge_15", &refNodeDataStatic_.wedge_15[0][0], 15);
446 wedge18Nodes = createDataViewFromHostArray(
"CellTools::ReferenceNodeData::wedge_18", &refNodeDataStatic_.wedge_18[0][0], 18);
449 Kokkos::push_finalize_hook( [=] {
480 isReferenceNodeDataSet_ =
true;
483 template<
typename DeviceType>
485 typename RefCellNodes<DeviceType>::ConstViewType
488 if(!isReferenceNodeDataSet_)
493 switch (cellTopoKey ) {
494 case shards::Line<2>::key:
495 case shards::ShellLine<2>::key:
496 case shards::Beam<2>::key: refNodes = lineNodes;
break;
497 case shards::Line<3>::key:
498 case shards::ShellLine<3>::key:
499 case shards::Beam<3>::key: refNodes = line3Nodes;
break;
501 case shards::Triangle<3>::key:
502 case shards::ShellTriangle<3>::key: refNodes = triangleNodes;
break;
503 case shards::Triangle<4>::key: refNodes = triangle4Nodes;
break;
504 case shards::Triangle<6>::key:
505 case shards::ShellTriangle<6>::key: refNodes = triangle6Nodes;
break;
507 case shards::Quadrilateral<4>::key:
508 case shards::ShellQuadrilateral<4>::key: refNodes = quadrilateralNodes;
break;
509 case shards::Quadrilateral<8>::key:
510 case shards::ShellQuadrilateral<8>::key: refNodes = quadrilateral8Nodes;
break;
511 case shards::Quadrilateral<9>::key:
512 case shards::ShellQuadrilateral<9>::key: refNodes = quadrilateral9Nodes;
break;
514 case shards::Tetrahedron<4>::key: refNodes = tetrahedronNodes;
break;
515 case shards::Tetrahedron<8>::key: refNodes = tetrahedron8Nodes;
break;
516 case shards::Tetrahedron<10>::key: refNodes = tetrahedron10Nodes;
break;
517 case shards::Tetrahedron<11>::key: refNodes = tetrahedron11Nodes;
break;
519 case shards::Hexahedron<8>::key: refNodes = hexahedronNodes;
break;
520 case shards::Hexahedron<20>::key: refNodes = hexahedron20Nodes;
break;
521 case shards::Hexahedron<27>::key: refNodes = hexahedron27Nodes;
break;
523 case shards::Pyramid<5>::key: refNodes = pyramidNodes;
break;
524 case shards::Pyramid<13>::key: refNodes = pyramid13Nodes;
break;
525 case shards::Pyramid<14>::key: refNodes = pyramid14Nodes;
break;
527 case shards::Wedge<6>::key: refNodes = wedgeNodes;
break;
528 case shards::Wedge<15>::key: refNodes = wedge15Nodes;
break;
529 case shards::Wedge<18>::key: refNodes = wedge18Nodes;
break;
533 ">>> ERROR (Intrepid2::CellTools::getReferenceNode): invalid cell topology.");
539 template<
typename DeviceType>
542 isReferenceNodeDataSet_ =
false;
544 #define DefineStaticRefNodes(obj) template<typename DeviceType> \
545 typename RefCellNodes<DeviceType>::ViewType \
546 RefCellNodes<DeviceType>:: \
547 obj = typename RefCellNodes<DeviceType>::ViewType();
549 DefineStaticRefNodes(lineNodes)
550 DefineStaticRefNodes(line3Nodes)
552 DefineStaticRefNodes(triangleNodes)
553 DefineStaticRefNodes(triangle4Nodes)
554 DefineStaticRefNodes(triangle6Nodes)
556 DefineStaticRefNodes(quadrilateralNodes)
557 DefineStaticRefNodes(quadrilateral8Nodes)
558 DefineStaticRefNodes(quadrilateral9Nodes)
560 DefineStaticRefNodes(tetrahedronNodes)
561 DefineStaticRefNodes(tetrahedron8Nodes)
562 DefineStaticRefNodes(tetrahedron10Nodes)
563 DefineStaticRefNodes(tetrahedron11Nodes)
565 DefineStaticRefNodes(hexahedronNodes)
566 DefineStaticRefNodes(hexahedron20Nodes)
567 DefineStaticRefNodes(hexahedron27Nodes)
569 DefineStaticRefNodes(pyramidNodes)
570 DefineStaticRefNodes(pyramid13Nodes)
571 DefineStaticRefNodes(pyramid14Nodes)
573 DefineStaticRefNodes(wedgeNodes)
574 DefineStaticRefNodes(wedge15Nodes)
575 DefineStaticRefNodes(wedge18Nodes)
577 template<typename DeviceType>
578 const typename
RefCellNodes<DeviceType>::ReferenceNodeDataStatic
580 refNodeDataStatic_ = {
583 {-1.0, 0.0, 0.0}, { 1.0, 0.0, 0.0}
586 {-1.0, 0.0, 0.0}, { 1.0, 0.0, 0.0}, { 0.0, 0.0, 0.0}
590 { 0.0, 0.0, 0.0}, { 1.0, 0.0, 0.0}, { 0.0, 1.0, 0.0}
593 { 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}
596 { 0.0, 0.0, 0.0}, { 1.0, 0.0, 0.0}, { 0.0, 1.0, 0.0},
597 { 0.5, 0.0, 0.0}, { 0.5, 0.5, 0.0}, { 0.0, 0.5, 0.0}
601 {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, 0.5, 1.0},
675 { 0.5, 0.0, 0.0}, { 0.5, 0.5, 0.0}, { 0.0, 0.5, 0.0}
679 template<
typename DeviceType>
683 if(isReferenceCellCenterDataSet_)
686 auto createDataViewFromHostArray = [](
const std::string& view_name,
double const * source_array){
688 auto host_view = Kokkos::create_mirror_view(dest_view);
689 for(ordinal_type i=0; i<3; ++i) host_view[i] = source_array[i];
690 Kokkos::deep_copy(dest_view, host_view);
696 lineCenter = createDataViewFromHostArray(
"CellTools::ReferenceCenterData::line", &refCenterDataStatic_.line[0]);
698 triangleCenter = createDataViewFromHostArray(
"CellTools::ReferenceCenterData::triangle", &refCenterDataStatic_.triangle[0]);
700 quadrilateralCenter = createDataViewFromHostArray(
"CellTools::ReferenceCenterData::quad", &refCenterDataStatic_.quadrilateral[0]);
702 tetrahedronCenter = createDataViewFromHostArray(
"CellTools::ReferenceCenterData::tet", &refCenterDataStatic_.tetrahedron[0]);
704 hexahedronCenter = createDataViewFromHostArray(
"CellTools::ReferenceCenterData::hex", &refCenterDataStatic_.hexahedron[0]);
706 pyramidCenter = createDataViewFromHostArray(
"CellTools::ReferenceCenterData::pyr", &refCenterDataStatic_.pyramid[0]);
708 wedgeCenter = createDataViewFromHostArray(
"CellTools::ReferenceCenterData::wedge", &refCenterDataStatic_.wedge[0]);
711 Kokkos::push_finalize_hook( [=] {
728 isReferenceCellCenterDataSet_ =
true;
731 template<
typename DeviceType>
733 typename RefCellCenter<DeviceType>::ConstViewType
736 if(!isReferenceCellCenterDataSet_)
741 switch (cellTopoKey ) {
742 case shards::Line<2>::key:
743 case shards::ShellLine<2>::key:
744 case shards::Beam<2>::key:
745 case shards::Line<3>::key:
746 case shards::ShellLine<3>::key:
747 case shards::Beam<3>::key: cellCenter = lineCenter;
break;
749 case shards::Triangle<3>::key:
750 case shards::ShellTriangle<3>::key:
751 case shards::Triangle<4>::key:
752 case shards::Triangle<6>::key:
753 case shards::ShellTriangle<6>::key: cellCenter = triangleCenter;
break;
755 case shards::Quadrilateral<4>::key:
756 case shards::ShellQuadrilateral<4>::key:
757 case shards::Quadrilateral<8>::key:
758 case shards::ShellQuadrilateral<8>::key:
759 case shards::Quadrilateral<9>::key:
760 case shards::ShellQuadrilateral<9>::key: cellCenter = quadrilateralCenter;
break;
762 case shards::Tetrahedron<4>::key:
763 case shards::Tetrahedron<8>::key:
764 case shards::Tetrahedron<10>::key:
765 case shards::Tetrahedron<11>::key: cellCenter = tetrahedronCenter;
break;
767 case shards::Hexahedron<8>::key:
768 case shards::Hexahedron<20>::key:
769 case shards::Hexahedron<27>::key: cellCenter = hexahedronCenter;
break;
771 case shards::Pyramid<5>::key:
772 case shards::Pyramid<13>::key:
773 case shards::Pyramid<14>::key: cellCenter = pyramidCenter;
break;
775 case shards::Wedge<6>::key:
776 case shards::Wedge<15>::key:
777 case shards::Wedge<18>::key: cellCenter = wedgeCenter;
break;
781 ">>> ERROR (Intrepid2::CellTools::getReferenceCellCenter): invalid cell topology.");
787 template<
typename DeviceType>
790 isReferenceCellCenterDataSet_ =
false;
792 #define DefineStaticRefCenter(obj) template<typename DeviceType> \
793 typename RefCellCenter<DeviceType>::ViewType \
794 RefCellCenter<DeviceType>:: \
795 obj = typename RefCellCenter<DeviceType>::ViewType();
797 DefineStaticRefCenter(lineCenter)
798 DefineStaticRefCenter(triangleCenter)
799 DefineStaticRefCenter(quadrilateralCenter)
800 DefineStaticRefCenter(tetrahedronCenter)
801 DefineStaticRefCenter(hexahedronCenter)
802 DefineStaticRefCenter(pyramidCenter)
803 DefineStaticRefCenter(wedgeCenter)
805 template<typename DeviceType>
806 const typename
RefCellCenter<DeviceType>::ReferenceCenterDataStatic
808 refCenterDataStatic_ = {
812 { 1.0/3.0, 1.0/3.0, 0.0},
822 { 1.0/3.0, 1.0/3.0, 0.0},
829 template<
typename Po
intViewType,
typename ScalarType>
830 KOKKOS_INLINE_FUNCTION
832 PointInclusion<shards::Line<>::key>::
833 check(
const PointViewType &point,
const ScalarType threshold) {
835 const ScalarType minus_one = -1.0 - threshold, plus_one = 1.0 + threshold;
836 return (minus_one <= point(0) && point(0) <= plus_one);
839 template<
typename Po
intViewType,
typename ScalarType>
840 KOKKOS_INLINE_FUNCTION
842 PointInclusion<shards::Triangle<>::key>::
843 check(
const PointViewType &point,
const ScalarType threshold) {
845 using PointType =
typename PointViewType::value_type;
846 const PointType one = 1.0;
847 const PointType distance = max( max( -point(0), -point(1) ), point(0) + point(1) - one );
848 return distance < threshold;
851 template<
typename Po
intViewType,
typename ScalarType>
852 KOKKOS_INLINE_FUNCTION
854 PointInclusion<shards::Quadrilateral<>::key>::
855 check(
const PointViewType &point,
const ScalarType threshold) {
857 const ScalarType minus_one = -1.0 - threshold, plus_one = 1.0 + threshold;
858 return ((minus_one <= point(0) && point(0) <= plus_one) &&
859 (minus_one <= point(1) && point(1) <= plus_one));
862 template<
typename Po
intViewType,
typename ScalarType>
863 KOKKOS_INLINE_FUNCTION
865 PointInclusion<shards::Tetrahedron<>::key>::
866 check(
const PointViewType &point,
const ScalarType threshold) {
868 using PointType =
typename PointViewType::value_type;
869 const PointType one = 1.0;
870 const PointType distance = max( max(-point(0),-point(1)),
871 max(-point(2), point(0) + point(1) + point(2) - one) );
872 return distance < threshold;
875 template<
typename Po
intViewType,
typename ScalarType>
876 KOKKOS_INLINE_FUNCTION
878 PointInclusion<shards::Hexahedron<>::key>::
879 check(
const PointViewType &point,
const ScalarType threshold) {
881 const ScalarType minus_one = -1.0 - threshold, plus_one = 1.0 + threshold;
882 return ((minus_one <= point(0) && point(0) <= plus_one) &&
883 (minus_one <= point(1) && point(1) <= plus_one) &&
884 (minus_one <= point(2) && point(2) <= plus_one));
887 template<
typename Po
intViewType,
typename ScalarType>
888 KOKKOS_INLINE_FUNCTION
890 PointInclusion<shards::Pyramid<>::key>::
891 check(
const PointViewType &point,
const ScalarType threshold) {
893 using PointType =
typename PointViewType::value_type;
894 const PointType minus_one = -1.0 - threshold, plus_one = 1.0 + threshold, minus_zero = -threshold;
895 const PointType left = minus_one + point(2);
896 const PointType right = plus_one - point(2);
897 return ((left <= point(0) && point(0) <= right) &&
898 (left <= point(1) && point(1) <= right) &&
899 (minus_zero <= point(2) && point(2) <= plus_one));
902 template<
typename Po
intViewType,
typename ScalarType>
903 KOKKOS_INLINE_FUNCTION
905 PointInclusion<shards::Wedge<>::key>::
906 check(
const PointViewType &point,
const ScalarType threshold) {
908 using PointType =
typename PointViewType::value_type;
909 const ScalarType minus_one = -1.0 - threshold, plus_one = 1.0 + threshold;
910 const PointType one = 1.0;
911 const PointType distance = max( max( -point(0), -point(1) ), point(0) + point(1) - one );
912 return (distance < threshold && (minus_one <= point(2) && point(2) <= plus_one));
This class defines the coordinates of the barycenter of the supported reference cells. The barycenter coordinates are stored in static views. The class is templated on the Kokkos::Device Type which is used to determine layout and memory space of the views.
Kokkos::DynRankView< double, DeviceType > ViewType
static views containing the center coordinates allocated on DeviceType::memory_space ...
static ConstViewType get(const unsigned cellTopoKey)
Retrieves the Cartesian coordinates of reference cell nodes.
#define INTREPID2_TEST_FOR_EXCEPTION_DEVICE_SAFE(test, x, msg)
static ConstViewType get(const ordinal_type subcellDim, const unsigned parentCellKey)
Returns a Kokkos view with the coefficients of the parametrization maps for the edges or faces of a r...
Kokkos::DynRankView< double, DeviceType > ViewType
static views containing the parametrization maps, allocated on DeviceType::memory_space ...
This class defines the coordinates of the nodes of reference cells according for supported cell topol...
static bool isSupported(const unsigned cellTopoKey)
Checks if a cell topology has a reference parametrization.
static void set()
Computes and stores static views containing the parametrizations maps of edges and faces of all refer...
static ConstViewType get(const unsigned cellTopoKey)
Retrieves the Cartesian coordinates of a reference cell barycenter.
Kokkos::DynRankView< double, DeviceType > ViewType
static views containing the node coordinates allocated on DeviceType::memory_space ...
This class defines the parametrizations of edges and faces of supported reference cells...
static void set()
Set center coordinates of reference cell for supported topologies.