52 #include "Shards_CellTopology.hpp"
54 #include "Teuchos_oblackholestream.hpp"
55 #include "Teuchos_RCP.hpp"
56 #include "Teuchos_GlobalMPISession.hpp"
57 #include "Teuchos_ScalarTraits.hpp"
60 using namespace Intrepid;
61 using namespace shards;
63 #define INTREPID_TEST_COMMAND( S , throwCounter, nException ) \
69 catch (std::logic_error err) { \
71 *outStream << "Expected Error " << nException << " -------------------------------------------------------------\n"; \
72 *outStream << err.what() << '\n'; \
73 *outStream << "-------------------------------------------------------------------------------" << "\n\n"; \
79 int main(
int argc,
char *argv[]) {
81 Teuchos::GlobalMPISession mpiSession(&argc, &argv);
87 int iprint = argc - 1;
89 Teuchos::RCP<std::ostream> outStream;
90 Teuchos::oblackholestream bhs;
93 outStream = Teuchos::rcp(&std::cout,
false);
95 outStream = Teuchos::rcp(&bhs,
false);
98 Teuchos::oblackholestream oldFormatState;
99 oldFormatState.copyfmt(std::cout);
102 <<
"===============================================================================\n" \
104 <<
"| Unit Test CellTools |\n" \
106 <<
"| 1) Mapping to and from reference cells with base and extended topologies|\n" \
107 <<
"| using default initial guesses when computing the inverse F^{-1} |\n" \
108 <<
"| 2) Repeat all tests from 1) using user-defined initial guess for F^{-1} |\n" \
109 <<
"| 3) Exception testing |\n" \
111 <<
"| Questions? Contact Pavel Bochev (pbboche@sandia.gov) |\n" \
112 <<
"| Denis Ridzal (dridzal@sandia.gov), or |\n" \
113 <<
"| Kara Peterson (kjpeter@sandia.gov) |\n" \
115 <<
"| Intrepid's website: http://trilinos.sandia.gov/packages/intrepid |\n" \
116 <<
"| Trilinos website: http://trilinos.sandia.gov |\n" \
118 <<
"===============================================================================\n";
123 std::vector<shards::CellTopology> supportedTopologies;
124 supportedTopologies.push_back(shards::getCellTopologyData<Triangle<3> >() );
125 supportedTopologies.push_back(shards::getCellTopologyData<Triangle<6> >() );
126 supportedTopologies.push_back(shards::getCellTopologyData<Quadrilateral<4> >() );
127 supportedTopologies.push_back(shards::getCellTopologyData<Quadrilateral<9> >() );
128 supportedTopologies.push_back(shards::getCellTopologyData<Tetrahedron<4> >() );
129 supportedTopologies.push_back(shards::getCellTopologyData<Tetrahedron<10> >() );
130 supportedTopologies.push_back(shards::getCellTopologyData<Hexahedron<8> >() );
131 supportedTopologies.push_back(shards::getCellTopologyData<Hexahedron<20> >() );
132 supportedTopologies.push_back(shards::getCellTopologyData<Hexahedron<27> >() );
133 supportedTopologies.push_back(shards::getCellTopologyData<Wedge<6> >() );
134 supportedTopologies.push_back(shards::getCellTopologyData<Wedge<15> >() );
135 supportedTopologies.push_back(shards::getCellTopologyData<Wedge<18> >() );
136 supportedTopologies.push_back(shards::getCellTopologyData<Pyramid<5> >() );
137 supportedTopologies.push_back(shards::getCellTopologyData<Pyramid<13> >() );
140 std::vector<shards::CellTopology>::iterator topo_iterator;
147 <<
"===============================================================================\n"\
148 <<
"| Test 1: computing F(x) and F^{-1}(x) using default initial guesses. |\n"\
149 <<
"===============================================================================\n\n";
175 for(topo_iterator = supportedTopologies.begin(); topo_iterator != supportedTopologies.end(); ++topo_iterator){
178 Teuchos::RCP<Cubature<double> > cellCubature = cubFactory.
create( (*topo_iterator), 4);
179 int cubDim = cellCubature -> getDimension();
180 int numPts = cellCubature -> getNumPoints();
181 cubPoints.
resize(numPts, cubDim);
182 cubWeights.
resize(numPts);
183 cellCubature -> getCubature(cubPoints, cubWeights);
187 int numNodes = (*topo_iterator).getNodeCount();
188 int cellDim = (*topo_iterator).getDimension();
189 cellWorkset.
resize(numCells, numNodes, cellDim);
193 CellTools::getReferenceSubcellNodes(refCellNodes, cellDim, 0, (*topo_iterator) );
196 for(
int cellOrd = 0; cellOrd < numCells; cellOrd++){
199 for(
int nodeOrd = 0; nodeOrd < numNodes; nodeOrd++){
200 for(
int d = 0; d < cellDim; d++){
201 double delta = Teuchos::ScalarTraits<double>::random()/16.0;
202 cellWorkset(cellOrd, nodeOrd, d) = refCellNodes(nodeOrd, d) + delta;
211 physPoints.
resize(numPts, cubDim);
212 controlPoints.
resize(numPts, cubDim);
215 <<
" Mapping a set of " << numPts <<
" points to one cell in a workset of " << numCells <<
" "
216 << (*topo_iterator).getName() <<
" cells. \n";
218 for(
int cellOrd = 0; cellOrd < numCells; cellOrd++){
221 CellTools::mapToPhysicalFrame(physPoints, cubPoints, cellWorkset, (*topo_iterator), cellOrd);
223 CellTools::mapToReferenceFrame(controlPoints, physPoints, cellWorkset, (*topo_iterator), cellOrd);
226 for(
int pt = 0; pt < numPts; pt++){
227 for(
int d = 0; d < cellDim; d++){
229 if( abs( controlPoints(pt, d) - cubPoints(pt, d) ) > 100.0*INTREPID_TOL ){
232 << std::setw(70) <<
"^^^^----FAILURE!" <<
"\n"
233 <<
" Mapping a single point set to a single physical cell in a workset failed for: \n"
234 <<
" Cell Topology = " << (*topo_iterator).getName() <<
"\n"
235 <<
" Physical cell ordinal in workset = " << cellOrd <<
"\n"
236 <<
" Reference point ordinal = " << setprecision(12) << pt <<
"\n"
237 <<
" At reference point coordinate = " << setprecision(12) << d <<
"\n"
238 <<
" Original value = " << cubPoints(pt, d) <<
"\n"
239 <<
" F^{-1}F(P_d) = " << controlPoints(pt, d) <<
"\n";
250 controlPoints.
clear();
251 physPoints.
resize(numCells, numPts, cubDim);
252 controlPoints.
resize(numCells, numPts, cubDim);
255 <<
" Mapping a set of " << numPts <<
" points to all cells in workset of " << numCells <<
" "
256 << (*topo_iterator).getName() <<
" cells. \n";
259 CellTools::mapToPhysicalFrame(physPoints, cubPoints, cellWorkset, (*topo_iterator));
261 CellTools::mapToReferenceFrame(controlPoints, physPoints, cellWorkset, (*topo_iterator));
264 for(
int cellOrd = 0; cellOrd < numCells; cellOrd++){
265 for(
int pt = 0; pt < numPts; pt++){
266 for(
int d = 0; d < cellDim; d++){
268 if( abs( controlPoints(cellOrd, pt, d) - cubPoints(pt, d) ) > 100.0*INTREPID_TOL ){
271 << std::setw(70) <<
"^^^^----FAILURE!" <<
"\n"
272 <<
" Mapping a single point set to all physical cells in a workset failed for: \n"
273 <<
" Cell Topology = " << (*topo_iterator).getName() <<
"\n"
274 <<
" Physical cell ordinal in workset = " << cellOrd <<
"\n"
275 <<
" Reference point ordinal = " << setprecision(12) << pt <<
"\n"
276 <<
" At reference point coordinate = " << setprecision(12) << d <<
"\n"
277 <<
" Original value = " << cubPoints(pt, d) <<
"\n"
278 <<
" F^{-1}F(P_d) = " << controlPoints(cellOrd, pt, d) <<
"\n";
289 controlPoints.
clear();
290 refPoints.
resize(numCells, numPts, cubDim);
291 physPoints.
resize(numCells, numPts, cubDim);
292 controlPoints.
resize(numCells, numPts, cubDim);
295 for(
int c = 0; c < numCells; c++){
296 for(
int pt = 0; pt < numPts; pt++){
297 for(
int d = 0; d < cellDim; d++){
298 refPoints(c, pt, d) = cubPoints(pt, d);
304 <<
" Mapping " << numCells <<
" sets of " << numPts <<
" points to corresponding cells in workset of " << numCells <<
" "
305 << (*topo_iterator).getName() <<
" cells. \n";
308 CellTools::mapToPhysicalFrame(physPoints, refPoints, cellWorkset, (*topo_iterator));
310 CellTools::mapToReferenceFrame(controlPoints, physPoints, cellWorkset, (*topo_iterator));
313 for(
int cellOrd = 0; cellOrd < numCells; cellOrd++){
314 for(
int pt = 0; pt < numPts; pt++){
315 for(
int d = 0; d < cellDim; d++){
317 if( abs( controlPoints(cellOrd, pt, d) - cubPoints(pt, d) ) > 100.0*INTREPID_TOL ){
320 << std::setw(70) <<
"^^^^----FAILURE!" <<
"\n"
321 <<
" Mapping multiple point sets to corresponding physical cells in a workset failed for: \n"
322 <<
" Cell Topology = " << (*topo_iterator).getName() <<
"\n"
323 <<
" Physical cell ordinal in workset = " << cellOrd <<
"\n"
324 <<
" Reference point ordinal = " << setprecision(12) << pt <<
"\n"
325 <<
" At reference point coordinate = " << setprecision(12) << d <<
"\n"
326 <<
" Original value = " << refPoints(cellOrd, pt, d) <<
"\n"
327 <<
" F^{-1}F(P_d) = " << controlPoints(cellOrd, pt, d) <<
"\n";
339 catch (std::logic_error err) {
340 *outStream << err.what() <<
"\n";
350 <<
"===============================================================================\n"\
351 <<
"| Test 2: computing F(x) and F^{-1}(x) using user-defined initial guess. |\n"\
352 <<
"===============================================================================\n\n";
378 for(topo_iterator = supportedTopologies.begin(); topo_iterator != supportedTopologies.end(); ++topo_iterator){
381 Teuchos::RCP<Cubature<double> > cellCubature = cubFactory.
create( (*topo_iterator), 4);
382 int cubDim = cellCubature -> getDimension();
383 int numPts = cellCubature -> getNumPoints();
384 cubPoints.
resize(numPts, cubDim);
385 cubWeights.
resize(numPts);
386 cellCubature -> getCubature(cubPoints, cubWeights);
390 int numNodes = (*topo_iterator).getNodeCount();
391 int cellDim = (*topo_iterator).getDimension();
392 cellWorkset.
resize(numCells, numNodes, cellDim);
396 CellTools::getReferenceSubcellNodes(refCellNodes, cellDim, 0, (*topo_iterator) );
399 for(
int cellOrd = 0; cellOrd < numCells; cellOrd++){
402 for(
int nodeOrd = 0; nodeOrd < numNodes; nodeOrd++){
403 for(
int d = 0; d < cellDim; d++){
404 double delta = Teuchos::ScalarTraits<double>::random()/16.0;
405 cellWorkset(cellOrd, nodeOrd, d) = refCellNodes(nodeOrd, d) + delta;
414 physPoints.
resize(numPts, cubDim);
415 controlPoints.
resize(numPts, cubDim);
418 <<
" Mapping a set of " << numPts <<
" points to one cell in a workset of " << numCells <<
" "
419 << (*topo_iterator).getName() <<
" cells. \n";
421 for(
int cellOrd = 0; cellOrd < numCells; cellOrd++){
424 CellTools::mapToPhysicalFrame(physPoints, cubPoints, cellWorkset, (*topo_iterator), cellOrd);
426 CellTools::mapToReferenceFrameInitGuess(controlPoints, cubPoints, physPoints, cellWorkset, (*topo_iterator), cellOrd);
429 for(
int pt = 0; pt < numPts; pt++){
430 for(
int d = 0; d < cellDim; d++){
432 if( abs( controlPoints(pt, d) - cubPoints(pt, d) ) > 100.0*INTREPID_TOL ){
435 << std::setw(70) <<
"^^^^----FAILURE!" <<
"\n"
436 <<
" Mapping a single point set to a single physical cell in a workset failed for: \n"
437 <<
" Cell Topology = " << (*topo_iterator).getName() <<
"\n"
438 <<
" Physical cell ordinal in workset = " << cellOrd <<
"\n"
439 <<
" Reference point ordinal = " << setprecision(12) << pt <<
"\n"
440 <<
" At reference point coordinate = " << setprecision(12) << d <<
"\n"
441 <<
" Original value = " << cubPoints(pt, d) <<
"\n"
442 <<
" F^{-1}F(P_d) = " << controlPoints(pt, d) <<
"\n";
453 controlPoints.
clear();
454 physPoints.
resize(numCells, numPts, cubDim);
455 controlPoints.
resize(numCells, numPts, cubDim);
458 initialGuess.
resize(numCells, numPts, cubDim);
459 for(
int c = 0; c < numCells; c++){
460 for(
int pt = 0; pt < numPts; pt++){
461 for(
int d = 0; d < cellDim; d++){
462 initialGuess(c, pt, d) = cubPoints(pt, d);
468 <<
" Mapping a set of " << numPts <<
" points to all cells in workset of " << numCells <<
" "
469 << (*topo_iterator).getName() <<
" cells. \n";
472 CellTools::mapToPhysicalFrame(physPoints, cubPoints, cellWorkset, (*topo_iterator));
474 CellTools::mapToReferenceFrameInitGuess(controlPoints, initialGuess, physPoints, cellWorkset, (*topo_iterator));
477 for(
int cellOrd = 0; cellOrd < numCells; cellOrd++){
478 for(
int pt = 0; pt < numPts; pt++){
479 for(
int d = 0; d < cellDim; d++){
481 if( abs( controlPoints(cellOrd, pt, d) - cubPoints(pt, d) ) > 100.0*INTREPID_TOL ){
484 << std::setw(70) <<
"^^^^----FAILURE!" <<
"\n"
485 <<
" Mapping a single point set to all physical cells in a workset failed for: \n"
486 <<
" Cell Topology = " << (*topo_iterator).getName() <<
"\n"
487 <<
" Physical cell ordinal in workset = " << cellOrd <<
"\n"
488 <<
" Reference point ordinal = " << setprecision(12) << pt <<
"\n"
489 <<
" At reference point coordinate = " << setprecision(12) << d <<
"\n"
490 <<
" Original value = " << cubPoints(pt, d) <<
"\n"
491 <<
" F^{-1}F(P_d) = " << controlPoints(cellOrd, pt, d) <<
"\n";
503 controlPoints.
clear();
504 physPoints.
resize(numCells, numPts, cubDim);
505 controlPoints.
resize(numCells, numPts, cubDim);
508 <<
" Mapping " << numCells <<
" sets of " << numPts <<
" points to corresponding cells in workset of " << numCells <<
" "
509 << (*topo_iterator).getName() <<
" cells. \n";
512 CellTools::mapToPhysicalFrame(physPoints, initialGuess, cellWorkset, (*topo_iterator));
514 CellTools::mapToReferenceFrameInitGuess(controlPoints, initialGuess, physPoints, cellWorkset, (*topo_iterator));
517 for(
int cellOrd = 0; cellOrd < numCells; cellOrd++){
518 for(
int pt = 0; pt < numPts; pt++){
519 for(
int d = 0; d < cellDim; d++){
521 if( abs( controlPoints(cellOrd, pt, d) - cubPoints(pt, d) ) > 100.0*INTREPID_TOL ){
524 << std::setw(70) <<
"^^^^----FAILURE!" <<
"\n"
525 <<
" Mapping multiple point sets to corresponding physical cells in a workset failed for: \n"
526 <<
" Cell Topology = " << (*topo_iterator).getName() <<
"\n"
527 <<
" Physical cell ordinal in workset = " << cellOrd <<
"\n"
528 <<
" Reference point ordinal = " << setprecision(12) << pt <<
"\n"
529 <<
" At reference point coordinate = " << setprecision(12) << d <<
"\n"
530 <<
" Original value = " << initialGuess(cellOrd, pt, d) <<
"\n"
531 <<
" F^{-1}F(P_d) = " << controlPoints(cellOrd, pt, d) <<
"\n";
543 catch (std::logic_error err) {
544 *outStream << err.what() <<
"\n";
550 <<
"===============================================================================\n"\
551 <<
"| Test 3: Exception testing - only when HAVE_INTREPID_DEBUG is defined. |\n"\
552 <<
"===============================================================================\n\n";
562 int throwCounter = 0;
566 #ifdef HAVE_INTREPID_DEBUG
589 topo_iterator = supportedTopologies.begin() + 1;
590 D = (*topo_iterator).getDimension();
591 N = (*topo_iterator).getNodeCount();
592 V = (*topo_iterator).getVertexCount();
597 cellWorkset.
resize(C, N, D);
598 INTREPID_TEST_COMMAND( CellTools::setJacobian(jacobian, points, cellWorkset, (*topo_iterator) ),
599 throwCounter, nException );
603 INTREPID_TEST_COMMAND( CellTools::setJacobian(jacobian, points, cellWorkset, (*topo_iterator) ),
604 throwCounter, nException );
607 cellWorkset.
resize(C, N, D);
609 INTREPID_TEST_COMMAND( CellTools::setJacobian(jacobian, points, cellWorkset, (*topo_iterator) ),
610 throwCounter, nException );
614 INTREPID_TEST_COMMAND( CellTools::setJacobian(jacobian, points, cellWorkset, (*topo_iterator), 0 ),
615 throwCounter, nException );
618 jacobian.
resize(C, P, D, D);
619 points.
resize(C, P, D - 1);
620 INTREPID_TEST_COMMAND( CellTools::setJacobian(jacobian, points, cellWorkset, (*topo_iterator) ),
621 throwCounter, nException );
624 jacobian.
resize(C, P, D, D);
625 points.
resize(C, P - 1, D);
626 INTREPID_TEST_COMMAND( CellTools::setJacobian(jacobian, points, cellWorkset, (*topo_iterator) ),
627 throwCounter, nException );
630 jacobian.
resize(C, P, D, D);
631 points.
resize(C - 1, P, D);
632 INTREPID_TEST_COMMAND( CellTools::setJacobian(jacobian, points, cellWorkset, (*topo_iterator) ),
633 throwCounter, nException );
636 jacobian.
resize(C, P, D, D);
638 cellWorkset.
resize(C, N, D - 1);
639 INTREPID_TEST_COMMAND( CellTools::setJacobian(jacobian, points, cellWorkset, (*topo_iterator) ),
640 throwCounter, nException );
643 jacobian.
resize(C, P, D, D);
645 cellWorkset.
resize(C - 1, N, D);
646 INTREPID_TEST_COMMAND( CellTools::setJacobian(jacobian, points, cellWorkset, (*topo_iterator) ),
647 throwCounter, nException );
652 cellWorkset.
resize(C, N, D);
653 INTREPID_TEST_COMMAND( CellTools::setJacobian(jacobian, points, cellWorkset, (*topo_iterator) ),
654 throwCounter, nException );
661 jacobian.
resize(C, P, D, D);
662 jacobianInv.
resize(P, D, D);
663 INTREPID_TEST_COMMAND( CellTools::setJacobianInv(jacobianInv, jacobian),
664 throwCounter, nException );
669 INTREPID_TEST_COMMAND( CellTools::setJacobianInv(jacobianInv, jacobian),
670 throwCounter, nException );
673 jacobian.
resize(C, P, D, D - 1);
674 jacobianInv.
resize(C, P, D, D);
675 INTREPID_TEST_COMMAND( CellTools::setJacobianInv(jacobianInv, jacobian),
676 throwCounter, nException );
679 jacobian.
resize(C, P, D - 1, D);
680 jacobianInv.
resize(C, P, D, D);
681 INTREPID_TEST_COMMAND( CellTools::setJacobianInv(jacobianInv, jacobian),
682 throwCounter, nException );
685 jacobian.
resize(C, P - 1, D, D);
686 jacobianInv.
resize(C, P, D, D);
687 INTREPID_TEST_COMMAND( CellTools::setJacobianInv(jacobianInv, jacobian),
688 throwCounter, nException );
691 jacobian.
resize(C - 1, P, D, D);
692 jacobianInv.
resize(C, P, D, D);
693 INTREPID_TEST_COMMAND( CellTools::setJacobianInv(jacobianInv, jacobian),
694 throwCounter, nException );
701 jacobian.
resize(C, P, D, D);
702 jacobianDet.
resize(C, P, D);
703 INTREPID_TEST_COMMAND( CellTools::setJacobianDet(jacobianDet, jacobian),
704 throwCounter, nException );
709 INTREPID_TEST_COMMAND( CellTools::setJacobianDet(jacobianDet, jacobian),
710 throwCounter, nException );
715 INTREPID_TEST_COMMAND( CellTools::setJacobianDet(jacobianDet, jacobian),
716 throwCounter, nException );
719 jacobian.
resize(C, P, D, D);
721 INTREPID_TEST_COMMAND( CellTools::setJacobianDet(jacobianDet, jacobian),
722 throwCounter, nException );
725 jacobian.
resize(C, P, D, D);
726 jacobianDet.
resize(C, P-1);
727 INTREPID_TEST_COMMAND( CellTools::setJacobianDet(jacobianDet, jacobian),
728 throwCounter, nException );
731 jacobian.
resize(C - 1, P, D, D);
733 INTREPID_TEST_COMMAND( CellTools::setJacobianDet(jacobianDet, jacobian),
734 throwCounter, nException );
743 cellWorkset.
resize(C, N, D);
744 INTREPID_TEST_COMMAND( CellTools::mapToPhysicalFrame(physPoints, refPoints, cellWorkset, (*topo_iterator) ),
745 throwCounter, nException );
749 physPoints.
resize(C, P, D);
750 INTREPID_TEST_COMMAND( CellTools::mapToPhysicalFrame(physPoints, refPoints, cellWorkset, (*topo_iterator) ),
751 throwCounter, nException );
754 refPoints.
resize(C, P, D);
756 cellWorkset.
resize(C, N, D);
757 INTREPID_TEST_COMMAND( CellTools::mapToPhysicalFrame(physPoints, refPoints, cellWorkset, (*topo_iterator) ),
758 throwCounter, nException );
761 refPoints.
resize(C, P, D);
762 physPoints.
resize(C, P, D - 1);
763 INTREPID_TEST_COMMAND( CellTools::mapToPhysicalFrame(physPoints, refPoints, cellWorkset, (*topo_iterator) ),
764 throwCounter, nException );
767 refPoints.
resize(C, P, D);
768 physPoints.
resize(C, P - 1, D);
769 INTREPID_TEST_COMMAND( CellTools::mapToPhysicalFrame(physPoints, refPoints, cellWorkset, (*topo_iterator) ),
770 throwCounter, nException );
773 refPoints.
resize(C, P, D);
774 physPoints.
resize(C - 1, P, D);
775 INTREPID_TEST_COMMAND( CellTools::mapToPhysicalFrame(physPoints, refPoints, cellWorkset, (*topo_iterator) ),
776 throwCounter, nException );
780 physPoints.
resize(C, P, D);
781 INTREPID_TEST_COMMAND( CellTools::mapToPhysicalFrame(physPoints, refPoints, cellWorkset, (*topo_iterator), 0 ),
782 throwCounter, nException );
789 refPoints.
resize(C, P, D);
791 cellWorkset.
resize(C, N, D);
792 INTREPID_TEST_COMMAND( CellTools::mapToReferenceFrame(refPoints, physPoints, cellWorkset, (*topo_iterator) ),
793 throwCounter, nException );
796 refPoints.
resize(C, P, D);
797 physPoints.
resize(C, P, D);
798 INTREPID_TEST_COMMAND( CellTools::mapToReferenceFrame(refPoints, physPoints, cellWorkset, (*topo_iterator), 0 ),
799 throwCounter, nException );
804 INTREPID_TEST_COMMAND( CellTools::mapToReferenceFrame(refPoints, physPoints, cellWorkset, (*topo_iterator)),
805 throwCounter, nException );
808 refPoints.
resize(C, P, D - 1);
809 physPoints.
resize(C, P, D);
810 INTREPID_TEST_COMMAND( CellTools::mapToReferenceFrame(refPoints, physPoints, cellWorkset, (*topo_iterator)),
811 throwCounter, nException );
814 refPoints.
resize(C, P - 1, D);
815 physPoints.
resize(C, P, D);
816 INTREPID_TEST_COMMAND( CellTools::mapToReferenceFrame(refPoints, physPoints, cellWorkset, (*topo_iterator)),
817 throwCounter, nException );
820 refPoints.
resize(C - 1, P, D);
821 physPoints.
resize(C, P, D);
822 INTREPID_TEST_COMMAND( CellTools::mapToReferenceFrame(refPoints, physPoints, cellWorkset, (*topo_iterator)),
823 throwCounter, nException );
826 refPoints.
resize(C, P, D);
827 physPoints.
resize(C, P, D);
829 INTREPID_TEST_COMMAND( CellTools::mapToReferenceFrame(refPoints, physPoints, cellWorkset, (*topo_iterator)),
830 throwCounter, nException );
837 refPoints.
resize(C, P, D);
838 physPoints.
resize(C, P, D);
840 cellWorkset.
resize(C, N, D);
841 INTREPID_TEST_COMMAND( CellTools::mapToReferenceFrameInitGuess(refPoints, initGuess, physPoints, cellWorkset, (*topo_iterator) ),
842 throwCounter, nException );
847 initGuess.
resize(C, P, D);
848 INTREPID_TEST_COMMAND( CellTools::mapToReferenceFrameInitGuess(refPoints, initGuess, physPoints, cellWorkset, (*topo_iterator), 0),
849 throwCounter, nException );
852 refPoints.
resize(C, P, D);
853 physPoints.
resize(C, P, D);
854 initGuess.
resize(C, P, D - 1);
855 INTREPID_TEST_COMMAND( CellTools::mapToReferenceFrameInitGuess(refPoints, initGuess, physPoints, cellWorkset, (*topo_iterator)),
856 throwCounter, nException );
859 initGuess.
resize(C, P - 1, D);
860 INTREPID_TEST_COMMAND( CellTools::mapToReferenceFrameInitGuess(refPoints, initGuess, physPoints, cellWorkset, (*topo_iterator)),
861 throwCounter, nException );
864 initGuess.
resize(C - 1, P, D);
865 INTREPID_TEST_COMMAND( CellTools::mapToReferenceFrameInitGuess(refPoints, initGuess, physPoints, cellWorkset, (*topo_iterator)),
866 throwCounter, nException );
879 D = (*topo_iterator).getDimension();
882 refSubcellPoints.
resize(P,3);
884 INTREPID_TEST_COMMAND( CellTools::mapToReferenceSubcell(refSubcellPoints, paramPoints, subcellDim, subcellOrd, (*topo_iterator)),
885 throwCounter, nException );
888 refSubcellPoints.
resize(P);
890 INTREPID_TEST_COMMAND( CellTools::mapToReferenceSubcell(refSubcellPoints, paramPoints, subcellDim, subcellOrd, (*topo_iterator)),
891 throwCounter, nException );
894 refSubcellPoints.
resize(P, 2);
896 INTREPID_TEST_COMMAND( CellTools::mapToReferenceSubcell(refSubcellPoints, paramPoints, subcellDim, subcellOrd, (*topo_iterator)),
897 throwCounter, nException );
900 refSubcellPoints.
resize(P, 3);
902 INTREPID_TEST_COMMAND( CellTools::mapToReferenceSubcell(refSubcellPoints, paramPoints, subcellDim, subcellOrd, (*topo_iterator)),
903 throwCounter, nException );
912 refEdgeTangent.
resize(C,P,D);
913 INTREPID_TEST_COMMAND( CellTools::getReferenceEdgeTangent(refEdgeTangent, 0, (*topo_iterator)),
914 throwCounter, nException );
918 INTREPID_TEST_COMMAND( CellTools::getReferenceEdgeTangent(refEdgeTangent, 0, (*topo_iterator)),
919 throwCounter, nException );
922 refEdgeTangent.
resize(C,P,D);
923 INTREPID_TEST_COMMAND( CellTools::getReferenceEdgeTangent(refEdgeTangent, 10, (*topo_iterator)),
924 throwCounter, nException );
936 INTREPID_TEST_COMMAND( CellTools::getReferenceFaceTangents(refFaceTanU, refFaceTanV, 0, (*topo_iterator)),
937 throwCounter, nException );
942 INTREPID_TEST_COMMAND( CellTools::getReferenceFaceTangents(refFaceTanU, refFaceTanV, 0, (*topo_iterator)),
943 throwCounter, nException );
946 refFaceTanU.
resize(D - 1);
948 INTREPID_TEST_COMMAND( CellTools::getReferenceFaceTangents(refFaceTanU, refFaceTanV, 0, (*topo_iterator)),
949 throwCounter, nException );
953 refFaceTanV.
resize(D - 1);
954 INTREPID_TEST_COMMAND( CellTools::getReferenceFaceTangents(refFaceTanU, refFaceTanV, 0, (*topo_iterator)),
955 throwCounter, nException );
960 INTREPID_TEST_COMMAND( CellTools::getReferenceFaceTangents(refFaceTanU, refFaceTanV, 10, (*topo_iterator)),
961 throwCounter, nException );
970 refSideNormal.
resize(C,P);
971 INTREPID_TEST_COMMAND( CellTools::getReferenceSideNormal(refSideNormal, 0, (*topo_iterator)),
972 throwCounter, nException );
973 INTREPID_TEST_COMMAND( CellTools::getReferenceFaceNormal(refSideNormal, 0, (*topo_iterator)),
974 throwCounter, nException );
977 refSideNormal.
resize(D - 1);
978 INTREPID_TEST_COMMAND( CellTools::getReferenceSideNormal(refSideNormal, 0, (*topo_iterator)),
979 throwCounter, nException );
980 INTREPID_TEST_COMMAND( CellTools::getReferenceFaceNormal(refSideNormal, 0, (*topo_iterator)),
981 throwCounter, nException );
985 INTREPID_TEST_COMMAND( CellTools::getReferenceSideNormal(refSideNormal, 10, (*topo_iterator)),
986 throwCounter, nException );
987 INTREPID_TEST_COMMAND( CellTools::getReferenceFaceNormal(refSideNormal, 10, (*topo_iterator)),
988 throwCounter, nException );
991 topo_iterator = supportedTopologies.begin();
992 D = (*topo_iterator).getDimension();
993 refSideNormal.
resize(D - 1);
994 INTREPID_TEST_COMMAND( CellTools::getReferenceSideNormal(refSideNormal, 0, (*topo_iterator)),
995 throwCounter, nException );
999 INTREPID_TEST_COMMAND( CellTools::getReferenceSideNormal(refSideNormal, 10, (*topo_iterator)),
1000 throwCounter, nException );
1004 INTREPID_TEST_COMMAND( CellTools::getReferenceFaceNormal(refSideNormal, 0, (*topo_iterator)),
1005 throwCounter, nException );
1015 INTREPID_TEST_COMMAND(CellTools::checkPointInclusion(point, (*topo_iterator).getDimension() + 1, (*topo_iterator) ),
1016 throwCounter, nException );
1019 CellTopology pentagon_5(shards::getCellTopologyData<shards::Pentagon<> >() );
1020 INTREPID_TEST_COMMAND(CellTools::checkPointInclusion(point, pentagon_5.getDimension(), pentagon_5 ),
1021 throwCounter, nException );
1024 points.
resize(10, 10, (*topo_iterator).getDimension() + 1);
1025 INTREPID_TEST_COMMAND(CellTools::checkPointsetInclusion(points, (*topo_iterator) ),
1026 throwCounter, nException );
1029 points.
resize(10,10,10,3);
1030 INTREPID_TEST_COMMAND(CellTools::checkPointsetInclusion(points, (*topo_iterator) ),
1031 throwCounter, nException );
1034 points.
resize(10,10,(*topo_iterator).getDimension() );
1036 INTREPID_TEST_COMMAND(CellTools::checkPointwiseInclusion(inCell, points, (*topo_iterator) ),
1037 throwCounter, nException );
1040 points.
resize(10, (*topo_iterator).getDimension() );
1042 INTREPID_TEST_COMMAND(CellTools::checkPointwiseInclusion(inCell, points, (*topo_iterator) ),
1043 throwCounter, nException );
1046 points.
resize((*topo_iterator).getDimension() );
1048 INTREPID_TEST_COMMAND(CellTools::checkPointwiseInclusion(inCell, points, (*topo_iterator) ),
1049 throwCounter, nException );
1052 points.
resize(10, 10, (*topo_iterator).getDimension() );
1054 INTREPID_TEST_COMMAND(CellTools::checkPointwiseInclusion(inCell, points, (*topo_iterator) ),
1055 throwCounter, nException );
1058 points.
resize(10, 10, (*topo_iterator).getDimension() );
1060 INTREPID_TEST_COMMAND(CellTools::checkPointwiseInclusion(inCell, points, (*topo_iterator) ),
1061 throwCounter, nException );
1064 points.
resize(10, (*topo_iterator).getDimension() );
1066 INTREPID_TEST_COMMAND(CellTools::checkPointwiseInclusion(inCell, points, (*topo_iterator) ),
1067 throwCounter, nException );
1070 points.
resize(10, 10, (*topo_iterator).getDimension() + 1);
1072 INTREPID_TEST_COMMAND(CellTools::checkPointwiseInclusion(inCell, points, (*topo_iterator) ),
1073 throwCounter, nException );
1076 points.
resize(10,10,10,3);
1077 INTREPID_TEST_COMMAND(CellTools::checkPointwiseInclusion(inCell, points, (*topo_iterator) ),
1078 throwCounter, nException );
1081 physPoints.
resize(C, P, D);
1084 cellWorkset.
resize(C, N, D, D);
1085 INTREPID_TEST_COMMAND(CellTools::checkPointwiseInclusion(inCell, physPoints, cellWorkset, (*topo_iterator) ),
1086 throwCounter, nException );
1089 cellWorkset.
resize(C, N + 1, D);
1090 INTREPID_TEST_COMMAND(CellTools::checkPointwiseInclusion(inCell, physPoints, cellWorkset, (*topo_iterator) ),
1091 throwCounter, nException );
1094 cellWorkset.
resize(C, N, D + 1);
1095 INTREPID_TEST_COMMAND(CellTools::checkPointwiseInclusion(inCell, physPoints, cellWorkset, (*topo_iterator) ),
1096 throwCounter, nException );
1099 cellWorkset.
resize(C, N, D);
1100 INTREPID_TEST_COMMAND(CellTools::checkPointwiseInclusion(inCell, physPoints, cellWorkset, (*topo_iterator), C + 1 ),
1101 throwCounter, nException );
1104 INTREPID_TEST_COMMAND(CellTools::checkPointwiseInclusion(inCell, physPoints, cellWorkset, (*topo_iterator), 0 ),
1105 throwCounter, nException );
1110 INTREPID_TEST_COMMAND(CellTools::checkPointwiseInclusion(inCell, physPoints, cellWorkset, (*topo_iterator) ),
1111 throwCounter, nException );
1114 physPoints.
resize(C, P, D);
1116 INTREPID_TEST_COMMAND(CellTools::checkPointwiseInclusion(inCell, physPoints, cellWorkset, (*topo_iterator)),
1117 throwCounter, nException );
1122 INTREPID_TEST_COMMAND(CellTools::checkPointwiseInclusion(inCell, physPoints, cellWorkset, (*topo_iterator), 0),
1123 throwCounter, nException );
1126 physPoints.
resize(C, P, D);
1128 INTREPID_TEST_COMMAND(CellTools::checkPointwiseInclusion(inCell, physPoints, cellWorkset, (*topo_iterator)),
1129 throwCounter, nException );
1132 physPoints.
resize(C + 1, P, D);
1134 INTREPID_TEST_COMMAND(CellTools::checkPointwiseInclusion(inCell, physPoints, cellWorkset, (*topo_iterator)),
1135 throwCounter, nException );
1140 INTREPID_TEST_COMMAND(CellTools::checkPointwiseInclusion(inCell, physPoints, cellWorkset, (*topo_iterator), 0 ),
1141 throwCounter, nException );
1151 INTREPID_TEST_COMMAND(CellTools::getReferenceVertex(pentagon_5, 0), throwCounter, nException);
1152 INTREPID_TEST_COMMAND(CellTools::getReferenceNode(pentagon_5, 0), throwCounter, nException);
1153 INTREPID_TEST_COMMAND(CellTools::getReferenceSubcellVertices(subcellNodes, 0, 0, pentagon_5), throwCounter, nException);
1154 INTREPID_TEST_COMMAND(CellTools::getReferenceSubcellNodes(subcellNodes, 0, 0, pentagon_5), throwCounter, nException);
1157 topo_iterator = supportedTopologies.end() - 1;
1158 D = (*topo_iterator).getDimension();
1159 int subcDim = D - 1;
1160 int S = (*topo_iterator).getSubcellCount(subcDim);
1161 V = (*topo_iterator).getVertexCount(subcDim, S - 1);
1162 subcellNodes.
resize(V, D);
1164 INTREPID_TEST_COMMAND(CellTools::getReferenceSubcellVertices(subcellNodes, subcDim, S + 1, (*topo_iterator)),
1165 throwCounter, nException);
1168 INTREPID_TEST_COMMAND(CellTools::getReferenceSubcellVertices(subcellNodes, D + 1, S, (*topo_iterator)),
1169 throwCounter, nException);
1172 subcellNodes.
resize(V, D, D);
1173 INTREPID_TEST_COMMAND(CellTools::getReferenceSubcellVertices(subcellNodes, subcDim, S - 1, (*topo_iterator)),
1174 throwCounter, nException);
1177 subcellNodes.
resize(V - 1, D);
1178 INTREPID_TEST_COMMAND(CellTools::getReferenceSubcellVertices(subcellNodes, subcDim, S - 1, (*topo_iterator)),
1179 throwCounter, nException);
1182 subcellNodes.
resize(V, D - 1);
1183 INTREPID_TEST_COMMAND(CellTools::getReferenceSubcellVertices(subcellNodes, subcDim, S - 1, (*topo_iterator)),
1184 throwCounter, nException);
1187 N = (*topo_iterator).getNodeCount(subcDim, S - 1);
1188 subcellNodes.
resize(N, D);
1190 INTREPID_TEST_COMMAND(CellTools::getReferenceSubcellNodes(subcellNodes, subcDim, S + 1, (*topo_iterator)),
1191 throwCounter, nException);
1194 INTREPID_TEST_COMMAND(CellTools::getReferenceSubcellNodes(subcellNodes, D + 1, S, (*topo_iterator)),
1195 throwCounter, nException);
1198 subcellNodes.
resize(N, D, D);
1199 INTREPID_TEST_COMMAND(CellTools::getReferenceSubcellNodes(subcellNodes, subcDim, S - 1, (*topo_iterator)),
1200 throwCounter, nException);
1203 subcellNodes.
resize(N - 1, D);
1204 INTREPID_TEST_COMMAND(CellTools::getReferenceSubcellNodes(subcellNodes, subcDim, S - 1, (*topo_iterator)),
1205 throwCounter, nException);
1208 subcellNodes.
resize(N, D - 1);
1209 INTREPID_TEST_COMMAND(CellTools::getReferenceSubcellNodes(subcellNodes, subcDim, S - 1, (*topo_iterator)),
1210 throwCounter, nException);
1219 catch(std::logic_error err) {
1220 *outStream << err.what() <<
"\n";
1225 if (throwCounter != nException) {
1227 *outStream << std::setw(70) <<
"^^^^----FAILURE!" <<
"\n";
1232 std::cout <<
"End Result: TEST FAILED\n";
1234 std::cout <<
"End Result: TEST PASSED\n";
1237 std::cout.copyfmt(oldFormatState);
void clear()
Clears FieldContainer to trivial container (one with rank = 0 and size = 0)
Header file for utility class to provide multidimensional containers.
Header file for the abstract base class Intrepid::DefaultCubatureFactory.
void resize(const int dim0)
Resizes FieldContainer to a rank-1 container with the specified dimension, initialized by 0...
A factory class that generates specific instances of cubatures.
Teuchos::RCP< Cubature< Scalar, ArrayPoint, ArrayWeight > > create(const shards::CellTopology &cellTopology, const std::vector< int > °ree)
Factory method.