55 #include "Teuchos_oblackholestream.hpp"
56 #include "Teuchos_RCP.hpp"
57 #include "Teuchos_GlobalMPISession.hpp"
60 using namespace Intrepid;
62 #define INTREPID_TEST_COMMAND( S ) \
67 catch (const std::logic_error & err) { \
68 *outStream << "Expected Error ----------------------------------------------------------------\n"; \
69 *outStream << err.what() << '\n'; \
70 *outStream << "-------------------------------------------------------------------------------" << "\n\n"; \
75 int main(
int argc,
char *argv[]) {
77 Teuchos::GlobalMPISession mpiSession(&argc, &argv);
81 int iprint = argc - 1;
82 Teuchos::RCP<std::ostream> outStream;
83 Teuchos::oblackholestream bhs;
85 outStream = Teuchos::rcp(&std::cout,
false);
87 outStream = Teuchos::rcp(&bhs,
false);
90 Teuchos::oblackholestream oldFormatState;
91 oldFormatState.copyfmt(std::cout);
94 <<
"===============================================================================\n" \
96 <<
"| Unit Test (FunctionSpaceTools) |\n" \
98 <<
"| 1) volume integration on tetrahedra, testing dataIntegral |\n" \
100 <<
"| Questions? Contact Pavel Bochev (pbboche@sandia.gov) or |\n" \
101 <<
"| Denis Ridzal (dridzal@sandia.gov). |\n" \
103 <<
"| Intrepid's website: http://trilinos.sandia.gov/packages/intrepid |\n" \
104 <<
"| Trilinos website: http://trilinos.sandia.gov |\n" \
106 <<
"===============================================================================\n";
115 <<
"===============================================================================\n"\
116 <<
"| TEST 1: correctness of cell volumes |\n"\
117 <<
"===============================================================================\n";
119 outStream->precision(20);
122 shards::CellTopology cellType = shards::getCellTopologyData< shards::Tetrahedron<> >();
127 Teuchos::RCP<Cubature<double> > myCub = cubFactory.
create(cellType, cubDegree);
128 int spaceDim = myCub->getDimension();
129 int numCubPoints = myCub->getNumPoints();
134 int numCellData = numCells*numNodes*spaceDim;
135 double tetnodes[] = {
159 double tetvols[] = {1.0/6.0, 194.0/3.0, 1.0/15.0, 2.0/25.0};
174 myCub->getCubature(cub_points, cub_weights);
177 cell_nodes.setValues(tetnodes, numCellData);
184 fst::computeCellMeasure<double>(weighted_measure, jacobian_det, cub_weights);
187 for (
int cell=0; cell<data_one.dimension(0); cell++) {
188 for (
int qp=0; qp<data_one.dimension(1); qp++) {
189 data_one(cell,qp) = 1.0;
194 fst::integrate<double>(volumes, data_one, weighted_measure, COMP_CPP);
200 for (
int cell_id = 0; cell_id < numCells; cell_id++) {
201 *outStream <<
"Volume of cell " << cell_id <<
" = " << volumes(cell_id) <<
" vs. Analytic value = " << tetvols[cell_id] <<
"\n";
202 if (std::fabs(volumes(cell_id)-tetvols[cell_id]) > INTREPID_TOL) {
210 catch (
const std::logic_error & err) {
211 *outStream <<
"UNEXPECTED ERROR !!! ----------------------------------------------------------\n";
212 *outStream << err.what() <<
'\n';
213 *outStream <<
"-------------------------------------------------------------------------------" <<
"\n\n";
219 std::cout <<
"End Result: TEST FAILED\n";
221 std::cout <<
"End Result: TEST PASSED\n";
224 std::cout.copyfmt(oldFormatState);
Header file for utility class to provide multidimensional containers.
Header file for the abstract base class Intrepid::DefaultCubatureFactory.
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.