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>
71 const auto tet = shards::CellTopology(shards::getCellTopologyData<shards::Tetrahedron<4> >());
72 setSubcellParametrization( subcellParamData_.tetFaces, 2, tet );
73 setSubcellParametrization( subcellParamData_.tetEdges, 1, tet );
76 const auto hex = shards::CellTopology(shards::getCellTopologyData<shards::Hexahedron<8> >());
77 setSubcellParametrization( subcellParamData_.hexFaces, 2, hex );
78 setSubcellParametrization( subcellParamData_.hexEdges, 1, hex );
81 const auto pyr = shards::CellTopology(shards::getCellTopologyData<shards::Pyramid<5> >());
82 setSubcellParametrization( subcellParamData_.pyrFaces, 2, pyr );
83 setSubcellParametrization( subcellParamData_.pyrEdges, 1, pyr );
86 const auto wedge = shards::CellTopology(shards::getCellTopologyData<shards::Wedge<6> >());
87 setSubcellParametrization( subcellParamData_.wedgeFaces, 2, wedge );
88 setSubcellParametrization( subcellParamData_.wedgeEdges, 1, wedge );
91 const auto tri = shards::CellTopology(shards::getCellTopologyData<shards::Triangle<3> >());
92 setSubcellParametrization( subcellParamData_.triEdges, 1, tri );
95 const auto quad = shards::CellTopology(shards::getCellTopologyData<shards::Quadrilateral<4> >());
96 setSubcellParametrization( subcellParamData_.quadEdges, 1, quad );
99 const auto line = shards::CellTopology(shards::getCellTopologyData<shards::ShellLine<2> >());
100 setSubcellParametrization( subcellParamData_.lineEdges, 1, line );
103 Kokkos::push_finalize_hook( [=] {
104 subcellParamData_.dummy = subcellParamViewType();
105 subcellParamData_.lineEdges = subcellParamViewType();
106 subcellParamData_.triEdges = subcellParamViewType();
107 subcellParamData_.quadEdges = subcellParamViewType();
108 subcellParamData_.shellTriEdges = subcellParamViewType();
109 subcellParamData_.shellQuadEdges = subcellParamViewType();
110 subcellParamData_.tetEdges = subcellParamViewType();
111 subcellParamData_.hexEdges = subcellParamViewType();
112 subcellParamData_.pyrEdges = subcellParamViewType();
113 subcellParamData_.wedgeEdges = subcellParamViewType();
114 subcellParamData_.shellTriFaces = subcellParamViewType();
115 subcellParamData_.shellQuadFaces = subcellParamViewType();
116 subcellParamData_.tetFaces = subcellParamViewType();
117 subcellParamData_.hexFaces = subcellParamViewType();
118 subcellParamData_.pyrFaces = subcellParamViewType();
119 subcellParamData_.wedgeFaces = subcellParamViewType();
122 isReferenceNodeDataSet_ =
true;
150 template<
typename SpT>
154 const ordinal_type subcellDim,
155 const shards::CellTopology parentCell ) {
156 #ifdef HAVE_INTREPID2_DEBUG
157 INTREPID2_TEST_FOR_EXCEPTION( !hasReferenceCell(parentCell), std::invalid_argument,
158 ">>> ERROR (Intrepid2::CellTools::getSubcellParametrization): the specified cell topology does not have a reference cell.");
161 if (!isSubcellParametrizationSet_)
162 setSubcellParametrization();
165 const auto pcd = parentCell.getDimension();
166 INTREPID2_TEST_FOR_EXCEPTION( subcellDim < 1 || subcellDim > static_cast<ordinal_type>(pcd-1), std::invalid_argument,
167 ">>> ERROR (Intrepid2::CellTools::getSubcellParametrization): Parametrizations defined in a range between 1 and (dim-1)");
169 switch (parentCell.getKey() ) {
170 case shards::Tetrahedron<4>::key:
171 case shards::Tetrahedron<8>::key:
172 case shards::Tetrahedron<10>::key:
173 case shards::Tetrahedron<11>::key: subcellParam = ( subcellDim == 2 ? subcellParamData_.tetFaces : subcellParamData_.tetEdges );
break;
175 case shards::Hexahedron<8>::key:
176 case shards::Hexahedron<20>::key:
177 case shards::Hexahedron<27>::key: subcellParam = ( subcellDim == 2 ? subcellParamData_.hexFaces : subcellParamData_.hexEdges );
break;
179 case shards::Pyramid<5>::key:
180 case shards::Pyramid<13>::key:
181 case shards::Pyramid<14>::key: subcellParam = ( subcellDim == 2 ? subcellParamData_.pyrFaces : subcellParamData_.pyrEdges );
break;
183 case shards::Wedge<6>::key:
184 case shards::Wedge<15>::key:
185 case shards::Wedge<18>::key: subcellParam = ( subcellDim == 2 ? subcellParamData_.wedgeFaces : subcellParamData_.wedgeEdges );
break;
187 case shards::Triangle<3>::key:
188 case shards::Triangle<4>::key:
189 case shards::Triangle<6>::key: subcellParam = subcellParamData_.triEdges;
break;
191 case shards::Quadrilateral<4>::key:
192 case shards::Quadrilateral<8>::key:
193 case shards::Quadrilateral<9>::key: subcellParam = subcellParamData_.quadEdges;
break;
202 case shards::ShellLine<2>::key:
203 case shards::ShellLine<3>::key:
204 case shards::Beam<2>::key:
205 case shards::Beam<3>::key: subcellParam = subcellParamData_.lineEdges;
break;
207 INTREPID2_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
208 ">>> ERROR (Intrepid2::CellTools::getSubcellParametrization): invalid cell topology.");
213 template<
typename SpT>
217 const ordinal_type subcellDim,
218 const shards::CellTopology parentCell ) {
219 #ifdef HAVE_INTREPID2_DEBUG
220 INTREPID2_TEST_FOR_EXCEPTION( !hasReferenceCell(parentCell), std::invalid_argument,
221 ">>> ERROR (Intrepid2::CellTools::setSubcellParametrization): the specified cell topology does not have a reference cell.");
241 const auto sc = parentCell.getSubcellCount(subcellDim);
242 const auto pcd = parentCell.getDimension();
243 const auto coeff = (subcellDim == 1) ? 2 : 3;
245 INTREPID2_TEST_FOR_EXCEPTION( subcellDim < 1 || subcellDim > static_cast<ordinal_type>(pcd-1), std::invalid_argument,
246 ">>> ERROR (Intrepid2::CellTools::setSubcellParametrization): Parametrizations defined in a range between 1 and (dim-1)");
250 subcellParam = subcellParamViewType(
"CellTools::setSubcellParametrization",
253 referenceNodeDataViewType
259 if (subcellDim == 1) {
261 for (size_type subcellOrd=0;subcellOrd<sc;++subcellOrd) {
264 const auto v0ord = parentCell.getNodeMap(subcellDim, subcellOrd, 0);
265 const auto v1ord = parentCell.getNodeMap(subcellDim, subcellOrd, 1);
267 getReferenceVertex(v0, parentCell, v0ord);
268 getReferenceVertex(v1, parentCell, v1ord);
271 subcellParam(subcellOrd, 0, 0) = (v0[0] + v1[0])/2.0;
272 subcellParam(subcellOrd, 0, 1) = (v1[0] - v0[0])/2.0;
275 subcellParam(subcellOrd, 1, 0) = (v0[1] + v1[1])/2.0;
276 subcellParam(subcellOrd, 1, 1) = (v1[1] - v0[1])/2.0;
280 subcellParam(subcellOrd, 2, 0) = (v0[2] + v1[2])/2.0;
281 subcellParam(subcellOrd, 2, 1) = (v1[2] - v0[2])/2.0;
285 else if (subcellDim == 2) {
289 for (size_type subcellOrd=0;subcellOrd<sc;++subcellOrd) {
291 switch (parentCell.getKey(subcellDim,subcellOrd)) {
293 case shards::Triangle<3>::key:
294 case shards::Triangle<4>::key:
295 case shards::Triangle<6>::key: {
296 const auto v0ord = parentCell.getNodeMap(subcellDim, subcellOrd, 0);
297 const auto v1ord = parentCell.getNodeMap(subcellDim, subcellOrd, 1);
298 const auto v2ord = parentCell.getNodeMap(subcellDim, subcellOrd, 2);
300 getReferenceVertex(v0, parentCell, v0ord);
301 getReferenceVertex(v1, parentCell, v1ord);
302 getReferenceVertex(v2, parentCell, v2ord);
305 subcellParam(subcellOrd, 0, 0) = v0[0];
306 subcellParam(subcellOrd, 0, 1) = v1[0] - v0[0];
307 subcellParam(subcellOrd, 0, 2) = v2[0] - v0[0];
310 subcellParam(subcellOrd, 1, 0) = v0[1];
311 subcellParam(subcellOrd, 1, 1) = v1[1] - v0[1];
312 subcellParam(subcellOrd, 1, 2) = v2[1] - v0[1];
315 subcellParam(subcellOrd, 2, 0) = v0[2];
316 subcellParam(subcellOrd, 2, 1) = v1[2] - v0[2];
317 subcellParam(subcellOrd, 2, 2) = v2[2] - v0[2];
320 case shards::Quadrilateral<4>::key:
321 case shards::Quadrilateral<8>::key:
322 case shards::Quadrilateral<9>::key: {
323 const auto v0ord = parentCell.getNodeMap(subcellDim, subcellOrd, 0);
324 const auto v1ord = parentCell.getNodeMap(subcellDim, subcellOrd, 1);
325 const auto v2ord = parentCell.getNodeMap(subcellDim, subcellOrd, 2);
326 const auto v3ord = parentCell.getNodeMap(subcellDim, subcellOrd, 3);
328 getReferenceVertex(v0, parentCell, v0ord);
329 getReferenceVertex(v1, parentCell, v1ord);
330 getReferenceVertex(v2, parentCell, v2ord);
331 getReferenceVertex(v3, parentCell, v3ord);
334 subcellParam(subcellOrd, 0, 0) = ( v0[0] + v1[0] + v2[0] + v3[0])/4.0;
335 subcellParam(subcellOrd, 0, 1) = (-v0[0] + v1[0] + v2[0] - v3[0])/4.0;
336 subcellParam(subcellOrd, 0, 2) = (-v0[0] - v1[0] + v2[0] + v3[0])/4.0;
339 subcellParam(subcellOrd, 1, 0) = ( v0[1] + v1[1] + v2[1] + v3[1])/4.0;
340 subcellParam(subcellOrd, 1, 1) = (-v0[1] + v1[1] + v2[1] - v3[1])/4.0;
341 subcellParam(subcellOrd, 1, 2) = (-v0[1] - v1[1] + v2[1] + v3[1])/4.0;
344 subcellParam(subcellOrd, 2, 0) = ( v0[2] + v1[2] + v2[2] + v3[2])/4.0;
345 subcellParam(subcellOrd, 2, 1) = (-v0[2] + v1[2] + v2[2] - v3[2])/4.0;
346 subcellParam(subcellOrd, 2, 2) = (-v0[2] - v1[2] + v2[2] + v3[2])/4.0;
350 INTREPID2_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
351 ">>> ERROR (Intrepid2::CellTools::setSubcellParametrization): parametrization not defined for the specified face topology.");
360 template<
typename SpT>
363 isSubcellParametrizationSet_ =
false;
365 template<
typename SpT>
static constexpr ordinal_type MaxDimension
The maximum ambient space dimension.