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"
58 #include <Kokkos_Core.hpp>
61 using namespace Intrepid;
62 using namespace shards;
64 #define INTREPID_TEST_COMMAND( S , throwCounter, nException ) \
70 catch (std::logic_error err) { \
72 *outStream << "Expected Error " << nException << " -------------------------------------------------------------\n"; \
73 *outStream << err.what() << '\n'; \
74 *outStream << "-------------------------------------------------------------------------------" << "\n\n"; \
80 int main(
int argc,
char *argv[]) {
82 Teuchos::GlobalMPISession mpiSession(&argc, &argv);
88 int iprint = argc - 1;
90 Teuchos::RCP<std::ostream> outStream;
91 Teuchos::oblackholestream bhs;
94 outStream = Teuchos::rcp(&std::cout,
false);
96 outStream = Teuchos::rcp(&bhs,
false);
99 Teuchos::oblackholestream oldFormatState;
100 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";
160 Kokkos::View<double***> cellWorkset(
"cellWorkset",10,10,10);
161 Kokkos::View<double***> refPoints(
"refPoints",10,10,10);
162 Kokkos::View<double**> controlPoints(
"controlPoints",10,10);
171 for(topo_iterator = supportedTopologies.begin(); topo_iterator != supportedTopologies.end(); ++topo_iterator){
173 Teuchos::RCP<Cubature<double,Kokkos::View<double**>,Kokkos::View<double*> > > cellCubature = cubFactory.
create( (*topo_iterator), 4);
174 int cubDim = cellCubature -> getDimension();
175 int numPts = cellCubature -> getNumPoints();
176 Kokkos::View<double**> cubPoints(
"cubPoints",numPts,cubDim);
177 Kokkos::View<double*> cubWeights(
"cubWeights",numPts);
178 cellCubature -> getCubature(cubPoints, cubWeights);
181 int numNodes = (*topo_iterator).getNodeCount();
182 int cellDim = (*topo_iterator).getDimension();
183 Kokkos::resize(cellWorkset,numCells, numNodes, cellDim);
185 Kokkos::View<double**> refCellNodes(
"refCellNodes",numNodes, cellDim );
186 CellTools::getReferenceSubcellNodes(refCellNodes, cellDim, 0, (*topo_iterator) );
188 for(
int cellOrd = 0; cellOrd < numCells; cellOrd++){
191 for(
int nodeOrd = 0; nodeOrd < numNodes; nodeOrd++){
192 for(
int d = 0; d < cellDim; d++){
193 double delta = Teuchos::ScalarTraits<double>::random()/16.0;
194 cellWorkset(cellOrd, nodeOrd, d) = refCellNodes(nodeOrd, d) + delta;
203 Kokkos::View<double**> physPoints(
"physPoints",numPts,cubDim);
204 Kokkos::View<double**> controlPoints(
"controlPoints",numPts,cubDim);
206 <<
" Mapping a set of " << numPts <<
" points to one cell in a workset of " << numCells <<
" "
207 << (*topo_iterator).getName() <<
" cells. \n";
208 for(
int cellOrd = 0; cellOrd < numCells; cellOrd++){
210 CellTools::mapToPhysicalFrame(physPoints, cubPoints, cellWorkset, (*topo_iterator), cellOrd);
212 CellTools::mapToReferenceFrame(controlPoints, physPoints, cellWorkset, (*topo_iterator), cellOrd);
214 for(
int pt = 0; pt < numPts; pt++){
215 for(
int d = 0; d < cellDim; d++){
217 if( abs( controlPoints(pt, d) - cubPoints(pt, d) ) > 100.0*INTREPID_TOL ){
220 << std::setw(70) <<
"^^^^----FAILURE!" <<
"\n"
221 <<
" Mapping a single point set to a single physical cell in a workset failed for: \n"
222 <<
" Cell Topology = " << (*topo_iterator).getName() <<
"\n"
223 <<
" Physical cell ordinal in workset = " << cellOrd <<
"\n"
224 <<
" Reference point ordinal = " << setprecision(12) << pt <<
"\n"
225 <<
" At reference point coordinate = " << setprecision(12) << d <<
"\n"
226 <<
" Original value = " << cubPoints(pt, d) <<
"\n"
227 <<
" F^{-1}F(P_d) = " << controlPoints(pt, d) <<
"\n";
237 Kokkos::View<double***>physPoints3(
"physPoints3",numCells, numPts, cubDim);
238 Kokkos::View<double***>controlPoints3(
"controlPoints3",numCells, numPts, cubDim);
241 <<
" Mapping a set of " << numPts <<
" points to all cells in workset of " << numCells <<
" "
242 << (*topo_iterator).getName() <<
" cells. \n";
245 CellTools::mapToPhysicalFrame(physPoints3, cubPoints, cellWorkset, (*topo_iterator));
247 CellTools::mapToReferenceFrame(controlPoints3, physPoints3, cellWorkset, (*topo_iterator));
250 for(
int cellOrd = 0; cellOrd < numCells; cellOrd++){
251 for(
int pt = 0; pt < numPts; pt++){
252 for(
int d = 0; d < cellDim; d++){
254 if( abs( controlPoints3(cellOrd, pt, d) - cubPoints(pt, d) ) > 100.0*INTREPID_TOL ){
257 << std::setw(70) <<
"^^^^----FAILURE!" <<
"\n"
258 <<
" Mapping a single point set to all physical cells in a workset failed for: \n"
259 <<
" Cell Topology = " << (*topo_iterator).getName() <<
"\n"
260 <<
" Physical cell ordinal in workset = " << cellOrd <<
"\n"
261 <<
" Reference point ordinal = " << setprecision(12) << pt <<
"\n"
262 <<
" At reference point coordinate = " << setprecision(12) << d <<
"\n"
263 <<
" Original value = " << cubPoints(pt, d) <<
"\n"
264 <<
" F^{-1}F(P_d) = " << controlPoints3(cellOrd, pt, d) <<
"\n";
274 Kokkos::resize(refPoints,numCells, numPts, cubDim);
275 Kokkos::resize(physPoints,numCells, numPts, cubDim);
276 Kokkos::resize(controlPoints,numCells, numPts, cubDim);
279 for(
int c = 0; c < numCells; c++){
280 for(
int pt = 0; pt < numPts; pt++){
281 for(
int d = 0; d < cellDim; d++){
282 refPoints(c, pt, d) = cubPoints(pt, d);
288 <<
" Mapping " << numCells <<
" sets of " << numPts <<
" points to corresponding cells in workset of " << numCells <<
" "
289 << (*topo_iterator).getName() <<
" cells. \n";
292 CellTools::mapToPhysicalFrame(physPoints3, refPoints, cellWorkset, (*topo_iterator));
294 CellTools::mapToReferenceFrame(controlPoints3, physPoints3, cellWorkset, (*topo_iterator));
297 for(
int cellOrd = 0; cellOrd < numCells; cellOrd++){
298 for(
int pt = 0; pt < numPts; pt++){
299 for(
int d = 0; d < cellDim; d++){
301 if( abs( controlPoints3(cellOrd, pt, d) - cubPoints(pt, d) ) > 100.0*INTREPID_TOL ){
304 << std::setw(70) <<
"^^^^----FAILURE!" <<
"\n"
305 <<
" Mapping multiple point sets to corresponding physical cells in a workset failed for: \n"
306 <<
" Cell Topology = " << (*topo_iterator).getName() <<
"\n"
307 <<
" Physical cell ordinal in workset = " << cellOrd <<
"\n"
308 <<
" Reference point ordinal = " << setprecision(12) << pt <<
"\n"
309 <<
" At reference point coordinate = " << setprecision(12) << d <<
"\n"
310 <<
" Original value = " << refPoints(cellOrd, pt, d) <<
"\n"
311 <<
" F^{-1}F(P_d) = " << controlPoints3(cellOrd, pt, d) <<
"\n";
323 catch (std::logic_error err) {
324 *outStream << err.what() <<
"\n";
334 <<
"===============================================================================\n"\
335 <<
"| Test 2: computing F(x) and F^{-1}(x) using user-defined initial guess. |\n"\
336 <<
"===============================================================================\n\n";
347 Kokkos::View<double***> cellWorkset(
"cellWorkset",10,10,10);
348 Kokkos::View<double**> physPoints(
"physPoints",10,10);
349 Kokkos::View<double**> controlPoints(
"controlPoints",10,10);
350 Kokkos::View<double***> initialGuess(
"initialGuess",10,10,10);
359 for(topo_iterator = supportedTopologies.begin(); topo_iterator != supportedTopologies.end(); ++topo_iterator){
362 Teuchos::RCP<Cubature<double,Kokkos::View<double**>, Kokkos::View<double*> > > cellCubature = cubFactory.
create( (*topo_iterator), 4);
363 int cubDim = cellCubature -> getDimension();
364 int numPts = cellCubature -> getNumPoints();
365 Kokkos::View<double**> cubPoints(
"cubPoints",numPts, cubDim);
366 Kokkos::View<double*> cubWeights(
"cubWeights",numPts);
367 cellCubature -> getCubature(cubPoints, cubWeights);
371 int numNodes = (*topo_iterator).getNodeCount();
372 int cellDim = (*topo_iterator).getDimension();
373 Kokkos::resize(cellWorkset,numCells, numNodes, cellDim);
376 Kokkos::View<double**> refCellNodes(
"refCellNodes",numNodes, cellDim );
377 CellTools::getReferenceSubcellNodes(refCellNodes, cellDim, 0, (*topo_iterator) );
380 for(
int cellOrd = 0; cellOrd < numCells; cellOrd++){
383 for(
int nodeOrd = 0; nodeOrd < numNodes; nodeOrd++){
384 for(
int d = 0; d < cellDim; d++){
385 double delta = Teuchos::ScalarTraits<double>::random()/16.0;
386 cellWorkset(cellOrd, nodeOrd, d) = refCellNodes(nodeOrd, d) + delta;
395 Kokkos::resize(physPoints,numPts, cubDim);
396 Kokkos::resize(controlPoints,numPts, cubDim);
399 <<
" Mapping a set of " << numPts <<
" points to one cell in a workset of " << numCells <<
" "
400 << (*topo_iterator).getName() <<
" cells. \n";
402 for(
int cellOrd = 0; cellOrd < numCells; cellOrd++){
405 CellTools::mapToPhysicalFrame(physPoints, cubPoints, cellWorkset, (*topo_iterator), cellOrd);
407 CellTools::mapToReferenceFrameInitGuess(controlPoints, cubPoints, physPoints, cellWorkset, (*topo_iterator), cellOrd);
410 for(
int pt = 0; pt < numPts; pt++){
411 for(
int d = 0; d < cellDim; d++){
413 if( abs( controlPoints(pt, d) - cubPoints(pt, d) ) > 100.0*INTREPID_TOL ){
416 << std::setw(70) <<
"^^^^----FAILURE!" <<
"\n"
417 <<
" Mapping a single point set to a single physical cell in a workset failed for: \n"
418 <<
" Cell Topology = " << (*topo_iterator).getName() <<
"\n"
419 <<
" Physical cell ordinal in workset = " << cellOrd <<
"\n"
420 <<
" Reference point ordinal = " << setprecision(12) << pt <<
"\n"
421 <<
" At reference point coordinate = " << setprecision(12) << d <<
"\n"
422 <<
" Original value = " << cubPoints(pt, d) <<
"\n"
423 <<
" F^{-1}F(P_d) = " << controlPoints(pt, d) <<
"\n";
433 Kokkos::View<double***>physPoints3(
"physPoints3",numCells, numPts, cubDim);
434 Kokkos::View<double***>controlPoints3(
"controlPoints3",numCells, numPts, cubDim);
437 Kokkos::resize(initialGuess,numCells, numPts, cubDim);
438 for(
int c = 0; c < numCells; c++){
439 for(
int pt = 0; pt < numPts; pt++){
440 for(
int d = 0; d < cellDim; d++){
441 initialGuess(c, pt, d) = cubPoints(pt, d);
447 <<
" Mapping a set of " << numPts <<
" points to all cells in workset of " << numCells <<
" "
448 << (*topo_iterator).getName() <<
" cells. \n";
451 CellTools::mapToPhysicalFrame(physPoints3, cubPoints, cellWorkset, (*topo_iterator));
453 CellTools::mapToReferenceFrameInitGuess(controlPoints3, initialGuess, physPoints3, cellWorkset, (*topo_iterator));
456 for(
int cellOrd = 0; cellOrd < numCells; cellOrd++){
457 for(
int pt = 0; pt < numPts; pt++){
458 for(
int d = 0; d < cellDim; d++){
460 if( abs( controlPoints3(cellOrd, pt, d) - cubPoints(pt, d) ) > 100.0*INTREPID_TOL ){
463 << std::setw(70) <<
"^^^^----FAILURE!" <<
"\n"
464 <<
" Mapping a single point set to all physical cells in a workset failed for: \n"
465 <<
" Cell Topology = " << (*topo_iterator).getName() <<
"\n"
466 <<
" Physical cell ordinal in workset = " << cellOrd <<
"\n"
467 <<
" Reference point ordinal = " << setprecision(12) << pt <<
"\n"
468 <<
" At reference point coordinate = " << setprecision(12) << d <<
"\n"
469 <<
" Original value = " << cubPoints(pt, d) <<
"\n"
470 <<
" F^{-1}F(P_d) = " << controlPoints3(cellOrd, pt, d) <<
"\n";
481 Kokkos::realloc(physPoints3,numCells, numPts, cubDim);
482 Kokkos::realloc(controlPoints3,numCells, numPts, cubDim);
485 <<
" Mapping " << numCells <<
" sets of " << numPts <<
" points to corresponding cells in workset of " << numCells <<
" "
486 << (*topo_iterator).getName() <<
" cells. \n";
489 CellTools::mapToPhysicalFrame(physPoints3, initialGuess, cellWorkset, (*topo_iterator));
491 CellTools::mapToReferenceFrameInitGuess(controlPoints3, initialGuess, physPoints3, cellWorkset, (*topo_iterator));
494 for(
int cellOrd = 0; cellOrd < numCells; cellOrd++){
495 for(
int pt = 0; pt < numPts; pt++){
496 for(
int d = 0; d < cellDim; d++){
498 if( abs( controlPoints3(cellOrd, pt, d) - cubPoints(pt, d) ) > 100.0*INTREPID_TOL ){
501 << std::setw(70) <<
"^^^^----FAILURE!" <<
"\n"
502 <<
" Mapping multiple point sets to corresponding physical cells in a workset failed for: \n"
503 <<
" Cell Topology = " << (*topo_iterator).getName() <<
"\n"
504 <<
" Physical cell ordinal in workset = " << cellOrd <<
"\n"
505 <<
" Reference point ordinal = " << setprecision(12) << pt <<
"\n"
506 <<
" At reference point coordinate = " << setprecision(12) << d <<
"\n"
507 <<
" Original value = " << initialGuess(cellOrd, pt, d) <<
"\n"
508 <<
" F^{-1}F(P_d) = " << controlPoints3(cellOrd, pt, d) <<
"\n";
520 catch (std::logic_error err) {
521 *outStream << err.what() <<
"\n";
527 <<
"===============================================================================\n"\
528 <<
"| Test 3: Exception testing - only when HAVE_INTREPID_DEBUG is defined. |\n"\
529 <<
"===============================================================================\n\n";
539 int throwCounter = 0;
543 #ifdef HAVE_INTREPID_DEBUG
566 topo_iterator = supportedTopologies.begin() + 1;
567 D = (*topo_iterator).getDimension();
568 N = (*topo_iterator).getNodeCount();
569 V = (*topo_iterator).getVertexCount();
574 cellWorkset.
resize(C, N, D);
575 INTREPID_TEST_COMMAND( CellTools::setJacobian(jacobian, points, cellWorkset, (*topo_iterator) ),
576 throwCounter, nException );
580 INTREPID_TEST_COMMAND( CellTools::setJacobian(jacobian, points, cellWorkset, (*topo_iterator) ),
581 throwCounter, nException );
584 cellWorkset.
resize(C, N, D);
586 INTREPID_TEST_COMMAND( CellTools::setJacobian(jacobian, points, cellWorkset, (*topo_iterator) ),
587 throwCounter, nException );
591 INTREPID_TEST_COMMAND( CellTools::setJacobian(jacobian, points, cellWorkset, (*topo_iterator), 0 ),
592 throwCounter, nException );
595 jacobian.
resize(C, P, D, D);
596 points.
resize(C, P, D - 1);
597 INTREPID_TEST_COMMAND( CellTools::setJacobian(jacobian, points, cellWorkset, (*topo_iterator) ),
598 throwCounter, nException );
601 jacobian.
resize(C, P, D, D);
602 points.
resize(C, P - 1, D);
603 INTREPID_TEST_COMMAND( CellTools::setJacobian(jacobian, points, cellWorkset, (*topo_iterator) ),
604 throwCounter, nException );
607 jacobian.
resize(C, P, D, D);
608 points.
resize(C - 1, P, D);
609 INTREPID_TEST_COMMAND( CellTools::setJacobian(jacobian, points, cellWorkset, (*topo_iterator) ),
610 throwCounter, nException );
613 jacobian.
resize(C, P, D, D);
615 cellWorkset.
resize(C, N, D - 1);
616 INTREPID_TEST_COMMAND( CellTools::setJacobian(jacobian, points, cellWorkset, (*topo_iterator) ),
617 throwCounter, nException );
620 jacobian.
resize(C, P, D, D);
622 cellWorkset.
resize(C - 1, N, D);
623 INTREPID_TEST_COMMAND( CellTools::setJacobian(jacobian, points, cellWorkset, (*topo_iterator) ),
624 throwCounter, nException );
629 cellWorkset.
resize(C, N, D);
630 INTREPID_TEST_COMMAND( CellTools::setJacobian(jacobian, points, cellWorkset, (*topo_iterator) ),
631 throwCounter, nException );
638 jacobian.
resize(C, P, D, D);
639 jacobianInv.
resize(P, D, D);
640 INTREPID_TEST_COMMAND( CellTools::setJacobianInv(jacobianInv, jacobian),
641 throwCounter, nException );
646 INTREPID_TEST_COMMAND( CellTools::setJacobianInv(jacobianInv, jacobian),
647 throwCounter, nException );
650 jacobian.
resize(C, P, D, D - 1);
651 jacobianInv.
resize(C, P, D, D);
652 INTREPID_TEST_COMMAND( CellTools::setJacobianInv(jacobianInv, jacobian),
653 throwCounter, nException );
656 jacobian.
resize(C, P, D - 1, D);
657 jacobianInv.
resize(C, P, D, D);
658 INTREPID_TEST_COMMAND( CellTools::setJacobianInv(jacobianInv, jacobian),
659 throwCounter, nException );
662 jacobian.
resize(C, P - 1, D, D);
663 jacobianInv.
resize(C, P, D, D);
664 INTREPID_TEST_COMMAND( CellTools::setJacobianInv(jacobianInv, jacobian),
665 throwCounter, nException );
668 jacobian.
resize(C - 1, P, D, D);
669 jacobianInv.
resize(C, P, D, D);
670 INTREPID_TEST_COMMAND( CellTools::setJacobianInv(jacobianInv, jacobian),
671 throwCounter, nException );
678 jacobian.
resize(C, P, D, D);
679 jacobianDet.
resize(C, P, D);
680 INTREPID_TEST_COMMAND( CellTools::setJacobianDet(jacobianDet, jacobian),
681 throwCounter, nException );
686 INTREPID_TEST_COMMAND( CellTools::setJacobianDet(jacobianDet, jacobian),
687 throwCounter, nException );
692 INTREPID_TEST_COMMAND( CellTools::setJacobianDet(jacobianDet, jacobian),
693 throwCounter, nException );
696 jacobian.
resize(C, P, D, D);
698 INTREPID_TEST_COMMAND( CellTools::setJacobianDet(jacobianDet, jacobian),
699 throwCounter, nException );
702 jacobian.
resize(C, P, D, D);
703 jacobianDet.
resize(C, P-1);
704 INTREPID_TEST_COMMAND( CellTools::setJacobianDet(jacobianDet, jacobian),
705 throwCounter, nException );
708 jacobian.
resize(C - 1, P, D, D);
710 INTREPID_TEST_COMMAND( CellTools::setJacobianDet(jacobianDet, jacobian),
711 throwCounter, nException );
720 cellWorkset.
resize(C, N, D);
721 INTREPID_TEST_COMMAND( CellTools::mapToPhysicalFrame(physPoints, refPoints, cellWorkset, (*topo_iterator) ),
722 throwCounter, nException );
726 physPoints.
resize(C, P, D);
727 INTREPID_TEST_COMMAND( CellTools::mapToPhysicalFrame(physPoints, refPoints, cellWorkset, (*topo_iterator) ),
728 throwCounter, nException );
731 refPoints.
resize(C, P, D);
733 cellWorkset.
resize(C, N, D);
734 INTREPID_TEST_COMMAND( CellTools::mapToPhysicalFrame(physPoints, refPoints, cellWorkset, (*topo_iterator) ),
735 throwCounter, nException );
738 refPoints.
resize(C, P, D);
739 physPoints.
resize(C, P, D - 1);
740 INTREPID_TEST_COMMAND( CellTools::mapToPhysicalFrame(physPoints, refPoints, cellWorkset, (*topo_iterator) ),
741 throwCounter, nException );
744 refPoints.
resize(C, P, D);
745 physPoints.
resize(C, P - 1, D);
746 INTREPID_TEST_COMMAND( CellTools::mapToPhysicalFrame(physPoints, refPoints, cellWorkset, (*topo_iterator) ),
747 throwCounter, nException );
750 refPoints.
resize(C, P, D);
751 physPoints.
resize(C - 1, P, D);
752 INTREPID_TEST_COMMAND( CellTools::mapToPhysicalFrame(physPoints, refPoints, cellWorkset, (*topo_iterator) ),
753 throwCounter, nException );
757 physPoints.
resize(C, P, D);
758 INTREPID_TEST_COMMAND( CellTools::mapToPhysicalFrame(physPoints, refPoints, cellWorkset, (*topo_iterator), 0 ),
759 throwCounter, nException );
766 refPoints.
resize(C, P, D);
768 cellWorkset.
resize(C, N, D);
769 INTREPID_TEST_COMMAND( CellTools::mapToReferenceFrame(refPoints, physPoints, cellWorkset, (*topo_iterator) ),
770 throwCounter, nException );
773 refPoints.
resize(C, P, D);
774 physPoints.
resize(C, P, D);
775 INTREPID_TEST_COMMAND( CellTools::mapToReferenceFrame(refPoints, physPoints, cellWorkset, (*topo_iterator), 0 ),
776 throwCounter, nException );
781 INTREPID_TEST_COMMAND( CellTools::mapToReferenceFrame(refPoints, physPoints, cellWorkset, (*topo_iterator)),
782 throwCounter, nException );
785 refPoints.
resize(C, P, D - 1);
786 physPoints.
resize(C, P, D);
787 INTREPID_TEST_COMMAND( CellTools::mapToReferenceFrame(refPoints, physPoints, cellWorkset, (*topo_iterator)),
788 throwCounter, nException );
791 refPoints.
resize(C, P - 1, D);
792 physPoints.
resize(C, P, D);
793 INTREPID_TEST_COMMAND( CellTools::mapToReferenceFrame(refPoints, physPoints, cellWorkset, (*topo_iterator)),
794 throwCounter, nException );
797 refPoints.
resize(C - 1, P, D);
798 physPoints.
resize(C, P, D);
799 INTREPID_TEST_COMMAND( CellTools::mapToReferenceFrame(refPoints, physPoints, cellWorkset, (*topo_iterator)),
800 throwCounter, nException );
803 refPoints.
resize(C, P, D);
804 physPoints.
resize(C, P, D);
806 INTREPID_TEST_COMMAND( CellTools::mapToReferenceFrame(refPoints, physPoints, cellWorkset, (*topo_iterator)),
807 throwCounter, nException );
814 refPoints.
resize(C, P, D);
815 physPoints.
resize(C, P, D);
817 cellWorkset.
resize(C, N, D);
818 INTREPID_TEST_COMMAND( CellTools::mapToReferenceFrameInitGuess(refPoints, initGuess, physPoints, cellWorkset, (*topo_iterator) ),
819 throwCounter, nException );
824 initGuess.
resize(C, P, D);
825 INTREPID_TEST_COMMAND( CellTools::mapToReferenceFrameInitGuess(refPoints, initGuess, physPoints, cellWorkset, (*topo_iterator), 0),
826 throwCounter, nException );
829 refPoints.
resize(C, P, D);
830 physPoints.
resize(C, P, D);
831 initGuess.
resize(C, P, D - 1);
832 INTREPID_TEST_COMMAND( CellTools::mapToReferenceFrameInitGuess(refPoints, initGuess, physPoints, cellWorkset, (*topo_iterator)),
833 throwCounter, nException );
836 initGuess.
resize(C, P - 1, D);
837 INTREPID_TEST_COMMAND( CellTools::mapToReferenceFrameInitGuess(refPoints, initGuess, physPoints, cellWorkset, (*topo_iterator)),
838 throwCounter, nException );
841 initGuess.
resize(C - 1, P, D);
842 INTREPID_TEST_COMMAND( CellTools::mapToReferenceFrameInitGuess(refPoints, initGuess, physPoints, cellWorkset, (*topo_iterator)),
843 throwCounter, nException );
856 D = (*topo_iterator).getDimension();
859 refSubcellPoints.
resize(P,3);
861 INTREPID_TEST_COMMAND( CellTools::mapToReferenceSubcell(refSubcellPoints, paramPoints, subcellDim, subcellOrd, (*topo_iterator)),
862 throwCounter, nException );
865 refSubcellPoints.
resize(P);
867 INTREPID_TEST_COMMAND( CellTools::mapToReferenceSubcell(refSubcellPoints, paramPoints, subcellDim, subcellOrd, (*topo_iterator)),
868 throwCounter, nException );
871 refSubcellPoints.
resize(P, 2);
873 INTREPID_TEST_COMMAND( CellTools::mapToReferenceSubcell(refSubcellPoints, paramPoints, subcellDim, subcellOrd, (*topo_iterator)),
874 throwCounter, nException );
877 refSubcellPoints.
resize(P, 3);
879 INTREPID_TEST_COMMAND( CellTools::mapToReferenceSubcell(refSubcellPoints, paramPoints, subcellDim, subcellOrd, (*topo_iterator)),
880 throwCounter, nException );
889 refEdgeTangent.
resize(C,P,D);
890 INTREPID_TEST_COMMAND( CellTools::getReferenceEdgeTangent(refEdgeTangent, 0, (*topo_iterator)),
891 throwCounter, nException );
895 INTREPID_TEST_COMMAND( CellTools::getReferenceEdgeTangent(refEdgeTangent, 0, (*topo_iterator)),
896 throwCounter, nException );
899 refEdgeTangent.
resize(C,P,D);
900 INTREPID_TEST_COMMAND( CellTools::getReferenceEdgeTangent(refEdgeTangent, 10, (*topo_iterator)),
901 throwCounter, nException );
913 INTREPID_TEST_COMMAND( CellTools::getReferenceFaceTangents(refFaceTanU, refFaceTanV, 0, (*topo_iterator)),
914 throwCounter, nException );
919 INTREPID_TEST_COMMAND( CellTools::getReferenceFaceTangents(refFaceTanU, refFaceTanV, 0, (*topo_iterator)),
920 throwCounter, nException );
923 refFaceTanU.
resize(D - 1);
925 INTREPID_TEST_COMMAND( CellTools::getReferenceFaceTangents(refFaceTanU, refFaceTanV, 0, (*topo_iterator)),
926 throwCounter, nException );
930 refFaceTanV.
resize(D - 1);
931 INTREPID_TEST_COMMAND( CellTools::getReferenceFaceTangents(refFaceTanU, refFaceTanV, 0, (*topo_iterator)),
932 throwCounter, nException );
937 INTREPID_TEST_COMMAND( CellTools::getReferenceFaceTangents(refFaceTanU, refFaceTanV, 10, (*topo_iterator)),
938 throwCounter, nException );
947 refSideNormal.
resize(C,P);
948 INTREPID_TEST_COMMAND( CellTools::getReferenceSideNormal(refSideNormal, 0, (*topo_iterator)),
949 throwCounter, nException );
950 INTREPID_TEST_COMMAND( CellTools::getReferenceFaceNormal(refSideNormal, 0, (*topo_iterator)),
951 throwCounter, nException );
954 refSideNormal.
resize(D - 1);
955 INTREPID_TEST_COMMAND( CellTools::getReferenceSideNormal(refSideNormal, 0, (*topo_iterator)),
956 throwCounter, nException );
957 INTREPID_TEST_COMMAND( CellTools::getReferenceFaceNormal(refSideNormal, 0, (*topo_iterator)),
958 throwCounter, nException );
962 INTREPID_TEST_COMMAND( CellTools::getReferenceSideNormal(refSideNormal, 10, (*topo_iterator)),
963 throwCounter, nException );
964 INTREPID_TEST_COMMAND( CellTools::getReferenceFaceNormal(refSideNormal, 10, (*topo_iterator)),
965 throwCounter, nException );
968 topo_iterator = supportedTopologies.begin();
969 D = (*topo_iterator).getDimension();
970 refSideNormal.
resize(D - 1);
971 INTREPID_TEST_COMMAND( CellTools::getReferenceSideNormal(refSideNormal, 0, (*topo_iterator)),
972 throwCounter, nException );
976 INTREPID_TEST_COMMAND( CellTools::getReferenceSideNormal(refSideNormal, 10, (*topo_iterator)),
977 throwCounter, nException );
981 INTREPID_TEST_COMMAND( CellTools::getReferenceFaceNormal(refSideNormal, 0, (*topo_iterator)),
982 throwCounter, nException );
992 INTREPID_TEST_COMMAND(CellTools::checkPointInclusion(point, (*topo_iterator).getDimension() + 1, (*topo_iterator) ),
993 throwCounter, nException );
996 CellTopology pentagon_5(shards::getCellTopologyData<shards::Pentagon<> >() );
997 INTREPID_TEST_COMMAND(CellTools::checkPointInclusion(point, pentagon_5.getDimension(), pentagon_5 ),
998 throwCounter, nException );
1001 points.
resize(10, 10, (*topo_iterator).getDimension() + 1);
1002 INTREPID_TEST_COMMAND(CellTools::checkPointsetInclusion(points, (*topo_iterator) ),
1003 throwCounter, nException );
1006 points.
resize(10,10,10,3);
1007 INTREPID_TEST_COMMAND(CellTools::checkPointsetInclusion(points, (*topo_iterator) ),
1008 throwCounter, nException );
1011 points.
resize(10,10,(*topo_iterator).getDimension() );
1013 INTREPID_TEST_COMMAND(CellTools::checkPointwiseInclusion(inCell, points, (*topo_iterator) ),
1014 throwCounter, nException );
1017 points.
resize(10, (*topo_iterator).getDimension() );
1019 INTREPID_TEST_COMMAND(CellTools::checkPointwiseInclusion(inCell, points, (*topo_iterator) ),
1020 throwCounter, nException );
1023 points.
resize((*topo_iterator).getDimension() );
1025 INTREPID_TEST_COMMAND(CellTools::checkPointwiseInclusion(inCell, points, (*topo_iterator) ),
1026 throwCounter, nException );
1029 points.
resize(10, 10, (*topo_iterator).getDimension() );
1031 INTREPID_TEST_COMMAND(CellTools::checkPointwiseInclusion(inCell, points, (*topo_iterator) ),
1032 throwCounter, nException );
1035 points.
resize(10, 10, (*topo_iterator).getDimension() );
1037 INTREPID_TEST_COMMAND(CellTools::checkPointwiseInclusion(inCell, points, (*topo_iterator) ),
1038 throwCounter, nException );
1041 points.
resize(10, (*topo_iterator).getDimension() );
1043 INTREPID_TEST_COMMAND(CellTools::checkPointwiseInclusion(inCell, points, (*topo_iterator) ),
1044 throwCounter, nException );
1047 points.
resize(10, 10, (*topo_iterator).getDimension() + 1);
1049 INTREPID_TEST_COMMAND(CellTools::checkPointwiseInclusion(inCell, points, (*topo_iterator) ),
1050 throwCounter, nException );
1053 points.
resize(10,10,10,3);
1054 INTREPID_TEST_COMMAND(CellTools::checkPointwiseInclusion(inCell, points, (*topo_iterator) ),
1055 throwCounter, nException );
1058 physPoints.
resize(C, P, D);
1061 cellWorkset.
resize(C, N, D, D);
1062 INTREPID_TEST_COMMAND(CellTools::checkPointwiseInclusion(inCell, physPoints, cellWorkset, (*topo_iterator) ),
1063 throwCounter, nException );
1066 cellWorkset.
resize(C, N + 1, D);
1067 INTREPID_TEST_COMMAND(CellTools::checkPointwiseInclusion(inCell, physPoints, cellWorkset, (*topo_iterator) ),
1068 throwCounter, nException );
1071 cellWorkset.
resize(C, N, D + 1);
1072 INTREPID_TEST_COMMAND(CellTools::checkPointwiseInclusion(inCell, physPoints, cellWorkset, (*topo_iterator) ),
1073 throwCounter, nException );
1076 cellWorkset.
resize(C, N, D);
1077 INTREPID_TEST_COMMAND(CellTools::checkPointwiseInclusion(inCell, physPoints, cellWorkset, (*topo_iterator), C + 1 ),
1078 throwCounter, nException );
1081 INTREPID_TEST_COMMAND(CellTools::checkPointwiseInclusion(inCell, physPoints, cellWorkset, (*topo_iterator), 0 ),
1082 throwCounter, nException );
1087 INTREPID_TEST_COMMAND(CellTools::checkPointwiseInclusion(inCell, physPoints, cellWorkset, (*topo_iterator) ),
1088 throwCounter, nException );
1091 physPoints.
resize(C, P, D);
1093 INTREPID_TEST_COMMAND(CellTools::checkPointwiseInclusion(inCell, physPoints, cellWorkset, (*topo_iterator)),
1094 throwCounter, nException );
1099 INTREPID_TEST_COMMAND(CellTools::checkPointwiseInclusion(inCell, physPoints, cellWorkset, (*topo_iterator), 0),
1100 throwCounter, nException );
1103 physPoints.
resize(C, P, D);
1105 INTREPID_TEST_COMMAND(CellTools::checkPointwiseInclusion(inCell, physPoints, cellWorkset, (*topo_iterator)),
1106 throwCounter, nException );
1109 physPoints.
resize(C + 1, P, D);
1111 INTREPID_TEST_COMMAND(CellTools::checkPointwiseInclusion(inCell, physPoints, cellWorkset, (*topo_iterator)),
1112 throwCounter, nException );
1117 INTREPID_TEST_COMMAND(CellTools::checkPointwiseInclusion(inCell, physPoints, cellWorkset, (*topo_iterator), 0 ),
1118 throwCounter, nException );
1128 INTREPID_TEST_COMMAND(CellTools::getReferenceVertex(pentagon_5, 0), throwCounter, nException);
1129 INTREPID_TEST_COMMAND(CellTools::getReferenceNode(pentagon_5, 0), throwCounter, nException);
1130 INTREPID_TEST_COMMAND(CellTools::getReferenceSubcellVertices(subcellNodes, 0, 0, pentagon_5), throwCounter, nException);
1131 INTREPID_TEST_COMMAND(CellTools::getReferenceSubcellNodes(subcellNodes, 0, 0, pentagon_5), throwCounter, nException);
1134 topo_iterator = supportedTopologies.end() - 1;
1135 D = (*topo_iterator).getDimension();
1136 int subcDim = D - 1;
1137 int S = (*topo_iterator).getSubcellCount(subcDim);
1138 V = (*topo_iterator).getVertexCount(subcDim, S - 1);
1139 subcellNodes.
resize(V, D);
1141 INTREPID_TEST_COMMAND(CellTools::getReferenceSubcellVertices(subcellNodes, subcDim, S + 1, (*topo_iterator)),
1142 throwCounter, nException);
1145 INTREPID_TEST_COMMAND(CellTools::getReferenceSubcellVertices(subcellNodes, D + 1, S, (*topo_iterator)),
1146 throwCounter, nException);
1149 subcellNodes.
resize(V, D, D);
1150 INTREPID_TEST_COMMAND(CellTools::getReferenceSubcellVertices(subcellNodes, subcDim, S - 1, (*topo_iterator)),
1151 throwCounter, nException);
1154 subcellNodes.
resize(V - 1, D);
1155 INTREPID_TEST_COMMAND(CellTools::getReferenceSubcellVertices(subcellNodes, subcDim, S - 1, (*topo_iterator)),
1156 throwCounter, nException);
1159 subcellNodes.
resize(V, D - 1);
1160 INTREPID_TEST_COMMAND(CellTools::getReferenceSubcellVertices(subcellNodes, subcDim, S - 1, (*topo_iterator)),
1161 throwCounter, nException);
1164 N = (*topo_iterator).getNodeCount(subcDim, S - 1);
1165 subcellNodes.
resize(N, D);
1167 INTREPID_TEST_COMMAND(CellTools::getReferenceSubcellNodes(subcellNodes, subcDim, S + 1, (*topo_iterator)),
1168 throwCounter, nException);
1171 INTREPID_TEST_COMMAND(CellTools::getReferenceSubcellNodes(subcellNodes, D + 1, S, (*topo_iterator)),
1172 throwCounter, nException);
1175 subcellNodes.
resize(N, D, D);
1176 INTREPID_TEST_COMMAND(CellTools::getReferenceSubcellNodes(subcellNodes, subcDim, S - 1, (*topo_iterator)),
1177 throwCounter, nException);
1180 subcellNodes.
resize(N - 1, D);
1181 INTREPID_TEST_COMMAND(CellTools::getReferenceSubcellNodes(subcellNodes, subcDim, S - 1, (*topo_iterator)),
1182 throwCounter, nException);
1185 subcellNodes.
resize(N, D - 1);
1186 INTREPID_TEST_COMMAND(CellTools::getReferenceSubcellNodes(subcellNodes, subcDim, S - 1, (*topo_iterator)),
1187 throwCounter, nException);
1196 catch(std::logic_error err) {
1197 *outStream << err.what() <<
"\n";
1202 if (throwCounter != nException) {
1204 *outStream << std::setw(70) <<
"^^^^----FAILURE!" <<
"\n";
1209 std::cout <<
"End Result: TEST FAILED\n";
1211 std::cout <<
"End Result: TEST PASSED\n";
1214 std::cout.copyfmt(oldFormatState);
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.