49 #ifndef INTREPID_CELLTOOLSDEF_HPP 
   50 #define INTREPID_CELLTOOLSDEF_HPP 
   53 #if defined (__clang__) && !defined (__INTEL_COMPILER) 
   54 #pragma clang system_header 
   59   template<
class Scalar>
 
   61                                                                              const shards::CellTopology& parentCell){
 
   63 #ifdef HAVE_INTREPID_DEBUG 
   64     TEUCHOS_TEST_FOR_EXCEPTION( !(hasReferenceCell(parentCell) ), std::invalid_argument, 
 
   65                         ">>> ERROR (Intrepid::CellTools::getSubcellParametrization): the specified cell topology does not have a reference cell.");
 
   67     TEUCHOS_TEST_FOR_EXCEPTION( !( (1 <= subcellDim) && (subcellDim <= 2 ) ), std::invalid_argument,
 
   68                            ">>> ERROR (Intrepid::CellTools::getSubcellParametrization): parametrization defined only for 1 and 2-dimensional subcells.");    
 
  115     switch(parentCell.getKey() ) {
 
  118       case shards::Tetrahedron<4>::key:
 
  119       case shards::Tetrahedron<8>::key:
 
  120       case shards::Tetrahedron<10>::key:
 
  121       case shards::Tetrahedron<11>::key:
 
  122         if(subcellDim == 2) {
 
  124             setSubcellParametrization(tetFaces, subcellDim, parentCell);
 
  129         else if(subcellDim == 1) {
 
  131             setSubcellParametrization(tetEdges, subcellDim, parentCell);
 
  137           TEUCHOS_TEST_FOR_EXCEPTION( (subcellDim != 1 || subcellDim != 2), std::invalid_argument, 
 
  138                               ">>> ERROR (Intrepid::CellTools::getSubcellParametrization): Tet parametrizations defined for 1 and 2-subcells only");
 
  143       case shards::Hexahedron<8>::key:
 
  144       case shards::Hexahedron<20>::key:
 
  145       case shards::Hexahedron<27>::key:
 
  146         if(subcellDim == 2) {
 
  148             setSubcellParametrization(hexFaces, subcellDim, parentCell);
 
  153         else if(subcellDim == 1) {
 
  155             setSubcellParametrization(hexEdges, subcellDim, parentCell);
 
  161           TEUCHOS_TEST_FOR_EXCEPTION( (subcellDim != 1 || subcellDim != 2), std::invalid_argument, 
 
  162                               ">>> ERROR (Intrepid::CellTools::getSubcellParametrization): Hex parametrizations defined for 1 and 2-subcells only");
 
  167       case shards::Pyramid<5>::key:
 
  168       case shards::Pyramid<13>::key:
 
  169       case shards::Pyramid<14>::key:
 
  170         if(subcellDim == 2) {
 
  172             setSubcellParametrization(pyrFaces, subcellDim, parentCell);
 
  177         else if(subcellDim == 1) {
 
  179             setSubcellParametrization(pyrEdges, subcellDim, parentCell);
 
  185           TEUCHOS_TEST_FOR_EXCEPTION( (subcellDim != 1 || subcellDim != 2), std::invalid_argument, 
 
  186                               ">>> ERROR (Intrepid::CellTools::getSubcellParametrization): Pyramid parametrizations defined for 1 and 2-subcells only");
 
  191       case shards::Wedge<6>::key:
 
  192       case shards::Wedge<15>::key:
 
  193       case shards::Wedge<18>::key:
 
  194         if(subcellDim == 2) {
 
  196             setSubcellParametrization(wedgeFaces, subcellDim, parentCell);
 
  201         else if(subcellDim == 1) {
 
  203             setSubcellParametrization(wedgeEdges, subcellDim, parentCell);
 
  209           TEUCHOS_TEST_FOR_EXCEPTION( (subcellDim != 1 || subcellDim != 2), std::invalid_argument, 
 
  210                               ">>> ERROR (Intrepid::CellTools::getSubcellParametrization): Wedge parametrization defined for 1 and 2-subcells only");
 
  216       case shards::Triangle<3>::key:
 
  217       case shards::Triangle<4>::key:
 
  218       case shards::Triangle<6>::key:
 
  219         if(subcellDim == 1) {
 
  221             setSubcellParametrization(triEdges, subcellDim, parentCell);
 
  227           TEUCHOS_TEST_FOR_EXCEPTION( 
true, std::invalid_argument, 
 
  228                               ">>> ERROR (Intrepid::CellTools::getSubcellParametrization): Triangle parametrizations defined for 1-subcells only");
 
  232       case shards::Quadrilateral<4>::key:
 
  233       case shards::Quadrilateral<8>::key:
 
  234       case shards::Quadrilateral<9>::key:
 
  235         if(subcellDim == 1) {
 
  237             setSubcellParametrization(quadEdges, subcellDim, parentCell);
 
  243           TEUCHOS_TEST_FOR_EXCEPTION( 
true, std::invalid_argument, 
 
  244                               ">>> ERROR (Intrepid::CellTools::getSubcellParametrization): Quad parametrizations defined for 1-subcells only");
 
  251       case shards::ShellTriangle<3>::key:
 
  252       case shards::ShellTriangle<6>::key:
 
  253         if(subcellDim == 2) {
 
  254           if(!shellTriFacesSet){
 
  255             setSubcellParametrization(shellTriFaces, subcellDim, parentCell);
 
  256             shellTriFacesSet = 1;
 
  258           return shellTriFaces;
 
  260         else if(subcellDim == 1) {
 
  261           if(!shellTriEdgesSet){
 
  262             setSubcellParametrization(shellTriEdges, subcellDim, parentCell);
 
  263             shellTriEdgesSet = 1;
 
  265           return shellTriEdges;
 
  267         else if( subcellDim != 1 || subcellDim != 2){
 
  268           TEUCHOS_TEST_FOR_EXCEPTION( 
true, std::invalid_argument, 
 
  269                               ">>> ERROR (Intrepid::CellTools::getSubcellParametrization): Shell Triangle parametrizations defined for 1 and 2-subcells only");
 
  273       case shards::ShellQuadrilateral<4>::key:
 
  274       case shards::ShellQuadrilateral<8>::key:
 
  275       case shards::ShellQuadrilateral<9>::key:
 
  276         if(subcellDim == 2) {
 
  277           if(!shellQuadFacesSet){
 
  278             setSubcellParametrization(shellQuadFaces, subcellDim, parentCell);
 
  279             shellQuadFacesSet = 1;
 
  281           return shellQuadFaces;
 
  283         else if(subcellDim == 1) {
 
  284           if(!shellQuadEdgesSet){
 
  285             setSubcellParametrization(shellQuadEdges, subcellDim, parentCell);
 
  286             shellQuadEdgesSet = 1;
 
  288           return shellQuadEdges;
 
  290         else if( subcellDim != 1 || subcellDim != 2){
 
  291           TEUCHOS_TEST_FOR_EXCEPTION( 
true, std::invalid_argument, 
 
  292                               ">>> ERROR (Intrepid::CellTools::getSubcellParametrization): Shell Quad parametrizations defined for 1 and 2-subcells only");
 
  299       case shards::ShellLine<2>::key:
 
  300       case shards::ShellLine<3>::key:
 
  301       case shards::Beam<2>::key:
 
  302       case shards::Beam<3>::key:
 
  303         if(subcellDim == 1) {
 
  305             setSubcellParametrization(lineEdges, subcellDim, parentCell);
 
  311           TEUCHOS_TEST_FOR_EXCEPTION( 
true, std::invalid_argument, 
 
  312                               ">>> ERROR (Intrepid::CellTools::getSubcellParametrization): shell line/beam parametrizations defined for 1-subcells only");
 
  317         TEUCHOS_TEST_FOR_EXCEPTION( 
true, std::invalid_argument, 
 
  318                             ">>> ERROR (Intrepid::CellTools::getSubcellParametrization): invalid cell topology.");
 
  326   template<
class Scalar>
 
  328                                                     const int                   subcellDim,
 
  329                                                     const shards::CellTopology& parentCell)
 
  331 #ifdef HAVE_INTREPID_DEBUG 
  332     TEUCHOS_TEST_FOR_EXCEPTION( !(hasReferenceCell(parentCell) ), std::invalid_argument, 
 
  333                         ">>> ERROR (Intrepid::CellTools::setSubcellParametrization): the specified cell topology does not have a reference cell.");
 
  335     TEUCHOS_TEST_FOR_EXCEPTION( !( (1 <= subcellDim) && (subcellDim <= 2 ) ), std::invalid_argument,
 
  336                         ">>> ERROR (Intrepid::CellTools::setSubcellParametrization): parametrization defined only for 1 and 2-dimensional subcells.");    
 
  356     unsigned sc    = parentCell.getSubcellCount(subcellDim);
 
  357     unsigned pcd   = parentCell.getDimension();   
 
  358     unsigned coeff = (subcellDim == 1) ? 2 : 3;
 
  362     subcellParametrization.
resize(sc, pcd, coeff);
 
  366       for(
unsigned subcellOrd = 0; subcellOrd < sc; subcellOrd++){
 
  368         int v0ord = parentCell.getNodeMap(subcellDim, subcellOrd, 0);
 
  369         int v1ord = parentCell.getNodeMap(subcellDim, subcellOrd, 1);
 
  373         const double* v0 = getReferenceVertex(parentCell, v0ord);
 
  374         const double* v1 = getReferenceVertex(parentCell, v1ord);
 
  377         subcellParametrization(subcellOrd, 0, 0) = (v0[0] + v1[0])/2.0;
 
  378         subcellParametrization(subcellOrd, 0, 1) = (v1[0] - v0[0])/2.0;
 
  381         subcellParametrization(subcellOrd, 1, 0) = (v0[1] + v1[1])/2.0;
 
  382         subcellParametrization(subcellOrd, 1, 1) = (v1[1] - v0[1])/2.0;
 
  386           subcellParametrization(subcellOrd, 2, 0) = (v0[2] + v1[2])/2.0;
 
  387           subcellParametrization(subcellOrd, 2, 1) = (v1[2] - v0[2])/2.0;
 
  395       else if(subcellDim == 2) {
 
  396         for(
unsigned subcellOrd = 0; subcellOrd < sc; subcellOrd++){
 
  398           switch(parentCell.getKey(subcellDim,subcellOrd)){
 
  401             case shards::Triangle<3>::key:
 
  402             case shards::Triangle<4>::key:
 
  403             case shards::Triangle<6>::key: 
 
  405                 int v0ord = parentCell.getNodeMap(subcellDim, subcellOrd, 0);
 
  406                 int v1ord = parentCell.getNodeMap(subcellDim, subcellOrd, 1);
 
  407                 int v2ord = parentCell.getNodeMap(subcellDim, subcellOrd, 2);
 
  408                 const double* v0 = getReferenceVertex(parentCell, v0ord);
 
  409                 const double* v1 = getReferenceVertex(parentCell, v1ord);
 
  410                 const double* v2 = getReferenceVertex(parentCell, v2ord);
 
  413                 subcellParametrization(subcellOrd, 0, 0) = v0[0];
 
  414                 subcellParametrization(subcellOrd, 0, 1) = v1[0] - v0[0];
 
  415                 subcellParametrization(subcellOrd, 0, 2) = v2[0] - v0[0];
 
  418                 subcellParametrization(subcellOrd, 1, 0) = v0[1];
 
  419                 subcellParametrization(subcellOrd, 1, 1) = v1[1] - v0[1];
 
  420                 subcellParametrization(subcellOrd, 1, 2) = v2[1] - v0[1];
 
  423                 subcellParametrization(subcellOrd, 2, 0) = v0[2];
 
  424                 subcellParametrization(subcellOrd, 2, 1) = v1[2] - v0[2];
 
  425                 subcellParametrization(subcellOrd, 2, 2) = v2[2] - v0[2];
 
  430             case shards::Quadrilateral<4>::key:
 
  431             case shards::Quadrilateral<8>::key:
 
  432             case shards::Quadrilateral<9>::key:
 
  434                 int v0ord = parentCell.getNodeMap(subcellDim, subcellOrd, 0);
 
  435                 int v1ord = parentCell.getNodeMap(subcellDim, subcellOrd, 1);
 
  436                 int v2ord = parentCell.getNodeMap(subcellDim, subcellOrd, 2);
 
  437                 int v3ord = parentCell.getNodeMap(subcellDim, subcellOrd, 3);
 
  438                 const double* v0 = getReferenceVertex(parentCell, v0ord);
 
  439                 const double* v1 = getReferenceVertex(parentCell, v1ord);
 
  440                 const double* v2 = getReferenceVertex(parentCell, v2ord);
 
  441                 const double* v3 = getReferenceVertex(parentCell, v3ord);
 
  444                 subcellParametrization(subcellOrd, 0, 0) = ( v0[0] + v1[0] + v2[0] + v3[0])/4.0;
 
  445                 subcellParametrization(subcellOrd, 0, 1) = (-v0[0] + v1[0] + v2[0] - v3[0])/4.0;
 
  446                 subcellParametrization(subcellOrd, 0, 2) = (-v0[0] - v1[0] + v2[0] + v3[0])/4.0;
 
  449                 subcellParametrization(subcellOrd, 1, 0) = ( v0[1] + v1[1] + v2[1] + v3[1])/4.0;
 
  450                 subcellParametrization(subcellOrd, 1, 1) = (-v0[1] + v1[1] + v2[1] - v3[1])/4.0;
 
  451                 subcellParametrization(subcellOrd, 1, 2) = (-v0[1] - v1[1] + v2[1] + v3[1])/4.0;
 
  454                 subcellParametrization(subcellOrd, 2, 0) = ( v0[2] + v1[2] + v2[2] + v3[2])/4.0;
 
  455                 subcellParametrization(subcellOrd, 2, 1) = (-v0[2] + v1[2] + v2[2] - v3[2])/4.0;
 
  456                 subcellParametrization(subcellOrd, 2, 2) = (-v0[2] - v1[2] + v2[2] + v3[2])/4.0;
 
  460               TEUCHOS_TEST_FOR_EXCEPTION( 
true, std::invalid_argument, 
 
  461                                   ">>> ERROR (Intrepid::CellTools::setSubcellParametrization): parametrization not defined for the specified face topology.");
 
  470   template<
class Scalar>
 
  472                                                       const int                   vertexOrd){
 
  474 #ifdef HAVE_INTREPID_DEBUG 
  475     TEUCHOS_TEST_FOR_EXCEPTION( !(hasReferenceCell(cell) ), std::invalid_argument, 
 
  476                         ">>> ERROR (Intrepid::CellTools::getReferenceVertex): the specified cell topology does not have a reference cell.");
 
  478     TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= vertexOrd) && (vertexOrd < (
int)cell.getVertexCount() ) ), std::invalid_argument,
 
  479                         ">>> ERROR (Intrepid::CellTools::getReferenceVertex): invalid node ordinal for the specified cell topology. ");
 
  483     return getReferenceNode(cell.getBaseCellTopologyData(), vertexOrd);
 
  488   template<
class Scalar>
 
  489   template<
class ArraySubcellVert>
 
  491                                                       const int                   subcellDim,
 
  492                                                       const int                   subcellOrd,
 
  493                                                       const shards::CellTopology& parentCell){
 
  494 #ifdef HAVE_INTREPID_DEBUG 
  495     TEUCHOS_TEST_FOR_EXCEPTION( !(hasReferenceCell(parentCell) ), std::invalid_argument, 
 
  496                         ">>> ERROR (Intrepid::CellTools::getReferenceSubcellVertices): the specified cell topology does not have a reference cell.");
 
  500     TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= subcellDim) && (subcellDim <= (
int)parentCell.getDimension()) ), std::invalid_argument,
 
  501                         ">>> ERROR (Intrepid::CellTools::getReferenceSubcellVertices): subcell dimension out of range.");
 
  503     TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= subcellOrd) && (subcellOrd < (
int)parentCell.getSubcellCount(subcellDim) ) ), std::invalid_argument,
 
  504                         ">>> ERROR (Intrepid::CellTools::getReferenceSubcellVertices): subcell ordinal out of range.");
 
  508       std::string errmsg = 
">>> ERROR (Intrepid::CellTools::getReferenceSubcellVertices):";
 
  509       TEUCHOS_TEST_FOR_EXCEPTION( !( requireRankRange(errmsg, subcellVertices, 2, 2) ), std::invalid_argument, errmsg);
 
  511       int subcVertexCount = parentCell.getVertexCount(subcellDim, subcellOrd);
 
  512       int spaceDim = parentCell.getDimension();
 
  514       TEUCHOS_TEST_FOR_EXCEPTION( !( requireDimensionRange(errmsg, subcellVertices, 0,  subcVertexCount, subcVertexCount) ),
 
  515                           std::invalid_argument, errmsg);
 
  517       TEUCHOS_TEST_FOR_EXCEPTION( !( requireDimensionRange(errmsg, subcellVertices, 1,  spaceDim, spaceDim) ),
 
  518                           std::invalid_argument, errmsg);
 
  523     getReferenceSubcellNodes(subcellVertices, subcellDim, subcellOrd, parentCell.getBaseCellTopologyData() );
 
  528   template<
class Scalar>
 
  532 #ifdef HAVE_INTREPID_DEBUG 
  533     TEUCHOS_TEST_FOR_EXCEPTION( !(hasReferenceCell(cell) ), std::invalid_argument, 
 
  534                         ">>> ERROR (Intrepid::CellTools::getReferenceNode): the specified cell topology does not have a reference cell.");
 
  536     TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= nodeOrd) && (nodeOrd < (
int)cell.getNodeCount() ) ), std::invalid_argument,
 
  537                         ">>> ERROR (Intrepid::CellTools::getReferenceNode): invalid node ordinal for the specified cell topology. ");
 
  542     static const double line[2][3] ={
 
  543       {-1.0, 0.0, 0.0}, { 1.0, 0.0, 0.0} 
 
  545     static const double line_3[3][3] = {
 
  546       {-1.0, 0.0, 0.0}, { 1.0, 0.0, 0.0},     
 
  553     static const double triangle[3][3] = {
 
  554       { 0.0, 0.0, 0.0}, { 1.0, 0.0, 0.0}, { 0.0, 1.0, 0.0} 
 
  556     static const double triangle_4[4][3] = {
 
  557       { 0.0, 0.0, 0.0}, { 1.0, 0.0, 0.0}, { 0.0, 1.0, 0.0},
 
  561     static const double triangle_6[6][3] = {
 
  562       { 0.0, 0.0, 0.0}, { 1.0, 0.0, 0.0}, { 0.0, 1.0, 0.0},
 
  564       { 0.5, 0.0, 0.0}, { 0.5, 0.5, 0.0}, { 0.0, 0.5, 0.0}
 
  569     static const double quadrilateral[4][3] = {
 
  570       {-1.0,-1.0, 0.0}, { 1.0,-1.0, 0.0}, { 1.0, 1.0, 0.0}, {-1.0, 1.0, 0.0}
 
  572     static const double quadrilateral_8[8][3] = {
 
  573       {-1.0,-1.0, 0.0}, { 1.0,-1.0, 0.0}, { 1.0, 1.0, 0.0}, {-1.0, 1.0, 0.0},
 
  575       { 0.0,-1.0, 0.0}, { 1.0, 0.0, 0.0}, { 0.0, 1.0, 0.0}, {-1.0, 0.0, 0.0}
 
  577     static const double quadrilateral_9[9][3] = {
 
  578       {-1.0,-1.0, 0.0}, { 1.0,-1.0, 0.0}, { 1.0, 1.0, 0.0}, {-1.0, 1.0, 0.0},
 
  580       { 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}
 
  585     static const double tetrahedron[4][3] = {
 
  586       { 0.0, 0.0, 0.0}, { 1.0, 0.0, 0.0}, { 0.0, 1.0, 0.0}, { 0.0, 0.0, 1.0}
 
  588     static const double tetrahedron_8[8][3] = {
 
  589       { 0.0, 0.0, 0.0}, { 1.0, 0.0, 0.0}, { 0.0, 1.0, 0.0}, { 0.0, 0.0, 1.0},
 
  591       { 1/3, 0.0, 1/3}, { 1/3, 1/3, 1/3}, { 1/3, 1/3, 0.0}, { 0.0, 1/3, 1/3} 
 
  593     static const double tetrahedron_10[10][3] = {
 
  594       { 0.0, 0.0, 0.0}, { 1.0, 0.0, 0.0}, { 0.0, 1.0, 0.0}, { 0.0, 0.0, 1.0},
 
  596       { 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}
 
  599     static const double tetrahedron_11[10][3] = {
 
  600       { 0.0, 0.0, 0.0}, { 1.0, 0.0, 0.0}, { 0.0, 1.0, 0.0}, { 0.0, 0.0, 1.0},
 
  602       { 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}
 
  607     static const double hexahedron[8][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     static const double hexahedron_20[20][3] = {
 
  612       {-1.0,-1.0,-1.0}, { 1.0,-1.0,-1.0}, { 1.0, 1.0,-1.0}, {-1.0, 1.0,-1.0},
 
  613       {-1.0,-1.0, 1.0}, { 1.0,-1.0, 1.0}, { 1.0, 1.0, 1.0}, {-1.0, 1.0, 1.0},
 
  615       { 0.0,-1.0,-1.0}, { 1.0, 0.0,-1.0}, { 0.0, 1.0,-1.0}, {-1.0, 0.0,-1.0}, 
 
  616       {-1.0,-1.0, 0.0}, { 1.0,-1.0, 0.0}, { 1.0, 1.0, 0.0}, {-1.0, 1.0, 0.0},
 
  617       { 0.0,-1.0, 1.0}, { 1.0, 0.0, 1.0}, { 0.0, 1.0, 1.0}, {-1.0, 0.0, 1.0}
 
  619     static const double hexahedron_27[27][3] = {
 
  620       {-1.0,-1.0,-1.0}, { 1.0,-1.0,-1.0}, { 1.0, 1.0,-1.0}, {-1.0, 1.0,-1.0},
 
  621       {-1.0,-1.0, 1.0}, { 1.0,-1.0, 1.0}, { 1.0, 1.0, 1.0}, {-1.0, 1.0, 1.0},
 
  623       { 0.0,-1.0,-1.0}, { 1.0, 0.0,-1.0}, { 0.0, 1.0,-1.0}, {-1.0, 0.0,-1.0}, 
 
  624       {-1.0,-1.0, 0.0}, { 1.0,-1.0, 0.0}, { 1.0, 1.0, 0.0}, {-1.0, 1.0, 0.0},
 
  625       { 0.0,-1.0, 1.0}, { 1.0, 0.0, 1.0}, { 0.0, 1.0, 1.0}, {-1.0, 0.0, 1.0},
 
  627       { 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} 
 
  632     static const double pyramid[5][3] = {
 
  633       {-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}
 
  635     static const double pyramid_13[13][3] = {
 
  636       {-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},
 
  638       { 0.0,-1.0, 0.0}, { 1.0, 0.0, 0.0}, { 0.0, 1.0, 0.0}, {-1.0, 0.0, 0.0},
 
  639       {-0.5,-0.5, 0.5}, { 0.5,-0.5, 0.5}, { 0.5, 0.5, 0.5}, {-0.5, 0.5, 0.5}   
 
  641     static const double pyramid_14[14][3] = {
 
  642       {-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},
 
  644       { 0.0,-1.0, 0.0}, { 1.0, 0.0, 0.0}, { 0.0, 1.0, 0.0}, {-1.0, 0.0, 0.0},
 
  645       {-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}  
 
  650     static const double wedge[6][3] = {
 
  651       { 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} 
 
  653     static const double wedge_15[15][3] = {
 
  654       { 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},
 
  656       { 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},
 
  657       { 0.5, 0.0, 1.0}, { 0.5, 0.5, 1.0}, { 0.0, 0.5, 1.0}
 
  659     static const double wedge_18[18][3] = {
 
  660       { 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},
 
  662       { 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},
 
  663       { 0.5, 0.0, 1.0}, { 0.5, 0.5, 1.0}, { 0.0, 0.5, 1.0},
 
  664       { 0.5, 0.0, 0.0}, { 0.5, 0.5, 0.0}, { 0.0, 0.5, 0.0}
 
  668     switch(cell.getKey() ) {
 
  671       case shards::Line<2>::key:
 
  672       case shards::ShellLine<2>::key:
 
  673       case shards::Beam<2>::key:
 
  674         return line[nodeOrd];
 
  678       case shards::Line<3>::key:
 
  679       case shards::ShellLine<3>::key:
 
  680       case shards::Beam<3>::key:
 
  681         return line_3[nodeOrd];
 
  686       case shards::Triangle<3>::key:
 
  687       case shards::ShellTriangle<3>::key:
 
  688         return triangle[nodeOrd];
 
  692       case shards::Triangle<4>::key:
 
  693         return triangle_4[nodeOrd];
 
  695       case shards::Triangle<6>::key:
 
  696       case shards::ShellTriangle<6>::key:
 
  697         return triangle_6[nodeOrd];
 
  702       case shards::Quadrilateral<4>::key:
 
  703       case shards::ShellQuadrilateral<4>::key:
 
  704         return quadrilateral[nodeOrd];
 
  708       case shards::Quadrilateral<8>::key:
 
  709       case shards::ShellQuadrilateral<8>::key:
 
  710         return quadrilateral_8[nodeOrd];
 
  712       case shards::Quadrilateral<9>::key:
 
  713       case shards::ShellQuadrilateral<9>::key:
 
  714         return quadrilateral_9[nodeOrd];
 
  719       case shards::Tetrahedron<4>::key:
 
  720         return tetrahedron[nodeOrd];
 
  724       case shards::Tetrahedron<8>::key:
 
  725         return tetrahedron_8[nodeOrd];
 
  727       case shards::Tetrahedron<10>::key:
 
  728         return tetrahedron_10[nodeOrd];
 
  730       case shards::Tetrahedron<11>::key:
 
  731         return tetrahedron_11[nodeOrd];
 
  736       case shards::Hexahedron<8>::key:
 
  737         return hexahedron[nodeOrd];
 
  741       case shards::Hexahedron<20>::key:
 
  742         return hexahedron_20[nodeOrd];
 
  744       case shards::Hexahedron<27>::key:
 
  745         return hexahedron_27[nodeOrd];
 
  750       case shards::Pyramid<5>::key:
 
  751         return pyramid[nodeOrd];
 
  755       case shards::Pyramid<13>::key:
 
  756         return pyramid_13[nodeOrd];
 
  758      case shards::Pyramid<14>::key:
 
  759         return pyramid_14[nodeOrd];
 
  764       case shards::Wedge<6>::key:
 
  765         return wedge[nodeOrd];
 
  769       case shards::Wedge<15>::key:
 
  770         return wedge_15[nodeOrd];
 
  772       case shards::Wedge<18>::key:
 
  773         return wedge_18[nodeOrd];
 
  777         TEUCHOS_TEST_FOR_EXCEPTION( 
true, std::invalid_argument, 
 
  778                             ">>> ERROR (Intrepid::CellTools::getReferenceNode): invalid cell topology.");
 
  786   template<
class Scalar>
 
  787   template<
class ArraySubcellNode>
 
  789                                                    const int                   subcellDim,
 
  790                                                    const int                   subcellOrd,
 
  791                                                    const shards::CellTopology& parentCell){
 
  792 #ifdef HAVE_INTREPID_DEBUG 
  793     TEUCHOS_TEST_FOR_EXCEPTION( !(hasReferenceCell(parentCell) ), std::invalid_argument, 
 
  794                         ">>> ERROR (Intrepid::CellTools::getReferenceSubcellNodes): the specified cell topology does not have a reference cell.");
 
  798     TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= subcellDim) && (subcellDim <= (
int)parentCell.getDimension()) ), std::invalid_argument,
 
  799                         ">>> ERROR (Intrepid::CellTools::getReferenceSubcellNodes): subcell dimension out of range.");
 
  801     TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= subcellOrd) && (subcellOrd < (
int)parentCell.getSubcellCount(subcellDim) ) ), std::invalid_argument,
 
  802                         ">>> ERROR (Intrepid::CellTools::getReferenceSubcellNodes): subcell ordinal out of range.");
 
  806       std::string errmsg = 
">>> ERROR (Intrepid::CellTools::getReferenceSubcellNodes):";
 
  807       TEUCHOS_TEST_FOR_EXCEPTION( !( requireRankRange(errmsg, subcellNodes, 2, 2) ), std::invalid_argument, errmsg);
 
  809       int subcNodeCount = parentCell.getNodeCount(subcellDim, subcellOrd);
 
  810       int spaceDim = parentCell.getDimension();
 
  812       TEUCHOS_TEST_FOR_EXCEPTION( !( requireDimensionRange(errmsg, subcellNodes, 0,  subcNodeCount, subcNodeCount) ),
 
  813                           std::invalid_argument, errmsg);
 
  815       TEUCHOS_TEST_FOR_EXCEPTION( !( requireDimensionRange(errmsg, subcellNodes, 1,  spaceDim, spaceDim) ),
 
  816                           std::invalid_argument, errmsg);
 
  821     int subcNodeCount = parentCell.getNodeCount(subcellDim, subcellOrd);
 
  824     for(
int subcNodeOrd = 0; subcNodeOrd < subcNodeCount; subcNodeOrd++){
 
  827       int cellNodeOrd = parentCell.getNodeMap(subcellDim, subcellOrd, subcNodeOrd);
 
  830       for(
int dim = 0; dim < (int)parentCell.getDimension(); dim++){
 
  838   template<
class Scalar>
 
  841     switch(cell.getKey() ) {
 
  842       case shards::Line<2>::key:
 
  843       case shards::Line<3>::key:
 
  844       case shards::ShellLine<2>::key:
 
  845       case shards::ShellLine<3>::key:
 
  846       case shards::Beam<2>::key:
 
  847       case shards::Beam<3>::key:
 
  849       case shards::Triangle<3>::key:
 
  850       case shards::Triangle<4>::key:
 
  851       case shards::Triangle<6>::key:
 
  852       case shards::ShellTriangle<3>::key:
 
  853       case shards::ShellTriangle<6>::key:
 
  855       case shards::Quadrilateral<4>::key:
 
  856       case shards::Quadrilateral<8>::key:
 
  857       case shards::Quadrilateral<9>::key:
 
  858       case shards::ShellQuadrilateral<4>::key:
 
  859       case shards::ShellQuadrilateral<8>::key:
 
  860       case shards::ShellQuadrilateral<9>::key:
 
  862       case shards::Tetrahedron<4>::key:
 
  863       case shards::Tetrahedron<8>::key:
 
  864       case shards::Tetrahedron<10>::key:
 
  865       case shards::Tetrahedron<11>::key:
 
  867       case shards::Hexahedron<8>::key:
 
  868       case shards::Hexahedron<20>::key:
 
  869       case shards::Hexahedron<27>::key:
 
  871       case shards::Pyramid<5>::key:
 
  872       case shards::Pyramid<13>::key:
 
  873       case shards::Pyramid<14>::key:
 
  875       case shards::Wedge<6>::key:
 
  876       case shards::Wedge<15>::key:
 
  877       case shards::Wedge<18>::key:
 
  896   template<
class Scalar>
 
  897   template<
class ArrayJac, 
class ArrayPo
int, 
class ArrayCell>
 
  899                                       const ArrayPoint &           points,
 
  900                                       const ArrayCell  &           cellWorkset,
 
  901                                       const shards::CellTopology & cellTopo,
 
  902                                       const int &                  whichCell) 
 
  904     INTREPID_VALIDATE( validateArguments_setJacobian(jacobian, points, cellWorkset, whichCell,  cellTopo) );
 
  906    ArrayWrapper<Scalar,ArrayJac, Rank<ArrayJac >::value, 
false>jacobianWrap(jacobian);   
 
  907    ArrayWrapper<Scalar,ArrayPoint, Rank<ArrayPoint >::value, 
true>pointsWrap(points);
 
  908    ArrayWrapper<Scalar,ArrayCell, Rank<ArrayCell >::value, 
true>cellWorksetWrap(cellWorkset);    
 
  909     int spaceDim  = (size_t)cellTopo.getDimension();
 
  910     size_t numCells  = 
static_cast<size_t>(cellWorkset.dimension(0));
 
  912     size_t numPoints = (getrank(points) == 2) ? static_cast<size_t>(points.dimension(0)) : static_cast<size_t>(points.dimension(1));
 
  915     Teuchos::RCP< Basis< Scalar, FieldContainer<Scalar> > > HGRAD_Basis;
 
  918     switch( cellTopo.getKey() ){
 
  921       case shards::Line<2>::key:
 
  925       case shards::Triangle<3>::key:
 
  929       case shards::Quadrilateral<4>::key:
 
  933       case shards::Tetrahedron<4>::key:
 
  937       case shards::Hexahedron<8>::key:
 
  941       case shards::Wedge<6>::key:
 
  945       case shards::Pyramid<5>::key:
 
  950       case shards::Triangle<6>::key:    
 
  953       case shards::Quadrilateral<9>::key:
 
  957       case shards::Tetrahedron<10>::key:
 
  961       case shards::Tetrahedron<11>::key:
 
  965       case shards::Hexahedron<20>::key:
 
  969       case shards::Hexahedron<27>::key:
 
  973       case shards::Wedge<15>::key:
 
  977       case shards::Wedge<18>::key:
 
  981       case shards::Pyramid<13>::key:
 
  986       case shards::Quadrilateral<8>::key:
 
  987         TEUCHOS_TEST_FOR_EXCEPTION( (
true), std::invalid_argument, 
 
  988                             ">>> ERROR (Intrepid::CellTools::setJacobian): Cell topology not supported. ");
 
  992       case shards::Line<3>::key:
 
  993       case shards::Beam<2>::key:
 
  994       case shards::Beam<3>::key:
 
  995       case shards::ShellLine<2>::key:
 
  996       case shards::ShellLine<3>::key:
 
  997       case shards::ShellTriangle<3>::key:
 
  998       case shards::ShellTriangle<6>::key:
 
  999       case shards::ShellQuadrilateral<4>::key:
 
 1000       case shards::ShellQuadrilateral<8>::key:
 
 1001       case shards::ShellQuadrilateral<9>::key:
 
 1002         TEUCHOS_TEST_FOR_EXCEPTION( (
true), std::invalid_argument, 
 
 1003                             ">>> ERROR (Intrepid::CellTools::setJacobian): Cell topology not supported. ");
 
 1006         TEUCHOS_TEST_FOR_EXCEPTION( (
true), std::invalid_argument, 
 
 1007                             ">>> ERROR (Intrepid::CellTools::setJacobian): Cell topology not supported.");        
 
 1011     int basisCardinality = HGRAD_Basis -> getCardinality();
 
 1012     FieldContainer<Scalar> basisGrads(basisCardinality, numPoints, spaceDim);
 
 1015 if(getrank(jacobian)==4){
 
 1016     for (
size_t i=0; i< static_cast<size_t>(jacobian.dimension(0)); i++){
 
 1017        for (
size_t j=0; j< static_cast<size_t>(jacobian.dimension(1)); j++){
 
 1018          for (
size_t k=0; k< static_cast<size_t>(jacobian.dimension(2)); k++){
 
 1019            for (
size_t l=0; l< static_cast<size_t>(jacobian.dimension(3)); l++){
 
 1020             jacobianWrap(i,j,k,l)=0.0;
 
 1027 if(getrank(jacobian)==3){
 
 1028     for (
size_t i=0; i< static_cast<size_t>(jacobian.dimension(0)); i++){
 
 1029        for (
size_t j=0; j< static_cast<size_t>(jacobian.dimension(1)); j++){
 
 1030          for (
size_t k=0; k< static_cast<size_t>(jacobian.dimension(2)); k++){
 
 1031             jacobianWrap(i,j,k)=0.0;
 
 1037     switch(getrank(points)) {
 
 1043           FieldContainer<Scalar> tempPoints( static_cast<size_t>(points.dimension(0)), static_cast<size_t>(points.dimension(1)) );
 
 1045               for(
size_t pt = 0; pt < static_cast<size_t>(points.dimension(0)); pt++){
 
 1046             for(
size_t dm = 0; dm < static_cast<size_t>(points.dimension(1)) ; dm++){
 
 1047               tempPoints(pt, dm) = pointsWrap(pt, dm);
 
 1051           HGRAD_Basis -> getValues(basisGrads, tempPoints, OPERATOR_GRAD);
 
 1055           size_t cellLoop = (whichCell == -1) ? numCells : 1 ;
 
 1057           if(whichCell == -1) {
 
 1058             for(
size_t cellOrd = 0; cellOrd < cellLoop; cellOrd++) {
 
 1059               for(
size_t pointOrd = 0; pointOrd < numPoints; pointOrd++) {
 
 1060                 for(
int row = 0; row < spaceDim; row++){
 
 1061                   for(
int col = 0; col < spaceDim; col++){
 
 1064                     for(
int bfOrd = 0; bfOrd < basisCardinality; bfOrd++){
 
 1065                       jacobianWrap(cellOrd, pointOrd, row, col) += cellWorksetWrap(cellOrd, bfOrd, row)*basisGrads(bfOrd, pointOrd, col);
 
 1076             for(
size_t cellOrd = 0; cellOrd < cellLoop; cellOrd++) {
 
 1077               for(
size_t pointOrd = 0; pointOrd < numPoints; pointOrd++) {
 
 1078                 for(
int row = 0; row < spaceDim; row++){
 
 1079                   for(
int col = 0; col < spaceDim; col++){
 
 1082                     for(
int bfOrd = 0; bfOrd < basisCardinality; bfOrd++){
 
 1083                       jacobianWrap(pointOrd, row, col) += cellWorksetWrap(whichCell, bfOrd, row)*basisGrads(bfOrd, pointOrd, col);
 
 1098           FieldContainer<Scalar> tempPoints( static_cast<size_t>(points.dimension(1)), static_cast<size_t>(points.dimension(2)) );
 
 1099           for(
size_t cellOrd = 0; cellOrd < numCells; cellOrd++) {
 
 1102             for(
size_t pt = 0; pt < static_cast<size_t>(points.dimension(1)); pt++){
 
 1103               for(
size_t dm = 0; dm < static_cast<size_t>(points.dimension(2)) ; dm++){
 
 1104                 tempPoints(pt, dm) = pointsWrap(cellOrd, pt, dm);
 
 1109             HGRAD_Basis -> getValues(basisGrads, tempPoints, OPERATOR_GRAD);
 
 1112             for(
size_t pointOrd = 0; pointOrd < numPoints; pointOrd++) {
 
 1113               for(
int row = 0; row < spaceDim; row++){
 
 1114                 for(
int col = 0; col < spaceDim; col++){
 
 1117                   for(
int bfOrd = 0; bfOrd < basisCardinality; bfOrd++){
 
 1118                     jacobianWrap(cellOrd, pointOrd, row, col) += cellWorksetWrap(cellOrd, bfOrd, row)*basisGrads(bfOrd, pointOrd, col);
 
 1130         TEUCHOS_TEST_FOR_EXCEPTION( !( (getrank(points) == 2) && (getrank(points) == 3) ), std::invalid_argument,
 
 1131                             ">>> ERROR (Intrepid::CellTools::setJacobian): rank 2 or 3 required for points array. ");        
 
 1136   template<
class Scalar>
 
 1137   template<
class ArrayJac, 
class ArrayPo
int, 
class ArrayCell>
 
 1138   void CellTools<Scalar>::setJacobian(ArrayJac &                   jacobian,
 
 1139                                       const ArrayPoint &           points,
 
 1140                                       const ArrayCell  &           cellWorkset,
 
 1141                                       const Teuchos::RCP< Basis< Scalar, FieldContainer<Scalar> > > HGRAD_Basis,
 
 1142                                       const int &                  whichCell) 
 
 1147     ArrayWrapper<Scalar,ArrayJac, Rank<ArrayJac >::value, 
false>jacobianWrap(jacobian);   
 
 1148     ArrayWrapper<Scalar,ArrayPoint, Rank<ArrayPoint >::value, 
true>pointsWrap(points);
 
 1149     ArrayWrapper<Scalar,ArrayCell, Rank<ArrayCell >::value, 
true>cellWorksetWrap(cellWorkset);    
 
 1150     int spaceDim  = (size_t)HGRAD_Basis->getBaseCellTopology().getDimension();
 
 1151     size_t numCells  = 
static_cast<size_t>(cellWorkset.dimension(0));
 
 1153     size_t numPoints = (getrank(points) == 2) ? static_cast<size_t>(points.dimension(0)) : static_cast<size_t>(points.dimension(1));
 
 1156     int basisCardinality = HGRAD_Basis -> getCardinality();
 
 1157     FieldContainer<Scalar> basisGrads(basisCardinality, numPoints, spaceDim);
 
 1160 if(getrank(jacobian)==4){
 
 1161     for (
size_t i=0; i< static_cast<size_t>(jacobian.dimension(0)); i++){
 
 1162        for (
size_t j=0; j< static_cast<size_t>(jacobian.dimension(1)); j++){
 
 1163          for (
size_t k=0; k< static_cast<size_t>(jacobian.dimension(2)); k++){
 
 1164            for (
size_t l=0; l< static_cast<size_t>(jacobian.dimension(3)); l++){
 
 1165             jacobianWrap(i,j,k,l)=0.0;
 
 1172 if(getrank(jacobian)==3){
 
 1173     for (
size_t i=0; i< static_cast<size_t>(jacobian.dimension(0)); i++){
 
 1174        for (
size_t j=0; j< static_cast<size_t>(jacobian.dimension(1)); j++){
 
 1175          for (
size_t k=0; k< static_cast<size_t>(jacobian.dimension(2)); k++){
 
 1176             jacobianWrap(i,j,k)=0.0;
 
 1182     switch(getrank(points)) {
 
 1188           FieldContainer<Scalar> tempPoints( static_cast<size_t>(points.dimension(0)), static_cast<size_t>(points.dimension(1)) );
 
 1190               for(
size_t pt = 0; pt < static_cast<size_t>(points.dimension(0)); pt++){
 
 1191             for(
size_t dm = 0; dm < static_cast<size_t>(points.dimension(1)) ; dm++){
 
 1192               tempPoints(pt, dm) = pointsWrap(pt, dm);
 
 1196           HGRAD_Basis -> getValues(basisGrads, tempPoints, OPERATOR_GRAD);
 
 1200           size_t cellLoop = (whichCell == -1) ? numCells : 1 ;
 
 1202           if(whichCell == -1) {
 
 1203             for(
size_t cellOrd = 0; cellOrd < cellLoop; cellOrd++) {
 
 1204               for(
size_t pointOrd = 0; pointOrd < numPoints; pointOrd++) {
 
 1205                 for(
int row = 0; row < spaceDim; row++){
 
 1206                   for(
int col = 0; col < spaceDim; col++){
 
 1209                     for(
int bfOrd = 0; bfOrd < basisCardinality; bfOrd++){
 
 1210                       jacobianWrap(cellOrd, pointOrd, row, col) += cellWorksetWrap(cellOrd, bfOrd, row)*basisGrads(bfOrd, pointOrd, col);
 
 1221             for(
size_t cellOrd = 0; cellOrd < cellLoop; cellOrd++) {
 
 1222               for(
size_t pointOrd = 0; pointOrd < numPoints; pointOrd++) {
 
 1223                 for(
int row = 0; row < spaceDim; row++){
 
 1224                   for(
int col = 0; col < spaceDim; col++){
 
 1227                     for(
int bfOrd = 0; bfOrd < basisCardinality; bfOrd++){
 
 1228                       jacobianWrap(pointOrd, row, col) += cellWorksetWrap(whichCell, bfOrd, row)*basisGrads(bfOrd, pointOrd, col);
 
 1243           FieldContainer<Scalar> tempPoints( static_cast<size_t>(points.dimension(1)), static_cast<size_t>(points.dimension(2)) );
 
 1244           for(
size_t cellOrd = 0; cellOrd < numCells; cellOrd++) {
 
 1247             for(
size_t pt = 0; pt < static_cast<size_t>(points.dimension(1)); pt++){
 
 1248               for(
size_t dm = 0; dm < static_cast<size_t>(points.dimension(2)) ; dm++){
 
 1249                 tempPoints(pt, dm) = pointsWrap(cellOrd, pt, dm);
 
 1254             HGRAD_Basis -> getValues(basisGrads, tempPoints, OPERATOR_GRAD);
 
 1257             for(
size_t pointOrd = 0; pointOrd < numPoints; pointOrd++) {
 
 1258               for(
int row = 0; row < spaceDim; row++){
 
 1259                 for(
int col = 0; col < spaceDim; col++){
 
 1262                   for(
int bfOrd = 0; bfOrd < basisCardinality; bfOrd++){
 
 1263                     jacobianWrap(cellOrd, pointOrd, row, col) += cellWorksetWrap(cellOrd, bfOrd, row)*basisGrads(bfOrd, pointOrd, col);
 
 1275         TEUCHOS_TEST_FOR_EXCEPTION( !( (getrank(points) == 2) && (getrank(points) == 3) ), std::invalid_argument,
 
 1276                             ">>> ERROR (Intrepid::CellTools::setJacobian): rank 2 or 3 required for points array. ");        
 
 1281 template<
class Scalar>
 
 1282 template<
class ArrayJacInv, 
class ArrayJac>
 
 1284                                        const ArrayJac &  jacobian) 
 
 1286   INTREPID_VALIDATE( validateArguments_setJacobianInv(jacobianInv, jacobian) );
 
 1312 template<
class Scalar>
 
 1313 template<
class ArrayJacDet, 
class ArrayJac>
 
 1315                                        const ArrayJac &  jacobian)
 
 1317   INTREPID_VALIDATE( validateArguments_setJacobianDetArgs(jacobianDet, jacobian) );
 
 1327 template<
class Scalar>
 
 1328 template<
class ArrayPhysPo
int, 
class ArrayRefPo
int, 
class ArrayCell>
 
 1330                                            const ArrayRefPoint &        refPoints,
 
 1331                                            const ArrayCell     &        cellWorkset,
 
 1333                                            const int &                  whichCell)
 
 1337    ArrayWrapper<Scalar,ArrayPhysPoint, Rank<ArrayPhysPoint >::value, 
false>physPointsWrap(physPoints);
 
 1338    ArrayWrapper<Scalar,ArrayRefPoint, Rank<ArrayRefPoint >::value, 
true>refPointsWrap(refPoints);
 
 1339    ArrayWrapper<Scalar,ArrayCell, Rank<ArrayCell >::value,
true>cellWorksetWrap(cellWorkset);
 
 1341   size_t spaceDim  = (size_t)HGRAD_Basis->getBaseCellTopology().getDimension();
 
 1343   size_t numCells  = 
static_cast<size_t>(cellWorkset.dimension(0));
 
 1345   size_t numPoints = (getrank(refPoints) == 2) ? static_cast<size_t>(refPoints.dimension(0)) : static_cast<size_t>(refPoints.dimension(1));
 
 1348   int basisCardinality = HGRAD_Basis -> getCardinality();
 
 1353   if(getrank(physPoints)==3){
 
 1354 for(
size_t i = 0; i < static_cast<size_t>(physPoints.dimension(0)); i++) {
 
 1355  for(
size_t j = 0; j < static_cast<size_t>(physPoints.dimension(1)); j++){
 
 1356         for(
size_t k = 0; k < static_cast<size_t>(physPoints.dimension(2)); k++){ 
 
 1357   physPointsWrap(i,j,k) = 0.0;
 
 1361  }
else if(getrank(physPoints)==2){
 
 1362           for(
size_t i = 0; i < static_cast<size_t>(physPoints.dimension(0)); i++){
 
 1363         for(
size_t j = 0; j < static_cast<size_t>(physPoints.dimension(1)); j++){ 
 
 1364   physPointsWrap(i,j) = 0.0;
 
 1374   switch(getrank(refPoints)) {
 
 1381         FieldContainer<Scalar> tempPoints( static_cast<size_t>(refPoints.dimension(0)), static_cast<size_t>(refPoints.dimension(1)) );
 
 1383         for(
size_t pt = 0; pt < static_cast<size_t>(refPoints.dimension(0)); pt++){
 
 1384           for(
size_t dm = 0; dm < static_cast<size_t>(refPoints.dimension(1)) ; dm++){
 
 1385             tempPoints(pt, dm) = refPointsWrap(pt, dm);
 
 1388         HGRAD_Basis -> getValues(basisVals, tempPoints, OPERATOR_VALUE);
 
 1391         size_t cellLoop = (whichCell == -1) ? numCells : 1 ;
 
 1394         for(
size_t cellOrd = 0; cellOrd < cellLoop; cellOrd++) {
 
 1395           for(
size_t pointOrd = 0; pointOrd < numPoints; pointOrd++) {
 
 1396             for(
size_t dim = 0; dim < spaceDim; dim++){
 
 1397               for(
int bfOrd = 0; bfOrd < basisCardinality; bfOrd++){
 
 1399                 if(whichCell == -1){
 
 1400                   physPointsWrap(cellOrd, pointOrd, dim) += cellWorksetWrap(cellOrd, bfOrd, dim)*basisVals(bfOrd, pointOrd);
 
 1403                   physPointsWrap(pointOrd, dim) += cellWorksetWrap(whichCell, bfOrd, dim)*basisVals(bfOrd, pointOrd);
 
 1418         FieldContainer<Scalar> tempPoints( static_cast<size_t>(refPoints.dimension(1)), static_cast<size_t>(refPoints.dimension(2)) );
 
 1421         for(
size_t cellOrd = 0; cellOrd < numCells; cellOrd++) {
 
 1424           for(
size_t pt = 0; pt < static_cast<size_t>(refPoints.dimension(1)); pt++){
 
 1425             for(
size_t dm = 0; dm < static_cast<size_t>(refPoints.dimension(2)) ; dm++){
 
 1426               tempPoints(pt, dm) = refPointsWrap(cellOrd, pt, dm);
 
 1431           HGRAD_Basis -> getValues(basisVals, tempPoints, OPERATOR_VALUE);
 
 1433           for(
size_t pointOrd = 0; pointOrd < numPoints; pointOrd++) {
 
 1434             for(
size_t dim = 0; dim < spaceDim; dim++){
 
 1435               for(
int bfOrd = 0; bfOrd < basisCardinality; bfOrd++){
 
 1437                 physPointsWrap(cellOrd, pointOrd, dim) += cellWorksetWrap(cellOrd, bfOrd, dim)*basisVals(bfOrd, pointOrd);
 
 1449 template<
class Scalar>
 
 1450 template<
class ArrayPhysPo
int, 
class ArrayRefPo
int, 
class ArrayCell>
 
 1452                                            const ArrayRefPoint &        refPoints,
 
 1453                                            const ArrayCell     &        cellWorkset,
 
 1454                                            const shards::CellTopology & cellTopo,
 
 1455                                            const int &                  whichCell)
 
 1457   INTREPID_VALIDATE(validateArguments_mapToPhysicalFrame( physPoints, refPoints, cellWorkset, cellTopo, whichCell) );
 
 1459    ArrayWrapper<Scalar,ArrayPhysPoint, Rank<ArrayPhysPoint >::value, 
false>physPointsWrap(physPoints);
 
 1460    ArrayWrapper<Scalar,ArrayRefPoint, Rank<ArrayRefPoint >::value, 
true>refPointsWrap(refPoints);
 
 1461    ArrayWrapper<Scalar,ArrayCell, Rank<ArrayCell >::value,
true>cellWorksetWrap(cellWorkset);
 
 1463   size_t spaceDim  = (size_t)cellTopo.getDimension();
 
 1464   size_t numCells  = 
static_cast<size_t>(cellWorkset.dimension(0));
 
 1466   size_t numPoints = (getrank(refPoints) == 2) ? static_cast<size_t>(refPoints.dimension(0)) : static_cast<size_t>(refPoints.dimension(1));
 
 1469   Teuchos::RCP<Basis<Scalar, FieldContainer<Scalar> > > HGRAD_Basis;
 
 1472   switch( cellTopo.getKey() ){
 
 1475     case shards::Line<2>::key:
 
 1479     case shards::Triangle<3>::key:
 
 1483     case shards::Quadrilateral<4>::key:
 
 1487     case shards::Tetrahedron<4>::key:
 
 1491     case shards::Hexahedron<8>::key:
 
 1495     case shards::Wedge<6>::key:
 
 1499     case shards::Pyramid<5>::key:
 
 1504     case shards::Triangle<6>::key:    
 
 1508     case shards::Quadrilateral<9>::key:
 
 1512     case shards::Tetrahedron<10>::key:
 
 1516     case shards::Tetrahedron<11>::key:
 
 1520     case shards::Hexahedron<20>::key:
 
 1524     case shards::Hexahedron<27>::key:
 
 1528     case shards::Wedge<15>::key:
 
 1532     case shards::Wedge<18>::key:
 
 1536     case shards::Pyramid<13>::key:
 
 1541     case shards::Quadrilateral<8>::key:
 
 1542       TEUCHOS_TEST_FOR_EXCEPTION( (
true), std::invalid_argument, 
 
 1543                           ">>> ERROR (Intrepid::CellTools::mapToPhysicalFrame): Cell topology not supported. ");
 
 1547     case shards::Line<3>::key:
 
 1548     case shards::Beam<2>::key:
 
 1549     case shards::Beam<3>::key:
 
 1550     case shards::ShellLine<2>::key:
 
 1551     case shards::ShellLine<3>::key:
 
 1552     case shards::ShellTriangle<3>::key:
 
 1553     case shards::ShellTriangle<6>::key:
 
 1554     case shards::ShellQuadrilateral<4>::key:
 
 1555     case shards::ShellQuadrilateral<8>::key:
 
 1556     case shards::ShellQuadrilateral<9>::key:
 
 1557       TEUCHOS_TEST_FOR_EXCEPTION( (
true), std::invalid_argument, 
 
 1558                           ">>> ERROR (Intrepid::CellTools::mapToPhysicalFrame): Cell topology not supported. ");
 
 1561       TEUCHOS_TEST_FOR_EXCEPTION( (
true), std::invalid_argument, 
 
 1562                           ">>> ERROR (Intrepid::CellTools::mapToPhysicalFrame): Cell topology not supported.");        
 
 1566   int basisCardinality = HGRAD_Basis -> getCardinality();
 
 1571   if(getrank(physPoints)==3){
 
 1572 for(
size_t i = 0; i < static_cast<size_t>(physPoints.dimension(0)); i++) {
 
 1573  for(
size_t j = 0; j < static_cast<size_t>(physPoints.dimension(1)); j++){
 
 1574         for(
size_t k = 0; k < static_cast<size_t>(physPoints.dimension(2)); k++){ 
 
 1575   physPointsWrap(i,j,k) = 0.0;
 
 1579  }
else if(getrank(physPoints)==2){
 
 1580           for(
size_t i = 0; i < static_cast<size_t>(physPoints.dimension(0)); i++){
 
 1581         for(
size_t j = 0; j < static_cast<size_t>(physPoints.dimension(1)); j++){ 
 
 1582   physPointsWrap(i,j) = 0.0;
 
 1592   switch(getrank(refPoints)) {
 
 1599         FieldContainer<Scalar> tempPoints( static_cast<size_t>(refPoints.dimension(0)), static_cast<size_t>(refPoints.dimension(1)) );
 
 1601         for(
size_t pt = 0; pt < static_cast<size_t>(refPoints.dimension(0)); pt++){
 
 1602           for(
size_t dm = 0; dm < static_cast<size_t>(refPoints.dimension(1)) ; dm++){
 
 1603             tempPoints(pt, dm) = refPointsWrap(pt, dm);
 
 1606         HGRAD_Basis -> getValues(basisVals, tempPoints, OPERATOR_VALUE);
 
 1609         size_t cellLoop = (whichCell == -1) ? numCells : 1 ;
 
 1612         for(
size_t cellOrd = 0; cellOrd < cellLoop; cellOrd++) {
 
 1613           for(
size_t pointOrd = 0; pointOrd < numPoints; pointOrd++) {
 
 1614             for(
size_t dim = 0; dim < spaceDim; dim++){
 
 1615               for(
int bfOrd = 0; bfOrd < basisCardinality; bfOrd++){
 
 1617                 if(whichCell == -1){
 
 1618                   physPointsWrap(cellOrd, pointOrd, dim) += cellWorksetWrap(cellOrd, bfOrd, dim)*basisVals(bfOrd, pointOrd);
 
 1621                   physPointsWrap(pointOrd, dim) += cellWorksetWrap(whichCell, bfOrd, dim)*basisVals(bfOrd, pointOrd);
 
 1636         FieldContainer<Scalar> tempPoints( static_cast<size_t>(refPoints.dimension(1)), static_cast<size_t>(refPoints.dimension(2)) );
 
 1639         for(
size_t cellOrd = 0; cellOrd < numCells; cellOrd++) {
 
 1642           for(
size_t pt = 0; pt < static_cast<size_t>(refPoints.dimension(1)); pt++){
 
 1643             for(
size_t dm = 0; dm < static_cast<size_t>(refPoints.dimension(2)) ; dm++){
 
 1644               tempPoints(pt, dm) = refPointsWrap(cellOrd, pt, dm);
 
 1649           HGRAD_Basis -> getValues(basisVals, tempPoints, OPERATOR_VALUE);
 
 1651           for(
size_t pointOrd = 0; pointOrd < numPoints; pointOrd++) {
 
 1652             for(
size_t dim = 0; dim < spaceDim; dim++){
 
 1653               for(
int bfOrd = 0; bfOrd < basisCardinality; bfOrd++){
 
 1655                 physPointsWrap(cellOrd, pointOrd, dim) += cellWorksetWrap(cellOrd, bfOrd, dim)*basisVals(bfOrd, pointOrd);
 
 1668 template<
class Scalar>
 
 1669 template<
class ArrayRefPo
int, 
class ArrayPhysPo
int, 
class ArrayCell>
 
 1671                                             const ArrayPhysPoint &        physPoints,
 
 1672                                             const ArrayCell      &        cellWorkset,
 
 1673                                             const shards::CellTopology &  cellTopo,
 
 1674                                             const int &                   whichCell)
 
 1676   INTREPID_VALIDATE( validateArguments_mapToReferenceFrame(refPoints, physPoints, cellWorkset, cellTopo, whichCell) );
 
 1678   size_t spaceDim  = (size_t)cellTopo.getDimension();
 
 1684   switch( cellTopo.getKey() ){
 
 1686     case shards::Line<2>::key:
 
 1687       cellCenter(0) = 0.0;    
break;
 
 1689     case shards::Triangle<3>::key:
 
 1690     case shards::Triangle<6>::key:    
 
 1691       cellCenter(0) = 1./3.;    cellCenter(1) = 1./3.;  
break;
 
 1693     case shards::Quadrilateral<4>::key:
 
 1694     case shards::Quadrilateral<9>::key:
 
 1695       cellCenter(0) = 0.0;      cellCenter(1) = 0.0;    
break;
 
 1697     case shards::Tetrahedron<4>::key:
 
 1698     case shards::Tetrahedron<10>::key:
 
 1699     case shards::Tetrahedron<11>::key:
 
 1700       cellCenter(0) = 1./6.;    cellCenter(1) =  1./6.;    cellCenter(2) =  1./6.;  
break;
 
 1702     case shards::Hexahedron<8>::key:
 
 1703     case shards::Hexahedron<20>::key:
 
 1704     case shards::Hexahedron<27>::key:
 
 1705       cellCenter(0) = 0.0;      cellCenter(1) =  0.0;       cellCenter(2) =  0.0;   
break;
 
 1707     case shards::Wedge<6>::key:
 
 1708     case shards::Wedge<15>::key:
 
 1709     case shards::Wedge<18>::key:
 
 1710       cellCenter(0) = 1./3.;    cellCenter(1) =  1./3.;     cellCenter(2) = 0.0;    
break;
 
 1712     case shards::Pyramid<5>::key:
 
 1713     case shards::Pyramid<13>::key:
 
 1714       cellCenter(0) = 0.;       cellCenter(1) = 0.;         cellCenter(2) = 0.25;    
break;
 
 1717     case shards::Quadrilateral<8>::key:
 
 1718       TEUCHOS_TEST_FOR_EXCEPTION( (
true), std::invalid_argument, 
 
 1719                           ">>> ERROR (Intrepid::CellTools::mapToReferenceFrame): Cell topology not supported. ");
 
 1723     case shards::Line<3>::key:
 
 1724     case shards::Beam<2>::key:
 
 1725     case shards::Beam<3>::key:
 
 1726     case shards::ShellLine<2>::key:
 
 1727     case shards::ShellLine<3>::key:
 
 1728     case shards::ShellTriangle<3>::key:
 
 1729     case shards::ShellTriangle<6>::key:
 
 1730     case shards::ShellQuadrilateral<4>::key:
 
 1731     case shards::ShellQuadrilateral<8>::key:
 
 1732     case shards::ShellQuadrilateral<9>::key:
 
 1733       TEUCHOS_TEST_FOR_EXCEPTION( (
true), std::invalid_argument, 
 
 1734                           ">>> ERROR (Intrepid::CellTools::mapToReferenceFrame): Cell topology not supported. ");
 
 1737       TEUCHOS_TEST_FOR_EXCEPTION( (
true), std::invalid_argument, 
 
 1738                           ">>> ERROR (Intrepid::CellTools::mapToReferenceFrame): Cell topology not supported.");        
 
 1745   if(whichCell == -1){
 
 1746     numPoints = 
static_cast<size_t>(physPoints.dimension(1));
 
 1747     numCells = 
static_cast<size_t>(cellWorkset.dimension(0));
 
 1748     initGuess.
resize(numCells, numPoints, spaceDim);
 
 1750     for(
size_t c = 0; c < numCells; c++){
 
 1751       for(
size_t p = 0; p < numPoints; p++){
 
 1752         for(
size_t d = 0; d < spaceDim; d++){
 
 1753           initGuess(c, p, d) = cellCenter(d);
 
 1760     numPoints = 
static_cast<size_t>(physPoints.dimension(0));
 
 1761     initGuess.
resize(numPoints, spaceDim);
 
 1763     for(
size_t p = 0; p < numPoints; p++){
 
 1764       for(
size_t d = 0; d < spaceDim; d++){
 
 1765         initGuess(p, d) = cellCenter(d);
 
 1770   mapToReferenceFrameInitGuess(refPoints, initGuess, physPoints, cellWorkset, cellTopo, whichCell);  
 
 1775 template<
class Scalar>
 
 1776 template<
class ArrayRefPo
int, 
class ArrayInitGuess, 
class ArrayPhysPo
int, 
class ArrayCell>
 
 1778                                                      const ArrayInitGuess &        initGuess,
 
 1779                                                      const ArrayPhysPoint &        physPoints,
 
 1780                                                      const ArrayCell      &        cellWorkset,
 
 1782                                                      const int &                   whichCell)
 
 1784 ArrayWrapper<Scalar,ArrayInitGuess, Rank<ArrayInitGuess >::value, 
true>initGuessWrap(initGuess);
 
 1785 ArrayWrapper<Scalar,ArrayRefPoint, Rank<ArrayRefPoint >::value, 
false>refPointsWrap(refPoints);
 
 1787   size_t spaceDim  = (size_t)HGRAD_Basis->getBaseCellTopology().getDimension();
 
 1800   if(whichCell == -1){
 
 1801     numPoints = 
static_cast<size_t>(physPoints.dimension(1));
 
 1802     numCells = 
static_cast<size_t>(cellWorkset.dimension(0));
 
 1803     xOld.
resize(numCells, numPoints, spaceDim);
 
 1804     xTem.
resize(numCells, numPoints, spaceDim);  
 
 1805     jacobian.
resize(numCells,numPoints, spaceDim, spaceDim);
 
 1806     jacobInv.
resize(numCells,numPoints, spaceDim, spaceDim);
 
 1807     error.
resize(numCells,numPoints); 
 
 1809     for(
size_t c = 0; c < numCells; c++){
 
 1810       for(
size_t p = 0; p < numPoints; p++){
 
 1811         for(
size_t d = 0; d < spaceDim; d++){
 
 1812           xOld(c, p, d) = initGuessWrap(c, p, d);
 
 1819     numPoints = 
static_cast<size_t>(physPoints.dimension(0));
 
 1820     xOld.
resize(numPoints, spaceDim);
 
 1821     xTem.
resize(numPoints, spaceDim);  
 
 1822     jacobian.
resize(numPoints, spaceDim, spaceDim);
 
 1823     jacobInv.
resize(numPoints, spaceDim, spaceDim);
 
 1826     for(
size_t c = 0; c < numCells; c++){
 
 1827       for(
size_t p = 0; p < numPoints; p++){
 
 1828         for(
size_t d = 0; d < spaceDim; d++){
 
 1829           xOld(c, p, d) = initGuessWrap(c, p, d);
 
 1840     setJacobian(jacobian, xOld, cellWorkset, HGRAD_Basis, whichCell);
 
 1841     setJacobianInv(jacobInv, jacobian);
 
 1843     mapToPhysicalFrame( xTem, xOld, cellWorkset, HGRAD_Basis->getBaseCellTopology(), whichCell );      
 
 1854     if(whichCell == -1) {
 
 1855       FieldContainer<Scalar> cellWiseError(numCells);
 
 1865       totalError = totalError;
 
 1869     if (totalError < INTREPID_TOL) {
 
 1872     else if ( iter > INTREPID_MAX_NEWTON) {
 
 1873       INTREPID_VALIDATE(std::cout << 
" Intrepid::CellTools::mapToReferenceFrameInitGuess failed to converge to desired tolerance within "  
 1874                       << INTREPID_MAX_NEWTON  << 
" iterations\n" );
 
 1880 int refPointsRank=getrank(refPoints);
 
 1881 if (refPointsRank==3){
 
 1882    for(
size_t i=0;i<static_cast<size_t>(refPoints.dimension(0));i++){
 
 1883       for(
size_t j=0;j<static_cast<size_t>(refPoints.dimension(1));j++){
 
 1884          for(
size_t k=0;k<static_cast<size_t>(refPoints.dimension(2));k++){
 
 1885             xOld(i,j,k) = refPointsWrap(i,j,k);
 
 1889 }
else if(refPointsRank==2){
 
 1890    for(
size_t i=0;i<static_cast<size_t>(refPoints.dimension(0));i++){
 
 1891       for(
size_t j=0;j<static_cast<size_t>(refPoints.dimension(1));j++){
 
 1892          xOld(i,j) = refPointsWrap(i,j);
 
 1905 template<
class Scalar>
 
 1906 template<
class ArrayRefPo
int, 
class ArrayInitGuess, 
class ArrayPhysPo
int, 
class ArrayCell>
 
 1908                                                      const ArrayInitGuess &        initGuess,
 
 1909                                                      const ArrayPhysPoint &        physPoints,
 
 1910                                                      const ArrayCell      &        cellWorkset,
 
 1911                                                      const shards::CellTopology &  cellTopo,
 
 1912                                                      const int &                   whichCell)
 
 1914 ArrayWrapper<Scalar,ArrayInitGuess, Rank<ArrayInitGuess >::value, 
true>initGuessWrap(initGuess);
 
 1915 ArrayWrapper<Scalar,ArrayRefPoint, Rank<ArrayRefPoint >::value, 
false>refPointsWrap(refPoints);
 
 1916  INTREPID_VALIDATE( validateArguments_mapToReferenceFrame(refPoints, initGuess, physPoints, cellWorkset, cellTopo, whichCell) );
 
 1917   size_t spaceDim  = (size_t)cellTopo.getDimension();
 
 1930   if(whichCell == -1){
 
 1931     numPoints = 
static_cast<size_t>(physPoints.dimension(1));
 
 1932     numCells = 
static_cast<size_t>(cellWorkset.dimension(0));
 
 1933     xOld.
resize(numCells, numPoints, spaceDim);
 
 1934     xTem.
resize(numCells, numPoints, spaceDim);  
 
 1935     jacobian.
resize(numCells,numPoints, spaceDim, spaceDim);
 
 1936     jacobInv.
resize(numCells,numPoints, spaceDim, spaceDim);
 
 1937     error.
resize(numCells,numPoints); 
 
 1939     for(
size_t c = 0; c < numCells; c++){
 
 1940       for(
size_t p = 0; p < numPoints; p++){
 
 1941         for(
size_t d = 0; d < spaceDim; d++){
 
 1942           xOld(c, p, d) = initGuessWrap(c, p, d);
 
 1949     numPoints = 
static_cast<size_t>(physPoints.dimension(0));
 
 1950     xOld.
resize(numPoints, spaceDim);
 
 1951     xTem.
resize(numPoints, spaceDim);  
 
 1952     jacobian.
resize(numPoints, spaceDim, spaceDim);
 
 1953     jacobInv.
resize(numPoints, spaceDim, spaceDim);
 
 1956     for(
size_t p = 0; p < numPoints; p++){
 
 1957       for(
size_t d = 0; d < spaceDim; d++){
 
 1958         xOld(p, d) = initGuessWrap(p, d);
 
 1968     setJacobian(jacobian, xOld, cellWorkset, cellTopo, whichCell);
 
 1969     setJacobianInv(jacobInv, jacobian);
 
 1971     mapToPhysicalFrame( xTem, xOld, cellWorkset, cellTopo, whichCell );      
 
 1982     if(whichCell == -1) {
 
 1993       totalError = totalError;
 
 1997     if (totalError < INTREPID_TOL) {
 
 2000     else if ( iter > INTREPID_MAX_NEWTON) {
 
 2001       INTREPID_VALIDATE(std::cout << 
" Intrepid::CellTools::mapToReferenceFrameInitGuess failed to converge to desired tolerance within "  
 2002                       << INTREPID_MAX_NEWTON  << 
" iterations\n" );
 
 2008 int refPointsRank=getrank(refPoints);
 
 2009 if (refPointsRank==3){
 
 2010    for(
size_t i=0;i<static_cast<size_t>(refPoints.dimension(0));i++){
 
 2011       for(
size_t j=0;j<static_cast<size_t>(refPoints.dimension(1));j++){
 
 2012          for(
size_t k=0;k<static_cast<size_t>(refPoints.dimension(2));k++){
 
 2013             xOld(i,j,k) = refPointsWrap(i,j,k);
 
 2017 }
else if(refPointsRank==2){
 
 2018    for(
size_t i=0;i<static_cast<size_t>(refPoints.dimension(0));i++){
 
 2019       for(
size_t j=0;j<static_cast<size_t>(refPoints.dimension(1));j++){
 
 2020          xOld(i,j) = refPointsWrap(i,j);
 
 2033 template<
class Scalar>
 
 2034 template<
class ArraySubcellPo
int, 
class ArrayParamPo
int>
 
 2036                                               const ArrayParamPoint &       paramPoints,
 
 2037                                               const int                     subcellDim,
 
 2038                                               const int                     subcellOrd,
 
 2039                                               const shards::CellTopology &  parentCell){
 
 2041   int cellDim = parentCell.getDimension();
 
 2042   size_t numPts  = 
static_cast<size_t>(paramPoints.dimension(0));
 
 2044 #ifdef HAVE_INTREPID_DEBUG 
 2045   TEUCHOS_TEST_FOR_EXCEPTION( !(hasReferenceCell(parentCell) ), std::invalid_argument, 
 
 2046                       ">>> ERROR (Intrepid::CellTools::mapToReferenceSubcell): the specified cell topology does not have a reference cell.");
 
 2048   TEUCHOS_TEST_FOR_EXCEPTION( !( (1 <= subcellDim) && (subcellDim <= 2 ) ), std::invalid_argument,
 
 2049                       ">>> ERROR (Intrepid::CellTools::mapToReferenceSubcell): method defined only for 1 and 2-dimensional subcells.");  
 
 2051   TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= subcellOrd) && (subcellOrd < (
int)parentCell.getSubcellCount(subcellDim) ) ), std::invalid_argument,
 
 2052                       ">>> ERROR (Intrepid::CellTools::mapToReferenceSubcell): subcell ordinal out of range.");
 
 2055   std::string errmsg = 
">>> ERROR (Intrepid::mapToReferenceSubcell):";
 
 2056   TEUCHOS_TEST_FOR_EXCEPTION( !requireRankRange(errmsg, refSubcellPoints, 2,2), std::invalid_argument, errmsg);
 
 2057   TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionRange(errmsg, refSubcellPoints, 1, cellDim, cellDim), std::invalid_argument, errmsg);
 
 2060   TEUCHOS_TEST_FOR_EXCEPTION( !requireRankRange(errmsg, paramPoints, 2,2), std::invalid_argument, errmsg);
 
 2061   TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionRange(errmsg, paramPoints, 1, subcellDim, subcellDim), std::invalid_argument, errmsg);    
 
 2064   TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionMatch(errmsg, refSubcellPoints, 0,  paramPoints, 0), std::invalid_argument, errmsg);      
 
 2072   if(subcellDim == 2) {
 
 2073     for(
size_t pt = 0; pt < numPts; pt++){
 
 2074       double u = paramPoints(pt,0);
 
 2075       double v = paramPoints(pt,1);
 
 2078       for(
int  dim = 0; dim < cellDim; dim++){
 
 2079         refSubcellPoints(pt, dim) = subcellMap(subcellOrd, dim, 0) + \
 
 2080                                     subcellMap(subcellOrd, dim, 1)*u + \
 
 2081                                     subcellMap(subcellOrd, dim, 2)*v;
 
 2085   else if(subcellDim == 1) {    
 
 2086     for(
size_t pt = 0; pt < numPts; pt++){
 
 2087       for(
int dim = 0; dim < cellDim; dim++) {
 
 2088         refSubcellPoints(pt, dim) = subcellMap(subcellOrd, dim, 0) + subcellMap(subcellOrd, dim, 1)*paramPoints(pt,0);
 
 2093     TEUCHOS_TEST_FOR_EXCEPTION( !( (subcellDim == 1) || (subcellDim == 2) ), std::invalid_argument, 
 
 2094                         ">>> ERROR (Intrepid::CellTools::mapToReferenceSubcell): method defined only for 1 and 2-subcells");
 
 2100 template<
class Scalar>
 
 2101 template<
class ArrayEdgeTangent>
 
 2103                                                 const int &                   edgeOrd,
 
 2104                                                 const shards::CellTopology &  parentCell){
 
 2106   int spaceDim  = parentCell.getDimension();
 
 2108 #ifdef HAVE_INTREPID_DEBUG 
 2110   TEUCHOS_TEST_FOR_EXCEPTION( !( (spaceDim == 2) || (spaceDim == 3) ), std::invalid_argument, 
 
 2111                               ">>> ERROR (Intrepid::CellTools::getReferenceFaceTangents): two or three-dimensional parent cell required");
 
 2113   TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= edgeOrd) && (edgeOrd < (
int)parentCell.getSubcellCount(1) ) ), std::invalid_argument,
 
 2114                               ">>> ERROR (Intrepid::CellTools::getReferenceFaceTangents): edge ordinal out of bounds");  
 
 2116   TEUCHOS_TEST_FOR_EXCEPTION( !( refEdgeTangent.size() == spaceDim ), std::invalid_argument,
 
 2117                               ">>> ERROR (Intrepid::CellTools::getReferenceFaceTangents): output array size is required to match space dimension");  
 
 2125   refEdgeTangent(0) = edgeMap(edgeOrd, 0, 1);
 
 2126   refEdgeTangent(1) = edgeMap(edgeOrd, 1, 1);
 
 2130     refEdgeTangent(2) = edgeMap(edgeOrd, 2, 1);  
 
 2136 template<
class Scalar>
 
 2137 template<
class ArrayFaceTangentU, 
class ArrayFaceTangentV>
 
 2139                                                  ArrayFaceTangentV &           vTan,
 
 2140                                                  const int &                   faceOrd,
 
 2141                                                  const shards::CellTopology &  parentCell){
 
 2143 #ifdef HAVE_INTREPID_DEBUG 
 2144   int spaceDim  = parentCell.getDimension();
 
 2145   TEUCHOS_TEST_FOR_EXCEPTION( !(spaceDim == 3), std::invalid_argument, 
 
 2146                               ">>> ERROR (Intrepid::CellTools::getReferenceFaceTangents): three-dimensional parent cell required");  
 
 2148   TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= faceOrd) && (faceOrd < (
int)parentCell.getSubcellCount(2) ) ), std::invalid_argument,
 
 2149                               ">>> ERROR (Intrepid::CellTools::getReferenceFaceTangents): face ordinal out of bounds");  
 
 2151   TEUCHOS_TEST_FOR_EXCEPTION( !( (getrank(uTan) == 1)  && (getrank(vTan) == 1) ), std::invalid_argument,  
 
 2152                               ">>> ERROR (Intrepid::CellTools::getReferenceFaceTangents): rank = 1 required for output arrays"); 
 
 2154   TEUCHOS_TEST_FOR_EXCEPTION( !( uTan.dimension(0) == spaceDim ), std::invalid_argument,
 
 2155                               ">>> ERROR (Intrepid::CellTools::getReferenceFaceTangents): dim0 (spatial dim) must match that of parent cell");  
 
 2157   TEUCHOS_TEST_FOR_EXCEPTION( !( vTan.dimension(0) == spaceDim ), std::invalid_argument,
 
 2158                               ">>> ERROR (Intrepid::CellTools::getReferenceFaceTangents): dim0 (spatial dim) must match that of parent cell");  
 
 2169     uTan(0) = faceMap(faceOrd, 0, 1);
 
 2170     uTan(1) = faceMap(faceOrd, 1, 1);
 
 2171     uTan(2) = faceMap(faceOrd, 2, 1);
 
 2174     vTan(0) = faceMap(faceOrd, 0, 2);
 
 2175     vTan(1) = faceMap(faceOrd, 1, 2);
 
 2176     vTan(2) = faceMap(faceOrd, 2, 2);
 
 2181 template<
class Scalar>
 
 2182 template<
class ArrayS
ideNormal>
 
 2184                                                const int &                   sideOrd,
 
 2185                                                const shards::CellTopology &  parentCell){
 
 2186   int spaceDim  = parentCell.getDimension();
 
 2188   #ifdef HAVE_INTREPID_DEBUG 
 2190   TEUCHOS_TEST_FOR_EXCEPTION( !( (spaceDim == 2) || (spaceDim == 3) ), std::invalid_argument, 
 
 2191                               ">>> ERROR (Intrepid::CellTools::getReferenceSideNormal): two or three-dimensional parent cell required");
 
 2194   TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= sideOrd) && (sideOrd < (
int)parentCell.getSubcellCount(spaceDim - 1) ) ), std::invalid_argument,
 
 2195                               ">>> ERROR (Intrepid::CellTools::getReferenceSideNormal): side ordinal out of bounds");    
 
 2200     getReferenceEdgeTangent(refSideNormal, sideOrd, parentCell);
 
 2203     Scalar temp = refSideNormal(0);
 
 2204     refSideNormal(0) = refSideNormal(1);
 
 2205     refSideNormal(1) = -temp;
 
 2209     getReferenceFaceNormal(refSideNormal, sideOrd, parentCell);
 
 2215 template<
class Scalar>
 
 2216 template<
class ArrayFaceNormal>
 
 2218                                                const int &                   faceOrd,
 
 2219                                                const shards::CellTopology &  parentCell){
 
 2220   int spaceDim  = parentCell.getDimension();
 
 2221   #ifdef HAVE_INTREPID_DEBUG 
 2223   TEUCHOS_TEST_FOR_EXCEPTION( !(spaceDim == 3), std::invalid_argument, 
 
 2224                               ">>> ERROR (Intrepid::CellTools::getReferenceFaceNormal): three-dimensional parent cell required");  
 
 2226   TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= faceOrd) && (faceOrd < (
int)parentCell.getSubcellCount(2) ) ), std::invalid_argument,
 
 2227                               ">>> ERROR (Intrepid::CellTools::getReferenceFaceNormal): face ordinal out of bounds");  
 
 2229   TEUCHOS_TEST_FOR_EXCEPTION( !( getrank(refFaceNormal) == 1 ), std::invalid_argument,  
 
 2230                               ">>> ERROR (Intrepid::CellTools::getReferenceFaceNormal): rank = 1 required for output array"); 
 
 2232   TEUCHOS_TEST_FOR_EXCEPTION( !( static_cast<size_t>(refFaceNormal.dimension(0)) == static_cast<size_t>(spaceDim) ), std::invalid_argument,
 
 2233                               ">>> ERROR (Intrepid::CellTools::getReferenceFaceNormal): dim0 (spatial dim) must match that of parent cell");  
 
 2239   getReferenceFaceTangents(uTan, vTan, faceOrd, parentCell);
 
 2245 template<
class Scalar>
 
 2246 template<
class ArrayEdgeTangent, 
class ArrayJac>
 
 2248                                                 const ArrayJac &              worksetJacobians,
 
 2249                                                 const int &                   worksetEdgeOrd,
 
 2250                                                 const shards::CellTopology &  parentCell){
 
 2251   size_t worksetSize = 
static_cast<size_t>(worksetJacobians.dimension(0));
 
 2252   size_t edgePtCount = 
static_cast<size_t>(worksetJacobians.dimension(1)); 
 
 2253   int pCellDim    = parentCell.getDimension();
 
 2254   #ifdef HAVE_INTREPID_DEBUG 
 2255   std::string errmsg = 
">>> ERROR (Intrepid::CellTools::getPhysicalEdgeTangents):";
 
 2257   TEUCHOS_TEST_FOR_EXCEPTION( !( (pCellDim == 3) || (pCellDim == 2) ), std::invalid_argument, 
 
 2258                               ">>> ERROR (Intrepid::CellTools::getPhysicalEdgeTangents): 2D or 3D parent cell required");  
 
 2261   TEUCHOS_TEST_FOR_EXCEPTION( !requireRankRange(errmsg, edgeTangents, 3,3), std::invalid_argument, errmsg);
 
 2262   TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionRange(errmsg, edgeTangents, 2, 2,3), std::invalid_argument, errmsg);
 
 2265   TEUCHOS_TEST_FOR_EXCEPTION( !requireRankRange(errmsg, worksetJacobians, 4,4), std::invalid_argument, errmsg);
 
 2266   TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionRange(errmsg, worksetJacobians, 2, 2,3), std::invalid_argument, errmsg);
 
 2267   TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionRange(errmsg, worksetJacobians, 3, 2,3), std::invalid_argument, errmsg);
 
 2270   TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionMatch(errmsg, edgeTangents, 0,1,2,2,  worksetJacobians, 0,1,2,3), std::invalid_argument, errmsg);      
 
 2276   getReferenceEdgeTangent(refEdgeTan, worksetEdgeOrd, parentCell);
 
 2279   for(
size_t pCell = 0; pCell < worksetSize; pCell++){
 
 2280     for(
size_t pt = 0; pt < edgePtCount; pt++){
 
 2283       for(
int i = 0; i < pCellDim; i++){
 
 2284         edgeTangents(pCell, pt, i) = 0.0;
 
 2285         for(
int j = 0; j < pCellDim; j++){
 
 2286           edgeTangents(pCell, pt, i) +=  worksetJacobians(pCell, pt, i, j)*refEdgeTan(j);
 
 2292 template<
class Scalar>
 
 2293 template<
class ArrayFaceTangentU, 
class ArrayFaceTangentV, 
class ArrayJac>
 
 2295                                                 ArrayFaceTangentV &           faceTanV,
 
 2296                                                 const ArrayJac &              worksetJacobians,
 
 2297                                                 const int &                   worksetFaceOrd,
 
 2298                                                 const shards::CellTopology &  parentCell){
 
 2299   size_t worksetSize = 
static_cast<size_t>(worksetJacobians.dimension(0));
 
 2300   size_t facePtCount = 
static_cast<size_t>(worksetJacobians.dimension(1)); 
 
 2301   int pCellDim    = parentCell.getDimension();
 
 2302   #ifdef HAVE_INTREPID_DEBUG 
 2303   std::string errmsg = 
">>> ERROR (Intrepid::CellTools::getPhysicalFaceTangents):";
 
 2305   TEUCHOS_TEST_FOR_EXCEPTION( !(pCellDim == 3), std::invalid_argument, 
 
 2306                               ">>> ERROR (Intrepid::CellTools::getPhysicalFaceTangents): three-dimensional parent cell required");  
 
 2309   TEUCHOS_TEST_FOR_EXCEPTION( !requireRankRange(errmsg, faceTanU, 3,3), std::invalid_argument, errmsg);
 
 2310   TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionRange(errmsg, faceTanU, 2, 3,3), std::invalid_argument, errmsg);
 
 2312   TEUCHOS_TEST_FOR_EXCEPTION( !requireRankRange(errmsg, faceTanV, 3,3), std::invalid_argument, errmsg);
 
 2313   TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionRange(errmsg, faceTanV, 2, 3,3), std::invalid_argument, errmsg);
 
 2315   TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionMatch(errmsg, faceTanU,  faceTanV), std::invalid_argument, errmsg);      
 
 2318   TEUCHOS_TEST_FOR_EXCEPTION( !requireRankRange(errmsg, worksetJacobians, 4,4), std::invalid_argument, errmsg);
 
 2319   TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionRange(errmsg, worksetJacobians, 2, 3,3), std::invalid_argument, errmsg);
 
 2320   TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionRange(errmsg, worksetJacobians, 3, 3,3), std::invalid_argument, errmsg);
 
 2323   TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionMatch(errmsg, faceTanU, 0,1,2,2,  worksetJacobians, 0,1,2,3), std::invalid_argument, errmsg);      
 
 2330   getReferenceFaceTangents(refFaceTanU, refFaceTanV, worksetFaceOrd, parentCell);
 
 2333   for(
size_t pCell = 0; pCell < worksetSize; pCell++){
 
 2334     for(
size_t pt = 0; pt < facePtCount; pt++){
 
 2337       for(
int dim = 0; dim < pCellDim; dim++){
 
 2338         faceTanU(pCell, pt, dim) = 0.0;
 
 2339         faceTanV(pCell, pt, dim) = 0.0;
 
 2342         faceTanU(pCell, pt, dim) = \
 
 2343           worksetJacobians(pCell, pt, dim, 0)*refFaceTanU(0) + \
 
 2344           worksetJacobians(pCell, pt, dim, 1)*refFaceTanU(1) + \
 
 2345           worksetJacobians(pCell, pt, dim, 2)*refFaceTanU(2);
 
 2346         faceTanV(pCell, pt, dim) = \
 
 2347           worksetJacobians(pCell, pt, dim, 0)*refFaceTanV(0) + \
 
 2348           worksetJacobians(pCell, pt, dim, 1)*refFaceTanV(1) + \
 
 2349           worksetJacobians(pCell, pt, dim, 2)*refFaceTanV(2);
 
 2355 template<
class Scalar>
 
 2356 template<
class ArrayS
ideNormal, 
class ArrayJac>
 
 2358                                                const ArrayJac &              worksetJacobians,
 
 2359                                                const int &                   worksetSideOrd,
 
 2360                                                const shards::CellTopology &  parentCell){
 
 2361   size_t worksetSize = 
static_cast<size_t>(worksetJacobians.dimension(0));
 
 2362   size_t sidePtCount = 
static_cast<size_t>(worksetJacobians.dimension(1));   
 
 2363   int spaceDim  = parentCell.getDimension();
 
 2364    #ifdef HAVE_INTREPID_DEBUG 
 2365   TEUCHOS_TEST_FOR_EXCEPTION( !( (spaceDim == 2) || (spaceDim == 3) ), std::invalid_argument, 
 
 2366                               ">>> ERROR (Intrepid::CellTools::getPhysicalSideNormals): two or three-dimensional parent cell required");
 
 2369   TEUCHOS_TEST_FOR_EXCEPTION( !( (0 <= worksetSideOrd) && (worksetSideOrd < (
int)parentCell.getSubcellCount(spaceDim - 1) ) ), std::invalid_argument,
 
 2370                               ">>> ERROR (Intrepid::CellTools::getPhysicalSideNormals): side ordinal out of bounds");  
 
 2376     getPhysicalEdgeTangents(sideNormals, worksetJacobians, worksetSideOrd, parentCell);
 
 2379     for(
size_t cell = 0; cell < worksetSize; cell++){
 
 2380       for(
size_t pt = 0; pt < sidePtCount; pt++){
 
 2381         Scalar temp = sideNormals(cell, pt, 0);
 
 2382         sideNormals(cell, pt, 0) = sideNormals(cell, pt, 1);
 
 2383         sideNormals(cell, pt, 1) = -temp;
 
 2389     getPhysicalFaceNormals(sideNormals, worksetJacobians, worksetSideOrd, parentCell);
 
 2394 template<
class Scalar>
 
 2395 template<
class ArrayFaceNormal, 
class ArrayJac>
 
 2397                                                const ArrayJac &              worksetJacobians,
 
 2398                                                const int &                   worksetFaceOrd,
 
 2399                                                const shards::CellTopology &  parentCell){
 
 2400   size_t worksetSize = 
static_cast<size_t>(worksetJacobians.dimension(0));
 
 2401   size_t facePtCount = 
static_cast<size_t>(worksetJacobians.dimension(1)); 
 
 2402   int pCellDim    = parentCell.getDimension();
 
 2403   #ifdef HAVE_INTREPID_DEBUG 
 2404   std::string errmsg = 
">>> ERROR (Intrepid::CellTools::getPhysicalFaceNormals):";
 
 2406   TEUCHOS_TEST_FOR_EXCEPTION( !(pCellDim == 3), std::invalid_argument, 
 
 2407                               ">>> ERROR (Intrepid::CellTools::getPhysicalFaceNormals): three-dimensional parent cell required");  
 
 2410   TEUCHOS_TEST_FOR_EXCEPTION( !requireRankRange(errmsg, faceNormals, 3,3), std::invalid_argument, errmsg);
 
 2411   TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionRange(errmsg, faceNormals, 2, 3,3), std::invalid_argument, errmsg);
 
 2414   TEUCHOS_TEST_FOR_EXCEPTION( !requireRankRange(errmsg, worksetJacobians, 4,4), std::invalid_argument, errmsg);
 
 2415   TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionRange(errmsg, worksetJacobians, 2, 3,3), std::invalid_argument, errmsg);
 
 2416   TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionRange(errmsg, worksetJacobians, 3, 3,3), std::invalid_argument, errmsg);
 
 2419   TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionMatch(errmsg, faceNormals, 0,1,2,2,  worksetJacobians, 0,1,2,3), std::invalid_argument, errmsg);        
 
 2425   getPhysicalFaceTangents(faceTanU, faceTanV, worksetJacobians, worksetFaceOrd, parentCell);
 
 2439 template<
class Scalar>
 
 2442                                            const shards::CellTopology &  cellTopo,
 
 2443                                            const double &                threshold) {
 
 2444 #ifdef HAVE_INTREPID_DEBUG 
 2445   TEUCHOS_TEST_FOR_EXCEPTION( !(pointDim == (
int)cellTopo.getDimension() ), std::invalid_argument,
 
 2446                       ">>> ERROR (Intrepid::CellTools::checkPointInclusion): Point and cell dimensions do not match. ");
 
 2451   double minus_one = -1.0 - threshold;
 
 2452   double plus_one  =  1.0 + threshold;
 
 2453   double minus_zero = - threshold;
 
 2458   unsigned key = cellTopo.getBaseCellTopologyData() -> key ;
 
 2461     case shards::Line<>::key :
 
 2462       if( !(minus_one <= point[0] && point[0] <= plus_one))  testResult = 0;
 
 2465     case shards::Triangle<>::key : {
 
 2466       Scalar distance = std::max( std::max( -point[0], -point[1] ), point[0] + point[1] - 1.0 );
 
 2467       if( distance > threshold ) testResult = 0;
 
 2471     case shards::Quadrilateral<>::key :
 
 2472       if(!( (minus_one <= point[0] && point[0] <= plus_one) && \
 
 2473             (minus_one <= point[1] && point[1] <= plus_one) ) ) testResult = 0;   
 
 2476     case shards::Tetrahedron<>::key : {
 
 2477       Scalar distance = std::max(  std::max(-point[0],-point[1]), \
 
 2478                                    std::max(-point[2], point[0] + point[1] + point[2] - 1)  );
 
 2479       if( distance > threshold ) testResult = 0;
 
 2483     case shards::Hexahedron<>::key :
 
 2484       if(!((minus_one <= point[0] && point[0] <= plus_one) && \
 
 2485            (minus_one <= point[1] && point[1] <= plus_one) && \
 
 2486            (minus_one <= point[2] && point[2] <= plus_one)))  \
 
 2492     case shards::Wedge<>::key : {
 
 2493       Scalar distance = std::max( std::max( -point[0], -point[1] ), point[0] + point[1] - 1 );
 
 2494       if( distance > threshold  || \
 
 2495           point[2] < minus_one || point[2] > plus_one) \
 
 2503     case shards::Pyramid<>::key : {
 
 2504       Scalar left  = minus_one + point[2];
 
 2505       Scalar right = plus_one  - point[2];
 
 2506       if(!( (left       <= point[0] && point[0] <= right) && \
 
 2507             (left       <= point[1] && point[1] <= right) && 
 
 2508             (minus_zero <= point[2] && point[2] <= plus_one) ) )  \
 
 2514       TEUCHOS_TEST_FOR_EXCEPTION( !( (key == shards::Line<>::key ) ||
 
 2515                              (key == shards::Triangle<>::key)  ||
 
 2516                              (key == shards::Quadrilateral<>::key) ||
 
 2517                              (key == shards::Tetrahedron<>::key)  ||
 
 2518                              (key == shards::Hexahedron<>::key)  ||
 
 2519                              (key == shards::Wedge<>::key)  ||
 
 2520                              (key == shards::Pyramid<>::key) ),
 
 2521                           std::invalid_argument,
 
 2522                           ">>> ERROR (Intrepid::CellTools::checkPointInclusion): Invalid cell topology. ");
 
 2529 template<
class Scalar>
 
 2530 template<
class ArrayPo
int>
 
 2532                                               const shards::CellTopology &  cellTopo, 
 
 2533                                               const double &                threshold) {
 
 2535   int rank = points.rank();  
 
 2537 #ifdef HAVE_INTREPID_DEBUG 
 2538   TEUCHOS_TEST_FOR_EXCEPTION( !( (1 <=getrank(points) ) && (getrank(points) <= 3) ), std::invalid_argument,
 
 2539                       ">>> ERROR (Intrepid::CellTools::checkPointsetInclusion): rank-1, 2 or 3 required for input points array. ");
 
 2542   TEUCHOS_TEST_FOR_EXCEPTION( !((
size_t) points.dimension(rank - 1) == (size_t)cellTopo.getDimension() ), std::invalid_argument,
 
 2543                       ">>> ERROR (Intrepid::CellTools::checkPointsetInclusion): Point and cell dimensions do not match. ");
 
 2549     case 1: inRefCell.
resize(1); 
break;
 
 2550     case 2: inRefCell.
resize( static_cast<size_t>(points.dimension(0)) ); 
break;
 
 2551     case 3: inRefCell.
resize( static_cast<size_t>(points.dimension(0)), static_cast<size_t>(points.dimension(1)) ); 
break;
 
 2555   checkPointwiseInclusion(inRefCell, points, cellTopo, threshold);
 
 2559   for(
int i = 0; i < inRefCell.
size(); i++ ){
 
 2560     if (inRefCell[i] == 0) {
 
 2570 template<
class Scalar>
 
 2571 template<
class ArrayIncl, 
class ArrayPo
int>
 
 2573                                                 const ArrayPoint &            points,
 
 2574                                                 const shards::CellTopology &  cellTopo, 
 
 2575                                                 const double &                threshold) {
 
 2576   int apRank   = points.rank();
 
 2578 #ifdef HAVE_INTREPID_DEBUG 
 2581   std::string errmsg = 
">>> ERROR (Intrepid::CellTools::checkPointwiseInclusion):";
 
 2582   if(getrank(points) == 1) {
 
 2583     TEUCHOS_TEST_FOR_EXCEPTION( !(getrank(inRefCell) == 1 ), std::invalid_argument, 
 
 2584                         ">>> ERROR (Intrepid::CellTools::checkPointwiseInclusion): rank-1 input array requires rank-1 output array.");  
 
 2585     TEUCHOS_TEST_FOR_EXCEPTION( !(static_cast<size_t>(inRefCell.dimension(0)) == 1), std::invalid_argument,
 
 2586                         ">>> ERROR (Intrepid::CellTools::checkPointwiseInclusion): rank-1 input array requires dim0 = 1 for output array.");  
 
 2588   else if(getrank(points) == 2){
 
 2589     TEUCHOS_TEST_FOR_EXCEPTION( !(getrank(inRefCell) == 1 ), std::invalid_argument, 
 
 2590                         ">>> ERROR (Intrepid::CellTools::checkPointwiseInclusion): rank-2 input array requires rank-1 output array.");  
 
 2592     TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionMatch( errmsg, inRefCell, 0,  points, 0), std::invalid_argument, errmsg);
 
 2594   else if (getrank(points) == 3) {
 
 2595     TEUCHOS_TEST_FOR_EXCEPTION( !(getrank(inRefCell) == 2 ), std::invalid_argument, 
 
 2596                         ">>> ERROR (Intrepid::CellTools::checkPointwiseInclusion): rank-3 input array requires rank-2 output array.");  
 
 2598     TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionMatch( errmsg, inRefCell, 0,1,  points, 0,1), std::invalid_argument, errmsg);
 
 2601     TEUCHOS_TEST_FOR_EXCEPTION( !( (getrank(points) == 1) || (getrank(points) == 2) || (getrank(points) == 3) ), std::invalid_argument,
 
 2602                         ">>> ERROR (Intrepid::CellTools::checkPointwiseInclusion): rank-1, 2 or 3 required for input points array. ");      
 
 2606   TEUCHOS_TEST_FOR_EXCEPTION( !((
size_t)points.dimension(apRank - 1) == (size_t)cellTopo.getDimension() ), std::invalid_argument,
 
 2607                       ">>> ERROR (Intrepid::CellTools::checkPointwiseInclusion): Point and cell dimensions do not match. ");
 
 2617       pointDim = 
static_cast<size_t>(points.dimension(0));
 
 2620       dim1     = 
static_cast<size_t>(points.dimension(0));
 
 2621       pointDim = 
static_cast<size_t>(points.dimension(1));
 
 2624       dim0     = 
static_cast<size_t>(points.dimension(0));
 
 2625       dim1     = 
static_cast<size_t>(points.dimension(1));
 
 2626       pointDim = 
static_cast<size_t>(points.dimension(2));
 
 2629       TEUCHOS_TEST_FOR_EXCEPTION( !( (1 <= getrank(points) ) && (getrank(points) <= 3) ), std::invalid_argument,
 
 2630                           ">>> ERROR (Intrepid::CellTools::checkPointwiseInclusion): rank-1, 2 or 3 required for input points array. ");      
 
 2642   Scalar point[3] = {0.0, 0.0, 0.0};
 
 2644   for(
int i0 = 0; i0 < dim0; i0++){
 
 2646     inPtr0  = outPtr0*pointDim;
 
 2648     for(
int i1 = 0; i1 < dim1; i1++) {
 
 2649       inPtr1 = inPtr0 + i1*pointDim;      
 
 2650       point[0] = points[inPtr1];
 
 2652         point[1] = points[inPtr1 + 1];
 
 2654           point[2] = points[inPtr1 + 2];
 
 2656             TEUCHOS_TEST_FOR_EXCEPTION( !( (1 <= pointDim) && (pointDim <= 3)), std::invalid_argument, 
 
 2657                                 ">>> ERROR (Intrepid::CellTools::checkPointwiseInclusion): Input array specifies invalid point dimension ");      
 
 2661       inRefCell[outPtr0 + i1] = checkPointInclusion(point, pointDim, cellTopo, threshold);
 
 2668 template<
class Scalar>
 
 2669 template<
class ArrayIncl, 
class ArrayPo
int, 
class ArrayCell>
 
 2671                                                 const ArrayPoint &            points,
 
 2672                                                 const ArrayCell &             cellWorkset,
 
 2673                                                 const shards::CellTopology &  cell,
 
 2674                                                 const int &                   whichCell, 
 
 2675                                                 const double &                threshold)
 
 2677   INTREPID_VALIDATE( validateArguments_checkPointwiseInclusion(inCell, points, cellWorkset, whichCell, cell) );
 
 2681   unsigned baseKey = cell.getBaseCellTopologyData() -> key;
 
 2685     case shards::Line<>::key :
 
 2686     case shards::Triangle<>::key:
 
 2687     case shards::Quadrilateral<>::key :
 
 2688     case shards::Tetrahedron<>::key :
 
 2689     case shards::Hexahedron<>::key :
 
 2690     case shards::Wedge<>::key :
 
 2691     case shards::Pyramid<>::key :
 
 2695         if(getrank(points) == 2){
 
 2696           refPoints.
resize(static_cast<size_t>(points.dimension(0)), static_cast<size_t>(points.dimension(1)) );
 
 2697           mapToReferenceFrame(refPoints, points, cellWorkset, cell, whichCell);
 
 2698           checkPointwiseInclusion(inCell, refPoints, cell, threshold );
 
 2700         else if(getrank(points) == 3){
 
 2701           refPoints.
resize(static_cast<size_t>(points.dimension(0)), static_cast<size_t>(points.dimension(1)), static_cast<size_t>(points.dimension(2)) );
 
 2702           mapToReferenceFrame(refPoints, points, cellWorkset, cell, whichCell);
 
 2703           checkPointwiseInclusion(inCell, refPoints, cell, threshold );          
 
 2708       TEUCHOS_TEST_FOR_EXCEPTION( 
true, std::invalid_argument, 
 
 2709                           ">>> ERROR (Intrepid::CellTools::checkPointwiseInclusion): cell topology not supported");
 
 2721 template<
class Scalar>
 
 2722 template<
class ArrayJac, 
class ArrayPo
int, 
class ArrayCell>
 
 2724                                                       const ArrayPoint  &          points,
 
 2725                                                       const ArrayCell   &          cellWorkset,
 
 2726                                                       const int &                  whichCell,
 
 2727                                                       const shards::CellTopology & cellTopo){
 
 2730   TEUCHOS_TEST_FOR_EXCEPTION( (getrank(cellWorkset) != 3), std::invalid_argument,
 
 2731                       ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): rank = 3 required for cellWorkset array");
 
 2733   TEUCHOS_TEST_FOR_EXCEPTION( (static_cast<size_t>(cellWorkset.dimension(0)) <= 0), std::invalid_argument,
 
 2734                       ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 0 (number of cells) >= 1 required for cellWorkset array");
 
 2736   TEUCHOS_TEST_FOR_EXCEPTION( (static_cast<size_t>(cellWorkset.dimension(1)) != (
size_t)cellTopo.getSubcellCount(0) ), std::invalid_argument,
 
 2737                       ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 1 (number of cell nodes) of cellWorkset array does not match cell topology");
 
 2739   TEUCHOS_TEST_FOR_EXCEPTION( (static_cast<size_t>(cellWorkset.dimension(2)) != (
size_t)cellTopo.getDimension() ), std::invalid_argument,
 
 2740                       ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 2 (spatial dimension) of cellWorkset array  does not match cell dimension");
 
 2743   TEUCHOS_TEST_FOR_EXCEPTION( !( ( (0 <= whichCell ) && (static_cast<size_t>(whichCell) < static_cast<size_t>(cellWorkset.dimension(0)) ) ) || (whichCell == -1) ), std::invalid_argument,
 
 2744                       ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): whichCell = -1 or a valid cell ordinal is required.");
 
 2749   if(getrank(points) == 2) {
 
 2750     TEUCHOS_TEST_FOR_EXCEPTION( (static_cast<size_t>(points.dimension(0)) <= 0), std::invalid_argument,
 
 2751                         ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 0 (number of points) >= 1 required for points array ");
 
 2753     TEUCHOS_TEST_FOR_EXCEPTION( (static_cast<size_t>(points.dimension(1)) != (
size_t)cellTopo.getDimension() ), std::invalid_argument,
 
 2754                         ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 1 (spatial dimension) of points array does not match cell dimension");
 
 2757     if(whichCell == -1) {
 
 2758       TEUCHOS_TEST_FOR_EXCEPTION( (getrank(jacobian) != 4), std::invalid_argument, 
 
 2759                           ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): rank = 4 required for jacobian array");
 
 2761       TEUCHOS_TEST_FOR_EXCEPTION( (static_cast<size_t>(jacobian.dimension(0)) != static_cast<size_t>(cellWorkset.dimension(0))), std::invalid_argument,
 
 2762                           ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 0 (number of cells) of jacobian array must equal dim 0 of cellWorkset array");
 
 2764       TEUCHOS_TEST_FOR_EXCEPTION( (static_cast<size_t>(jacobian.dimension(1)) != static_cast<size_t>(points.dimension(0))), std::invalid_argument,
 
 2765                           ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 1 (number of points) of jacobian array must equal dim 0 of points array");
 
 2767       TEUCHOS_TEST_FOR_EXCEPTION( (static_cast<size_t>(jacobian.dimension(2)) != static_cast<size_t>(points.dimension(1))), std::invalid_argument,
 
 2768                           ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 2 (spatial dimension) of jacobian array must equal dim 1 of points array");
 
 2770       TEUCHOS_TEST_FOR_EXCEPTION( !(static_cast<size_t>(jacobian.dimension(2)) == static_cast<size_t>(jacobian.dimension(3)) ), std::invalid_argument,
 
 2771                           ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 2 = dim 3 (same spatial dimensions) required for jacobian array. ");
 
 2773       TEUCHOS_TEST_FOR_EXCEPTION( !( (0 < static_cast<size_t>(jacobian.dimension(3)) ) && (
static_cast<size_t>(jacobian.dimension(3)) < 4) ), std::invalid_argument,
 
 2774                           ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 2 and dim 3 (spatial dimensions) must be between 1 and 3. ");
 
 2778       TEUCHOS_TEST_FOR_EXCEPTION( (getrank(jacobian) != 3), std::invalid_argument, 
 
 2779                           ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): rank = 3 required for jacobian array");
 
 2781       TEUCHOS_TEST_FOR_EXCEPTION( (static_cast<size_t>(jacobian.dimension(0)) != static_cast<size_t>(points.dimension(0))), std::invalid_argument,
 
 2782                           ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 0 (number of points) of jacobian array must equal dim 0 of points array");
 
 2784       TEUCHOS_TEST_FOR_EXCEPTION( (static_cast<size_t>(jacobian.dimension(1)) != static_cast<size_t>(points.dimension(1))), std::invalid_argument,
 
 2785                           ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 1 (spatial dimension) of jacobian array must equal dim 1 of points array");
 
 2787       TEUCHOS_TEST_FOR_EXCEPTION( !(static_cast<size_t>(jacobian.dimension(1)) == static_cast<size_t>(jacobian.dimension(2)) ), std::invalid_argument,
 
 2788                           ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 1 = dim 2 (same spatial dimensions) required for jacobian array. ");
 
 2790       TEUCHOS_TEST_FOR_EXCEPTION( !( (0 < static_cast<size_t>(jacobian.dimension(1)) ) && (
static_cast<size_t>(jacobian.dimension(1)) < 4) ), std::invalid_argument,
 
 2791                           ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 1 and dim 2 (spatial dimensions) must be between 1 and 3. ");
 
 2795   else if(getrank(points) ==3){
 
 2796     std::string errmsg  = 
">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian):";
 
 2797     TEUCHOS_TEST_FOR_EXCEPTION( (static_cast<size_t>(points.dimension(0)) != static_cast<size_t>(cellWorkset.dimension(0)) ), std::invalid_argument,
 
 2798                         ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 0 (number of cells) of points array must equal dim 0 of cellWorkset array");
 
 2800     TEUCHOS_TEST_FOR_EXCEPTION( (static_cast<size_t>(points.dimension(1)) <= 0), std::invalid_argument,
 
 2801                         ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 1 (number of points) >= 1 required for points array ");
 
 2803     TEUCHOS_TEST_FOR_EXCEPTION( (static_cast<size_t>(points.dimension(2)) != (
size_t)cellTopo.getDimension() ), std::invalid_argument,
 
 2804                         ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 2 (spatial dimension) of points array does not match cell dimension");
 
 2806     TEUCHOS_TEST_FOR_EXCEPTION( (whichCell != -1), std::invalid_argument,
 
 2807                         ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): default value whichCell=-1 required for rank-3 input points");
 
 2810     TEUCHOS_TEST_FOR_EXCEPTION( !requireRankRange(errmsg, jacobian,  4, 4), std::invalid_argument,errmsg);
 
 2812     TEUCHOS_TEST_FOR_EXCEPTION( (static_cast<size_t>(jacobian.dimension(0)) != static_cast<size_t>(points.dimension(0))), std::invalid_argument,
 
 2813                         ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 0 (number of cells) of jacobian array must equal dim 0 of points array");
 
 2815     TEUCHOS_TEST_FOR_EXCEPTION( (static_cast<size_t>(jacobian.dimension(1)) != static_cast<size_t>(points.dimension(1))), std::invalid_argument,
 
 2816                         ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 1 (number of points) of jacobian array must equal dim 1 of points array");
 
 2818     TEUCHOS_TEST_FOR_EXCEPTION( (static_cast<size_t>(jacobian.dimension(2)) != static_cast<size_t>(points.dimension(2))), std::invalid_argument,
 
 2819                         ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 2 (spatial dimension) of jacobian array must equal dim 2 of points array");
 
 2821     TEUCHOS_TEST_FOR_EXCEPTION( !(static_cast<size_t>(jacobian.dimension(2)) == static_cast<size_t>(jacobian.dimension(3)) ), std::invalid_argument,
 
 2822                         ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 2 = dim 3 (same spatial dimensions) required for jacobian array. ");
 
 2824     TEUCHOS_TEST_FOR_EXCEPTION( !( (0 < static_cast<size_t>(jacobian.dimension(3)) ) && (
static_cast<size_t>(jacobian.dimension(3)) < 4) ), std::invalid_argument,
 
 2825                         ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): dim 2 and dim 3 (spatial dimensions) must be between 1 and 3. ");
 
 2828     TEUCHOS_TEST_FOR_EXCEPTION( !( (getrank(points) == 2) && (getrank(points) ==3) ), std::invalid_argument,
 
 2829                         ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobian): rank = 2 or 3 required for points array");
 
 2835 template<
class Scalar>
 
 2836 template<
class ArrayJacInv, 
class ArrayJac>
 
 2838                                                          const ArrayJac &    jacobian)
 
 2842   int jacobRank = getrank(jacobian);
 
 2843   TEUCHOS_TEST_FOR_EXCEPTION( !( (jacobRank == 4) || (jacobRank == 3) ), std::invalid_argument,
 
 2844                       ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobianInv): rank = 4 or 3 required for jacobian array. ");
 
 2847   TEUCHOS_TEST_FOR_EXCEPTION( !(jacobian.dimension(jacobRank - 1) == jacobian.dimension(jacobRank - 2) ), std::invalid_argument,
 
 2848                       ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobianInv): dim(rank-2) = dim(rank-2) (same spatial dimensions) required for jacobian array. ");
 
 2850   TEUCHOS_TEST_FOR_EXCEPTION( !( (0 < jacobian.dimension(jacobRank - 1) ) && (jacobian.dimension(jacobRank - 1) < 4) ), std::invalid_argument,
 
 2851                       ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobianInv): dim(rank-1) and dim(rank-2) (spatial dimensions) must be between 1 and 3. ");
 
 2854   std::string errmsg = 
">>> ERROR (Intrepid::CellTools::validateArguments_setJacobianInv):";
 
 2856   TEUCHOS_TEST_FOR_EXCEPTION( !(requireRankMatch(errmsg, jacobianInv, jacobian) ), std::invalid_argument, errmsg);
 
 2858   TEUCHOS_TEST_FOR_EXCEPTION( !(requireDimensionMatch(errmsg, jacobianInv, jacobian) ), std::invalid_argument, errmsg);
 
 2863 template<
class Scalar>
 
 2864 template<
class ArrayJacDet, 
class ArrayJac>
 
 2866                                                              const ArrayJac    &  jacobian)
 
 2870   int jacobRank = getrank(jacobian);
 
 2871   TEUCHOS_TEST_FOR_EXCEPTION( !( (jacobRank == 4) || (jacobRank == 3) ), std::invalid_argument,
 
 2872                       ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobianInv): rank = 4 or 3 required for jacobian array. ");
 
 2875   TEUCHOS_TEST_FOR_EXCEPTION( !(jacobian.dimension(jacobRank - 1) == jacobian.dimension(jacobRank - 2) ), std::invalid_argument,
 
 2876                       ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobianInv): dim(rank-2) = dim(rank-2) (same spatial dimensions) required for jacobian array. ");
 
 2878   TEUCHOS_TEST_FOR_EXCEPTION( !( (0 < jacobian.dimension(jacobRank - 1) ) && (jacobian.dimension(jacobRank - 1) < 4) ), std::invalid_argument,
 
 2879                       ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobianInv): dim(rank-1) and dim(rank-2) (spatial dimensions) must be between 1 and 3. ");
 
 2884     TEUCHOS_TEST_FOR_EXCEPTION( !(getrank(jacobianDet) == 2), std::invalid_argument,
 
 2885                         ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobianDetArgs): rank = 2 required for jacobianDet if jacobian is rank-4. ");
 
 2887     TEUCHOS_TEST_FOR_EXCEPTION( !(static_cast<size_t>(jacobianDet.dimension(0)) == static_cast<size_t>(jacobian.dimension(0)) ), std::invalid_argument,
 
 2888                         ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobianDetArgs): dim 0 (number of cells) of jacobianDet array must equal dim 0 of jacobian array. ");
 
 2890     TEUCHOS_TEST_FOR_EXCEPTION( !(static_cast<size_t>(jacobianDet.dimension(1)) == static_cast<size_t>(jacobian.dimension(1)) ), std::invalid_argument,
 
 2891                         ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobianDetArgs): dim 1 (number of points) of jacobianDet array must equal dim 1 of jacobian array.");  
 
 2896     TEUCHOS_TEST_FOR_EXCEPTION( !(getrank(jacobianDet) == 1), std::invalid_argument,
 
 2897                         ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobianDetArgs): rank = 1 required for jacobianDet if jacobian is rank-3. ");
 
 2899     TEUCHOS_TEST_FOR_EXCEPTION( !(static_cast<size_t>(jacobianDet.dimension(0)) == static_cast<size_t>(jacobian.dimension(0)) ), std::invalid_argument,
 
 2900                         ">>> ERROR (Intrepid::CellTools::validateArguments_setJacobianDetArgs): dim 0 (number of points) of jacobianDet array must equal dim 0 of jacobian array.");  
 
 2906 template<
class Scalar>
 
 2907 template<
class ArrayPhysPo
int, 
class ArrayRefPo
int, 
class ArrayCell>
 
 2909                                                              const ArrayRefPoint  &        refPoints,
 
 2910                                                              const ArrayCell      &        cellWorkset,
 
 2911                                                              const shards::CellTopology &  cellTopo,
 
 2912                                                              const int&                    whichCell)
 
 2914   std::string errmsg = 
">>> ERROR (Intrepid::CellTools::validateArguments_mapToPhysicalFrame):";
 
 2917   TEUCHOS_TEST_FOR_EXCEPTION( (getrank(cellWorkset) != 3), std::invalid_argument,
 
 2918                       ">>> ERROR (Intrepid::CellTools::validateArguments_mapToPhysicalFrame): rank = 3 required for cellWorkset array");
 
 2920   TEUCHOS_TEST_FOR_EXCEPTION( (static_cast<size_t>(cellWorkset.dimension(0)) <= 0), std::invalid_argument,
 
 2921                       ">>> ERROR (Intrepid::CellTools::validateArguments_mapToPhysicalFrame): dim 0 (number of cells) >= 1 required for cellWorkset array");
 
 2923   TEUCHOS_TEST_FOR_EXCEPTION( (static_cast<size_t>(cellWorkset.dimension(1)) != (
size_t)cellTopo.getSubcellCount(0) ), std::invalid_argument,
 
 2924                       ">>> ERROR (Intrepid::CellTools::validateArguments_mapToPhysicalFrame): dim 1 (number of cell nodes) of cellWorkset array does not match cell topology");
 
 2926   TEUCHOS_TEST_FOR_EXCEPTION( (static_cast<size_t>(cellWorkset.dimension(2)) != (
size_t)cellTopo.getDimension() ), std::invalid_argument,
 
 2927                       ">>> ERROR (Intrepid::CellTools::validateArguments_mapToPhysicalFrame): dim 2 (spatial dimension) of cellWorkset array  does not match cell dimension");
 
 2932 TEUCHOS_TEST_FOR_EXCEPTION( !( ( (0 <= whichCell ) && ((
size_t)whichCell < (
size_t)cellWorkset.dimension(0) ) ) || (whichCell == -1) ), std::invalid_argument,
 
 2933                       ">>> ERROR (Intrepid::CellTools::validateArguments_mapToPhysicalFrame): whichCell = -1 or a valid cell ordinal is required.");
 
 2937   if(getrank(refPoints) == 2) {
 
 2938     TEUCHOS_TEST_FOR_EXCEPTION( (refPoints.dimension(0) <= 0), std::invalid_argument,
 
 2939                         ">>> ERROR (Intrepid::CellTools::validateArguments_mapToPhysicalFrame): dim 0 (number of points) >= 1 required for refPoints array ");
 
 2941     TEUCHOS_TEST_FOR_EXCEPTION( ((
size_t)refPoints.dimension(1) != (size_t)cellTopo.getDimension() ), std::invalid_argument,
 
 2942                         ">>> ERROR (Intrepid::CellTools::validateArguments_mapToPhysicalFrame): dim 1 (spatial dimension) of refPoints array does not match cell dimension");
 
 2945     if(whichCell == -1) {
 
 2946       TEUCHOS_TEST_FOR_EXCEPTION( ( (getrank(physPoints) != 3) && (whichCell == -1) ), std::invalid_argument,
 
 2947                           ">>> ERROR (Intrepid::CellTools::validateArguments_mapToPhysicalFrame): rank = 3 required for physPoints array for the default whichCell value");
 
 2949       TEUCHOS_TEST_FOR_EXCEPTION( ((
size_t)physPoints.dimension(0) != (size_t)cellWorkset.dimension(0)), std::invalid_argument,
 
 2950                           ">>> ERROR (Intrepid::CellTools::validateArguments_mapToPhysicalFrame): dim 0 (number of cells) of physPoints array must equal dim 0 of cellWorkset array");
 
 2952       TEUCHOS_TEST_FOR_EXCEPTION( ((
size_t)physPoints.dimension(1) != (size_t)refPoints.dimension(0)), std::invalid_argument,
 
 2953                           ">>> ERROR (Intrepid::CellTools::validateArguments_mapToPhysicalFrame): dim 1 (number of points) of physPoints array must equal dim 0 of refPoints array"); 
 
 2955       TEUCHOS_TEST_FOR_EXCEPTION( ((
size_t)physPoints.dimension(2) != (size_t)cellTopo.getDimension()), std::invalid_argument,
 
 2956                           ">>> ERROR (Intrepid::CellTools::validateArguments_mapToPhysicalFrame): dim 2 (spatial dimension) does not match cell dimension ");  
 
 2960       TEUCHOS_TEST_FOR_EXCEPTION( (getrank(physPoints) != 2), std::invalid_argument,
 
 2961                           ">>> ERROR (Intrepid::CellTools::validateArguments_mapToPhysicalFrame): rank = 2 required for physPoints array");
 
 2963       TEUCHOS_TEST_FOR_EXCEPTION( ((
size_t)physPoints.dimension(0) != (size_t)refPoints.dimension(0)), std::invalid_argument,
 
 2964                           ">>> ERROR (Intrepid::CellTools::validateArguments_mapToPhysicalFrame): dim 0 (number of points) of physPoints array must equal dim 0 of refPoints array"); 
 
 2966       TEUCHOS_TEST_FOR_EXCEPTION( ((
size_t)physPoints.dimension(1) != (size_t)cellTopo.getDimension()), std::invalid_argument,
 
 2967                           ">>> ERROR (Intrepid::CellTools::validateArguments_mapToPhysicalFrame): dim 1 (spatial dimension) does not match cell dimension ");      
 
 2971   else if(getrank(refPoints) == 3) {
 
 2974     TEUCHOS_TEST_FOR_EXCEPTION( ((
size_t)refPoints.dimension(0) !=(size_t) cellWorkset.dimension(0) ), std::invalid_argument,
 
 2975                         ">>> ERROR (Intrepid::CellTools::validateArguments_mapToPhysicalFrame): dim 0 (number of cells) of refPoints and cellWorkset arraya are required to match ");
 
 2977     TEUCHOS_TEST_FOR_EXCEPTION( (refPoints.dimension(1) <= 0), std::invalid_argument,
 
 2978                         ">>> ERROR (Intrepid::CellTools::validateArguments_mapToPhysicalFrame): dim 1 (number of points) >= 1 required for refPoints array ");
 
 2980     TEUCHOS_TEST_FOR_EXCEPTION( ((
size_t)refPoints.dimension(2) != (size_t)cellTopo.getDimension() ), std::invalid_argument,
 
 2981                         ">>> ERROR (Intrepid::CellTools::validateArguments_mapToPhysicalFrame): dim 2 (spatial dimension) of refPoints array does not match cell dimension");
 
 2984     TEUCHOS_TEST_FOR_EXCEPTION( (whichCell != -1), std::invalid_argument, 
 
 2985                         ">>> ERROR (Intrepid::CellTools::validateArguments_mapToPhysicalFrame): default value is required for rank-3 refPoints array");
 
 2988     TEUCHOS_TEST_FOR_EXCEPTION( !requireRankMatch(errmsg, refPoints, physPoints), std::invalid_argument, errmsg );
 
 2989     TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionMatch(errmsg, refPoints, physPoints), std::invalid_argument, errmsg);
 
 2993     TEUCHOS_TEST_FOR_EXCEPTION( !( (getrank(refPoints) == 2) || (getrank(refPoints) == 3) ), std::invalid_argument,
 
 2994                         ">>> ERROR (Intrepid::CellTools::validateArguments_mapToPhysicalFrame): rank = 2 or 3 required for refPoints array");
 
 2997 template<
class Scalar>
 
 2998 template<
class ArrayRefPo
int, 
class ArrayPhysPo
int, 
class ArrayCell>
 
 3000                                                               const ArrayPhysPoint &        physPoints,
 
 3001                                                               const ArrayCell      &        cellWorkset,
 
 3002                                                               const shards::CellTopology &  cellTopo,
 
 3003                                                               const int&                    whichCell)
 
 3005   std::string errmsg  = 
">>> ERROR (Intrepid::CellTools::validateArguments_mapToReferenceFrame):";
 
 3006   std::string errmsg1 = 
">>> ERROR (Intrepid::CellTools::validateArguments_mapToReferenceFrame):";
 
 3009   TEUCHOS_TEST_FOR_EXCEPTION( (getrank(cellWorkset) != 3), std::invalid_argument,
 
 3010                       ">>> ERROR (Intrepid::CellTools::validateArguments_mapToReferenceFrame): rank = 3 required for cellWorkset array");
 
 3012   TEUCHOS_TEST_FOR_EXCEPTION( (static_cast<size_t>(cellWorkset.dimension(0)) <= 0), std::invalid_argument,
 
 3013                       ">>> ERROR (Intrepid::CellTools::validateArguments_mapToReferenceFrame): dim 0 (number of cells) >= 1 required for cellWorkset array");
 
 3015   TEUCHOS_TEST_FOR_EXCEPTION( (static_cast<size_t>(cellWorkset.dimension(1)) != (
size_t)cellTopo.getSubcellCount(0) ), std::invalid_argument,
 
 3016                       ">>> ERROR (Intrepid::CellTools::validateArguments_mapToReferenceFrame): dim 1 (number of cell nodes) of cellWorkset array does not match cell topology");
 
 3018   TEUCHOS_TEST_FOR_EXCEPTION( (static_cast<size_t>(cellWorkset.dimension(2)) != (
size_t)cellTopo.getDimension() ), std::invalid_argument,
 
 3019                       ">>> ERROR (Intrepid::CellTools::validateArguments_mapToReferenceFrame): dim 2 (spatial dimension) of cellWorkset array  does not match cell dimension");
 
 3022  TEUCHOS_TEST_FOR_EXCEPTION( !( ( (0 <= whichCell ) && ((
size_t)whichCell <(
size_t) cellWorkset.dimension(0) ) ) || (whichCell == -1) ), std::invalid_argument,
 
 3023                       ">>> ERROR (Intrepid::CellTools::validateArguments_mapToReferenceFrame): whichCell = -1 or a valid cell ordinal is required.");  
 
 3027   if(whichCell == -1) {
 
 3029     errmsg1 += 
" default value of whichCell requires rank-3 arrays:";
 
 3033     errmsg1 += 
" rank-2 arrays required when whichCell is valid cell ordinal";
 
 3036   TEUCHOS_TEST_FOR_EXCEPTION( !requireRankRange(errmsg1, refPoints,  validRank,validRank), std::invalid_argument, errmsg1);
 
 3037   TEUCHOS_TEST_FOR_EXCEPTION( !requireRankMatch(errmsg1, physPoints, refPoints),           std::invalid_argument, errmsg1);
 
 3038   TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionMatch(errmsg1, refPoints, physPoints),      std::invalid_argument, errmsg1);
 
 3043 template<
class Scalar>
 
 3044 template<
class ArrayRefPo
int, 
class ArrayInitGuess, 
class ArrayPhysPo
int, 
class ArrayCell>
 
 3046                                                               const ArrayInitGuess &        initGuess,
 
 3047                                                               const ArrayPhysPoint &        physPoints,
 
 3048                                                               const ArrayCell      &        cellWorkset,
 
 3049                                                               const shards::CellTopology &  cellTopo,
 
 3050                                                               const int&                    whichCell)
 
 3053   validateArguments_mapToReferenceFrame(refPoints, physPoints, cellWorkset, cellTopo, whichCell);
 
 3056   std::string errmsg = 
">>> ERROR (Intrepid::CellTools::validateArguments_mapToReferenceFrame):";
 
 3057   TEUCHOS_TEST_FOR_EXCEPTION( !requireDimensionMatch(errmsg, initGuess, physPoints), std::invalid_argument, errmsg);  
 
 3061 template<
class Scalar>
 
 3062 template<
class ArrayIncl, 
class ArrayPo
int, 
class ArrayCell>
 
 3064                                                                   const ArrayPoint &            physPoints,
 
 3065                                                                   const ArrayCell &             cellWorkset,
 
 3066                                                                   const int &                   whichCell,
 
 3067                                                                   const shards::CellTopology &  cell)
 
 3070   TEUCHOS_TEST_FOR_EXCEPTION( (getrank(cellWorkset) != 3), std::invalid_argument,
 
 3071                       ">>> ERROR (Intrepid::CellTools::validateArguments_checkPointwiseInclusion): rank = 3 required for cellWorkset array");
 
 3073   TEUCHOS_TEST_FOR_EXCEPTION( (static_cast<size_t>(cellWorkset.dimension(0)) <= 0), std::invalid_argument,
 
 3074                       ">>> ERROR (Intrepid::CellTools::validateArguments_checkPointwiseInclusion): dim 0 (number of cells) >= 1 required for cellWorkset array");
 
 3076   TEUCHOS_TEST_FOR_EXCEPTION( (static_cast<size_t>(cellWorkset.dimension(1)) != (
size_t)cell.getSubcellCount(0) ), std::invalid_argument,
 
 3077                       ">>> ERROR (Intrepid::CellTools::validateArguments_checkPointwiseInclusion): dim 1 (number of cell nodes) of cellWorkset array does not match cell topology");
 
 3079   TEUCHOS_TEST_FOR_EXCEPTION( (static_cast<size_t>(cellWorkset.dimension(2)) != (
size_t)cell.getDimension() ), std::invalid_argument,
 
 3080                       ">>> ERROR (Intrepid::CellTools::validateArguments_checkPointwiseInclusion): dim 2 (spatial dimension) of cellWorkset array  does not match cell dimension");
 
 3084   TEUCHOS_TEST_FOR_EXCEPTION( !( ( (0 <= whichCell ) && (whichCell < cellWorkset.dimension(0) ) ) || (whichCell == -1) ), std::invalid_argument,
 
 3085                       ">>> ERROR (Intrepid::CellTools::validateArguments_checkPointwiseInclusion): whichCell = -1 or a valid cell ordinal is required.");  
 
 3089   if(getrank(physPoints) == 2) {
 
 3091     TEUCHOS_TEST_FOR_EXCEPTION( (whichCell == -1), std::invalid_argument,
 
 3092                         ">>> ERROR (Intrepid::CellTools::validateArguments_checkPointwiseInclusion): whichCell = a valid cell ordinal is required with rank-2 input array.");
 
 3094     TEUCHOS_TEST_FOR_EXCEPTION( (static_cast<size_t>(physPoints.dimension(0)) <= 0), std::invalid_argument,
 
 3095                         ">>> ERROR (Intrepid::CellTools::validateArguments_checkPointwiseInclusion): dim 0 (number of points) >= 1 required for physPoints array ");
 
 3097     TEUCHOS_TEST_FOR_EXCEPTION( (static_cast<size_t>(physPoints.dimension(1)) != (
size_t)cell.getDimension() ), std::invalid_argument,
 
 3098                         ">>> ERROR (Intrepid::CellTools::validateArguments_checkPointwiseInclusion): dim 1 (spatial dimension) of physPoints array does not match cell dimension");
 
 3101     TEUCHOS_TEST_FOR_EXCEPTION( (getrank(inCell) != 1), std::invalid_argument, 
 
 3102                         ">>> ERROR (Intrepid::CellTools::validateArguments_checkPointwiseInclusion): rank = 1 required for inCell array");
 
 3104     TEUCHOS_TEST_FOR_EXCEPTION( (static_cast<size_t>(inCell.dimension(0)) != static_cast<size_t>(physPoints.dimension(0))), std::invalid_argument,
 
 3105                         ">>> ERROR (Intrepid::CellTools::validateArguments_checkPointwiseInclusion): dim 0 (number of points) of inCell array must equal dim 0 of physPoints array");
 
 3108   else if (getrank(physPoints) == 3){
 
 3110     TEUCHOS_TEST_FOR_EXCEPTION( !(whichCell == -1), std::invalid_argument,
 
 3111                         ">>> ERROR (Intrepid::CellTools::validateArguments_checkPointwiseInclusion): whichCell = -1 is required with rank-3 input array.");
 
 3113     TEUCHOS_TEST_FOR_EXCEPTION( (static_cast<size_t>(physPoints.dimension(0)) != static_cast<size_t>(cellWorkset.dimension(0)) ), std::invalid_argument,
 
 3114                         ">>> ERROR (Intrepid::CellTools::validateArguments_checkPointwiseInclusion): dim 0 (number of cells)  of physPoints array must equal dim 0 of cellWorkset array ");
 
 3116     TEUCHOS_TEST_FOR_EXCEPTION( (static_cast<size_t>(physPoints.dimension(1)) <= 0), std::invalid_argument,
 
 3117                         ">>> ERROR (Intrepid::CellTools::validateArguments_checkPointwiseInclusion): dim 1 (number of points) >= 1 required for physPoints array ");
 
 3119     TEUCHOS_TEST_FOR_EXCEPTION( (static_cast<size_t>(physPoints.dimension(2)) != (
size_t)cell.getDimension() ), std::invalid_argument,
 
 3120                         ">>> ERROR (Intrepid::CellTools::validateArguments_checkPointwiseInclusion): dim 2 (spatial dimension) of physPoints array does not match cell dimension");
 
 3123     TEUCHOS_TEST_FOR_EXCEPTION( (getrank(inCell) != 2), std::invalid_argument, 
 
 3124                         ">>> ERROR (Intrepid::CellTools::validateArguments_checkPointwiseInclusion): rank = 2 required for inCell array");
 
 3126     TEUCHOS_TEST_FOR_EXCEPTION( (static_cast<size_t>(inCell.dimension(0)) != static_cast<size_t>(physPoints.dimension(0))), std::invalid_argument,
 
 3127                         ">>> ERROR (Intrepid::CellTools::validateArguments_checkPointwiseInclusion): dim 0 (number of cells) of inCell array must equal dim 0 of physPoints array");    
 
 3129     TEUCHOS_TEST_FOR_EXCEPTION( (static_cast<size_t>(inCell.dimension(1)) != static_cast<size_t>(physPoints.dimension(1))), std::invalid_argument,
 
 3130                         ">>> ERROR (Intrepid::CellTools::validateArguments_checkPointwiseInclusion): dim 1 (number of points) of inCell array must equal dim 1 of physPoints array");    
 
 3133     TEUCHOS_TEST_FOR_EXCEPTION( !( (getrank(physPoints) == 2) && (getrank(physPoints) ==3) ), std::invalid_argument,
 
 3134                         ">>> ERROR (Intrepid::CellTools::validateArguments_checkPointwiseInclusion): rank = 2 or 3 required for points array");
 
 3147 template<
class Scalar>
 
 3149                                              const int subcellOrd,
 
 3150                                              const shards::CellTopology & parentCell){
 
 3153   int subcVertexCount = parentCell.getVertexCount(subcellDim, subcellOrd);
 
 3154   int cellDim         = parentCell.getDimension();
 
 3160   getReferenceSubcellVertices(subcellVertices,
 
 3167     << 
" Subcell " << std::setw(2) << subcellOrd 
 
 3168     <<  
" is " << parentCell.getName(subcellDim, subcellOrd) << 
" with vertices = {";
 
 3171   for(
int subcVertOrd = 0; subcVertOrd < subcVertexCount; subcVertOrd++){
 
 3175     for(
int dim = 0; dim < (int)parentCell.getDimension(); dim++){
 
 3176       std::cout << subcellVertices(subcVertOrd, dim);
 
 3177       if(dim < (
int)parentCell.getDimension()-1 ) { std::cout << 
","; }
 
 3180     if(subcVertOrd < subcVertexCount - 1) { std::cout << 
", "; }
 
 3186 template<
class Scalar>
 
 3187 template<
class ArrayCell>
 
 3189                                             const shards::CellTopology &  parentCell,
 
 3190                                             const int&                    pCellOrd,
 
 3191                                             const int&                    subcellDim,
 
 3192                                             const int&                    subcellOrd,
 
 3193                                             const int&                    fieldWidth){
 
 3196   int subcNodeCount = parentCell.getNodeCount(subcellDim, subcellOrd);
 
 3197   int pCellDim      = parentCell.getDimension();
 
 3198   std::vector<int> subcNodeOrdinals(subcNodeCount);
 
 3200   for(
int i = 0; i < subcNodeCount; i++){
 
 3201     subcNodeOrdinals[i] = parentCell.getNodeMap(subcellDim, subcellOrd, i);
 
 3207     << 
" Subcell " << subcellOrd << 
" on parent cell " << pCellOrd << 
" is "  
 3208     << parentCell.getName(subcellDim, subcellOrd) << 
" with node(s) \n ({";
 
 3210   for(
int i = 0; i < subcNodeCount; i++){
 
 3213     for(
int dim = 0; dim < pCellDim; dim++){
 
 3215       << std::setw(fieldWidth) << std::right << cellWorkset(pCellOrd, subcNodeOrdinals[i], dim); 
 
 3216       if(dim < pCellDim - 1){ std::cout << 
","; }
 
 3219     if(i < subcNodeCount - 1){ std::cout <<
", {"; }
 
 3221   std::cout << 
")\n\n";
 
 3229   template<
class Scalar>
 
 3230   template<
class ArrayCVCoord, 
class ArrayCellCoord>
 
 3232                                          const ArrayCellCoord & cellCoords,
 
 3233                                          const shards::CellTopology& primaryCell)
 
 3237    int numCells        = cellCoords.dimension(0);
 
 3238    int numNodesPerCell = cellCoords.dimension(1);
 
 3239    int spaceDim        = cellCoords.dimension(2);
 
 3242    int numEdgesPerCell = primaryCell.getEdgeCount();
 
 3245    int numFacesPerCell = 0;
 
 3247       numFacesPerCell = primaryCell.getFaceCount();
 
 3252    getBarycenter(barycenter,cellCoords);
 
 3255    for (
int icell = 0; icell < numCells; icell++){
 
 3259         for (
int iedge = 0; iedge < numEdgesPerCell; iedge++){
 
 3260           for (
int idim = 0; idim < spaceDim; idim++){
 
 3262                int node0 = primaryCell.getNodeMap(1,iedge,0);
 
 3263                int node1 = primaryCell.getNodeMap(1,iedge,1);
 
 3264                edgeMidpts(iedge,idim) = (cellCoords(icell,node0,idim) +
 
 3265                                          cellCoords(icell,node1,idim))/2.0;
 
 3271         int numNodesPerFace;
 
 3274            for (
int iface = 0; iface < numFacesPerCell; iface++){
 
 3275                numNodesPerFace = primaryCell.getNodeCount(2,iface);
 
 3277                for (
int idim = 0; idim < spaceDim; idim++){
 
 3279                   for (
int inode0 = 0; inode0 < numNodesPerFace; inode0++) {
 
 3280                       int node1 = primaryCell.getNodeMap(2,iface,inode0);
 
 3281                       faceMidpts(iface,idim) += cellCoords(icell,node1,idim)/numNodesPerFace;
 
 3289          switch(primaryCell.getKey() ) {
 
 3292            case shards::Triangle<3>::key:
 
 3293            case shards::Quadrilateral<4>::key:
 
 3295             for (
int inode = 0; inode < numNodesPerCell; inode++){
 
 3296               for (
int idim = 0; idim < spaceDim; idim++){
 
 3299                  subCVCoords(icell,inode,0,idim) = cellCoords(icell,inode,idim);
 
 3302                  subCVCoords(icell,inode,1,idim) = edgeMidpts(inode,idim);
 
 3305                  subCVCoords(icell,inode,2,idim) = barycenter(icell,idim);
 
 3308                  int jnode = numNodesPerCell-1;
 
 3309                  if (inode > 0) jnode = inode - 1;
 
 3310                  subCVCoords(icell,inode,3,idim) = edgeMidpts(jnode,idim);
 
 3317          case shards::Hexahedron<8>::key:
 
 3319            for (
int idim = 0; idim < spaceDim; idim++){
 
 3322               for (
int icount = 0; icount < 4; icount++){
 
 3326                 subCVCoords(icell,icount,0,idim) = cellCoords(icell,icount,idim);
 
 3327                 subCVCoords(icell,icount+4,4,idim) = cellCoords(icell,icount+4,idim);
 
 3331                 subCVCoords(icell,icount,1,idim) = edgeMidpts(icount,idim);
 
 3332                 subCVCoords(icell,icount+4,5,idim) = edgeMidpts(icount+4,idim);
 
 3336                 subCVCoords(icell,icount,2,idim) = faceMidpts(4,idim);
 
 3337                 subCVCoords(icell,icount+4,6,idim) = faceMidpts(5,idim);
 
 3342                  if (icount > 0) jcount = icount - 1;
 
 3343                  subCVCoords(icell,icount,3,idim) = edgeMidpts(jcount,idim);
 
 3344                  subCVCoords(icell,icount+4,7,idim) = edgeMidpts(jcount+4,idim);
 
 3348                 subCVCoords(icell,icount,4,idim) = edgeMidpts(icount+numNodesPerCell,idim);
 
 3349                 subCVCoords(icell,icount+4,0,idim) = edgeMidpts(icount+numNodesPerCell,idim);
 
 3353                 subCVCoords(icell,icount,5,idim) = faceMidpts(icount,idim);
 
 3354                 subCVCoords(icell,icount+4,1,idim) = faceMidpts(icount,idim);
 
 3358                 subCVCoords(icell,icount,6,idim) = barycenter(icell,idim);
 
 3359                 subCVCoords(icell,icount+4,2,idim) = barycenter(icell,idim);
 
 3364                 if (icount > 0) jcount = icount - 1;
 
 3365                 subCVCoords(icell,icount,7,idim) = faceMidpts(jcount,idim);
 
 3366                 subCVCoords(icell,icount+4,3,idim) = faceMidpts(jcount,idim);
 
 3374          case shards::Tetrahedron<4>::key:
 
 3376            for (
int idim = 0; idim < spaceDim; idim++){
 
 3379               for (
int icount = 0; icount < 3; icount++){
 
 3382                 subCVCoords(icell,icount,0,idim) = cellCoords(icell,icount,idim);
 
 3385                 subCVCoords(icell,icount,1,idim) = edgeMidpts(icount,idim);
 
 3388                 subCVCoords(icell,icount,2,idim) = faceMidpts(3,idim);
 
 3392                 if (icount > 0) jcount = icount - 1;
 
 3393                 subCVCoords(icell,icount,3,idim) = edgeMidpts(jcount,idim);
 
 3396                 subCVCoords(icell,icount,4,idim) = edgeMidpts(icount+3,idim);
 
 3399                 subCVCoords(icell,icount,5,idim) = faceMidpts(icount,idim);
 
 3402                 subCVCoords(icell,icount,6,idim) = barycenter(icell,idim);
 
 3406                 if (icount > 0) jcount = icount - 1;
 
 3407                 subCVCoords(icell,icount,7,idim) = faceMidpts(jcount,idim);
 
 3413                 subCVCoords(icell,3,0,idim) = cellCoords(icell,3,idim);
 
 3416                 subCVCoords(icell,3,1,idim) = edgeMidpts(3,idim);
 
 3419                 subCVCoords(icell,3,2,idim) = faceMidpts(2,idim);
 
 3422                 subCVCoords(icell,3,3,idim) = edgeMidpts(5,idim);
 
 3425                 subCVCoords(icell,3,4,idim) = edgeMidpts(4,idim);
 
 3428                 subCVCoords(icell,3,5,idim) = faceMidpts(0,idim);
 
 3431                 subCVCoords(icell,3,6,idim) = barycenter(icell,idim);
 
 3434                 subCVCoords(icell,3,7,idim) = faceMidpts(1,idim);
 
 3441         TEUCHOS_TEST_FOR_EXCEPTION( 
true, std::invalid_argument,
 
 3442                             ">>> ERROR (getSubCVCoords: invalid cell topology.");
 
 3449  template<
class Scalar>
 
 3450  template<
class ArrayCent, 
class ArrayCellCoord>
 
 3454    int numCells        = cellCoords.dimension(0);
 
 3455    int numVertsPerCell = cellCoords.dimension(1);
 
 3456    int spaceDim        = cellCoords.dimension(2);
 
 3461      for (
int icell = 0; icell < numCells; icell++){
 
 3466         for (
int inode = 0; inode < numVertsPerCell; inode++){
 
 3468             int jnode = inode + 1;
 
 3469             if (jnode >= numVertsPerCell) {
 
 3473             Scalar area_mult = cellCoords(icell,inode,0)*cellCoords(icell,jnode,1)
 
 3474                                  - cellCoords(icell,jnode,0)*cellCoords(icell,inode,1);
 
 3475             cell_centroid(0) += (cellCoords(icell,inode,0) + cellCoords(icell,jnode,0))*area_mult;
 
 3476             cell_centroid(1) += (cellCoords(icell,inode,1) + cellCoords(icell,jnode,1))*area_mult;
 
 3478             area += 0.5*area_mult;
 
 3481        barycenter(icell,0) = cell_centroid(0)/(6.0*area);
 
 3482        barycenter(icell,1) = cell_centroid(1)/(6.0*area);
 
 3491      for (
int icell = 0; icell < numCells; icell++){
 
 3495         for (
int inode = 0; inode < numVertsPerCell; inode++){
 
 3496             for (
int idim = 0; idim < spaceDim; idim++){
 
 3497                 cell_centroid(idim) += cellCoords(icell,inode,idim)/numVertsPerCell;
 
 3500         for (
int idim = 0; idim < spaceDim; idim++){
 
 3501              barycenter(icell,idim) = cell_centroid(idim);
 
int size() const 
Returns size of the FieldContainer defined as the product of its dimensions. 
Implementation of the serendipity-family H(grad)-compatible FEM basis of degree 2 on a Hexahedron cel...
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...
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 an H(grad)-compatible FEM basis of degree 2 on Wedge 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...
An abstract base class that defines interface for concrete basis implementations for Finite Element (...
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 Pyramid cell...
Implementation of the default H(grad)-compatible FEM basis of degree 1 on Hexahedron cell...
Implementation of an H(grad)-compatible FEM basis of degree 2 on a Pyramid 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...