|
Intrepid
|
00001 // @HEADER 00002 // ************************************************************************ 00003 // 00004 // Intrepid Package 00005 // Copyright (2007) Sandia Corporation 00006 // 00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00008 // license for use of this work by or on behalf of the U.S. Government. 00009 // 00010 // Redistribution and use in source and binary forms, with or without 00011 // modification, are permitted provided that the following conditions are 00012 // met: 00013 // 00014 // 1. Redistributions of source code must retain the above copyright 00015 // notice, this list of conditions and the following disclaimer. 00016 // 00017 // 2. Redistributions in binary form must reproduce the above copyright 00018 // notice, this list of conditions and the following disclaimer in the 00019 // documentation and/or other materials provided with the distribution. 00020 // 00021 // 3. Neither the name of the Corporation nor the names of the 00022 // contributors may be used to endorse or promote products derived from 00023 // this software without specific prior written permission. 00024 // 00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY 00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE 00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00036 // 00037 // Questions? Contact Pavel Bochev (pbboche@sandia.gov) 00038 // Denis Ridzal (dridzal@sandia.gov), or 00039 // Kara Peterson (kjpeter@sandia.gov) 00040 // 00041 // ************************************************************************ 00042 // @HEADER 00043 00048 #include "Intrepid_FieldContainer.hpp" 00049 #include "Intrepid_HGRAD_PYR_I2_FEM.hpp" 00050 #include "Teuchos_oblackholestream.hpp" 00051 #include "Teuchos_RCP.hpp" 00052 #include "Teuchos_GlobalMPISession.hpp" 00053 00054 using namespace std; 00055 using namespace Intrepid; 00056 00057 #define INTREPID_TEST_COMMAND( S , throwCounter, nException ) \ 00058 { \ 00059 ++nException; \ 00060 try { \ 00061 S ; \ 00062 } \ 00063 catch (std::logic_error err) { \ 00064 ++throwCounter; \ 00065 *outStream << "Expected Error " << nException << " -------------------------------------------------------------\n"; \ 00066 *outStream << err.what() << '\n'; \ 00067 *outStream << "-------------------------------------------------------------------------------" << "\n\n"; \ 00068 }; \ 00069 } 00070 00071 int main(int argc, char *argv[]) { 00072 00073 Teuchos::GlobalMPISession mpiSession(&argc, &argv); 00074 00075 // This little trick lets us print to std::cout only if 00076 // a (dummy) command-line argument is provided. 00077 int iprint = argc - 1; 00078 Teuchos::RCP<std::ostream> outStream; 00079 Teuchos::oblackholestream bhs; // outputs nothing 00080 if (iprint > 0) 00081 outStream = Teuchos::rcp(&std::cout, false); 00082 else 00083 outStream = Teuchos::rcp(&bhs, false); 00084 00085 // Save the format state of the original std::cout. 00086 Teuchos::oblackholestream oldFormatState; 00087 oldFormatState.copyfmt(std::cout); 00088 00089 *outStream \ 00090 << "===============================================================================\n" \ 00091 << "| |\n" \ 00092 << "| Unit Test (Basis_HGRAD_PYR_I2_FEM) |\n" \ 00093 << "| |\n" \ 00094 << "| 1) Conversion of Dof tags into Dof ordinals and back |\n" \ 00095 << "| 2) Basis values for VALUE, GRAD, CURL, and Dk operators |\n" \ 00096 << "| |\n" \ 00097 << "| Questions? Contact Pavel Bochev (pbboche@sandia.gov), |\n" \ 00098 << "| Denis Ridzal (dridzal@sandia.gov), |\n" \ 00099 << "| Kara Peterson (kjpeter@sandia.gov). |\n" \ 00100 << "| |\n" \ 00101 << "| Intrepid's website: http://trilinos.sandia.gov/packages/intrepid |\n" \ 00102 << "| Trilinos website: http://trilinos.sandia.gov |\n" \ 00103 << "| |\n" \ 00104 << "===============================================================================\n"\ 00105 << "| TEST 1: Basis creation, exception testing |\n"\ 00106 << "===============================================================================\n"; 00107 00108 // Define basis and error flag 00109 Basis_HGRAD_PYR_I2_FEM<double, FieldContainer<double> > pyrBasis; 00110 int errorFlag = 0; 00111 00112 // Initialize throw counter for exception testing 00113 int nException = 0; 00114 int throwCounter = 0; 00115 00116 // Define array containing the 13 nodes of the reference PYRAMID and some other points. 00117 FieldContainer<double> pyrNodes(18, 3); 00118 pyrNodes(0,0) = -1.0; pyrNodes(0,1) = -1.0; pyrNodes(0,2) = 0; 00119 pyrNodes(1,0) = 1.0; pyrNodes(1,1) = -1.0; pyrNodes(1,2) = 0; 00120 pyrNodes(2,0) = 1.0; pyrNodes(2,1) = 1.0; pyrNodes(2,2) = 0; 00121 pyrNodes(3,0) = -1.0; pyrNodes(3,1) = 1.0; pyrNodes(3,2) = 0; 00122 pyrNodes(4,0) = 0.0; pyrNodes(4,1) = 0.0; pyrNodes(4,2) = 1.0; 00123 pyrNodes(5,0) = 0.0; pyrNodes(5,1) = -1.0; pyrNodes(5,2) = 0.0; 00124 pyrNodes(6,0) = 1.0; pyrNodes(6,1) = 0.0; pyrNodes(6,2) = 0.0; 00125 pyrNodes(7,0) = 0.0; pyrNodes(7,1) = 1.0; pyrNodes(7,2) = 0.0; 00126 pyrNodes(8,0) = -1.0; pyrNodes(8,1) = 0.0; pyrNodes(8,2) = 0.0; 00127 pyrNodes(9,0) = -0.5; pyrNodes(9,1) = -0.5; pyrNodes(9,2) = 0.5; 00128 pyrNodes(10,0) = 0.5; pyrNodes(10,1) = -0.5; pyrNodes(10,2) = 0.5; 00129 pyrNodes(11,0) = 0.5; pyrNodes(11,1) = 0.5; pyrNodes(11,2) = 0.5; 00130 pyrNodes(12,0) = -0.5; pyrNodes(12,1) = 0.5; pyrNodes(12,2) = 0.5; 00131 00132 pyrNodes(13,0) = 0.25; pyrNodes(13,1) = 0.5; pyrNodes(13,2) = 0.2; 00133 pyrNodes(14,0) = -0.7 ; pyrNodes(14,1) = 0.3; pyrNodes(14,2) = 0.3; 00134 pyrNodes(15,0) = 0.; pyrNodes(15,1) = -0.05; pyrNodes(15,2) = 0.95; 00135 pyrNodes(16,0) = -0.15; pyrNodes(16,1) = -0.2; pyrNodes(16,2) = 0.75; 00136 pyrNodes(17,0) = -0.4; pyrNodes(17,1) = 0.9; pyrNodes(17,2) = 0.0; 00137 00138 00139 // Generic array for the output values; needs to be properly resized depending on the operator type 00140 FieldContainer<double> vals; 00141 00142 try{ 00143 // exception #1: CURL cannot be applied to scalar functions 00144 // resize vals to rank-3 container with dimensions (num. points, num. basis functions) 00145 vals.resize(pyrBasis.getCardinality(), pyrNodes.dimension(0), 3 ); 00146 INTREPID_TEST_COMMAND( pyrBasis.getValues(vals, pyrNodes, OPERATOR_CURL), throwCounter, nException ); 00147 00148 // exception #2: DIV cannot be applied to scalar functions 00149 // resize vals to rank-2 container with dimensions (num. points, num. basis functions) 00150 vals.resize(pyrBasis.getCardinality(), pyrNodes.dimension(0) ); 00151 INTREPID_TEST_COMMAND( pyrBasis.getValues(vals, pyrNodes, OPERATOR_DIV), throwCounter, nException ); 00152 00153 // Exceptions 3-7: all bf tags/bf Ids below are wrong and should cause getDofOrdinal() and 00154 // getDofTag() to access invalid array elements thereby causing bounds check exception 00155 // exception #3 00156 INTREPID_TEST_COMMAND( pyrBasis.getDofOrdinal(3,0,0), throwCounter, nException ); 00157 // exception #4 00158 INTREPID_TEST_COMMAND( pyrBasis.getDofOrdinal(1,1,1), throwCounter, nException ); 00159 // exception #5 00160 INTREPID_TEST_COMMAND( pyrBasis.getDofOrdinal(0,6,0), throwCounter, nException ); 00161 // exception #6 00162 INTREPID_TEST_COMMAND( pyrBasis.getDofTag(14), throwCounter, nException ); 00163 // exception #7 00164 INTREPID_TEST_COMMAND( pyrBasis.getDofTag(-1), throwCounter, nException ); 00165 00166 #ifdef HAVE_INTREPID_DEBUG 00167 // Exceptions 8-18 test exception handling with incorrectly dimensioned input/output arrays 00168 // exception #8: input points array must be of rank-2 00169 FieldContainer<double> badPoints1(4, 5, 3); 00170 INTREPID_TEST_COMMAND( pyrBasis.getValues(vals, badPoints1, OPERATOR_VALUE), throwCounter, nException ); 00171 00172 // exception #9 dimension 1 in the input point array must equal space dimension of the cell 00173 FieldContainer<double> badPoints2(4, 2); 00174 INTREPID_TEST_COMMAND( pyrBasis.getValues(vals, badPoints2, OPERATOR_VALUE), throwCounter, nException ); 00175 00176 // exception #10 output values must be of rank-2 for OPERATOR_VALUE 00177 FieldContainer<double> badVals1(4, 3, 1); 00178 INTREPID_TEST_COMMAND( pyrBasis.getValues(badVals1, pyrNodes, OPERATOR_VALUE), throwCounter, nException ); 00179 00180 // exception #11 output values must be of rank-3 for OPERATOR_GRAD 00181 FieldContainer<double> badVals2(4, 3); 00182 INTREPID_TEST_COMMAND( pyrBasis.getValues(badVals2, pyrNodes, OPERATOR_GRAD), throwCounter, nException ); 00183 00184 // exception #12 output values must be of rank-3 for OPERATOR_D1 00185 INTREPID_TEST_COMMAND( pyrBasis.getValues(badVals2, pyrNodes, OPERATOR_D1), throwCounter, nException ); 00186 00187 // exception #13 output values must be of rank-3 for OPERATOR_D2 00188 //INTREPID_TEST_COMMAND( pyrBasis.getValues(badVals2, pyrNodes, OPERATOR_D2), throwCounter, nException ); 00189 00190 // exception #14 incorrect 0th dimension of output array (must equal number of basis functions) 00191 FieldContainer<double> badVals3(pyrBasis.getCardinality() + 1, pyrNodes.dimension(0)); 00192 INTREPID_TEST_COMMAND( pyrBasis.getValues(badVals3, pyrNodes, OPERATOR_VALUE), throwCounter, nException ); 00193 00194 // exception #15 incorrect 1st dimension of output array (must equal number of points) 00195 FieldContainer<double> badVals4(pyrBasis.getCardinality(), pyrNodes.dimension(0) + 1); 00196 INTREPID_TEST_COMMAND( pyrBasis.getValues(badVals4, pyrNodes, OPERATOR_VALUE), throwCounter, nException ); 00197 00198 // exception #16: incorrect 2nd dimension of output array (must equal the space dimension) 00199 FieldContainer<double> badVals5(pyrBasis.getCardinality(), pyrNodes.dimension(0), 4); 00200 INTREPID_TEST_COMMAND( pyrBasis.getValues(badVals5, pyrNodes, OPERATOR_GRAD), throwCounter, nException ); 00201 00202 // exception #17: incorrect 2nd dimension of output array (must equal D2 cardinality in 3D) 00203 //FieldContainer<double> badVals6(pyrBasis.getCardinality(), pyrNodes.dimension(0), 40); 00204 //INTREPID_TEST_COMMAND( pyrBasis.getValues(badVals6, pyrNodes, OPERATOR_D2), throwCounter, nException ); 00205 00206 // exception #18: incorrect 2nd dimension of output array (must equal D3 cardinality in 3D) 00207 //INTREPID_TEST_COMMAND( pyrBasis.getValues(badVals6, pyrNodes, OPERATOR_D3), throwCounter, nException ); 00208 #endif 00209 00210 } 00211 catch (std::logic_error err) { 00212 *outStream << "UNEXPECTED ERROR !!! ----------------------------------------------------------\n"; 00213 *outStream << err.what() << '\n'; 00214 *outStream << "-------------------------------------------------------------------------------" << "\n\n"; 00215 errorFlag = -1000; 00216 }; 00217 00218 // Check if number of thrown exceptions matches the one we expect - 18 00219 if (throwCounter != nException) { 00220 errorFlag++; 00221 *outStream << std::setw(70) << "^^^^----FAILURE!" << "\n"; 00222 } 00223 00224 *outStream \ 00225 << "\n" 00226 << "===============================================================================\n"\ 00227 << "| TEST 2: correctness of tag to enum and enum to tag lookups |\n"\ 00228 << "===============================================================================\n"; 00229 00230 try{ 00231 std::vector<std::vector<int> > allTags = pyrBasis.getAllDofTags(); 00232 00233 // Loop over all tags, lookup the associated dof enumeration and then lookup the tag again 00234 for (unsigned i = 0; i < allTags.size(); i++) { 00235 int bfOrd = pyrBasis.getDofOrdinal(allTags[i][0], allTags[i][1], allTags[i][2]); 00236 00237 std::vector<int> myTag = pyrBasis.getDofTag(bfOrd); 00238 if( !( (myTag[0] == allTags[i][0]) && 00239 (myTag[1] == allTags[i][1]) && 00240 (myTag[2] == allTags[i][2]) && 00241 (myTag[3] == allTags[i][3]) ) ) { 00242 errorFlag++; 00243 *outStream << std::setw(70) << "^^^^----FAILURE!" << "\n"; 00244 *outStream << " getDofOrdinal( {" 00245 << allTags[i][0] << ", " 00246 << allTags[i][1] << ", " 00247 << allTags[i][2] << ", " 00248 << allTags[i][3] << "}) = " << bfOrd <<" but \n"; 00249 *outStream << " getDofTag(" << bfOrd << ") = { " 00250 << myTag[0] << ", " 00251 << myTag[1] << ", " 00252 << myTag[2] << ", " 00253 << myTag[3] << "}\n"; 00254 } 00255 } 00256 00257 // Now do the same but loop over basis functions 00258 for( int bfOrd = 0; bfOrd < pyrBasis.getCardinality(); bfOrd++) { 00259 std::vector<int> myTag = pyrBasis.getDofTag(bfOrd); 00260 int myBfOrd = pyrBasis.getDofOrdinal(myTag[0], myTag[1], myTag[2]); 00261 if( bfOrd != myBfOrd) { 00262 errorFlag++; 00263 *outStream << std::setw(70) << "^^^^----FAILURE!" << "\n"; 00264 *outStream << " getDofTag(" << bfOrd << ") = { " 00265 << myTag[0] << ", " 00266 << myTag[1] << ", " 00267 << myTag[2] << ", " 00268 << myTag[3] << "} but getDofOrdinal({" 00269 << myTag[0] << ", " 00270 << myTag[1] << ", " 00271 << myTag[2] << ", " 00272 << myTag[3] << "} ) = " << myBfOrd << "\n"; 00273 } 00274 } 00275 } 00276 catch (std::logic_error err){ 00277 *outStream << err.what() << "\n\n"; 00278 errorFlag = -1000; 00279 }; 00280 00281 *outStream \ 00282 << "\n" 00283 << "===============================================================================\n"\ 00284 << "| TEST 3: correctness of basis function values |\n"\ 00285 << "===============================================================================\n"; 00286 00287 outStream -> precision(20); 00288 00289 // VAL, GRAD, D2 test values are stored in files due to their large size 00290 std::string fileName; 00291 std::ifstream dataFile; 00292 00293 // Values are stored in (F,P) format in a data file. Read file and do the test 00294 std::vector<double> basisValues; // Flat array for the basis values. 00295 fileName = "./testdata/PYR_I2_Vals.dat"; 00296 dataFile.open(fileName.c_str()); 00297 TEUCHOS_TEST_FOR_EXCEPTION( !dataFile.good(), std::logic_error, 00298 ">>> ERROR (HGRAD_PYR_I2/test01): could not open basis values data file, test aborted."); 00299 while (!dataFile.eof() ){ 00300 double temp; 00301 string line; // string for one line of input file 00302 std::getline(dataFile, line); // get next line from file 00303 stringstream data_line(line); // convert to stringstream 00304 while(data_line >> temp){ // extract value from line 00305 basisValues.push_back(temp); // push into vector 00306 } 00307 } 00308 // It turns out that just closing and then opening the ifstream variable does not reset it 00309 // and subsequent open() command fails. One fix is to explicitely clear the ifstream, or 00310 // scope the variables. 00311 dataFile.close(); 00312 dataFile.clear(); 00313 00314 00315 // GRAD and D1 values are stored in (F,P,D) format in a data file. Read file and do the test 00316 std::vector<double> basisGrads; // Flat array for the gradient values. 00317 fileName = "./testdata/PYR_I2_GradVals.dat"; 00318 dataFile.open(fileName.c_str()); 00319 TEUCHOS_TEST_FOR_EXCEPTION( !dataFile.good(), std::logic_error, 00320 ">>> ERROR (HGRAD_PYR_I2/test01): could not open GRAD values data file, test aborted."); 00321 while (!dataFile.eof() ){ 00322 double temp; 00323 string line; // string for one line of input file 00324 std::getline(dataFile, line); // get next line from file 00325 stringstream data_line(line); // convert to stringstream 00326 while(data_line >> temp){ // extract value from line 00327 basisGrads.push_back(temp); // push into vector 00328 } 00329 } 00330 // It turns out that just closing and then opening the ifstream variable does not reset it 00331 // and subsequent open() command fails. One fix is to explicitely clear the ifstream, or 00332 // scope the variables. 00333 dataFile.close(); 00334 dataFile.clear(); 00335 00336 //D2: flat array with the values of D2 applied to basis functions. Multi-index is (F,P,D2cardinality) 00337 std::vector<double> basisD2; 00338 00339 fileName = "./testdata/PYR_I2_D2Vals.dat"; 00340 dataFile.open(fileName.c_str()); 00341 TEUCHOS_TEST_FOR_EXCEPTION( !dataFile.good(), std::logic_error, 00342 ">>> ERROR (HGRAD_PYR_I2/test01): could not open D2 values data file, test aborted."); 00343 00344 while (!dataFile.eof() ){ 00345 double temp; 00346 string line; // string for one line of input file 00347 std::getline(dataFile, line); // get next line from file 00348 stringstream data_line(line); // convert to stringstream 00349 while(data_line >> temp){ // extract value from line 00350 basisD2.push_back(temp); // push into vector 00351 } 00352 } 00353 dataFile.close(); 00354 dataFile.clear(); 00355 00356 try{ 00357 00358 // Dimensions for the output arrays: 00359 int numFields = pyrBasis.getCardinality(); 00360 int numPoints = pyrNodes.dimension(0); 00361 int spaceDim = pyrBasis.getBaseCellTopology().getDimension(); 00362 int D2Cardin = Intrepid::getDkCardinality(OPERATOR_D2, spaceDim); 00363 00364 // Generic array for values, grads, curls, etc. that will be properly sized before each call 00365 FieldContainer<double> vals; 00366 00367 // Check VALUE of basis functions: resize vals to rank-2 container: 00368 vals.resize(numFields, numPoints); 00369 pyrBasis.getValues(vals, pyrNodes, OPERATOR_VALUE); 00370 for (int i = 0; i < numFields; i++) { 00371 for (int j = 0; j < numPoints; j++) { 00372 int l = j + i * numPoints; 00373 00374 if (std::abs(vals(i,j) - basisValues[l]) > 100.*INTREPID_TOL) { 00375 errorFlag++; 00376 *outStream << std::setw(70) << "^^^^----FAILURE!" << "\n"; 00377 00378 // Output the multi-index of the value where the error is: 00379 *outStream << " At multi-index { "; 00380 *outStream << i << " ";*outStream << j << " "; 00381 *outStream << "} computed value: " << vals(i,j) 00382 << " but reference value: " << basisValues[l] << "\n"; 00383 00384 } 00385 } 00386 } 00387 00388 00389 // Check GRAD of basis function: resize vals to rank-3 container 00390 vals.resize(numFields, numPoints, spaceDim); 00391 pyrBasis.getValues(vals, pyrNodes, OPERATOR_GRAD); 00392 for (int i = 0; i < numFields; i++) { 00393 for (int j = 0; j < numPoints; j++) { 00394 for (int k = 0; k < spaceDim; k++) { 00395 //int l = k + h * spaceDim + j * spaceDim * numFields; 00396 int l = i + j * numFields + k * numFields * numPoints; 00397 00398 if (std::abs(vals(i,j,k) - basisGrads[l]) > 100.*INTREPID_TOL) { 00399 errorFlag++; 00400 *outStream << std::setw(70) << "^^^^----FAILURE!" << "\n"; 00401 00402 // Output the multi-index of the value where the error is: 00403 *outStream << " At multi-index { "; 00404 *outStream << i << " ";*outStream << j << " ";*outStream << k << " "; 00405 *outStream << "} computed grad component: " << vals(i,j,k) 00406 << " but reference grad component: " << basisGrads[l] << "\n"; 00407 00408 } 00409 00410 } 00411 } 00412 } 00413 00414 // Check D1 of basis function (do not resize vals because it has the correct size: D1 = GRAD) 00415 pyrBasis.getValues(vals, pyrNodes, OPERATOR_D1); 00416 for (int i = 0; i < numFields; i++) { 00417 for (int j = 0; j < numPoints; j++) { 00418 for (int k = 0; k < spaceDim; k++) { 00419 int l = i + j * numFields + k * numFields * numPoints; 00420 00421 if (std::abs(vals(i,j,k) - basisGrads[l]) > 100.*INTREPID_TOL) { 00422 errorFlag++; 00423 *outStream << std::setw(70) << "^^^^----FAILURE!" << "\n"; 00424 00425 // Output the multi-index of the value where the error is: 00426 *outStream << " At multi-index { "; 00427 *outStream << i << " ";*outStream << j << " ";*outStream << k << " "; 00428 *outStream << "} computed D1 component: " << vals(i,j,k) 00429 << " but reference D1 component: " << basisGrads[l] << "\n"; 00430 } 00431 00432 } 00433 } 00434 } 00435 00436 00437 // Check D2 of basis function 00438 vals.resize(numFields, numPoints, D2Cardin); 00439 pyrBasis.getValues(vals, pyrNodes, OPERATOR_D2); 00440 //int l=0; 00441 for (int i = 0; i < numFields; i++) { 00442 for (int j = 0; j < numPoints; j++) { 00443 if(j == 4) continue; //derivatives are singular when z = 1. 00444 for (int k = 0; k < D2Cardin; k++) { 00445 // int l = k + i * D2Cardin + j * D2Cardin * numFields; 00446 int l = i + j * numFields + k * numFields * numPoints; 00447 //int l = k + j * D2Cardin + i * D2Cardin * numPoints; 00448 00449 00450 if (std::abs(vals(i,j,k) - basisD2[l]) > 100.*INTREPID_TOL) { 00451 errorFlag++; 00452 *outStream << std::setw(70) << "^^^^----FAILURE!" << "\n"; 00453 00454 // Output the multi-index of the value where the error is: 00455 *outStream << " At multi-index { "; 00456 *outStream << i << " ";*outStream << j << " ";*outStream << k << " "; 00457 *outStream << "} computed D2 component: " << vals(i,j,k) 00458 << " but reference D2 component: " << basisD2[l] << "\n"; 00459 } 00460 00461 // l++; 00462 00463 // *outStream << vals(i,j,k) << "\n"; 00464 00465 00466 } 00467 } 00468 } 00469 } 00470 00471 00472 // Catch unexpected errors 00473 catch (std::logic_error err) { 00474 *outStream << err.what() << "\n\n"; 00475 errorFlag = -1000; 00476 }; 00477 00478 if (errorFlag != 0) 00479 std::cout << "End Result: TEST FAILED\n"; 00480 else 00481 std::cout << "End Result: TEST PASSED\n"; 00482 00483 // reset format state of std::cout 00484 std::cout.copyfmt(oldFormatState); 00485 00486 return errorFlag; 00487 }
1.7.6.1