50 #include "Teuchos_oblackholestream.hpp"
51 #include "Teuchos_RCP.hpp"
52 #include "Teuchos_GlobalMPISession.hpp"
55 using namespace Intrepid;
57 #define INTREPID_TEST_COMMAND( S , throwCounter, nException ) \
63 catch (const std::logic_error & err) { \
65 *outStream << "Expected Error " << nException << " -------------------------------------------------------------\n"; \
66 *outStream << err.what() << '\n'; \
67 *outStream << "-------------------------------------------------------------------------------" << "\n\n"; \
71 int main(
int argc,
char *argv[]) {
73 Teuchos::GlobalMPISession mpiSession(&argc, &argv);
77 int iprint = argc - 1;
78 Teuchos::RCP<std::ostream> outStream;
79 Teuchos::oblackholestream bhs;
81 outStream = Teuchos::rcp(&std::cout,
false);
83 outStream = Teuchos::rcp(&bhs,
false);
86 Teuchos::oblackholestream oldFormatState;
87 oldFormatState.copyfmt(std::cout);
90 <<
"===============================================================================\n" \
92 <<
"| Unit Test (Basis_HGRAD_HEX_C2_FEM) |\n" \
94 <<
"| 1) Conversion of Dof tags into Dof ordinals and back |\n" \
95 <<
"| 2) Basis values for VALUE, GRAD, and Dk operators |\n" \
97 <<
"| Questions? Contact Pavel Bochev (pbboche@sandia.gov), |\n" \
98 <<
"| Denis Ridzal (dridzal@sandia.gov), |\n" \
99 <<
"| Kara Peterson (kjpeter@sandia.gov). |\n" \
101 <<
"| Intrepid's website: http://trilinos.sandia.gov/packages/intrepid |\n" \
102 <<
"| Trilinos website: http://trilinos.sandia.gov |\n" \
104 <<
"===============================================================================\n"\
105 <<
"| TEST 1: Basis creation, exception testing |\n"\
106 <<
"===============================================================================\n";
114 int throwCounter = 0;
119 hexNodes(0, 0) = -1.0; hexNodes(0, 1) = -1.0; hexNodes(0, 2) = -1.0;
120 hexNodes(1, 0) = 1.0; hexNodes(1, 1) = -1.0; hexNodes(1, 2) = -1.0;
121 hexNodes(2, 0) = 1.0; hexNodes(2, 1) = 1.0; hexNodes(2, 2) = -1.0;
122 hexNodes(3, 0) = -1.0; hexNodes(3, 1) = 1.0; hexNodes(3, 2) = -1.0;
124 hexNodes(4, 0) = -1.0; hexNodes(4, 1) = -1.0; hexNodes(4, 2) = 1.0;
125 hexNodes(5, 0) = 1.0; hexNodes(5, 1) = -1.0; hexNodes(5, 2) = 1.0;
126 hexNodes(6, 0) = 1.0; hexNodes(6, 1) = 1.0; hexNodes(6, 2) = 1.0;
127 hexNodes(7, 0) = -1.0; hexNodes(7, 1) = 1.0; hexNodes(7, 2) = 1.0;
130 hexNodes(8, 0) = 0.0; hexNodes(8, 1) = -1.0; hexNodes(8, 2) = -1.0;
131 hexNodes(9, 0) = 1.0; hexNodes(9, 1) = 0.0; hexNodes(9, 2) = -1.0;
132 hexNodes(10,0) = 0.0; hexNodes(10,1) = 1.0; hexNodes(10,2) = -1.0;
133 hexNodes(11,0) = -1.0; hexNodes(11,1) = 0.0; hexNodes(11,2) = -1.0;
134 hexNodes(12,0) = -1.0; hexNodes(12,1) = -1.0; hexNodes(12,2) = 0.0;
135 hexNodes(13,0) = 1.0; hexNodes(13,1) = -1.0; hexNodes(13,2) = 0.0;
136 hexNodes(14,0) = 1.0; hexNodes(14,1) = 1.0; hexNodes(14,2) = 0.0;
137 hexNodes(15,0) = -1.0; hexNodes(15,1) = 1.0; hexNodes(15,2) = 0.0;
138 hexNodes(16,0) = 0.0; hexNodes(16,1) = -1.0; hexNodes(16,2) = 1.0;
139 hexNodes(17,0) = 1.0; hexNodes(17,1) = 0.0; hexNodes(17,2) = 1.0;
140 hexNodes(18,0) = 0.0; hexNodes(18,1) = 1.0; hexNodes(18,2) = 1.0;
141 hexNodes(19,0) = -1.0; hexNodes(19,1) = 0.0; hexNodes(19,2) = 1.0;
144 hexNodes(20,0) = 0.0; hexNodes(20,1) = 0.0; hexNodes(20,2) = 0.0;
147 hexNodes(21,0) = 0.0; hexNodes(21,1) = 0.0; hexNodes(21,2) = -1.0;
148 hexNodes(22,0) = 0.0; hexNodes(22,1) = 0.0; hexNodes(22,2) = 1.0;
149 hexNodes(23,0) = -1.0; hexNodes(23,1) = 0.0; hexNodes(23,2) = 0.0;
150 hexNodes(24,0) = 1.0; hexNodes(24,1) = 0.0; hexNodes(24,2) = 0.0;
151 hexNodes(25,0) = 0.0; hexNodes(25,1) = -1.0; hexNodes(25,2) = 0.0;
152 hexNodes(26,0) = 0.0; hexNodes(26,1) = 1.0; hexNodes(26,2) = 0.0;
161 INTREPID_TEST_COMMAND( hexBasis.
getValues(vals, hexNodes, OPERATOR_CURL), throwCounter, nException );
166 INTREPID_TEST_COMMAND( hexBasis.
getValues(vals, hexNodes, OPERATOR_DIV), throwCounter, nException );
171 INTREPID_TEST_COMMAND( hexBasis.
getDofOrdinal(3,10,0), throwCounter, nException );
173 INTREPID_TEST_COMMAND( hexBasis.
getDofOrdinal(1,2,1), throwCounter, nException );
175 INTREPID_TEST_COMMAND( hexBasis.
getDofOrdinal(0,4,1), throwCounter, nException );
177 INTREPID_TEST_COMMAND( hexBasis.
getDofTag(28), throwCounter, nException );
179 INTREPID_TEST_COMMAND( hexBasis.
getDofTag(-1), throwCounter, nException );
181 #ifdef HAVE_INTREPID_DEBUG
185 INTREPID_TEST_COMMAND( hexBasis.
getValues(vals, badPoints1, OPERATOR_VALUE), throwCounter, nException );
189 INTREPID_TEST_COMMAND( hexBasis.
getValues(vals, badPoints2, OPERATOR_VALUE), throwCounter, nException );
193 INTREPID_TEST_COMMAND( hexBasis.
getValues(badVals1, hexNodes, OPERATOR_VALUE), throwCounter, nException );
197 INTREPID_TEST_COMMAND( hexBasis.
getValues(badVals2, hexNodes, OPERATOR_GRAD), throwCounter, nException );
200 INTREPID_TEST_COMMAND( hexBasis.
getValues(badVals2, hexNodes, OPERATOR_D1), throwCounter, nException );
203 INTREPID_TEST_COMMAND( hexBasis.
getValues(badVals2, hexNodes, OPERATOR_D2), throwCounter, nException );
207 INTREPID_TEST_COMMAND( hexBasis.
getValues(badVals3, hexNodes, OPERATOR_VALUE), throwCounter, nException );
211 INTREPID_TEST_COMMAND( hexBasis.
getValues(badVals4, hexNodes, OPERATOR_VALUE), throwCounter, nException );
215 INTREPID_TEST_COMMAND( hexBasis.
getValues(badVals5, hexNodes, OPERATOR_GRAD), throwCounter, nException );
219 INTREPID_TEST_COMMAND( hexBasis.
getValues(badVals6, hexNodes, OPERATOR_D2), throwCounter, nException );
223 INTREPID_TEST_COMMAND( hexBasis.
getValues(badVals7, hexNodes, OPERATOR_D3), throwCounter, nException );
227 catch (
const std::logic_error & err) {
228 *outStream <<
"UNEXPECTED ERROR !!! ----------------------------------------------------------\n";
229 *outStream << err.what() <<
'\n';
230 *outStream <<
"-------------------------------------------------------------------------------" <<
"\n\n";
236 if (throwCounter != nException) {
238 *outStream << std::setw(70) <<
"^^^^----FAILURE!" <<
"\n";
243 <<
"===============================================================================\n"\
244 <<
"| TEST 2: correctness of tag to enum and enum to tag lookups |\n"\
245 <<
"===============================================================================\n";
248 std::vector<std::vector<int> > allTags = hexBasis.
getAllDofTags();
251 for (
unsigned i = 0; i < allTags.size(); i++) {
252 int bfOrd = hexBasis.
getDofOrdinal(allTags[i][0], allTags[i][1], allTags[i][2]);
254 std::vector<int> myTag = hexBasis.
getDofTag(bfOrd);
255 if( !( (myTag[0] == allTags[i][0]) &&
256 (myTag[1] == allTags[i][1]) &&
257 (myTag[2] == allTags[i][2]) &&
258 (myTag[3] == allTags[i][3]) ) ) {
260 *outStream << std::setw(70) <<
"^^^^----FAILURE!" <<
"\n";
261 *outStream <<
" getDofOrdinal( {"
262 << allTags[i][0] <<
", "
263 << allTags[i][1] <<
", "
264 << allTags[i][2] <<
", "
265 << allTags[i][3] <<
"}) = " << bfOrd <<
" but \n";
266 *outStream <<
" getDofTag(" << bfOrd <<
") = { "
270 << myTag[3] <<
"}\n";
276 std::vector<int> myTag = hexBasis.
getDofTag(bfOrd);
277 int myBfOrd = hexBasis.
getDofOrdinal(myTag[0], myTag[1], myTag[2]);
278 if( bfOrd != myBfOrd) {
280 *outStream << std::setw(70) <<
"^^^^----FAILURE!" <<
"\n";
281 *outStream <<
" getDofTag(" << bfOrd <<
") = { "
285 << myTag[3] <<
"} but getDofOrdinal({"
289 << myTag[3] <<
"} ) = " << myBfOrd <<
"\n";
293 catch (
const std::logic_error & err){
294 *outStream << err.what() <<
"\n\n";
301 <<
"===============================================================================\n"\
302 <<
"| TEST 3: correctness of basis function values |\n"\
303 <<
"===============================================================================\n";
305 outStream -> precision(20);
308 double basisValues[] = {
309 1.000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
310 0, 0, 0, 0, 0, 0, 1.000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
311 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.000, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
312 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.000, 0, 0, 0, \
313 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
314 0, 1.000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
315 0, 0, 0, 0, 0, 0, 0, 1.000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
316 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.000, 0, 0, 0, 0, 0, 0, 0, 0, \
317 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.000, 0, 0, \
318 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
319 0, 0, 1.000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
320 0, 0, 0, 0, 0, 0, 0, 0, 1.000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
321 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.000, 0, 0, 0, 0, 0, 0, 0, \
322 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.000, 0, \
323 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
324 0, 0, 0, 1.000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
325 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
326 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.000, 0, 0, 0, 0, 0, 0, \
327 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.000, \
328 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
329 0, 0, 0, 0, 1.000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
330 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
331 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.000, 0, 0, 0, 0, 0, \
332 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
333 1.000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
334 0, 0, 0, 0, 0, 0, 1.000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
335 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.000, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
336 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.000, 0, 0, 0, \
337 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
338 0, 1.000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
339 0, 0, 0, 0, 0, 0, 0, 1.000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
340 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.000, 0, 0, 0, 0, 0, 0, 0, 0, \
341 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.000 };
345 std::string fileName;
346 std::ifstream dataFile;
349 std::vector<double> basisGrads;
351 fileName =
"./testdata/HEX_C2_GradVals.dat";
352 dataFile.open(fileName.c_str());
353 TEUCHOS_TEST_FOR_EXCEPTION( !dataFile.good(), std::logic_error,
354 ">>> ERROR (HGRAD_HEX_C2/test01): could not open GRAD values data file, test aborted.");
355 while (!dataFile.eof() ){
358 std::getline(dataFile, line);
359 stringstream data_line(line);
360 while(data_line >> temp){
361 basisGrads.push_back(temp);
372 std::vector<double> basisD2;
373 fileName =
"./testdata/HEX_C2_D2Vals.dat";
374 dataFile.open(fileName.c_str());
375 TEUCHOS_TEST_FOR_EXCEPTION( !dataFile.good(), std::logic_error,
376 ">>> ERROR (HGRAD_HEX_C2/test01): could not open D2 values data file, test aborted.");
377 while (!dataFile.eof() ){
380 std::getline(dataFile, line);
381 stringstream data_line(line);
382 while(data_line >> temp){
383 basisD2.push_back(temp);
391 std::vector<double> basisD3;
393 fileName =
"./testdata/HEX_C2_D3Vals.dat";
394 dataFile.open(fileName.c_str());
395 TEUCHOS_TEST_FOR_EXCEPTION( !dataFile.good(), std::logic_error,
396 ">>> ERROR (HGRAD_HEX_C2/test01): could not open D3 values data file, test aborted.");
398 while (!dataFile.eof() ){
401 std::getline(dataFile, line);
402 stringstream data_line(line);
403 while(data_line >> temp){
404 basisD3.push_back(temp);
412 std::vector<double> basisD4;
414 fileName =
"./testdata/HEX_C2_D4Vals.dat";
415 dataFile.open(fileName.c_str());
416 TEUCHOS_TEST_FOR_EXCEPTION( !dataFile.good(), std::logic_error,
417 ">>> ERROR (HGRAD_HEX_C2/test01): could not open D4 values data file, test aborted.");
419 while (!dataFile.eof() ){
422 std::getline(dataFile, line);
423 stringstream data_line(line);
424 while(data_line >> temp){
425 basisD4.push_back(temp);
436 int numPoints = hexNodes.dimension(0);
443 vals.
resize(numFields, numPoints);
444 hexBasis.
getValues(vals, hexNodes, OPERATOR_VALUE);
445 for (
int i = 0; i < numFields; i++) {
446 for (
int j = 0; j < numPoints; j++) {
447 int l = i + j * numFields;
448 if (std::abs(vals(i,j) - basisValues[l]) > INTREPID_TOL) {
450 *outStream << std::setw(70) <<
"^^^^----FAILURE!" <<
"\n";
453 *outStream <<
" At multi-index { ";
454 *outStream << i <<
" ";*outStream << j <<
" ";
455 *outStream <<
"} computed value: " << vals(i,j)
456 <<
" but reference value: " << basisValues[l] <<
"\n";
463 vals.
resize(numFields, numPoints, spaceDim);
464 hexBasis.
getValues(vals, hexNodes, OPERATOR_GRAD);
465 for (
int i = 0; i < numFields; i++) {
466 for (
int j = 0; j < numPoints; j++) {
467 for (
int k = 0; k < spaceDim; k++) {
470 int l = k + j * spaceDim + i * spaceDim * numPoints;
471 if (std::abs(vals(i,j,k) - basisGrads[l]) > INTREPID_TOL) {
473 *outStream << std::setw(70) <<
"^^^^----FAILURE!" <<
"\n";
476 *outStream <<
" At multi-index { ";
477 *outStream << i <<
" ";*outStream << j <<
" ";*outStream << k <<
" ";
478 *outStream <<
"} computed grad component: " << vals(i,j,k)
479 <<
" but reference grad component: " << basisGrads[l] <<
"\n";
486 hexBasis.
getValues(vals, hexNodes, OPERATOR_D1);
487 for (
int i = 0; i < numFields; i++) {
488 for (
int j = 0; j < numPoints; j++) {
489 for (
int k = 0; k < spaceDim; k++) {
492 int l = k + j * spaceDim + i * spaceDim * numPoints;
493 if (std::abs(vals(i,j,k) - basisGrads[l]) > INTREPID_TOL) {
495 *outStream << std::setw(70) <<
"^^^^----FAILURE!" <<
"\n";
498 *outStream <<
" At multi-index { ";
499 *outStream << i <<
" ";*outStream << j <<
" ";*outStream << k <<
" ";
500 *outStream <<
"} computed D1 component: " << vals(i,j,k)
501 <<
" but reference D1 component: " << basisGrads[l] <<
"\n";
509 int D2cardinality = Intrepid::getDkCardinality(OPERATOR_D2, spaceDim);
510 vals.
resize(numFields, numPoints, D2cardinality);
511 hexBasis.
getValues(vals, hexNodes, OPERATOR_D2);
512 for (
int i = 0; i < numFields; i++) {
513 for (
int j = 0; j < numPoints; j++) {
514 for (
int k = 0; k < D2cardinality; k++) {
517 int l = k + j * D2cardinality + i * D2cardinality * numPoints;
518 if (std::abs(vals(i,j,k) - basisD2[l]) > INTREPID_TOL) {
520 *outStream << std::setw(70) <<
"^^^^----FAILURE!" <<
"\n";
523 *outStream <<
" At multi-index { ";
524 *outStream << i <<
" ";*outStream << j <<
" ";*outStream << k <<
" ";
525 *outStream <<
"} computed D2 component: " << vals(i,j,k)
526 <<
" but reference D2 component: " << basisD2[l] <<
"\n";
534 int D3cardinality = Intrepid::getDkCardinality(OPERATOR_D3, spaceDim);
535 vals.
resize(numFields, numPoints, D3cardinality);
536 hexBasis.
getValues(vals, hexNodes, OPERATOR_D3);
538 for (
int i = 0; i < numFields; i++) {
539 for (
int j = 0; j < numPoints; j++) {
540 for (
int k = 0; k < D3cardinality; k++) {
543 int l = k + j * D3cardinality + i * D3cardinality * numPoints;
544 if (std::abs(vals(i,j,k) - basisD3[l]) > INTREPID_TOL) {
546 *outStream << std::setw(70) <<
"^^^^----FAILURE!" <<
"\n";
549 *outStream <<
" At multi-index { ";
550 *outStream << i <<
" ";*outStream << j <<
" ";*outStream << k <<
" ";
551 *outStream <<
"} computed D3 component: " << vals(i,j,k)
552 <<
" but reference D3 component: " << basisD3[l] <<
"\n";
560 int D4cardinality = Intrepid::getDkCardinality(OPERATOR_D4, spaceDim);
561 vals.
resize(numFields, numPoints, D4cardinality);
562 hexBasis.
getValues(vals, hexNodes, OPERATOR_D4);
563 for (
int i = 0; i < numFields; i++) {
564 for (
int j = 0; j < numPoints; j++) {
565 for (
int k = 0; k < D4cardinality; k++) {
568 int l = k + j * D4cardinality + i * D4cardinality * numPoints;
569 if (std::abs(vals(i,j,k) - basisD4[l]) > INTREPID_TOL) {
571 *outStream << std::setw(70) <<
"^^^^----FAILURE!" <<
"\n";
574 *outStream <<
" At multi-index { ";
575 *outStream << i <<
" ";*outStream << j <<
" ";*outStream << k <<
" ";
576 *outStream <<
"} computed D4 component: " << vals(i,j,k)
577 <<
" but reference D4 component: " << basisD2[l] <<
"\n";
586 for(EOperator op = OPERATOR_D7; op < OPERATOR_MAX; op++) {
589 int DkCardin = Intrepid::getDkCardinality(op, spaceDim);
590 vals.
resize(numFields, numPoints, DkCardin);
593 for (
int i = 0; i < vals.
size(); i++) {
594 if (std::abs(vals[i]) > INTREPID_TOL) {
596 *outStream << std::setw(70) <<
"^^^^----FAILURE!" <<
"\n";
599 std::vector<int> myIndex;
601 int ord = Intrepid::getOperatorOrder(op);
602 *outStream <<
" At multi-index { ";
603 for(
int j = 0; j < vals.
rank(); j++) {
604 *outStream << myIndex[j] <<
" ";
606 *outStream <<
"} computed D"<< ord <<
" component: " << vals[i]
607 <<
" but reference D" << ord <<
" component: 0 \n";
614 catch (
const std::logic_error & err) {
615 *outStream << err.what() <<
"\n\n";
621 <<
"===============================================================================\n"\
622 <<
"| TEST 4: correctness of DoF locations |\n"\
623 <<
"===============================================================================\n";
626 Teuchos::RCP<Basis<double, FieldContainer<double> > > basis =
628 Teuchos::RCP<DofCoordsInterface<FieldContainer<double> > > coord_iface =
635 #ifdef HAVE_INTREPID_DEBUG
637 INTREPID_TEST_COMMAND( coord_iface->getDofCoords(cvals), throwCounter, nException );
639 INTREPID_TEST_COMMAND( coord_iface->getDofCoords(cvals), throwCounter, nException );
641 INTREPID_TEST_COMMAND( coord_iface->getDofCoords(cvals), throwCounter, nException );
644 INTREPID_TEST_COMMAND( coord_iface->getDofCoords(cvals), throwCounter, nException ); nException--;
646 if (throwCounter != nException) {
648 *outStream << std::setw(70) <<
"^^^^----FAILURE!" <<
"\n";
652 basis->getValues(bvals, cvals, OPERATOR_VALUE);
654 for (
int i=0; i<bvals.dimension(0); i++) {
655 for (
int j=0; j<bvals.dimension(1); j++) {
656 if ((i != j) && (std::abs(bvals(i,j) - 0.0) > INTREPID_TOL)) {
658 sprintf(buffer,
"\nValue of basis function %d at (%6.4e, %6.4e, %6.4e) is %6.4e but should be %6.4e!\n", i, cvals(i,0), cvals(i,1), cvals(i,2), bvals(i,j), 0.0);
659 *outStream << buffer;
661 else if ((i == j) && (std::abs(bvals(i,j) - 1.0) > INTREPID_TOL)) {
663 sprintf(buffer,
"\nValue of basis function %d at (%6.4e, %6.4e, %6.4e) is %6.4e but should be %6.4e!\n", i, cvals(i,0), cvals(i,1), cvals(i,2), bvals(i,j), 1.0);
664 *outStream << buffer;
670 catch (
const std::logic_error & err){
671 *outStream << err.what() <<
"\n\n";
676 std::cout <<
"End Result: TEST FAILED\n";
678 std::cout <<
"End Result: TEST PASSED\n";
681 std::cout.copyfmt(oldFormatState);
int size() const
Returns size of the FieldContainer defined as the product of its dimensions.
void getValues(ArrayScalar &outputValues, const ArrayScalar &inputPoints, const EOperator operatorType) const
Evaluation of a FEM basis on a reference Hexahedron cell.
virtual const std::vector< int > & getDofTag(const int dofOrd)
DoF ordinal to DoF tag lookup.
virtual int getCardinality() const
Returns cardinality of the basis.
This is an interface class for bases whose degrees of freedom can be associated with spatial location...
Implementation of the default H(grad)-compatible FEM basis of degree 2 on Hexahedron cell...
virtual const std::vector< std::vector< int > > & getAllDofTags()
Retrieves all DoF tags.
Header file for utility class to provide multidimensional containers.
void getMultiIndex(int &i0, const int valueEnum) const
Returns the multi-index of a value, based on its enumeration, as a list, for rank-1 containers...
int rank() const
Return rank of the FieldContainer = number of indices used to tag the multi-indexed value...
void resize(const int dim0)
Resizes FieldContainer to a rank-1 container with the specified dimension, initialized by 0...
Header file for the Intrepid::HGRAD_HEX_C2_FEM class.
virtual int getDofOrdinal(const int subcDim, const int subcOrd, const int subcDofOrd)
DoF tag to ordinal lookup.
virtual const shards::CellTopology getBaseCellTopology() const
Returns the base cell topology for which the basis is defined. See Shards documentation http://trilin...