53 #include "Teuchos_oblackholestream.hpp"
54 #include "Teuchos_RCP.hpp"
55 #include "Teuchos_GlobalMPISession.hpp"
57 using namespace Intrepid;
62 long double evalQuad(
int order,
int power, EIntrepidBurkardt rule) {
66 lineCub.update(-1.0,lineCub2,1.0);
67 int size = lineCub.getNumPoints();
70 lineCub.getCubature(cubPoints,cubWeights);
73 for (
int i=0; i<size; i++) {
74 Q += cubWeights(i)*powl(cubPoints(i),(
long double)power);
92 int main(
int argc,
char *argv[]) {
94 Teuchos::GlobalMPISession mpiSession(&argc, &argv);
98 int iprint = argc - 1;
99 Teuchos::RCP<std::ostream> outStream;
100 Teuchos::oblackholestream bhs;
102 outStream = Teuchos::rcp(&std::cout,
false);
104 outStream = Teuchos::rcp(&bhs,
false);
107 Teuchos::oblackholestream oldFormatState;
108 oldFormatState.copyfmt(std::cout);
111 <<
"===============================================================================\n" \
113 <<
"| Unit Test (CubatureLineSorted) |\n" \
115 <<
"| 1) Computing differential integrals of monomials in 1D |\n" \
117 <<
"| Questions? Contact Drew Kouri (dpkouri@sandia.gov) or |\n" \
118 <<
"| Denis Ridzal (dridzal@sandia.gov). |\n" \
120 <<
"| Intrepid's website: http://trilinos.sandia.gov/packages/intrepid |\n" \
121 <<
"| Trilinos website: http://trilinos.sandia.gov |\n" \
123 <<
"===============================================================================\n"\
124 <<
"| TEST 15: differential integrals of monomials in 1D |\n"\
125 <<
"===============================================================================\n";
129 long double abstol = 1.0e+05*INTREPID_TOL;
131 long double analyticInt = 0;
132 long double testInt = 0;
134 EIntrepidBurkardt rule = BURK_LEGENDRE;
136 *outStream <<
"\nDifferential integrals of monomials on a reference line:\n";
139 *outStream <<
"Testing " << EIntrepidBurkardtToString(rule) <<
"\n";
141 for (
int i=2; i <= maxOrder; i++) {
143 for (
int j=0; j <= maxDeg; j++) {
144 testInt = evalQuad(i,j,rule);
145 long double absdiff = std::fabs(testInt);
146 *outStream <<
"Cubature order " << std::setw(2) << std::left << i
148 <<
"x^" << std::setw(2) << std::left << j <<
":" <<
" "
149 << std::scientific << std::setprecision(16) << testInt
150 <<
" " << analyticInt
151 <<
" " << std::setprecision(4) << absdiff <<
" "
152 <<
"<?" <<
" " << abstol
154 if (absdiff > abstol) {
156 *outStream << std::right << std::setw(104) <<
"^^^^---FAILURE!\n";
162 catch (
const std::logic_error & err) {
163 *outStream << err.what() <<
"\n";
169 std::cout <<
"End Result: TEST FAILED\n";
171 std::cout <<
"End Result: TEST PASSED\n";
174 std::cout.copyfmt(oldFormatState);
Utilizes cubature (integration) rules contained in the library sandia_rules (John Burkardt...
Header file for the Intrepid::CubatureLineSorted class.
Implementation of a templated lexicographical container for a multi-indexed scalar quantity...