49 #ifndef __INTREPID2_CELLTOOLS_DEF_PARAMETRIZATION_HPP__
50 #define __INTREPID2_CELLTOOLS_DEF_PARAMETRIZATION_HPP__
53 #if defined (__clang__) && !defined (__INTEL_COMPILER)
54 #pragma clang system_header
66 template<
typename SpT>
70 if(isSubcellParametrizationSet_)
74 const auto tet = shards::CellTopology(shards::getCellTopologyData<shards::Tetrahedron<4> >());
75 setSubcellParametrization( subcellParamData_.tetFaces, 2, tet );
76 setSubcellParametrization( subcellParamData_.tetEdges, 1, tet );
79 const auto hex = shards::CellTopology(shards::getCellTopologyData<shards::Hexahedron<8> >());
80 setSubcellParametrization( subcellParamData_.hexFaces, 2, hex );
81 setSubcellParametrization( subcellParamData_.hexEdges, 1, hex );
84 const auto pyr = shards::CellTopology(shards::getCellTopologyData<shards::Pyramid<5> >());
85 setSubcellParametrization( subcellParamData_.pyrFaces, 2, pyr );
86 setSubcellParametrization( subcellParamData_.pyrEdges, 1, pyr );
89 const auto wedge = shards::CellTopology(shards::getCellTopologyData<shards::Wedge<6> >());
90 setSubcellParametrization( subcellParamData_.wedgeFaces, 2, wedge );
91 setSubcellParametrization( subcellParamData_.wedgeEdges, 1, wedge );
94 const auto tri = shards::CellTopology(shards::getCellTopologyData<shards::Triangle<3> >());
95 setSubcellParametrization( subcellParamData_.triEdges, 1, tri );
98 const auto quad = shards::CellTopology(shards::getCellTopologyData<shards::Quadrilateral<4> >());
99 setSubcellParametrization( subcellParamData_.quadEdges, 1, quad );
102 const auto line = shards::CellTopology(shards::getCellTopologyData<shards::ShellLine<2> >());
103 setSubcellParametrization( subcellParamData_.lineEdges, 1, line );
106 Kokkos::push_finalize_hook( [=] {
107 subcellParamData_.dummy = subcellParamViewType();
108 subcellParamData_.lineEdges = subcellParamViewType();
109 subcellParamData_.triEdges = subcellParamViewType();
110 subcellParamData_.quadEdges = subcellParamViewType();
111 subcellParamData_.shellTriEdges = subcellParamViewType();
112 subcellParamData_.shellQuadEdges = subcellParamViewType();
113 subcellParamData_.tetEdges = subcellParamViewType();
114 subcellParamData_.hexEdges = subcellParamViewType();
115 subcellParamData_.pyrEdges = subcellParamViewType();
116 subcellParamData_.wedgeEdges = subcellParamViewType();
117 subcellParamData_.shellTriFaces = subcellParamViewType();
118 subcellParamData_.shellQuadFaces = subcellParamViewType();
119 subcellParamData_.tetFaces = subcellParamViewType();
120 subcellParamData_.hexFaces = subcellParamViewType();
121 subcellParamData_.pyrFaces = subcellParamViewType();
122 subcellParamData_.wedgeFaces = subcellParamViewType();
125 isSubcellParametrizationSet_=
true;
153 template<
typename SpT>
157 const ordinal_type subcellDim,
158 const shards::CellTopology parentCell ) {
159 #ifdef HAVE_INTREPID2_DEBUG
160 INTREPID2_TEST_FOR_EXCEPTION( !hasReferenceCell(parentCell), std::invalid_argument,
161 ">>> ERROR (Intrepid2::CellTools::getSubcellParametrization): the specified cell topology does not have a reference cell.");
164 if (!isSubcellParametrizationSet_)
165 setSubcellParametrization();
168 const auto pcd = parentCell.getDimension();
169 INTREPID2_TEST_FOR_EXCEPTION( subcellDim < 1 || subcellDim > static_cast<ordinal_type>(pcd-1), std::invalid_argument,
170 ">>> ERROR (Intrepid2::CellTools::getSubcellParametrization): Parametrizations defined in a range between 1 and (dim-1)");
172 switch (parentCell.getKey() ) {
173 case shards::Tetrahedron<4>::key:
174 case shards::Tetrahedron<8>::key:
175 case shards::Tetrahedron<10>::key:
176 case shards::Tetrahedron<11>::key: subcellParam = ( subcellDim == 2 ? subcellParamData_.tetFaces : subcellParamData_.tetEdges );
break;
178 case shards::Hexahedron<8>::key:
179 case shards::Hexahedron<20>::key:
180 case shards::Hexahedron<27>::key: subcellParam = ( subcellDim == 2 ? subcellParamData_.hexFaces : subcellParamData_.hexEdges );
break;
182 case shards::Pyramid<5>::key:
183 case shards::Pyramid<13>::key:
184 case shards::Pyramid<14>::key: subcellParam = ( subcellDim == 2 ? subcellParamData_.pyrFaces : subcellParamData_.pyrEdges );
break;
186 case shards::Wedge<6>::key:
187 case shards::Wedge<15>::key:
188 case shards::Wedge<18>::key: subcellParam = ( subcellDim == 2 ? subcellParamData_.wedgeFaces : subcellParamData_.wedgeEdges );
break;
190 case shards::Triangle<3>::key:
191 case shards::Triangle<4>::key:
192 case shards::Triangle<6>::key: subcellParam = subcellParamData_.triEdges;
break;
194 case shards::Quadrilateral<4>::key:
195 case shards::Quadrilateral<8>::key:
196 case shards::Quadrilateral<9>::key: subcellParam = subcellParamData_.quadEdges;
break;
205 case shards::ShellLine<2>::key:
206 case shards::ShellLine<3>::key:
207 case shards::Beam<2>::key:
208 case shards::Beam<3>::key: subcellParam = subcellParamData_.lineEdges;
break;
210 INTREPID2_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
211 ">>> ERROR (Intrepid2::CellTools::getSubcellParametrization): invalid cell topology.");
216 template<
typename SpT>
220 const ordinal_type subcellDim,
221 const shards::CellTopology parentCell ) {
222 #ifdef HAVE_INTREPID2_DEBUG
223 INTREPID2_TEST_FOR_EXCEPTION( !hasReferenceCell(parentCell), std::invalid_argument,
224 ">>> ERROR (Intrepid2::CellTools::setSubcellParametrization): the specified cell topology does not have a reference cell.");
244 const auto sc = parentCell.getSubcellCount(subcellDim);
245 const auto pcd = parentCell.getDimension();
246 const auto coeff = (subcellDim == 1) ? 2 : 3;
248 INTREPID2_TEST_FOR_EXCEPTION( subcellDim < 1 || subcellDim > static_cast<ordinal_type>(pcd-1), std::invalid_argument,
249 ">>> ERROR (Intrepid2::CellTools::setSubcellParametrization): Parametrizations defined in a range between 1 and (dim-1)");
253 subcellParam = subcellParamViewType(
"CellTools::setSubcellParametrization",
256 referenceNodeDataViewType
262 if (subcellDim == 1) {
264 for (size_type subcellOrd=0;subcellOrd<sc;++subcellOrd) {
267 const auto v0ord = parentCell.getNodeMap(subcellDim, subcellOrd, 0);
268 const auto v1ord = parentCell.getNodeMap(subcellDim, subcellOrd, 1);
270 getReferenceVertex(v0, parentCell, v0ord);
271 getReferenceVertex(v1, parentCell, v1ord);
274 subcellParam(subcellOrd, 0, 0) = (v0[0] + v1[0])/2.0;
275 subcellParam(subcellOrd, 0, 1) = (v1[0] - v0[0])/2.0;
278 subcellParam(subcellOrd, 1, 0) = (v0[1] + v1[1])/2.0;
279 subcellParam(subcellOrd, 1, 1) = (v1[1] - v0[1])/2.0;
283 subcellParam(subcellOrd, 2, 0) = (v0[2] + v1[2])/2.0;
284 subcellParam(subcellOrd, 2, 1) = (v1[2] - v0[2])/2.0;
288 else if (subcellDim == 2) {
292 for (size_type subcellOrd=0;subcellOrd<sc;++subcellOrd) {
294 switch (parentCell.getKey(subcellDim,subcellOrd)) {
296 case shards::Triangle<3>::key:
297 case shards::Triangle<4>::key:
298 case shards::Triangle<6>::key: {
299 const auto v0ord = parentCell.getNodeMap(subcellDim, subcellOrd, 0);
300 const auto v1ord = parentCell.getNodeMap(subcellDim, subcellOrd, 1);
301 const auto v2ord = parentCell.getNodeMap(subcellDim, subcellOrd, 2);
303 getReferenceVertex(v0, parentCell, v0ord);
304 getReferenceVertex(v1, parentCell, v1ord);
305 getReferenceVertex(v2, parentCell, v2ord);
308 subcellParam(subcellOrd, 0, 0) = v0[0];
309 subcellParam(subcellOrd, 0, 1) = v1[0] - v0[0];
310 subcellParam(subcellOrd, 0, 2) = v2[0] - v0[0];
313 subcellParam(subcellOrd, 1, 0) = v0[1];
314 subcellParam(subcellOrd, 1, 1) = v1[1] - v0[1];
315 subcellParam(subcellOrd, 1, 2) = v2[1] - v0[1];
318 subcellParam(subcellOrd, 2, 0) = v0[2];
319 subcellParam(subcellOrd, 2, 1) = v1[2] - v0[2];
320 subcellParam(subcellOrd, 2, 2) = v2[2] - v0[2];
323 case shards::Quadrilateral<4>::key:
324 case shards::Quadrilateral<8>::key:
325 case shards::Quadrilateral<9>::key: {
326 const auto v0ord = parentCell.getNodeMap(subcellDim, subcellOrd, 0);
327 const auto v1ord = parentCell.getNodeMap(subcellDim, subcellOrd, 1);
328 const auto v2ord = parentCell.getNodeMap(subcellDim, subcellOrd, 2);
329 const auto v3ord = parentCell.getNodeMap(subcellDim, subcellOrd, 3);
331 getReferenceVertex(v0, parentCell, v0ord);
332 getReferenceVertex(v1, parentCell, v1ord);
333 getReferenceVertex(v2, parentCell, v2ord);
334 getReferenceVertex(v3, parentCell, v3ord);
337 subcellParam(subcellOrd, 0, 0) = ( v0[0] + v1[0] + v2[0] + v3[0])/4.0;
338 subcellParam(subcellOrd, 0, 1) = (-v0[0] + v1[0] + v2[0] - v3[0])/4.0;
339 subcellParam(subcellOrd, 0, 2) = (-v0[0] - v1[0] + v2[0] + v3[0])/4.0;
342 subcellParam(subcellOrd, 1, 0) = ( v0[1] + v1[1] + v2[1] + v3[1])/4.0;
343 subcellParam(subcellOrd, 1, 1) = (-v0[1] + v1[1] + v2[1] - v3[1])/4.0;
344 subcellParam(subcellOrd, 1, 2) = (-v0[1] - v1[1] + v2[1] + v3[1])/4.0;
347 subcellParam(subcellOrd, 2, 0) = ( v0[2] + v1[2] + v2[2] + v3[2])/4.0;
348 subcellParam(subcellOrd, 2, 1) = (-v0[2] + v1[2] + v2[2] - v3[2])/4.0;
349 subcellParam(subcellOrd, 2, 2) = (-v0[2] - v1[2] + v2[2] + v3[2])/4.0;
353 INTREPID2_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
354 ">>> ERROR (Intrepid2::CellTools::setSubcellParametrization): parametrization not defined for the specified face topology.");
363 template<
typename SpT>
366 isSubcellParametrizationSet_ =
false;
368 template<
typename SpT>
static constexpr ordinal_type MaxDimension
The maximum ambient space dimension.