49 #ifndef INTREPID_CELLTOOLSDEF_HPP
50 #define INTREPID_CELLTOOLSDEF_HPP
55 template<
class Scalar>
57 const shards::CellTopology& parentCell){
59 #ifdef HAVE_INTREPID_DEBUG
60 TEUCHOS_TEST_FOR_EXCEPTION( !(hasReferenceCell(parentCell) ), std::invalid_argument,
61 ">>> ERROR (Intrepid::CellTools::getSubcellParametrization): the specified cell topology does not have a reference cell.");
63 TEUCHOS_TEST_FOR_EXCEPTION( !( (1 <= subcellDim) && (subcellDim <= 2 ) ), std::invalid_argument,
64 ">>> ERROR (Intrepid::CellTools::getSubcellParametrization): parametrization defined only for 1 and 2-dimensional subcells.");
111 switch(parentCell.getKey() ) {
114 case shards::Tetrahedron<4>::key:
115 case shards::Tetrahedron<8>::key:
116 case shards::Tetrahedron<10>::key:
117 case shards::Tetrahedron<11>::key:
118 if(subcellDim == 2) {
120 setSubcellParametrization(tetFaces, subcellDim, parentCell);
125 else if(subcellDim == 1) {
127 setSubcellParametrization(tetEdges, subcellDim, parentCell);
133 TEUCHOS_TEST_FOR_EXCEPTION( (subcellDim != 1 || subcellDim != 2), std::invalid_argument,
134 ">>> ERROR (Intrepid::CellTools::getSubcellParametrization): Tet parametrizations defined for 1 and 2-subcells only");
139 case shards::Hexahedron<8>::key:
140 case shards::Hexahedron<20>::key:
141 case shards::Hexahedron<27>::key:
142 if(subcellDim == 2) {
144 setSubcellParametrization(hexFaces, subcellDim, parentCell);
149 else if(subcellDim == 1) {
151 setSubcellParametrization(hexEdges, subcellDim, parentCell);
157 TEUCHOS_TEST_FOR_EXCEPTION( (subcellDim != 1 || subcellDim != 2), std::invalid_argument,
158 ">>> ERROR (Intrepid::CellTools::getSubcellParametrization): Hex parametrizations defined for 1 and 2-subcells only");
163 case shards::Pyramid<5>::key:
164 case shards::Pyramid<13>::key:
165 case shards::Pyramid<14>::key:
166 if(subcellDim == 2) {
168 setSubcellParametrization(pyrFaces, subcellDim, parentCell);
173 else if(subcellDim == 1) {
175 setSubcellParametrization(pyrEdges, subcellDim, parentCell);
181 TEUCHOS_TEST_FOR_EXCEPTION( (subcellDim != 1 || subcellDim != 2), std::invalid_argument,
182 ">>> ERROR (Intrepid::CellTools::getSubcellParametrization): Pyramid parametrizations defined for 1 and 2-subcells only");
187 case shards::Wedge<6>::key:
188 case shards::Wedge<15>::key:
189 case shards::Wedge<18>::key:
190 if(subcellDim == 2) {
192 setSubcellParametrization(wedgeFaces, subcellDim, parentCell);
197 else if(subcellDim == 1) {
199 setSubcellParametrization(wedgeEdges, subcellDim, parentCell);
205 TEUCHOS_TEST_FOR_EXCEPTION( (subcellDim != 1 || subcellDim != 2), std::invalid_argument,
206 ">>> ERROR (Intrepid::CellTools::getSubcellParametrization): Wedge parametrization defined for 1 and 2-subcells only");
212 case shards::Triangle<3>::key:
213 case shards::Triangle<4>::key:
214 case shards::Triangle<6>::key:
215 if(subcellDim == 1) {
217 setSubcellParametrization(triEdges, subcellDim, parentCell);
223 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
224 ">>> ERROR (Intrepid::CellTools::getSubcellParametrization): Triangle parametrizations defined for 1-subcells only");
228 case shards::Quadrilateral<4>::key:
229 case shards::Quadrilateral<8>::key:
230 case shards::Quadrilateral<9>::key:
231 if(subcellDim == 1) {
233 setSubcellParametrization(quadEdges, subcellDim, parentCell);
239 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
240 ">>> ERROR (Intrepid::CellTools::getSubcellParametrization): Quad parametrizations defined for 1-subcells only");
247 case shards::ShellTriangle<3>::key:
248 case shards::ShellTriangle<6>::key:
249 if(subcellDim == 2) {
250 if(!shellTriFacesSet){
251 setSubcellParametrization(shellTriFaces, subcellDim, parentCell);
252 shellTriFacesSet = 1;
254 return shellTriFaces;
256 else if(subcellDim == 1) {
257 if(!shellTriEdgesSet){
258 setSubcellParametrization(shellTriEdges, subcellDim, parentCell);
259 shellTriEdgesSet = 1;
261 return shellTriEdges;
263 else if( subcellDim != 1 || subcellDim != 2){
264 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
265 ">>> ERROR (Intrepid::CellTools::getSubcellParametrization): Shell Triangle parametrizations defined for 1 and 2-subcells only");
269 case shards::ShellQuadrilateral<4>::key:
270 case shards::ShellQuadrilateral<8>::key:
271 case shards::ShellQuadrilateral<9>::key:
272 if(subcellDim == 2) {
273 if(!shellQuadFacesSet){
274 setSubcellParametrization(shellQuadFaces, subcellDim, parentCell);
275 shellQuadFacesSet = 1;
277 return shellQuadFaces;
279 else if(subcellDim == 1) {
280 if(!shellQuadEdgesSet){
281 setSubcellParametrization(shellQuadEdges, subcellDim, parentCell);
282 shellQuadEdgesSet = 1;
284 return shellQuadEdges;
286 else if( subcellDim != 1 || subcellDim != 2){
287 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
288 ">>> ERROR (Intrepid::CellTools::getSubcellParametrization): Shell Quad parametrizations defined for 1 and 2-subcells only");
295 case shards::ShellLine<2>::key:
296 case shards::ShellLine<3>::key:
297 case shards::Beam<2>::key:
298 case shards::Beam<3>::key:
299 if(subcellDim == 1) {
301 setSubcellParametrization(lineEdges, subcellDim, parentCell);
307 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
308 ">>> ERROR (Intrepid::CellTools::getSubcellParametrization): shell line/beam parametrizations defined for 1-subcells only");
313 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
314 ">>> ERROR (Intrepid::CellTools::getSubcellParametrization): invalid cell topology.");
322 template<
class Scalar>
324 const int subcellDim,
325 const shards::CellTopology& parentCell)
327 #ifdef HAVE_INTREPID_DEBUG
328 TEUCHOS_TEST_FOR_EXCEPTION( !(hasReferenceCell(parentCell) ), std::invalid_argument,
329 ">>> ERROR (Intrepid::CellTools::setSubcellParametrization): the specified cell topology does not have a reference cell.");
331 TEUCHOS_TEST_FOR_EXCEPTION( !( (1 <= subcellDim) && (subcellDim <= 2 ) ), std::invalid_argument,
332 ">>> ERROR (Intrepid::CellTools::setSubcellParametrization): parametrization defined only for 1 and 2-dimensional subcells.");
352 unsigned sc = parentCell.getSubcellCount(subcellDim);
353 unsigned pcd = parentCell.getDimension();
354 unsigned coeff = (subcellDim == 1) ? 2 : 3;
358 subcellParametrization.
resize(sc, pcd, coeff);
362 for(
unsigned subcellOrd = 0; subcellOrd < sc; subcellOrd++){
364 int v0ord = parentCell.getNodeMap(subcellDim, subcellOrd, 0);
365 int v1ord = parentCell.getNodeMap(subcellDim, subcellOrd, 1);
369 const double* v0 = getReferenceVertex(parentCell, v0ord);
370 const double* v1 = getReferenceVertex(parentCell, v1ord);
373 subcellParametrization(subcellOrd, 0, 0) = (v0[0] + v1[0])/2.0;
374 subcellParametrization(subcellOrd, 0, 1) = (v1[0] - v0[0])/2.0;
377 subcellParametrization(subcellOrd, 1, 0) = (v0[1] + v1[1])/2.0;
378 subcellParametrization(subcellOrd, 1, 1) = (v1[1] - v0[1])/2.0;
382 subcellParametrization(subcellOrd, 2, 0) = (v0[2] + v1[2])/2.0;
383 subcellParametrization(subcellOrd, 2, 1) = (v1[2] - v0[2])/2.0;
391 else if(subcellDim == 2) {
392 for(
unsigned subcellOrd = 0; subcellOrd < sc; subcellOrd++){
394 switch(parentCell.getKey(subcellDim,subcellOrd)){
397 case shards::Triangle<3>::key:
398 case shards::Triangle<4>::key:
399 case shards::Triangle<6>::key:
401 int v0ord = parentCell.getNodeMap(subcellDim, subcellOrd, 0);
402 int v1ord = parentCell.getNodeMap(subcellDim, subcellOrd, 1);
403 int v2ord = parentCell.getNodeMap(subcellDim, subcellOrd, 2);
404 const double* v0 = getReferenceVertex(parentCell, v0ord);
405 const double* v1 = getReferenceVertex(parentCell, v1ord);
406 const double* v2 = getReferenceVertex(parentCell, v2ord);
409 subcellParametrization(subcellOrd, 0, 0) = v0[0];
410 subcellParametrization(subcellOrd, 0, 1) = v1[0] - v0[0];
411 subcellParametrization(subcellOrd, 0, 2) = v2[0] - v0[0];
414 subcellParametrization(subcellOrd, 1, 0) = v0[1];
415 subcellParametrization(subcellOrd, 1, 1) = v1[1] - v0[1];
416 subcellParametrization(subcellOrd, 1, 2) = v2[1] - v0[1];
419 subcellParametrization(subcellOrd, 2, 0) = v0[2];
420 subcellParametrization(subcellOrd, 2, 1) = v1[2] - v0[2];
421 subcellParametrization(subcellOrd, 2, 2) = v2[2] - v0[2];
426 case shards::Quadrilateral<4>::key:
427 case shards::Quadrilateral<8>::key:
428 case shards::Quadrilateral<9>::key:
430 int v0ord = parentCell.getNodeMap(subcellDim, subcellOrd, 0);
431 int v1ord = parentCell.getNodeMap(subcellDim, subcellOrd, 1);
432 int v2ord = parentCell.getNodeMap(subcellDim, subcellOrd, 2);
433 int v3ord = parentCell.getNodeMap(subcellDim, subcellOrd, 3);
434 const double* v0 = getReferenceVertex(parentCell, v0ord);
435 const double* v1 = getReferenceVertex(parentCell, v1ord);
436 const double* v2 = getReferenceVertex(parentCell, v2ord);
437 const double* v3 = getReferenceVertex(parentCell, v3ord);
440 subcellParametrization(subcellOrd, 0, 0) = ( v0[0] + v1[0] + v2[0] + v3[0])/4.0;
441 subcellParametrization(subcellOrd, 0, 1) = (-v0[0] + v1[0] + v2[0] - v3[0])/4.0;
442 subcellParametrization(subcellOrd, 0, 2) = (-v0[0] - v1[0] + v2[0] + v3[0])/4.0;
445 subcellParametrization(subcellOrd, 1, 0) = ( v0[1] + v1[1] + v2[1] + v3[1])/4.0;
446 subcellParametrization(subcellOrd, 1, 1) = (-v0[1] + v1[1] + v2[1] - v3[1])/4.0;
447 subcellParametrization(subcellOrd, 1, 2) = (-v0[1] - v1[1] + v2[1] + v3[1])/4.0;
450 subcellParametrization(subcellOrd, 2, 0) = ( v0[2] + v1[2] + v2[2] + v3[2])/4.0;
451 subcellParametrization(subcellOrd, 2, 1) = (-v0[2] + v1[2] + v2[2] - v3[2])/4.0;
452 subcellParametrization(subcellOrd, 2, 2) = (-v0[2] - v1[2] + v2[2] + v3[2])/4.0;
456 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
457 ">>> ERROR (Intrepid::CellTools::setSubcellParametrization): parametrization not defined for the specified face topology.");
466 template<
class Scalar>
468 const int vertexOrd){
470 #ifdef HAVE_INTREPID_DEBUG
471 TEUCHOS_TEST_FOR_EXCEPTION( !(hasReferenceCell(cell) ), std::invalid_argument,
472 ">>> ERROR (Intrepid::CellTools::getReferenceVertex): the specified cell topology does not have a reference cell.");
474 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= vertexOrd) && (vertexOrd < (
int)cell.getVertexCount() ) ), std::invalid_argument,
475 ">>> ERROR (Intrepid::CellTools::getReferenceVertex): invalid node ordinal for the specified cell topology. ");
479 return getReferenceNode(cell.getBaseCellTopologyData(), vertexOrd);
484 template<
class Scalar>
485 template<
class ArraySubcellVert>
487 const int subcellDim,
488 const int subcellOrd,
489 const shards::CellTopology& parentCell){
490 #ifdef HAVE_INTREPID_DEBUG
491 TEUCHOS_TEST_FOR_EXCEPTION( !(hasReferenceCell(parentCell) ), std::invalid_argument,
492 ">>> ERROR (Intrepid::CellTools::getReferenceSubcellVertices): the specified cell topology does not have a reference cell.");
496 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= subcellDim) && (subcellDim <= (
int)parentCell.getDimension()) ), std::invalid_argument,
497 ">>> ERROR (Intrepid::CellTools::getReferenceSubcellVertices): subcell dimension out of range.");
499 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= subcellOrd) && (subcellOrd < (
int)parentCell.getSubcellCount(subcellDim) ) ), std::invalid_argument,
500 ">>> ERROR (Intrepid::CellTools::getReferenceSubcellVertices): subcell ordinal out of range.");
504 std::string errmsg =
">>> ERROR (Intrepid::CellTools::getReferenceSubcellVertices):";
505 TEUCHOS_TEST_FOR_EXCEPTION( !( requireRankRange(errmsg, subcellVertices, 2, 2) ), std::invalid_argument, errmsg);
507 int subcVertexCount = parentCell.getVertexCount(subcellDim, subcellOrd);
508 int spaceDim = parentCell.getDimension();
510 TEUCHOS_TEST_FOR_EXCEPTION( !( requireDimensionRange(errmsg, subcellVertices, 0, subcVertexCount, subcVertexCount) ),
511 std::invalid_argument, errmsg);
513 TEUCHOS_TEST_FOR_EXCEPTION( !( requireDimensionRange(errmsg, subcellVertices, 1, spaceDim, spaceDim) ),
514 std::invalid_argument, errmsg);
519 getReferenceSubcellNodes(subcellVertices, subcellDim, subcellOrd, parentCell.getBaseCellTopologyData() );
524 template<
class Scalar>
528 #ifdef HAVE_INTREPID_DEBUG
529 TEUCHOS_TEST_FOR_EXCEPTION( !(hasReferenceCell(cell) ), std::invalid_argument,
530 ">>> ERROR (Intrepid::CellTools::getReferenceNode): the specified cell topology does not have a reference cell.");
532 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= nodeOrd) && (nodeOrd < (
int)cell.getNodeCount() ) ), std::invalid_argument,
533 ">>> ERROR (Intrepid::CellTools::getReferenceNode): invalid node ordinal for the specified cell topology. ");
538 static const double line[2][3] ={
539 {-1.0, 0.0, 0.0}, { 1.0, 0.0, 0.0}
541 static const double line_3[3][3] = {
542 {-1.0, 0.0, 0.0}, { 1.0, 0.0, 0.0},
549 static const double triangle[3][3] = {
550 { 0.0, 0.0, 0.0}, { 1.0, 0.0, 0.0}, { 0.0, 1.0, 0.0}
552 static const double triangle_4[4][3] = {
553 { 0.0, 0.0, 0.0}, { 1.0, 0.0, 0.0}, { 0.0, 1.0, 0.0},
557 static const double triangle_6[6][3] = {
558 { 0.0, 0.0, 0.0}, { 1.0, 0.0, 0.0}, { 0.0, 1.0, 0.0},
560 { 0.5, 0.0, 0.0}, { 0.5, 0.5, 0.0}, { 0.0, 0.5, 0.0}
565 static const double quadrilateral[4][3] = {
566 {-1.0,-1.0, 0.0}, { 1.0,-1.0, 0.0}, { 1.0, 1.0, 0.0}, {-1.0, 1.0, 0.0}
568 static const double quadrilateral_8[8][3] = {
569 {-1.0,-1.0, 0.0}, { 1.0,-1.0, 0.0}, { 1.0, 1.0, 0.0}, {-1.0, 1.0, 0.0},
571 { 0.0,-1.0, 0.0}, { 1.0, 0.0, 0.0}, { 0.0, 1.0, 0.0}, {-1.0, 0.0, 0.0}
573 static const double quadrilateral_9[9][3] = {
574 {-1.0,-1.0, 0.0}, { 1.0,-1.0, 0.0}, { 1.0, 1.0, 0.0}, {-1.0, 1.0, 0.0},
576 { 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}
581 static const double tetrahedron[4][3] = {
582 { 0.0, 0.0, 0.0}, { 1.0, 0.0, 0.0}, { 0.0, 1.0, 0.0}, { 0.0, 0.0, 1.0}
584 static const double tetrahedron_8[8][3] = {
585 { 0.0, 0.0, 0.0}, { 1.0, 0.0, 0.0}, { 0.0, 1.0, 0.0}, { 0.0, 0.0, 1.0},
587 { 1/3, 0.0, 1/3}, { 1/3, 1/3, 1/3}, { 1/3, 1/3, 0.0}, { 0.0, 1/3, 1/3}
589 static const double tetrahedron_10[10][3] = {
590 { 0.0, 0.0, 0.0}, { 1.0, 0.0, 0.0}, { 0.0, 1.0, 0.0}, { 0.0, 0.0, 1.0},
592 { 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}
595 static const double tetrahedron_11[10][3] = {
596 { 0.0, 0.0, 0.0}, { 1.0, 0.0, 0.0}, { 0.0, 1.0, 0.0}, { 0.0, 0.0, 1.0},
598 { 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}
603 static const double hexahedron[8][3] = {
604 {-1.0,-1.0,-1.0}, { 1.0,-1.0,-1.0}, { 1.0, 1.0,-1.0}, {-1.0, 1.0,-1.0},
605 {-1.0,-1.0, 1.0}, { 1.0,-1.0, 1.0}, { 1.0, 1.0, 1.0}, {-1.0, 1.0, 1.0}
607 static const double hexahedron_20[20][3] = {
608 {-1.0,-1.0,-1.0}, { 1.0,-1.0,-1.0}, { 1.0, 1.0,-1.0}, {-1.0, 1.0,-1.0},
609 {-1.0,-1.0, 1.0}, { 1.0,-1.0, 1.0}, { 1.0, 1.0, 1.0}, {-1.0, 1.0, 1.0},
611 { 0.0,-1.0,-1.0}, { 1.0, 0.0,-1.0}, { 0.0, 1.0,-1.0}, {-1.0, 0.0,-1.0},
612 {-1.0,-1.0, 0.0}, { 1.0,-1.0, 0.0}, { 1.0, 1.0, 0.0}, {-1.0, 1.0, 0.0},
613 { 0.0,-1.0, 1.0}, { 1.0, 0.0, 1.0}, { 0.0, 1.0, 1.0}, {-1.0, 0.0, 1.0}
615 static const double hexahedron_27[27][3] = {
616 {-1.0,-1.0,-1.0}, { 1.0,-1.0,-1.0}, { 1.0, 1.0,-1.0}, {-1.0, 1.0,-1.0},
617 {-1.0,-1.0, 1.0}, { 1.0,-1.0, 1.0}, { 1.0, 1.0, 1.0}, {-1.0, 1.0, 1.0},
619 { 0.0,-1.0,-1.0}, { 1.0, 0.0,-1.0}, { 0.0, 1.0,-1.0}, {-1.0, 0.0,-1.0},
620 {-1.0,-1.0, 0.0}, { 1.0,-1.0, 0.0}, { 1.0, 1.0, 0.0}, {-1.0, 1.0, 0.0},
621 { 0.0,-1.0, 1.0}, { 1.0, 0.0, 1.0}, { 0.0, 1.0, 1.0}, {-1.0, 0.0, 1.0},
623 { 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}
628 static const double pyramid[5][3] = {
629 {-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}
631 static const double pyramid_13[13][3] = {
632 {-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},
634 { 0.0,-1.0, 0.0}, { 1.0, 0.0, 0.0}, { 0.0, 1.0, 0.0}, {-1.0, 0.0, 0.0},
635 {-0.5,-0.5, 0.5}, { 0.5,-0.5, 0.5}, { 0.5, 0.5, 0.5}, {-0.5, 0.5, 0.5}
637 static const double pyramid_14[14][3] = {
638 {-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},
640 { 0.0,-1.0, 0.0}, { 1.0, 0.0, 0.0}, { 0.0, 1.0, 0.0}, {-1.0, 0.0, 0.0},
641 {-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}
646 static const double wedge[6][3] = {
647 { 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}
649 static const double wedge_15[15][3] = {
650 { 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},
652 { 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},
653 { 0.5, 0.0, 1.0}, { 0.5, 0.5, 1.0}, { 0.0, 0.5, 1.0}
655 static const double wedge_18[18][3] = {
656 { 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},
658 { 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},
659 { 0.5, 0.0, 1.0}, { 0.5, 0.5, 1.0}, { 0.0, 0.5, 1.0},
660 { 0.5, 0.0, 0.0}, { 0.5, 0.5, 0.0}, { 0.0, 0.5, 0.0}
664 switch(cell.getKey() ) {
667 case shards::Line<2>::key:
668 case shards::ShellLine<2>::key:
669 case shards::Beam<2>::key:
670 return line[nodeOrd];
674 case shards::Line<3>::key:
675 case shards::ShellLine<3>::key:
676 case shards::Beam<3>::key:
677 return line_3[nodeOrd];
682 case shards::Triangle<3>::key:
683 case shards::ShellTriangle<3>::key:
684 return triangle[nodeOrd];
688 case shards::Triangle<4>::key:
689 return triangle_4[nodeOrd];
691 case shards::Triangle<6>::key:
692 case shards::ShellTriangle<6>::key:
693 return triangle_6[nodeOrd];
698 case shards::Quadrilateral<4>::key:
699 case shards::ShellQuadrilateral<4>::key:
700 return quadrilateral[nodeOrd];
704 case shards::Quadrilateral<8>::key:
705 case shards::ShellQuadrilateral<8>::key:
706 return quadrilateral_8[nodeOrd];
708 case shards::Quadrilateral<9>::key:
709 case shards::ShellQuadrilateral<9>::key:
710 return quadrilateral_9[nodeOrd];
715 case shards::Tetrahedron<4>::key:
716 return tetrahedron[nodeOrd];
720 case shards::Tetrahedron<8>::key:
721 return tetrahedron_8[nodeOrd];
723 case shards::Tetrahedron<10>::key:
724 return tetrahedron_10[nodeOrd];
726 case shards::Tetrahedron<11>::key:
727 return tetrahedron_11[nodeOrd];
732 case shards::Hexahedron<8>::key:
733 return hexahedron[nodeOrd];
737 case shards::Hexahedron<20>::key:
738 return hexahedron_20[nodeOrd];
740 case shards::Hexahedron<27>::key:
741 return hexahedron_27[nodeOrd];
746 case shards::Pyramid<5>::key:
747 return pyramid[nodeOrd];
751 case shards::Pyramid<13>::key:
752 return pyramid_13[nodeOrd];
754 case shards::Pyramid<14>::key:
755 return pyramid_14[nodeOrd];
760 case shards::Wedge<6>::key:
761 return wedge[nodeOrd];
765 case shards::Wedge<15>::key:
766 return wedge_15[nodeOrd];
768 case shards::Wedge<18>::key:
769 return wedge_18[nodeOrd];
773 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
774 ">>> ERROR (Intrepid::CellTools::getReferenceNode): invalid cell topology.");
782 template<
class Scalar>
783 template<
class ArraySubcellNode>
785 const int subcellDim,
786 const int subcellOrd,
787 const shards::CellTopology& parentCell){
788 #ifdef HAVE_INTREPID_DEBUG
789 TEUCHOS_TEST_FOR_EXCEPTION( !(hasReferenceCell(parentCell) ), std::invalid_argument,
790 ">>> ERROR (Intrepid::CellTools::getReferenceSubcellNodes): the specified cell topology does not have a reference cell.");
794 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= subcellDim) && (subcellDim <= (
int)parentCell.getDimension()) ), std::invalid_argument,
795 ">>> ERROR (Intrepid::CellTools::getReferenceSubcellNodes): subcell dimension out of range.");
797 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= subcellOrd) && (subcellOrd < (
int)parentCell.getSubcellCount(subcellDim) ) ), std::invalid_argument,
798 ">>> ERROR (Intrepid::CellTools::getReferenceSubcellNodes): subcell ordinal out of range.");
802 std::string errmsg =
">>> ERROR (Intrepid::CellTools::getReferenceSubcellNodes):";
803 TEUCHOS_TEST_FOR_EXCEPTION( !( requireRankRange(errmsg, subcellNodes, 2, 2) ), std::invalid_argument, errmsg);
805 int subcNodeCount = parentCell.getNodeCount(subcellDim, subcellOrd);
806 int spaceDim = parentCell.getDimension();
808 TEUCHOS_TEST_FOR_EXCEPTION( !( requireDimensionRange(errmsg, subcellNodes, 0, subcNodeCount, subcNodeCount) ),
809 std::invalid_argument, errmsg);
811 TEUCHOS_TEST_FOR_EXCEPTION( !( requireDimensionRange(errmsg, subcellNodes, 1, spaceDim, spaceDim) ),
812 std::invalid_argument, errmsg);
817 int subcNodeCount = parentCell.getNodeCount(subcellDim, subcellOrd);
820 for(
int subcNodeOrd = 0; subcNodeOrd < subcNodeCount; subcNodeOrd++){
823 int cellNodeOrd = parentCell.getNodeMap(subcellDim, subcellOrd, subcNodeOrd);
826 for(
int dim = 0; dim < (int)parentCell.getDimension(); dim++){
834 template<
class Scalar>
837 switch(cell.getKey() ) {
838 case shards::Line<2>::key:
839 case shards::Line<3>::key:
840 case shards::ShellLine<2>::key:
841 case shards::ShellLine<3>::key:
842 case shards::Beam<2>::key:
843 case shards::Beam<3>::key:
845 case shards::Triangle<3>::key:
846 case shards::Triangle<4>::key:
847 case shards::Triangle<6>::key:
848 case shards::ShellTriangle<3>::key:
849 case shards::ShellTriangle<6>::key:
851 case shards::Quadrilateral<4>::key:
852 case shards::Quadrilateral<8>::key:
853 case shards::Quadrilateral<9>::key:
854 case shards::ShellQuadrilateral<4>::key:
855 case shards::ShellQuadrilateral<8>::key:
856 case shards::ShellQuadrilateral<9>::key:
858 case shards::Tetrahedron<4>::key:
859 case shards::Tetrahedron<8>::key:
860 case shards::Tetrahedron<10>::key:
861 case shards::Tetrahedron<11>::key:
863 case shards::Hexahedron<8>::key:
864 case shards::Hexahedron<20>::key:
865 case shards::Hexahedron<27>::key:
867 case shards::Pyramid<5>::key:
868 case shards::Pyramid<13>::key:
869 case shards::Pyramid<14>::key:
871 case shards::Wedge<6>::key:
872 case shards::Wedge<15>::key:
873 case shards::Wedge<18>::key:
889 template<
class Scalar>
890 template<
class ArrayJac,
class ArrayPo
int,
class ArrayCell>
892 const ArrayPoint & points,
893 const ArrayCell & cellWorkset,
894 const shards::CellTopology & cellTopo,
895 const int & whichCell)
897 INTREPID_VALIDATE( validateArguments_setJacobian(jacobian, points, cellWorkset, whichCell, cellTopo) );
899 int spaceDim = (int)cellTopo.getDimension();
900 int numCells = cellWorkset.dimension(0);
902 int numPoints = (points.rank() == 2) ? points.dimension(0) : points.dimension(1);
905 Teuchos::RCP< Basis< Scalar, FieldContainer<Scalar> > > HGRAD_Basis;
908 switch( cellTopo.getKey() ){
911 case shards::Line<2>::key:
915 case shards::Triangle<3>::key:
919 case shards::Quadrilateral<4>::key:
923 case shards::Tetrahedron<4>::key:
927 case shards::Hexahedron<8>::key:
931 case shards::Wedge<6>::key:
936 case shards::Triangle<6>::key:
939 case shards::Quadrilateral<9>::key:
943 case shards::Tetrahedron<10>::key:
947 case shards::Tetrahedron<11>::key:
951 case shards::Hexahedron<27>::key:
955 case shards::Wedge<18>::key:
960 case shards::Quadrilateral<8>::key:
961 case shards::Hexahedron<20>::key:
962 case shards::Wedge<15>::key:
963 TEUCHOS_TEST_FOR_EXCEPTION( (
true), std::invalid_argument,
964 ">>> ERROR (Intrepid::CellTools::setJacobian): Cell topology not supported. ");
968 case shards::Line<3>::key:
969 case shards::Beam<2>::key:
970 case shards::Beam<3>::key:
971 case shards::ShellLine<2>::key:
972 case shards::ShellLine<3>::key:
973 case shards::ShellTriangle<3>::key:
974 case shards::ShellTriangle<6>::key:
975 case shards::ShellQuadrilateral<4>::key:
976 case shards::ShellQuadrilateral<8>::key:
977 case shards::ShellQuadrilateral<9>::key:
978 TEUCHOS_TEST_FOR_EXCEPTION( (
true), std::invalid_argument,
979 ">>> ERROR (Intrepid::CellTools::setJacobian): Cell topology not supported. ");
982 TEUCHOS_TEST_FOR_EXCEPTION( (
true), std::invalid_argument,
983 ">>> ERROR (Intrepid::CellTools::setJacobian): Cell topology not supported.");
987 int basisCardinality = HGRAD_Basis -> getCardinality();
991 for(
int i = 0; i < jacobian.size(); i++){
996 switch(points.rank()) {
1004 for(
int pt = 0; pt < points.dimension(0); pt++){
1005 for(
int dm = 0; dm < points.dimension(1) ; dm++){
1006 tempPoints(pt, dm) = points(pt, dm);
1009 HGRAD_Basis -> getValues(basisGrads, tempPoints, OPERATOR_GRAD);
1013 int cellLoop = (whichCell == -1) ? numCells : 1 ;
1015 if(whichCell == -1) {
1016 for(
int cellOrd = 0; cellOrd < cellLoop; cellOrd++) {
1017 for(
int pointOrd = 0; pointOrd < numPoints; pointOrd++) {
1018 for(
int row = 0; row < spaceDim; row++){
1019 for(
int col = 0; col < spaceDim; col++){
1022 for(
int bfOrd = 0; bfOrd < basisCardinality; bfOrd++){
1023 jacobian(cellOrd, pointOrd, row, col) += cellWorkset(cellOrd, bfOrd, row)*basisGrads(bfOrd, pointOrd, col);
1031 for(
int cellOrd = 0; cellOrd < cellLoop; cellOrd++) {
1032 for(
int pointOrd = 0; pointOrd < numPoints; pointOrd++) {
1033 for(
int row = 0; row < spaceDim; row++){
1034 for(
int col = 0; col < spaceDim; col++){
1037 for(
int bfOrd = 0; bfOrd < basisCardinality; bfOrd++){
1038 jacobian(pointOrd, row, col) += cellWorkset(whichCell, bfOrd, row)*basisGrads(bfOrd, pointOrd, col);
1054 for(
int cellOrd = 0; cellOrd < numCells; cellOrd++) {
1057 for(
int pt = 0; pt < points.dimension(1); pt++){
1058 for(
int dm = 0; dm < points.dimension(2) ; dm++){
1059 tempPoints(pt, dm) = points(cellOrd, pt, dm);
1064 HGRAD_Basis -> getValues(basisGrads, tempPoints, OPERATOR_GRAD);
1067 for(
int pointOrd = 0; pointOrd < numPoints; pointOrd++) {
1068 for(
int row = 0; row < spaceDim; row++){
1069 for(
int col = 0; col < spaceDim; col++){
1072 for(
int bfOrd = 0; bfOrd < basisCardinality; bfOrd++){
1073 jacobian(cellOrd, pointOrd, row, col) += cellWorkset(cellOrd, bfOrd, row)*basisGrads(bfOrd, pointOrd, col);
1084 TEUCHOS_TEST_FOR_EXCEPTION( !( (points.rank() == 2) && (points.rank() == 3) ), std::invalid_argument,
1085 ">>> ERROR (Intrepid::CellTools::setJacobian): rank 2 or 3 required for points array. ");
1091 template<
class Scalar>
1092 template<
class ArrayJacInv,
class ArrayJac>
1094 const ArrayJac & jacobian)
1096 INTREPID_VALIDATE( validateArguments_setJacobianInv(jacobianInv, jacobian) );
1103 template<
class Scalar>
1104 template<
class ArrayJacDet,
class ArrayJac>
1106 const ArrayJac & jacobian)
1108 INTREPID_VALIDATE( validateArguments_setJacobianDetArgs(jacobianDet, jacobian) );
1119 template<
class Scalar>
1120 template<
class ArrayPhysPo
int,
class ArrayRefPo
int,
class ArrayCell>
1122 const ArrayRefPoint & refPoints,
1123 const ArrayCell & cellWorkset,
1124 const shards::CellTopology & cellTopo,
1125 const int & whichCell)
1127 INTREPID_VALIDATE(validateArguments_mapToPhysicalFrame( physPoints, refPoints, cellWorkset, cellTopo, whichCell) );
1129 int spaceDim = (int)cellTopo.getDimension();
1130 int numCells = cellWorkset.dimension(0);
1132 int numPoints = (refPoints.rank() == 2) ? refPoints.dimension(0) : refPoints.dimension(1);
1135 Teuchos::RCP<Basis<Scalar, FieldContainer<Scalar> > > HGRAD_Basis;
1138 switch( cellTopo.getKey() ){
1141 case shards::Line<2>::key:
1145 case shards::Triangle<3>::key:
1149 case shards::Quadrilateral<4>::key:
1153 case shards::Tetrahedron<4>::key:
1157 case shards::Hexahedron<8>::key:
1161 case shards::Wedge<6>::key:
1166 case shards::Triangle<6>::key:
1170 case shards::Quadrilateral<9>::key:
1174 case shards::Tetrahedron<10>::key:
1178 case shards::Tetrahedron<11>::key:
1182 case shards::Hexahedron<27>::key:
1186 case shards::Wedge<18>::key:
1191 case shards::Quadrilateral<8>::key:
1192 case shards::Hexahedron<20>::key:
1193 case shards::Wedge<15>::key:
1194 TEUCHOS_TEST_FOR_EXCEPTION( (
true), std::invalid_argument,
1195 ">>> ERROR (Intrepid::CellTools::mapToPhysicalFrame): Cell topology not supported. ");
1199 case shards::Line<3>::key:
1200 case shards::Beam<2>::key:
1201 case shards::Beam<3>::key:
1202 case shards::ShellLine<2>::key:
1203 case shards::ShellLine<3>::key:
1204 case shards::ShellTriangle<3>::key:
1205 case shards::ShellTriangle<6>::key:
1206 case shards::ShellQuadrilateral<4>::key:
1207 case shards::ShellQuadrilateral<8>::key:
1208 case shards::ShellQuadrilateral<9>::key:
1209 TEUCHOS_TEST_FOR_EXCEPTION( (
true), std::invalid_argument,
1210 ">>> ERROR (Intrepid::CellTools::mapToPhysicalFrame): Cell topology not supported. ");
1213 TEUCHOS_TEST_FOR_EXCEPTION( (
true), std::invalid_argument,
1214 ">>> ERROR (Intrepid::CellTools::mapToPhysicalFrame): Cell topology not supported.");
1218 int basisCardinality = HGRAD_Basis -> getCardinality();
1222 for(
int i = 0; i < physPoints.size(); i++){
1223 physPoints[i] = 0.0;
1227 switch(refPoints.rank()) {
1235 for(
int pt = 0; pt < refPoints.dimension(0); pt++){
1236 for(
int dm = 0; dm < refPoints.dimension(1) ; dm++){
1237 tempPoints(pt, dm) = refPoints(pt, dm);
1240 HGRAD_Basis -> getValues(basisVals, tempPoints, OPERATOR_VALUE);
1243 int cellLoop = (whichCell == -1) ? numCells : 1 ;
1246 for(
int cellOrd = 0; cellOrd < cellLoop; cellOrd++) {
1247 for(
int pointOrd = 0; pointOrd < numPoints; pointOrd++) {
1248 for(
int dim = 0; dim < spaceDim; dim++){
1249 for(
int bfOrd = 0; bfOrd < basisCardinality; bfOrd++){
1251 if(whichCell == -1){
1252 physPoints(cellOrd, pointOrd, dim) += cellWorkset(cellOrd, bfOrd, dim)*basisVals(bfOrd, pointOrd);
1255 physPoints(pointOrd, dim) += cellWorkset(whichCell, bfOrd, dim)*basisVals(bfOrd, pointOrd);
1271 for(
int cellOrd = 0; cellOrd < numCells; cellOrd++) {
1274 for(
int pt = 0; pt < refPoints.dimension(1); pt++){
1275 for(
int dm = 0; dm < refPoints.dimension(2) ; dm++){
1276 tempPoints(pt, dm) = refPoints(cellOrd, pt, dm);
1281 HGRAD_Basis -> getValues(basisVals, tempPoints, OPERATOR_VALUE);
1283 for(
int pointOrd = 0; pointOrd < numPoints; pointOrd++) {
1284 for(
int dim = 0; dim < spaceDim; dim++){
1285 for(
int bfOrd = 0; bfOrd < basisCardinality; bfOrd++){
1287 physPoints(cellOrd, pointOrd, dim) += cellWorkset(cellOrd, bfOrd, dim)*basisVals(bfOrd, pointOrd);
1297 TEUCHOS_TEST_FOR_EXCEPTION( !( (refPoints.rank() == 2) && (refPoints.rank() == 3) ), std::invalid_argument,
1298 ">>> ERROR (Intrepid::CellTools::mapToPhysicalFrame): rank 2 or 3 required for refPoints array. ");
1304 template<
class Scalar>
1305 template<
class ArrayRefPo
int,
class ArrayPhysPo
int,
class ArrayCell>
1307 const ArrayPhysPoint & physPoints,
1308 const ArrayCell & cellWorkset,
1309 const shards::CellTopology & cellTopo,
1310 const int & whichCell)
1312 INTREPID_VALIDATE( validateArguments_mapToReferenceFrame(refPoints, physPoints, cellWorkset, cellTopo, whichCell) );
1314 int spaceDim = (int)cellTopo.getDimension();
1320 switch( cellTopo.getKey() ){
1322 case shards::Line<2>::key:
1323 cellCenter(0) = 0.0;
break;
1325 case shards::Triangle<3>::key:
1326 case shards::Triangle<6>::key:
1327 cellCenter(0) = 1./3.; cellCenter(1) = 1./3.;
break;
1329 case shards::Quadrilateral<4>::key:
1330 case shards::Quadrilateral<9>::key:
1331 cellCenter(0) = 0.0; cellCenter(1) = 0.0;
break;
1333 case shards::Tetrahedron<4>::key:
1334 case shards::Tetrahedron<10>::key:
1335 case shards::Tetrahedron<11>::key:
1336 cellCenter(0) = 1./6.; cellCenter(1) = 1./6.; cellCenter(2) = 1./6.;
break;
1338 case shards::Hexahedron<8>::key:
1339 case shards::Hexahedron<27>::key:
1340 cellCenter(0) = 0.0; cellCenter(1) = 0.0; cellCenter(2) = 0.0;
break;
1342 case shards::Wedge<6>::key:
1343 case shards::Wedge<18>::key:
1344 cellCenter(0) = 1./3.; cellCenter(1) = 1./3.; cellCenter(2) = 0.0;
break;
1347 case shards::Quadrilateral<8>::key:
1348 case shards::Hexahedron<20>::key:
1349 case shards::Wedge<15>::key:
1350 TEUCHOS_TEST_FOR_EXCEPTION( (
true), std::invalid_argument,
1351 ">>> ERROR (Intrepid::CellTools::mapToReferenceFrame): Cell topology not supported. ");
1355 case shards::Line<3>::key:
1356 case shards::Beam<2>::key:
1357 case shards::Beam<3>::key:
1358 case shards::ShellLine<2>::key:
1359 case shards::ShellLine<3>::key:
1360 case shards::ShellTriangle<3>::key:
1361 case shards::ShellTriangle<6>::key:
1362 case shards::ShellQuadrilateral<4>::key:
1363 case shards::ShellQuadrilateral<8>::key:
1364 case shards::ShellQuadrilateral<9>::key:
1365 TEUCHOS_TEST_FOR_EXCEPTION( (
true), std::invalid_argument,
1366 ">>> ERROR (Intrepid::CellTools::mapToReferenceFrame): Cell topology not supported. ");
1369 TEUCHOS_TEST_FOR_EXCEPTION( (
true), std::invalid_argument,
1370 ">>> ERROR (Intrepid::CellTools::mapToReferenceFrame): Cell topology not supported.");
1377 if(whichCell == -1){
1379 numCells = cellWorkset.dimension(0);
1380 initGuess.
resize(numCells, numPoints, spaceDim);
1382 for(
int c = 0; c < numCells; c++){
1383 for(
int p = 0; p < numPoints; p++){
1384 for(
int d = 0; d < spaceDim; d++){
1385 initGuess(c, p, d) = cellCenter(d);
1392 numPoints = physPoints.dimension(0);
1393 initGuess.
resize(numPoints, spaceDim);
1395 for(
int p = 0; p < numPoints; p++){
1396 for(
int d = 0; d < spaceDim; d++){
1397 initGuess(p, d) = cellCenter(d);
1403 mapToReferenceFrameInitGuess(refPoints, initGuess, physPoints, cellWorkset, cellTopo, whichCell);
1408 template<
class Scalar>
1409 template<
class ArrayRefPo
int,
class ArrayInitGuess,
class ArrayPhysPo
int,
class ArrayCell>
1411 const ArrayInitGuess & initGuess,
1412 const ArrayPhysPoint & physPoints,
1413 const ArrayCell & cellWorkset,
1414 const shards::CellTopology & cellTopo,
1415 const int & whichCell)
1417 INTREPID_VALIDATE( validateArguments_mapToReferenceFrame(refPoints, initGuess, physPoints, cellWorkset, cellTopo, whichCell) );
1419 int spaceDim = (int)cellTopo.getDimension();
1432 if(whichCell == -1){
1433 numPoints = physPoints.dimension(1);
1434 numCells = cellWorkset.dimension(0);
1435 xOld.
resize(numCells, numPoints, spaceDim);
1436 xTem.
resize(numCells, numPoints, spaceDim);
1437 jacobian.
resize(numCells,numPoints, spaceDim, spaceDim);
1438 jacobInv.
resize(numCells,numPoints, spaceDim, spaceDim);
1439 error.
resize(numCells,numPoints);
1441 for(
int c = 0; c < numCells; c++){
1442 for(
int p = 0; p < numPoints; p++){
1443 for(
int d = 0; d < spaceDim; d++){
1444 xOld(c, p, d) = initGuess(c, p, d);
1451 numPoints = physPoints.dimension(0);
1452 xOld.
resize(numPoints, spaceDim);
1453 xTem.
resize(numPoints, spaceDim);
1454 jacobian.
resize(numPoints, spaceDim, spaceDim);
1455 jacobInv.
resize(numPoints, spaceDim, spaceDim);
1458 for(
int p = 0; p < numPoints; p++){
1459 for(
int d = 0; d < spaceDim; d++){
1460 xOld(p, d) = initGuess(p, d);
1471 setJacobian(jacobian, xOld, cellWorkset, cellTopo, whichCell);
1472 setJacobianInv(jacobInv, jacobian);
1475 mapToPhysicalFrame( xTem, xOld, cellWorkset, cellTopo, whichCell );
1486 if(whichCell == -1) {
1495 totalError = totalError;
1499 if (totalError < INTREPID_TOL) {
1502 else if ( iter > INTREPID_MAX_NEWTON) {
1503 INTREPID_VALIDATE(std::cout <<
" Intrepid::CellTools::mapToReferenceFrameInitGuess failed to converge to desired tolerance within "
1504 << INTREPID_MAX_NEWTON <<
" iterations\n" );
1515 template<
class Scalar>
1516 template<
class ArraySubcellPo
int,
class ArrayParamPo
int>
1518 const ArrayParamPoint & paramPoints,
1519 const int subcellDim,
1520 const int subcellOrd,
1521 const shards::CellTopology & parentCell){
1523 int cellDim = parentCell.getDimension();
1524 int numPts = paramPoints.dimension(0);
1526 #ifdef HAVE_INTREPID_DEBUG
1527 TEUCHOS_TEST_FOR_EXCEPTION( !(hasReferenceCell(parentCell) ), std::invalid_argument,
1528 ">>> ERROR (Intrepid::CellTools::mapToReferenceSubcell): the specified cell topology does not have a reference cell.");
1530 TEUCHOS_TEST_FOR_EXCEPTION( !( (1 <= subcellDim) && (subcellDim <= 2 ) ), std::invalid_argument,
1531 ">>> ERROR (Intrepid::CellTools::mapToReferenceSubcell): method defined only for 1 and 2-dimensional subcells.");
1533 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= subcellOrd) && (subcellOrd < (
int)parentCell.getSubcellCount(subcellDim) ) ), std::invalid_argument,
1534 ">>> ERROR (Intrepid::CellTools::mapToReferenceSubcell): subcell ordinal out of range.");
1537 std::string errmsg =
">>> ERROR (Intrepid::mapToReferenceSubcell):";
1538 TEUCHOS_TEST_FOR_EXCEPTION( !requireRankRange(errmsg, refSubcellPoints, 2,2), std::invalid_argument, errmsg);
1539 TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionRange(errmsg, refSubcellPoints, 1, cellDim, cellDim), std::invalid_argument, errmsg);
1542 TEUCHOS_TEST_FOR_EXCEPTION( !requireRankRange(errmsg, paramPoints, 2,2), std::invalid_argument, errmsg);
1543 TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionRange(errmsg, paramPoints, 1, subcellDim, subcellDim), std::invalid_argument, errmsg);
1546 TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionMatch(errmsg, refSubcellPoints, 0, paramPoints, 0), std::invalid_argument, errmsg);
1554 if(subcellDim == 2) {
1555 for(
int pt = 0; pt < numPts; pt++){
1556 double u = paramPoints(pt,0);
1557 double v = paramPoints(pt,1);
1560 for(
int dim = 0; dim < cellDim; dim++){
1561 refSubcellPoints(pt, dim) = subcellMap(subcellOrd, dim, 0) + \
1562 subcellMap(subcellOrd, dim, 1)*u + \
1563 subcellMap(subcellOrd, dim, 2)*v;
1567 else if(subcellDim == 1) {
1568 for(
int pt = 0; pt < numPts; pt++){
1569 for(
int dim = 0; dim < cellDim; dim++) {
1570 refSubcellPoints(pt, dim) = subcellMap(subcellOrd, dim, 0) + subcellMap(subcellOrd, dim, 1)*paramPoints(pt,0);
1575 TEUCHOS_TEST_FOR_EXCEPTION( !( (subcellDim == 1) || (subcellDim == 2) ), std::invalid_argument,
1576 ">>> ERROR (Intrepid::CellTools::mapToReferenceSubcell): method defined only for 1 and 2-subcells");
1582 template<
class Scalar>
1583 template<
class ArrayEdgeTangent>
1585 const int & edgeOrd,
1586 const shards::CellTopology & parentCell){
1588 int spaceDim = parentCell.getDimension();
1590 #ifdef HAVE_INTREPID_DEBUG
1592 TEUCHOS_TEST_FOR_EXCEPTION( !( (spaceDim == 2) || (spaceDim == 3) ), std::invalid_argument,
1593 ">>> ERROR (Intrepid::CellTools::getReferenceFaceTangents): two or three-dimensional parent cell required");
1595 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= edgeOrd) && (edgeOrd < (
int)parentCell.getSubcellCount(1) ) ), std::invalid_argument,
1596 ">>> ERROR (Intrepid::CellTools::getReferenceFaceTangents): edge ordinal out of bounds");
1598 TEUCHOS_TEST_FOR_EXCEPTION( !( refEdgeTangent.size() == spaceDim ), std::invalid_argument,
1599 ">>> ERROR (Intrepid::CellTools::getReferenceFaceTangents): output array size is required to match space dimension");
1608 refEdgeTangent(0) = edgeMap(edgeOrd, 0, 1);
1609 refEdgeTangent(1) = edgeMap(edgeOrd, 1, 1);
1613 refEdgeTangent(2) = edgeMap(edgeOrd, 2, 1);
1619 template<
class Scalar>
1620 template<
class ArrayFaceTangentU,
class ArrayFaceTangentV>
1622 ArrayFaceTangentV & vTan,
1623 const int & faceOrd,
1624 const shards::CellTopology & parentCell){
1626 #ifdef HAVE_INTREPID_DEBUG
1627 int spaceDim = parentCell.getDimension();
1628 TEUCHOS_TEST_FOR_EXCEPTION( !(spaceDim == 3), std::invalid_argument,
1629 ">>> ERROR (Intrepid::CellTools::getReferenceFaceTangents): three-dimensional parent cell required");
1631 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= faceOrd) && (faceOrd < (
int)parentCell.getSubcellCount(2) ) ), std::invalid_argument,
1632 ">>> ERROR (Intrepid::CellTools::getReferenceFaceTangents): face ordinal out of bounds");
1634 TEUCHOS_TEST_FOR_EXCEPTION( !( (uTan.rank() == 1) && (vTan.rank() == 1) ), std::invalid_argument,
1635 ">>> ERROR (Intrepid::CellTools::getReferenceFaceTangents): rank = 1 required for output arrays");
1637 TEUCHOS_TEST_FOR_EXCEPTION( !( uTan.dimension(0) == spaceDim ), std::invalid_argument,
1638 ">>> ERROR (Intrepid::CellTools::getReferenceFaceTangents): dim0 (spatial dim) must match that of parent cell");
1640 TEUCHOS_TEST_FOR_EXCEPTION( !( vTan.dimension(0) == spaceDim ), std::invalid_argument,
1641 ">>> ERROR (Intrepid::CellTools::getReferenceFaceTangents): dim0 (spatial dim) must match that of parent cell");
1652 uTan(0) = faceMap(faceOrd, 0, 1);
1653 uTan(1) = faceMap(faceOrd, 1, 1);
1654 uTan(2) = faceMap(faceOrd, 2, 1);
1657 vTan(0) = faceMap(faceOrd, 0, 2);
1658 vTan(1) = faceMap(faceOrd, 1, 2);
1659 vTan(2) = faceMap(faceOrd, 2, 2);
1664 template<
class Scalar>
1665 template<
class ArrayS
ideNormal>
1667 const int & sideOrd,
1668 const shards::CellTopology & parentCell){
1669 int spaceDim = parentCell.getDimension();
1670 #ifdef HAVE_INTREPID_DEBUG
1672 TEUCHOS_TEST_FOR_EXCEPTION( !( (spaceDim == 2) || (spaceDim == 3) ), std::invalid_argument,
1673 ">>> ERROR (Intrepid::CellTools::getReferenceSideNormal): two or three-dimensional parent cell required");
1676 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= sideOrd) && (sideOrd < (
int)parentCell.getSubcellCount(spaceDim - 1) ) ), std::invalid_argument,
1677 ">>> ERROR (Intrepid::CellTools::getReferenceSideNormal): side ordinal out of bounds");
1683 getReferenceEdgeTangent(refSideNormal, sideOrd, parentCell);
1686 Scalar temp = refSideNormal(0);
1687 refSideNormal(0) = refSideNormal(1);
1688 refSideNormal(1) = -temp;
1692 getReferenceFaceNormal(refSideNormal, sideOrd, parentCell);
1698 template<
class Scalar>
1699 template<
class ArrayFaceNormal>
1701 const int & faceOrd,
1702 const shards::CellTopology & parentCell){
1703 int spaceDim = parentCell.getDimension();
1705 #ifdef HAVE_INTREPID_DEBUG
1707 TEUCHOS_TEST_FOR_EXCEPTION( !(spaceDim == 3), std::invalid_argument,
1708 ">>> ERROR (Intrepid::CellTools::getReferenceFaceNormal): three-dimensional parent cell required");
1710 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= faceOrd) && (faceOrd < (
int)parentCell.getSubcellCount(2) ) ), std::invalid_argument,
1711 ">>> ERROR (Intrepid::CellTools::getReferenceFaceNormal): face ordinal out of bounds");
1713 TEUCHOS_TEST_FOR_EXCEPTION( !( refFaceNormal.rank() == 1 ), std::invalid_argument,
1714 ">>> ERROR (Intrepid::CellTools::getReferenceFaceNormal): rank = 1 required for output array");
1716 TEUCHOS_TEST_FOR_EXCEPTION( !( refFaceNormal.dimension(0) == spaceDim ), std::invalid_argument,
1717 ">>> ERROR (Intrepid::CellTools::getReferenceFaceNormal): dim0 (spatial dim) must match that of parent cell");
1723 getReferenceFaceTangents(uTan, vTan, faceOrd, parentCell);
1731 template<
class Scalar>
1732 template<
class ArrayEdgeTangent,
class ArrayJac>
1734 const ArrayJac & worksetJacobians,
1735 const int & worksetEdgeOrd,
1736 const shards::CellTopology & parentCell){
1737 int worksetSize = worksetJacobians.dimension(0);
1738 int edgePtCount = worksetJacobians.dimension(1);
1739 int pCellDim = parentCell.getDimension();
1741 #ifdef HAVE_INTREPID_DEBUG
1742 std::string errmsg =
">>> ERROR (Intrepid::CellTools::getPhysicalEdgeTangents):";
1744 TEUCHOS_TEST_FOR_EXCEPTION( !( (pCellDim == 3) || (pCellDim == 2) ), std::invalid_argument,
1745 ">>> ERROR (Intrepid::CellTools::getPhysicalEdgeTangents): 2D or 3D parent cell required");
1748 TEUCHOS_TEST_FOR_EXCEPTION( !requireRankRange(errmsg, edgeTangents, 3,3), std::invalid_argument, errmsg);
1749 TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionRange(errmsg, edgeTangents, 2, 2,3), std::invalid_argument, errmsg);
1752 TEUCHOS_TEST_FOR_EXCEPTION( !requireRankRange(errmsg, worksetJacobians, 4,4), std::invalid_argument, errmsg);
1753 TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionRange(errmsg, worksetJacobians, 2, 2,3), std::invalid_argument, errmsg);
1754 TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionRange(errmsg, worksetJacobians, 3, 2,3), std::invalid_argument, errmsg);
1757 TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionMatch(errmsg, edgeTangents, 0,1,2,2, worksetJacobians, 0,1,2,3), std::invalid_argument, errmsg);
1763 getReferenceEdgeTangent(refEdgeTan, worksetEdgeOrd, parentCell);
1766 for(
int pCell = 0; pCell < worksetSize; pCell++){
1767 for(
int pt = 0; pt < edgePtCount; pt++){
1770 for(
int i = 0; i < pCellDim; i++){
1771 edgeTangents(pCell, pt, i) = 0.0;
1772 for(
int j = 0; j < pCellDim; j++){
1773 edgeTangents(pCell, pt, i) += worksetJacobians(pCell, pt, i, j)*refEdgeTan(j);
1782 template<
class Scalar>
1783 template<
class ArrayFaceTangentU,
class ArrayFaceTangentV,
class ArrayJac>
1785 ArrayFaceTangentV & faceTanV,
1786 const ArrayJac & worksetJacobians,
1787 const int & worksetFaceOrd,
1788 const shards::CellTopology & parentCell){
1789 int worksetSize = worksetJacobians.dimension(0);
1790 int facePtCount = worksetJacobians.dimension(1);
1791 int pCellDim = parentCell.getDimension();
1793 #ifdef HAVE_INTREPID_DEBUG
1794 std::string errmsg =
">>> ERROR (Intrepid::CellTools::getPhysicalFaceTangents):";
1796 TEUCHOS_TEST_FOR_EXCEPTION( !(pCellDim == 3), std::invalid_argument,
1797 ">>> ERROR (Intrepid::CellTools::getPhysicalFaceTangents): three-dimensional parent cell required");
1800 TEUCHOS_TEST_FOR_EXCEPTION( !requireRankRange(errmsg, faceTanU, 3,3), std::invalid_argument, errmsg);
1801 TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionRange(errmsg, faceTanU, 2, 3,3), std::invalid_argument, errmsg);
1803 TEUCHOS_TEST_FOR_EXCEPTION( !requireRankRange(errmsg, faceTanV, 3,3), std::invalid_argument, errmsg);
1804 TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionRange(errmsg, faceTanV, 2, 3,3), std::invalid_argument, errmsg);
1806 TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionMatch(errmsg, faceTanU, faceTanV), std::invalid_argument, errmsg);
1809 TEUCHOS_TEST_FOR_EXCEPTION( !requireRankRange(errmsg, worksetJacobians, 4,4), std::invalid_argument, errmsg);
1810 TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionRange(errmsg, worksetJacobians, 2, 3,3), std::invalid_argument, errmsg);
1811 TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionRange(errmsg, worksetJacobians, 3, 3,3), std::invalid_argument, errmsg);
1814 TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionMatch(errmsg, faceTanU, 0,1,2,2, worksetJacobians, 0,1,2,3), std::invalid_argument, errmsg);
1821 getReferenceFaceTangents(refFaceTanU, refFaceTanV, worksetFaceOrd, parentCell);
1824 for(
int pCell = 0; pCell < worksetSize; pCell++){
1825 for(
int pt = 0; pt < facePtCount; pt++){
1828 for(
int dim = 0; dim < pCellDim; dim++){
1829 faceTanU(pCell, pt, dim) = 0.0;
1830 faceTanV(pCell, pt, dim) = 0.0;
1833 faceTanU(pCell, pt, dim) = \
1834 worksetJacobians(pCell, pt, dim, 0)*refFaceTanU(0) + \
1835 worksetJacobians(pCell, pt, dim, 1)*refFaceTanU(1) + \
1836 worksetJacobians(pCell, pt, dim, 2)*refFaceTanU(2);
1837 faceTanV(pCell, pt, dim) = \
1838 worksetJacobians(pCell, pt, dim, 0)*refFaceTanV(0) + \
1839 worksetJacobians(pCell, pt, dim, 1)*refFaceTanV(1) + \
1840 worksetJacobians(pCell, pt, dim, 2)*refFaceTanV(2);
1847 template<
class Scalar>
1848 template<
class ArrayS
ideNormal,
class ArrayJac>
1850 const ArrayJac & worksetJacobians,
1851 const int & worksetSideOrd,
1852 const shards::CellTopology & parentCell){
1853 int worksetSize = worksetJacobians.dimension(0);
1854 int sidePtCount = worksetJacobians.dimension(1);
1855 int spaceDim = parentCell.getDimension();
1857 #ifdef HAVE_INTREPID_DEBUG
1858 TEUCHOS_TEST_FOR_EXCEPTION( !( (spaceDim == 2) || (spaceDim == 3) ), std::invalid_argument,
1859 ">>> ERROR (Intrepid::CellTools::getPhysicalSideNormals): two or three-dimensional parent cell required");
1862 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= worksetSideOrd) && (worksetSideOrd < (
int)parentCell.getSubcellCount(spaceDim - 1) ) ), std::invalid_argument,
1863 ">>> ERROR (Intrepid::CellTools::getPhysicalSideNormals): side ordinal out of bounds");
1869 getPhysicalEdgeTangents(sideNormals, worksetJacobians, worksetSideOrd, parentCell);
1872 for(
int cell = 0; cell < worksetSize; cell++){
1873 for(
int pt = 0; pt < sidePtCount; pt++){
1874 Scalar temp = sideNormals(cell, pt, 0);
1875 sideNormals(cell, pt, 0) = sideNormals(cell, pt, 1);
1876 sideNormals(cell, pt, 1) = -temp;
1882 getPhysicalFaceNormals(sideNormals, worksetJacobians, worksetSideOrd, parentCell);
1888 template<
class Scalar>
1889 template<
class ArrayFaceNormal,
class ArrayJac>
1891 const ArrayJac & worksetJacobians,
1892 const int & worksetFaceOrd,
1893 const shards::CellTopology & parentCell){
1894 int worksetSize = worksetJacobians.dimension(0);
1895 int facePtCount = worksetJacobians.dimension(1);
1896 int pCellDim = parentCell.getDimension();
1898 #ifdef HAVE_INTREPID_DEBUG
1899 std::string errmsg =
">>> ERROR (Intrepid::CellTools::getPhysicalFaceNormals):";
1901 TEUCHOS_TEST_FOR_EXCEPTION( !(pCellDim == 3), std::invalid_argument,
1902 ">>> ERROR (Intrepid::CellTools::getPhysicalFaceNormals): three-dimensional parent cell required");
1905 TEUCHOS_TEST_FOR_EXCEPTION( !requireRankRange(errmsg, faceNormals, 3,3), std::invalid_argument, errmsg);
1906 TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionRange(errmsg, faceNormals, 2, 3,3), std::invalid_argument, errmsg);
1909 TEUCHOS_TEST_FOR_EXCEPTION( !requireRankRange(errmsg, worksetJacobians, 4,4), std::invalid_argument, errmsg);
1910 TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionRange(errmsg, worksetJacobians, 2, 3,3), std::invalid_argument, errmsg);
1911 TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionRange(errmsg, worksetJacobians, 3, 3,3), std::invalid_argument, errmsg);
1914 TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionMatch(errmsg, faceNormals, 0,1,2,2, worksetJacobians, 0,1,2,3), std::invalid_argument, errmsg);
1920 getPhysicalFaceTangents(faceTanU, faceTanV, worksetJacobians, worksetFaceOrd, parentCell);
1935 template<
class Scalar>
1938 const shards::CellTopology & cellTopo,
1939 const double & threshold) {
1940 #ifdef HAVE_INTREPID_DEBUG
1941 TEUCHOS_TEST_FOR_EXCEPTION( !(pointDim == (
int)cellTopo.getDimension() ), std::invalid_argument,
1942 ">>> ERROR (Intrepid::CellTools::checkPointInclusion): Point and cell dimensions do not match. ");
1947 double minus_one = -1.0 - threshold;
1948 double plus_one = 1.0 + threshold;
1949 double minus_zero = - threshold;
1954 unsigned key = cellTopo.getBaseCellTopologyData() -> key ;
1957 case shards::Line<>::key :
1958 if( !(minus_one <= point[0] && point[0] <= plus_one)) testResult = 0;
1961 case shards::Triangle<>::key : {
1962 Scalar distance = std::max( std::max( -point[0], -point[1] ), point[0] + point[1] - 1.0 );
1963 if( distance > threshold ) testResult = 0;
1967 case shards::Quadrilateral<>::key :
1968 if(!( (minus_one <= point[0] && point[0] <= plus_one) && \
1969 (minus_one <= point[1] && point[1] <= plus_one) ) ) testResult = 0;
1972 case shards::Tetrahedron<>::key : {
1973 Scalar distance = std::max( std::max(-point[0],-point[1]), \
1974 std::max(-point[2], point[0] + point[1] + point[2] - 1) );
1975 if( distance > threshold ) testResult = 0;
1979 case shards::Hexahedron<>::key :
1980 if(!((minus_one <= point[0] && point[0] <= plus_one) && \
1981 (minus_one <= point[1] && point[1] <= plus_one) && \
1982 (minus_one <= point[2] && point[2] <= plus_one))) \
1988 case shards::Wedge<>::key : {
1989 Scalar distance = std::max( std::max( -point[0], -point[1] ), point[0] + point[1] - 1 );
1990 if( distance > threshold || \
1991 point[2] < minus_one || point[2] > plus_one) \
1999 case shards::Pyramid<>::key : {
2000 Scalar left = minus_one + point[2];
2001 Scalar right = plus_one - point[2];
2002 if(!( (left <= point[0] && point[0] <= right) && \
2003 (left <= point[1] && point[1] <= right) &&
2004 (minus_zero <= point[2] && point[2] <= plus_one) ) ) \
2010 TEUCHOS_TEST_FOR_EXCEPTION( !( (key == shards::Line<>::key ) ||
2011 (key == shards::Triangle<>::key) ||
2012 (key == shards::Quadrilateral<>::key) ||
2013 (key == shards::Tetrahedron<>::key) ||
2014 (key == shards::Hexahedron<>::key) ||
2015 (key == shards::Wedge<>::key) ||
2016 (key == shards::Pyramid<>::key) ),
2017 std::invalid_argument,
2018 ">>> ERROR (Intrepid::CellTools::checkPointInclusion): Invalid cell topology. ");
2025 template<
class Scalar>
2026 template<
class ArrayPo
int>
2028 const shards::CellTopology & cellTopo,
2029 const double & threshold) {
2031 int rank = points.rank();
2033 #ifdef HAVE_INTREPID_DEBUG
2034 TEUCHOS_TEST_FOR_EXCEPTION( !( (1 <= points.rank() ) && (points.rank() <= 3) ), std::invalid_argument,
2035 ">>> ERROR (Intrepid::CellTools::checkPointsetInclusion): rank-1, 2 or 3 required for input points array. ");
2038 TEUCHOS_TEST_FOR_EXCEPTION( !( points.dimension(rank - 1) == (int)cellTopo.getDimension() ), std::invalid_argument,
2039 ">>> ERROR (Intrepid::CellTools::checkPointsetInclusion): Point and cell dimensions do not match. ");
2045 case 1: inRefCell.
resize(1);
break;
2046 case 2: inRefCell.
resize( points.dimension(0) );
break;
2047 case 3: inRefCell.
resize( points.dimension(0), points.dimension(1) );
break;
2051 checkPointwiseInclusion(inRefCell, points, cellTopo, threshold);
2055 for(
int i = 0; i < inRefCell.
size(); i++ ){
2056 if (inRefCell[i] == 0) {
2066 template<
class Scalar>
2067 template<
class ArrayIncl,
class ArrayPo
int>
2069 const ArrayPoint & points,
2070 const shards::CellTopology & cellTopo,
2071 const double & threshold) {
2072 int apRank = points.rank();
2074 #ifdef HAVE_INTREPID_DEBUG
2077 std::string errmsg =
">>> ERROR (Intrepid::CellTools::checkPointwiseInclusion):";
2078 if(points.rank() == 1) {
2079 TEUCHOS_TEST_FOR_EXCEPTION( !(inRefCell.rank() == 1 ), std::invalid_argument,
2080 ">>> ERROR (Intrepid::CellTools::checkPointwiseInclusion): rank-1 input array requires rank-1 output array.");
2081 TEUCHOS_TEST_FOR_EXCEPTION( !(inRefCell.dimension(0) == 1), std::invalid_argument,
2082 ">>> ERROR (Intrepid::CellTools::checkPointwiseInclusion): rank-1 input array requires dim0 = 1 for output array.");
2084 else if(points.rank() == 2){
2085 TEUCHOS_TEST_FOR_EXCEPTION( !(inRefCell.rank() == 1 ), std::invalid_argument,
2086 ">>> ERROR (Intrepid::CellTools::checkPointwiseInclusion): rank-2 input array requires rank-1 output array.");
2088 TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionMatch( errmsg, inRefCell, 0, points, 0), std::invalid_argument, errmsg);
2090 else if (points.rank() == 3) {
2091 TEUCHOS_TEST_FOR_EXCEPTION( !(inRefCell.rank() == 2 ), std::invalid_argument,
2092 ">>> ERROR (Intrepid::CellTools::checkPointwiseInclusion): rank-3 input array requires rank-2 output array.");
2094 TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionMatch( errmsg, inRefCell, 0,1, points, 0,1), std::invalid_argument, errmsg);
2097 TEUCHOS_TEST_FOR_EXCEPTION( !( (points.rank() == 1) || (points.rank() == 2) || (points.rank() == 3) ), std::invalid_argument,
2098 ">>> ERROR (Intrepid::CellTools::checkPointwiseInclusion): rank-1, 2 or 3 required for input points array. ");
2102 TEUCHOS_TEST_FOR_EXCEPTION( !( points.dimension(apRank - 1) == (int)cellTopo.getDimension() ), std::invalid_argument,
2103 ">>> ERROR (Intrepid::CellTools::checkPointwiseInclusion): Point and cell dimensions do not match. ");
2113 pointDim = points.dimension(0);
2116 dim1 = points.dimension(0);
2117 pointDim = points.dimension(1);
2120 dim0 = points.dimension(0);
2121 dim1 = points.dimension(1);
2122 pointDim = points.dimension(2);
2125 TEUCHOS_TEST_FOR_EXCEPTION( !( (1 <= points.rank() ) && (points.rank() <= 3) ), std::invalid_argument,
2126 ">>> ERROR (Intrepid::CellTools::checkPointwiseInclusion): rank-1, 2 or 3 required for input points array. ");
2138 Scalar point[3] = {0.0, 0.0, 0.0};
2140 for(
int i0 = 0; i0 < dim0; i0++){
2142 inPtr0 = outPtr0*pointDim;
2144 for(
int i1 = 0; i1 < dim1; i1++) {
2145 inPtr1 = inPtr0 + i1*pointDim;
2146 point[0] = points[inPtr1];
2148 point[1] = points[inPtr1 + 1];
2150 point[2] = points[inPtr1 + 2];
2152 TEUCHOS_TEST_FOR_EXCEPTION( !( (1 <= pointDim) && (pointDim <= 3)), std::invalid_argument,
2153 ">>> ERROR (Intrepid::CellTools::checkPointwiseInclusion): Input array specifies invalid point dimension ");
2157 inRefCell[outPtr0 + i1] = checkPointInclusion(point, pointDim, cellTopo, threshold);
2164 template<
class Scalar>
2165 template<
class ArrayIncl,
class ArrayPo
int,
class ArrayCell>
2167 const ArrayPoint & points,
2168 const ArrayCell & cellWorkset,
2169 const shards::CellTopology & cell,
2170 const int & whichCell,
2171 const double & threshold)
2173 INTREPID_VALIDATE( validateArguments_checkPointwiseInclusion(inCell, points, cellWorkset, whichCell, cell) );
2177 unsigned baseKey = cell.getBaseCellTopologyData() -> key;
2181 case shards::Line<>::key :
2182 case shards::Triangle<>::key:
2183 case shards::Quadrilateral<>::key :
2184 case shards::Tetrahedron<>::key :
2185 case shards::Hexahedron<>::key :
2186 case shards::Wedge<>::key :
2187 case shards::Pyramid<>::key :
2191 if(points.rank() == 2){
2192 refPoints.
resize(points.dimension(0), points.dimension(1) );
2193 mapToReferenceFrame(refPoints, points, cellWorkset, cell, whichCell);
2194 checkPointwiseInclusion(inCell, refPoints, cell, threshold );
2196 else if(points.rank() == 3){
2197 refPoints.
resize(points.dimension(0), points.dimension(1), points.dimension(2) );
2198 mapToReferenceFrame(refPoints, points, cellWorkset, cell, whichCell);
2199 checkPointwiseInclusion(inCell, refPoints, cell, threshold );
2204 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
2205 ">>> ERROR (Intrepid::CellTools::checkPointwiseInclusion): cell topology not supported");
2217 template<
class Scalar>
2218 template<
class ArrayJac,
class ArrayPo
int,
class ArrayCell>
2220 const ArrayPoint & points,
2221 const ArrayCell & cellWorkset,
2222 const int & whichCell,
2223 const shards::CellTopology & cellTopo){
2226 TEUCHOS_TEST_FOR_EXCEPTION( (cellWorkset.rank() != 3), std::invalid_argument,
2227 ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): rank = 3 required for cellWorkset array");
2229 TEUCHOS_TEST_FOR_EXCEPTION( (cellWorkset.dimension(0) <= 0), std::invalid_argument,
2230 ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 0 (number of cells) >= 1 required for cellWorkset array");
2232 TEUCHOS_TEST_FOR_EXCEPTION( (cellWorkset.dimension(1) != (int)cellTopo.getSubcellCount(0) ), std::invalid_argument,
2233 ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 1 (number of cell nodes) of cellWorkset array does not match cell topology");
2235 TEUCHOS_TEST_FOR_EXCEPTION( (cellWorkset.dimension(2) != (int)cellTopo.getDimension() ), std::invalid_argument,
2236 ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 2 (spatial dimension) of cellWorkset array does not match cell dimension");
2239 TEUCHOS_TEST_FOR_EXCEPTION( !( ( (0 <= whichCell ) && (whichCell < cellWorkset.dimension(0) ) ) || (whichCell == -1) ), std::invalid_argument,
2240 ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): whichCell = -1 or a valid cell ordinal is required.");
2245 if(points.rank() == 2) {
2246 TEUCHOS_TEST_FOR_EXCEPTION( (points.dimension(0) <= 0), std::invalid_argument,
2247 ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 0 (number of points) >= 1 required for points array ");
2249 TEUCHOS_TEST_FOR_EXCEPTION( (points.dimension(1) != (int)cellTopo.getDimension() ), std::invalid_argument,
2250 ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 1 (spatial dimension) of points array does not match cell dimension");
2253 if(whichCell == -1) {
2254 TEUCHOS_TEST_FOR_EXCEPTION( (jacobian.rank() != 4), std::invalid_argument,
2255 ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): rank = 4 required for jacobian array");
2257 TEUCHOS_TEST_FOR_EXCEPTION( (jacobian.dimension(0) != cellWorkset.dimension(0)), std::invalid_argument,
2258 ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 0 (number of cells) of jacobian array must equal dim 0 of cellWorkset array");
2260 TEUCHOS_TEST_FOR_EXCEPTION( (jacobian.dimension(1) != points.dimension(0)), std::invalid_argument,
2261 ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 1 (number of points) of jacobian array must equal dim 0 of points array");
2263 TEUCHOS_TEST_FOR_EXCEPTION( (jacobian.dimension(2) != points.dimension(1)), std::invalid_argument,
2264 ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 2 (spatial dimension) of jacobian array must equal dim 1 of points array");
2266 TEUCHOS_TEST_FOR_EXCEPTION( !(jacobian.dimension(2) == jacobian.dimension(3) ), std::invalid_argument,
2267 ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 2 = dim 3 (same spatial dimensions) required for jacobian array. ");
2269 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 < jacobian.dimension(3) ) && (jacobian.dimension(3) < 4) ), std::invalid_argument,
2270 ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 2 and dim 3 (spatial dimensions) must be between 1 and 3. ");
2274 TEUCHOS_TEST_FOR_EXCEPTION( (jacobian.rank() != 3), std::invalid_argument,
2275 ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): rank = 3 required for jacobian array");
2277 TEUCHOS_TEST_FOR_EXCEPTION( (jacobian.dimension(0) != points.dimension(0)), std::invalid_argument,
2278 ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 0 (number of points) of jacobian array must equal dim 0 of points array");
2280 TEUCHOS_TEST_FOR_EXCEPTION( (jacobian.dimension(1) != points.dimension(1)), std::invalid_argument,
2281 ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 1 (spatial dimension) of jacobian array must equal dim 1 of points array");
2283 TEUCHOS_TEST_FOR_EXCEPTION( !(jacobian.dimension(1) == jacobian.dimension(2) ), std::invalid_argument,
2284 ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 1 = dim 2 (same spatial dimensions) required for jacobian array. ");
2286 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 < jacobian.dimension(1) ) && (jacobian.dimension(1) < 4) ), std::invalid_argument,
2287 ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 1 and dim 2 (spatial dimensions) must be between 1 and 3. ");
2291 else if(points.rank() ==3){
2292 std::string errmsg =
">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian):";
2293 TEUCHOS_TEST_FOR_EXCEPTION( (points.dimension(0) != cellWorkset.dimension(0) ), std::invalid_argument,
2294 ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 0 (number of cells) of points array must equal dim 0 of cellWorkset array");
2296 TEUCHOS_TEST_FOR_EXCEPTION( (points.dimension(1) <= 0), std::invalid_argument,
2297 ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 1 (number of points) >= 1 required for points array ");
2299 TEUCHOS_TEST_FOR_EXCEPTION( (points.dimension(2) != (int)cellTopo.getDimension() ), std::invalid_argument,
2300 ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 2 (spatial dimension) of points array does not match cell dimension");
2302 TEUCHOS_TEST_FOR_EXCEPTION( (whichCell != -1), std::invalid_argument,
2303 ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): default value whichCell=-1 required for rank-3 input points");
2306 TEUCHOS_TEST_FOR_EXCEPTION( !requireRankRange(errmsg, jacobian, 4, 4), std::invalid_argument,errmsg);
2308 TEUCHOS_TEST_FOR_EXCEPTION( (jacobian.dimension(0) != points.dimension(0)), std::invalid_argument,
2309 ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 0 (number of cells) of jacobian array must equal dim 0 of points array");
2311 TEUCHOS_TEST_FOR_EXCEPTION( (jacobian.dimension(1) != points.dimension(1)), std::invalid_argument,
2312 ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 1 (number of points) of jacobian array must equal dim 1 of points array");
2314 TEUCHOS_TEST_FOR_EXCEPTION( (jacobian.dimension(2) != points.dimension(2)), std::invalid_argument,
2315 ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 2 (spatial dimension) of jacobian array must equal dim 2 of points array");
2317 TEUCHOS_TEST_FOR_EXCEPTION( !(jacobian.dimension(2) == jacobian.dimension(3) ), std::invalid_argument,
2318 ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 2 = dim 3 (same spatial dimensions) required for jacobian array. ");
2320 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 < jacobian.dimension(3) ) && (jacobian.dimension(3) < 4) ), std::invalid_argument,
2321 ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 2 and dim 3 (spatial dimensions) must be between 1 and 3. ");
2324 TEUCHOS_TEST_FOR_EXCEPTION( !( (points.rank() == 2) && (points.rank() ==3) ), std::invalid_argument,
2325 ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): rank = 2 or 3 required for points array");
2331 template<
class Scalar>
2332 template<
class ArrayJacInv,
class ArrayJac>
2334 const ArrayJac & jacobian)
2338 int jacobRank = jacobian.rank();
2339 TEUCHOS_TEST_FOR_EXCEPTION( !( (jacobRank == 4) || (jacobRank == 3) ), std::invalid_argument,
2340 ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobianInv): rank = 4 or 3 required for jacobian array. ");
2343 TEUCHOS_TEST_FOR_EXCEPTION( !(jacobian.dimension(jacobRank - 1) == jacobian.dimension(jacobRank - 2) ), std::invalid_argument,
2344 ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobianInv): dim(rank-2) = dim(rank-2) (same spatial dimensions) required for jacobian array. ");
2346 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 < jacobian.dimension(jacobRank - 1) ) && (jacobian.dimension(jacobRank - 1) < 4) ), std::invalid_argument,
2347 ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobianInv): dim(rank-1) and dim(rank-2) (spatial dimensions) must be between 1 and 3. ");
2350 std::string errmsg =
">>> ERROR (Intrepid::CellTools::validateArguments_setJacobianInv):";
2352 TEUCHOS_TEST_FOR_EXCEPTION( !(requireRankMatch(errmsg, jacobianInv, jacobian) ), std::invalid_argument, errmsg);
2354 TEUCHOS_TEST_FOR_EXCEPTION( !(requireDimensionMatch(errmsg, jacobianInv, jacobian) ), std::invalid_argument, errmsg);
2359 template<
class Scalar>
2360 template<
class ArrayJacDet,
class ArrayJac>
2362 const ArrayJac & jacobian)
2366 int jacobRank = jacobian.rank();
2367 TEUCHOS_TEST_FOR_EXCEPTION( !( (jacobRank == 4) || (jacobRank == 3) ), std::invalid_argument,
2368 ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobianInv): rank = 4 or 3 required for jacobian array. ");
2371 TEUCHOS_TEST_FOR_EXCEPTION( !(jacobian.dimension(jacobRank - 1) == jacobian.dimension(jacobRank - 2) ), std::invalid_argument,
2372 ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobianInv): dim(rank-2) = dim(rank-2) (same spatial dimensions) required for jacobian array. ");
2374 TEUCHOS_TEST_FOR_EXCEPTION( !( (0 < jacobian.dimension(jacobRank - 1) ) && (jacobian.dimension(jacobRank - 1) < 4) ), std::invalid_argument,
2375 ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobianInv): dim(rank-1) and dim(rank-2) (spatial dimensions) must be between 1 and 3. ");
2380 TEUCHOS_TEST_FOR_EXCEPTION( !(jacobianDet.rank() == 2), std::invalid_argument,
2381 ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobianDetArgs): rank = 2 required for jacobianDet if jacobian is rank-4. ");
2383 TEUCHOS_TEST_FOR_EXCEPTION( !(jacobianDet.dimension(0) == jacobian.dimension(0) ), std::invalid_argument,
2384 ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobianDetArgs): dim 0 (number of cells) of jacobianDet array must equal dim 0 of jacobian array. ");
2386 TEUCHOS_TEST_FOR_EXCEPTION( !(jacobianDet.dimension(1) == jacobian.dimension(1) ), std::invalid_argument,
2387 ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobianDetArgs): dim 1 (number of points) of jacobianDet array must equal dim 1 of jacobian array.");
2392 TEUCHOS_TEST_FOR_EXCEPTION( !(jacobianDet.rank() == 1), std::invalid_argument,
2393 ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobianDetArgs): rank = 1 required for jacobianDet if jacobian is rank-3. ");
2395 TEUCHOS_TEST_FOR_EXCEPTION( !(jacobianDet.dimension(0) == jacobian.dimension(0) ), std::invalid_argument,
2396 ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobianDetArgs): dim 0 (number of points) of jacobianDet array must equal dim 0 of jacobian array.");
2402 template<
class Scalar>
2403 template<
class ArrayPhysPo
int,
class ArrayRefPo
int,
class ArrayCell>
2405 const ArrayRefPoint & refPoints,
2406 const ArrayCell & cellWorkset,
2407 const shards::CellTopology & cellTopo,
2408 const int& whichCell)
2410 std::string errmsg =
">>> ERROR (Intrepid::CellTools::validateArguments_mapToPhysicalFrame):";
2413 TEUCHOS_TEST_FOR_EXCEPTION( (cellWorkset.rank() != 3), std::invalid_argument,
2414 ">>> ERROR (Intrepid::CellTools::validateArguments_mapToPhysicalFrame): rank = 3 required for cellWorkset array");
2416 TEUCHOS_TEST_FOR_EXCEPTION( (cellWorkset.dimension(0) <= 0), std::invalid_argument,
2417 ">>> ERROR (Intrepid::CellTools::validateArguments_mapToPhysicalFrame): dim 0 (number of cells) >= 1 required for cellWorkset array");
2419 TEUCHOS_TEST_FOR_EXCEPTION( (cellWorkset.dimension(1) != (int)cellTopo.getSubcellCount(0) ), std::invalid_argument,
2420 ">>> ERROR (Intrepid::CellTools::validateArguments_mapToPhysicalFrame): dim 1 (number of cell nodes) of cellWorkset array does not match cell topology");
2422 TEUCHOS_TEST_FOR_EXCEPTION( (cellWorkset.dimension(2) != (int)cellTopo.getDimension() ), std::invalid_argument,
2423 ">>> ERROR (Intrepid::CellTools::validateArguments_mapToPhysicalFrame): dim 2 (spatial dimension) of cellWorkset array does not match cell dimension");
2427 TEUCHOS_TEST_FOR_EXCEPTION( !( ( (0 <= whichCell ) && (whichCell < cellWorkset.dimension(0) ) ) || (whichCell == -1) ), std::invalid_argument,
2428 ">>> ERROR (Intrepid::CellTools::validateArguments_mapToPhysicalFrame): whichCell = -1 or a valid cell ordinal is required.");
2432 if(refPoints.rank() == 2) {
2433 TEUCHOS_TEST_FOR_EXCEPTION( (refPoints.dimension(0) <= 0), std::invalid_argument,
2434 ">>> ERROR (Intrepid::CellTools::validateArguments_mapToPhysicalFrame): dim 0 (number of points) >= 1 required for refPoints array ");
2436 TEUCHOS_TEST_FOR_EXCEPTION( (refPoints.dimension(1) != (int)cellTopo.getDimension() ), std::invalid_argument,
2437 ">>> ERROR (Intrepid::CellTools::validateArguments_mapToPhysicalFrame): dim 1 (spatial dimension) of refPoints array does not match cell dimension");
2440 if(whichCell == -1) {
2441 TEUCHOS_TEST_FOR_EXCEPTION( ( (physPoints.rank() != 3) && (whichCell == -1) ), std::invalid_argument,
2442 ">>> ERROR (Intrepid::CellTools::validateArguments_mapToPhysicalFrame): rank = 3 required for physPoints array for the default whichCell value");
2444 TEUCHOS_TEST_FOR_EXCEPTION( (physPoints.dimension(0) != cellWorkset.dimension(0)), std::invalid_argument,
2445 ">>> ERROR (Intrepid::CellTools::validateArguments_mapToPhysicalFrame): dim 0 (number of cells) of physPoints array must equal dim 0 of cellWorkset array");
2447 TEUCHOS_TEST_FOR_EXCEPTION( (physPoints.dimension(1) != refPoints.dimension(0)), std::invalid_argument,
2448 ">>> ERROR (Intrepid::CellTools::validateArguments_mapToPhysicalFrame): dim 1 (number of points) of physPoints array must equal dim 0 of refPoints array");
2450 TEUCHOS_TEST_FOR_EXCEPTION( (physPoints.dimension(2) != (int)cellTopo.getDimension()), std::invalid_argument,
2451 ">>> ERROR (Intrepid::CellTools::validateArguments_mapToPhysicalFrame): dim 2 (spatial dimension) does not match cell dimension ");
2455 TEUCHOS_TEST_FOR_EXCEPTION( (physPoints.rank() != 2), std::invalid_argument,
2456 ">>> ERROR (Intrepid::CellTools::validateArguments_mapToPhysicalFrame): rank = 2 required for physPoints array");
2458 TEUCHOS_TEST_FOR_EXCEPTION( (physPoints.dimension(0) != refPoints.dimension(0)), std::invalid_argument,
2459 ">>> ERROR (Intrepid::CellTools::validateArguments_mapToPhysicalFrame): dim 0 (number of points) of physPoints array must equal dim 0 of refPoints array");
2461 TEUCHOS_TEST_FOR_EXCEPTION( (physPoints.dimension(1) != (int)cellTopo.getDimension()), std::invalid_argument,
2462 ">>> ERROR (Intrepid::CellTools::validateArguments_mapToPhysicalFrame): dim 1 (spatial dimension) does not match cell dimension ");
2466 else if(refPoints.rank() == 3) {
2469 TEUCHOS_TEST_FOR_EXCEPTION( (refPoints.dimension(0) != cellWorkset.dimension(0) ), std::invalid_argument,
2470 ">>> ERROR (Intrepid::CellTools::validateArguments_mapToPhysicalFrame): dim 0 (number of cells) of refPoints and cellWorkset arraya are required to match ");
2472 TEUCHOS_TEST_FOR_EXCEPTION( (refPoints.dimension(1) <= 0), std::invalid_argument,
2473 ">>> ERROR (Intrepid::CellTools::validateArguments_mapToPhysicalFrame): dim 1 (number of points) >= 1 required for refPoints array ");
2475 TEUCHOS_TEST_FOR_EXCEPTION( (refPoints.dimension(2) != (int)cellTopo.getDimension() ), std::invalid_argument,
2476 ">>> ERROR (Intrepid::CellTools::validateArguments_mapToPhysicalFrame): dim 2 (spatial dimension) of refPoints array does not match cell dimension");
2479 TEUCHOS_TEST_FOR_EXCEPTION( (whichCell != -1), std::invalid_argument,
2480 ">>> ERROR (Intrepid::CellTools::validateArguments_mapToPhysicalFrame): default value is required for rank-3 refPoints array");
2483 TEUCHOS_TEST_FOR_EXCEPTION( !requireRankMatch(errmsg, refPoints, physPoints), std::invalid_argument, errmsg );
2484 TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionMatch(errmsg, refPoints, physPoints), std::invalid_argument, errmsg);
2488 TEUCHOS_TEST_FOR_EXCEPTION( !( (refPoints.rank() == 2) || (refPoints.rank() == 3) ), std::invalid_argument,
2489 ">>> ERROR (Intrepid::CellTools::validateArguments_mapToPhysicalFrame): rank = 2 or 3 required for refPoints array");
2495 template<
class Scalar>
2496 template<
class ArrayRefPo
int,
class ArrayPhysPo
int,
class ArrayCell>
2498 const ArrayPhysPoint & physPoints,
2499 const ArrayCell & cellWorkset,
2500 const shards::CellTopology & cellTopo,
2501 const int& whichCell)
2503 std::string errmsg =
">>> ERROR (Intrepid::CellTools::validateArguments_mapToReferenceFrame):";
2504 std::string errmsg1 =
">>> ERROR (Intrepid::CellTools::validateArguments_mapToReferenceFrame):";
2507 TEUCHOS_TEST_FOR_EXCEPTION( (cellWorkset.rank() != 3), std::invalid_argument,
2508 ">>> ERROR (Intrepid::CellTools::validateArguments_mapToReferenceFrame): rank = 3 required for cellWorkset array");
2510 TEUCHOS_TEST_FOR_EXCEPTION( (cellWorkset.dimension(0) <= 0), std::invalid_argument,
2511 ">>> ERROR (Intrepid::CellTools::validateArguments_mapToReferenceFrame): dim 0 (number of cells) >= 1 required for cellWorkset array");
2513 TEUCHOS_TEST_FOR_EXCEPTION( (cellWorkset.dimension(1) != (int)cellTopo.getSubcellCount(0) ), std::invalid_argument,
2514 ">>> ERROR (Intrepid::CellTools::validateArguments_mapToReferenceFrame): dim 1 (number of cell nodes) of cellWorkset array does not match cell topology");
2516 TEUCHOS_TEST_FOR_EXCEPTION( (cellWorkset.dimension(2) != (int)cellTopo.getDimension() ), std::invalid_argument,
2517 ">>> ERROR (Intrepid::CellTools::validateArguments_mapToReferenceFrame): dim 2 (spatial dimension) of cellWorkset array does not match cell dimension");
2520 TEUCHOS_TEST_FOR_EXCEPTION( !( ( (0 <= whichCell ) && (whichCell < cellWorkset.dimension(0) ) ) || (whichCell == -1) ), std::invalid_argument,
2521 ">>> ERROR (Intrepid::CellTools::validateArguments_mapToReferenceFrame): whichCell = -1 or a valid cell ordinal is required.");
2526 if(whichCell == -1) {
2528 errmsg1 +=
" default value of whichCell requires rank-3 arrays:";
2532 errmsg1 +=
" rank-2 arrays required when whichCell is valid cell ordinal";
2535 TEUCHOS_TEST_FOR_EXCEPTION( !requireRankRange(errmsg1, refPoints, validRank,validRank), std::invalid_argument, errmsg1);
2536 TEUCHOS_TEST_FOR_EXCEPTION( !requireRankMatch(errmsg1, physPoints, refPoints), std::invalid_argument, errmsg1);
2537 TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionMatch(errmsg1, refPoints, physPoints), std::invalid_argument, errmsg1);
2542 template<
class Scalar>
2543 template<
class ArrayRefPo
int,
class ArrayInitGuess,
class ArrayPhysPo
int,
class ArrayCell>
2545 const ArrayInitGuess & initGuess,
2546 const ArrayPhysPoint & physPoints,
2547 const ArrayCell & cellWorkset,
2548 const shards::CellTopology & cellTopo,
2549 const int& whichCell)
2552 validateArguments_mapToReferenceFrame(refPoints, physPoints, cellWorkset, cellTopo, whichCell);
2555 std::string errmsg =
">>> ERROR (Intrepid::CellTools::validateArguments_mapToReferenceFrame):";
2556 TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionMatch(errmsg, initGuess, physPoints), std::invalid_argument, errmsg);
2560 template<
class Scalar>
2561 template<
class ArrayIncl,
class ArrayPo
int,
class ArrayCell>
2563 const ArrayPoint & physPoints,
2564 const ArrayCell & cellWorkset,
2565 const int & whichCell,
2566 const shards::CellTopology & cell)
2569 TEUCHOS_TEST_FOR_EXCEPTION( (cellWorkset.rank() != 3), std::invalid_argument,
2570 ">>> ERROR (Intrepid::CellTools::validateArguments_checkPointwiseInclusion): rank = 3 required for cellWorkset array");
2572 TEUCHOS_TEST_FOR_EXCEPTION( (cellWorkset.dimension(0) <= 0), std::invalid_argument,
2573 ">>> ERROR (Intrepid::CellTools::validateArguments_checkPointwiseInclusion): dim 0 (number of cells) >= 1 required for cellWorkset array");
2575 TEUCHOS_TEST_FOR_EXCEPTION( (cellWorkset.dimension(1) != (int)cell.getSubcellCount(0) ), std::invalid_argument,
2576 ">>> ERROR (Intrepid::CellTools::validateArguments_checkPointwiseInclusion): dim 1 (number of cell nodes) of cellWorkset array does not match cell topology");
2578 TEUCHOS_TEST_FOR_EXCEPTION( (cellWorkset.dimension(2) != (int)cell.getDimension() ), std::invalid_argument,
2579 ">>> ERROR (Intrepid::CellTools::validateArguments_checkPointwiseInclusion): dim 2 (spatial dimension) of cellWorkset array does not match cell dimension");
2583 TEUCHOS_TEST_FOR_EXCEPTION( !( ( (0 <= whichCell ) && (whichCell < cellWorkset.dimension(0) ) ) || (whichCell == -1) ), std::invalid_argument,
2584 ">>> ERROR (Intrepid::CellTools::validateArguments_checkPointwiseInclusion): whichCell = -1 or a valid cell ordinal is required.");
2589 if(physPoints.rank() == 2) {
2591 TEUCHOS_TEST_FOR_EXCEPTION( (whichCell == -1), std::invalid_argument,
2592 ">>> ERROR (Intrepid::CellTools::validateArguments_checkPointwiseInclusion): whichCell = a valid cell ordinal is required with rank-2 input array.");
2594 TEUCHOS_TEST_FOR_EXCEPTION( (physPoints.dimension(0) <= 0), std::invalid_argument,
2595 ">>> ERROR (Intrepid::CellTools::validateArguments_checkPointwiseInclusion): dim 0 (number of points) >= 1 required for physPoints array ");
2597 TEUCHOS_TEST_FOR_EXCEPTION( (physPoints.dimension(1) != (int)cell.getDimension() ), std::invalid_argument,
2598 ">>> ERROR (Intrepid::CellTools::validateArguments_checkPointwiseInclusion): dim 1 (spatial dimension) of physPoints array does not match cell dimension");
2601 TEUCHOS_TEST_FOR_EXCEPTION( (inCell.rank() != 1), std::invalid_argument,
2602 ">>> ERROR (Intrepid::CellTools::validateArguments_checkPointwiseInclusion): rank = 1 required for inCell array");
2604 TEUCHOS_TEST_FOR_EXCEPTION( (inCell.dimension(0) != physPoints.dimension(0)), std::invalid_argument,
2605 ">>> ERROR (Intrepid::CellTools::validateArguments_checkPointwiseInclusion): dim 0 (number of points) of inCell array must equal dim 0 of physPoints array");
2608 else if (physPoints.rank() == 3){
2610 TEUCHOS_TEST_FOR_EXCEPTION( !(whichCell == -1), std::invalid_argument,
2611 ">>> ERROR (Intrepid::CellTools::validateArguments_checkPointwiseInclusion): whichCell = -1 is required with rank-3 input array.");
2613 TEUCHOS_TEST_FOR_EXCEPTION( (physPoints.dimension(0) != cellWorkset.dimension(0) ), std::invalid_argument,
2614 ">>> ERROR (Intrepid::CellTools::validateArguments_checkPointwiseInclusion): dim 0 (number of cells) of physPoints array must equal dim 0 of cellWorkset array ");
2616 TEUCHOS_TEST_FOR_EXCEPTION( (physPoints.dimension(1) <= 0), std::invalid_argument,
2617 ">>> ERROR (Intrepid::CellTools::validateArguments_checkPointwiseInclusion): dim 1 (number of points) >= 1 required for physPoints array ");
2619 TEUCHOS_TEST_FOR_EXCEPTION( (physPoints.dimension(2) != (int)cell.getDimension() ), std::invalid_argument,
2620 ">>> ERROR (Intrepid::CellTools::validateArguments_checkPointwiseInclusion): dim 2 (spatial dimension) of physPoints array does not match cell dimension");
2623 TEUCHOS_TEST_FOR_EXCEPTION( (inCell.rank() != 2), std::invalid_argument,
2624 ">>> ERROR (Intrepid::CellTools::validateArguments_checkPointwiseInclusion): rank = 2 required for inCell array");
2626 TEUCHOS_TEST_FOR_EXCEPTION( (inCell.dimension(0) != physPoints.dimension(0)), std::invalid_argument,
2627 ">>> ERROR (Intrepid::CellTools::validateArguments_checkPointwiseInclusion): dim 0 (number of cells) of inCell array must equal dim 0 of physPoints array");
2629 TEUCHOS_TEST_FOR_EXCEPTION( (inCell.dimension(1) != physPoints.dimension(1)), std::invalid_argument,
2630 ">>> ERROR (Intrepid::CellTools::validateArguments_checkPointwiseInclusion): dim 1 (number of points) of inCell array must equal dim 1 of physPoints array");
2633 TEUCHOS_TEST_FOR_EXCEPTION( !( (physPoints.rank() == 2) && (physPoints.rank() ==3) ), std::invalid_argument,
2634 ">>> ERROR (Intrepid::CellTools::validateArguments_checkPointwiseInclusion): rank = 2 or 3 required for points array");
2647 template<
class Scalar>
2649 const int subcellOrd,
2650 const shards::CellTopology & parentCell){
2653 int subcVertexCount = parentCell.getVertexCount(subcellDim, subcellOrd);
2654 int cellDim = parentCell.getDimension();
2660 getReferenceSubcellVertices(subcellVertices,
2667 <<
" Subcell " << std::setw(2) << subcellOrd
2668 <<
" is " << parentCell.getName(subcellDim, subcellOrd) <<
" with vertices = {";
2671 for(
int subcVertOrd = 0; subcVertOrd < subcVertexCount; subcVertOrd++){
2675 for(
int dim = 0; dim < (int)parentCell.getDimension(); dim++){
2676 std::cout << subcellVertices(subcVertOrd, dim);
2677 if(dim < (
int)parentCell.getDimension()-1 ) { std::cout <<
","; }
2680 if(subcVertOrd < subcVertexCount - 1) { std::cout <<
", "; }
2686 template<
class Scalar>
2687 template<
class ArrayCell>
2689 const shards::CellTopology & parentCell,
2690 const int& pCellOrd,
2691 const int& subcellDim,
2692 const int& subcellOrd,
2693 const int& fieldWidth){
2696 int subcNodeCount = parentCell.getNodeCount(subcellDim, subcellOrd);
2697 int pCellDim = parentCell.getDimension();
2698 std::vector<int> subcNodeOrdinals(subcNodeCount);
2700 for(
int i = 0; i < subcNodeCount; i++){
2701 subcNodeOrdinals[i] = parentCell.getNodeMap(subcellDim, subcellOrd, i);
2707 <<
" Subcell " << subcellOrd <<
" on parent cell " << pCellOrd <<
" is "
2708 << parentCell.getName(subcellDim, subcellOrd) <<
" with node(s) \n ({";
2710 for(
int i = 0; i < subcNodeCount; i++){
2713 for(
int dim = 0; dim < pCellDim; dim++){
2715 << std::setw(fieldWidth) << std::right << cellWorkset(pCellOrd, subcNodeOrdinals[i], dim);
2716 if(dim < pCellDim - 1){ std::cout <<
","; }
2719 if(i < subcNodeCount - 1){ std::cout <<
", {"; }
2721 std::cout <<
")\n\n";
int size() const
Returns size of the FieldContainer defined as the product of its dimensions.
Implementation of the default H(grad)-compatible FEM basis of degree 1 on Wedge cell.
Implementation of the default H(grad)-compatible FEM basis of degree 2 on Wedge cell.
#define INTREPID_MAX_NEWTON
Maximum number of Newton iterations used internally in methods such as computing the action of the in...
int dimension(const int whichDim) const
Returns the specified dimension.
Implementation of the default H(grad)-compatible FEM basis of degree 2 on Hexahedron cell...
Implementation of the default H(grad)-compatible FEM basis of degree 1 on Line cell.
Implementation of the default H(grad)-compatible FEM basis of degree 1 on Triangle cell...
Implementation of the default H(grad)-compatible FEM basis of degree 1 on Quadrilateral cell...
Implementation of the default H(grad)-compatible FEM basis of degree 2 on Tetrahedron cell...
Implementation of the default H(grad)-compatible FEM basis of degree 2 on Quadrilateral cell...
void resize(const int dim0)
Resizes FieldContainer to a rank-1 container with the specified dimension, initialized by 0...
Implementation of the default H(grad)-compatible FEM basis of degree 1 on Hexahedron cell...
Implementation of the default H(grad)-compatible FEM basis of degree 2 on Triangle cell...
Implementation of the default H(grad)-compatible FEM basis of degree 1 on Tetrahedron cell...