Intrepid
http://trilinos.sandia.gov/packages/docs/r10.10/packages/intrepid/test/Discretization/FunctionSpaceTools/test_06.cpp
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 
00050 #include "Intrepid_FunctionSpaceTools.hpp"
00051 #include "Intrepid_FieldContainer.hpp"
00052 #include "Intrepid_CellTools.hpp"
00053 #include "Intrepid_HGRAD_TET_C1_FEM.hpp"
00054 #include "Intrepid_DefaultCubatureFactory.hpp"
00055 #include "Intrepid_Utils.hpp"
00056 #include "Teuchos_oblackholestream.hpp"
00057 #include "Teuchos_RCP.hpp"
00058 #include "Teuchos_GlobalMPISession.hpp"
00059 
00060 using namespace std;
00061 using namespace Intrepid;
00062 
00063 #define INTREPID_TEST_COMMAND( S )                                                                                  \
00064 {                                                                                                                   \
00065   try {                                                                                                             \
00066     S ;                                                                                                             \
00067   }                                                                                                                 \
00068   catch (std::logic_error err) {                                                                                    \
00069       *outStream << "Expected Error ----------------------------------------------------------------\n";            \
00070       *outStream << err.what() << '\n';                                                                             \
00071       *outStream << "-------------------------------------------------------------------------------" << "\n\n";    \
00072   };                                                                                                                \
00073 }
00074 
00075 
00076 int main(int argc, char *argv[]) {
00077 
00078   Teuchos::GlobalMPISession mpiSession(&argc, &argv);
00079 
00080   // This little trick lets us print to std::cout only if
00081   // a (dummy) command-line argument is provided.
00082   int iprint     = argc - 1;
00083   Teuchos::RCP<std::ostream> outStream;
00084   Teuchos::oblackholestream bhs; // outputs nothing
00085   if (iprint > 0)
00086     outStream = Teuchos::rcp(&std::cout, false);
00087   else
00088     outStream = Teuchos::rcp(&bhs, false);
00089 
00090   // Save the format state of the original std::cout.
00091   Teuchos::oblackholestream oldFormatState;
00092   oldFormatState.copyfmt(std::cout);
00093 
00094   *outStream \
00095   << "===============================================================================\n" \
00096   << "|                                                                             |\n" \
00097   << "|                      Unit Test (FunctionSpaceTools)                         |\n" \
00098   << "|                                                                             |\n" \
00099   << "|     1) basic operator transformations and integration in HGRAD              |\n" \
00100   << "|                                                                             |\n" \
00101   << "|  Questions? Contact  Pavel Bochev (pbboche@sandia.gov) or                   |\n" \
00102   << "|                      Denis Ridzal (dridzal@sandia.gov).                     |\n" \
00103   << "|                                                                             |\n" \
00104   << "|  Intrepid's website: http://trilinos.sandia.gov/packages/intrepid           |\n" \
00105   << "|  Trilinos website:   http://trilinos.sandia.gov                             |\n" \
00106   << "|                                                                             |\n" \
00107   << "===============================================================================\n";
00108 
00109 
00110   int errorFlag = 0;
00111 #ifdef HAVE_INTREPID_DEBUG
00112   int beginThrowNumber = Teuchos::TestForException_getThrowNumber();
00113   int endThrowNumber = beginThrowNumber + 28;
00114 #endif
00115 
00116   typedef FunctionSpaceTools fst; 
00117 
00118   *outStream \
00119   << "\n"
00120   << "===============================================================================\n"\
00121   << "| TEST 1: exceptions                                                          |\n"\
00122   << "===============================================================================\n";
00123 
00124   try{
00125 #ifdef HAVE_INTREPID_DEBUG
00126     FieldContainer<double,  1> a_2(2);
00127     FieldContainer<double,  2> a_2_2(2, 2);
00128     FieldContainer<double,  3> a_2_3(2, 3);
00129     FieldContainer<double,  4> a_3_2(3, 2);
00130     FieldContainer<double,  5> a_2_2_3(2, 2, 3);
00131     FieldContainer<double,  6> a_2_2_3_3(2, 2, 3, 3);
00132     FieldContainer<double,  7> a_2_2_2(2, 2, 2);
00133     FieldContainer<double,  8> a_2_2_2_3_3(2, 2, 2, 3, 3);
00134     FieldContainer<double,  9> a_2_2_2_2_2(2, 2, 2, 2, 2);
00135     FieldContainer<double, 10> a_2_2_2_2(2, 2, 2, 2);
00136     FieldContainer<double, 11> a_3_2_2_2(3, 2, 2, 2);
00137     FieldContainer<double, 12> a_2_3_2_2(2, 3, 2, 2);
00138     FieldContainer<double, 13> a_2_2_3_2(2, 2, 3, 2);
00139     FieldContainer<double, 14> a_2_2_2_3(2, 2, 2, 3);
00140 
00141     *outStream << "\n >>>>> TESTING computeCellMeasure:\n";
00142     INTREPID_TEST_COMMAND( fst::computeCellMeasure<double>(a_2_2, a_2, a_2) );
00143     INTREPID_TEST_COMMAND( fst::computeCellMeasure<double>(a_2_2, a_2_2, a_2) );
00144 
00145     *outStream << "\n >>>>> TESTING computeFaceMeasure:\n";
00146     INTREPID_TEST_COMMAND( fst::computeFaceMeasure<double>(a_2_2, a_2, a_2, 0, shards::getCellTopologyData< shards::Tetrahedron<> >()) );
00147     INTREPID_TEST_COMMAND( fst::computeFaceMeasure<double>(a_2_2, a_2_2_3_3, a_2, 0, shards::getCellTopologyData< shards::Tetrahedron<> >()) );
00148 
00149     *outStream << "\n >>>>> TESTING computeEdgeMeasure:\n";
00150     INTREPID_TEST_COMMAND( fst::computeEdgeMeasure<double>(a_2_2, a_2, a_2, 0, shards::getCellTopologyData< shards::Triangle<> >()) );
00151     INTREPID_TEST_COMMAND( fst::computeEdgeMeasure<double>(a_2_2, a_2_2_2_2, a_2, 0, shards::getCellTopologyData< shards::Triangle<> >()) );
00152 
00153     *outStream << "\n >>>>> TESTING integrate:\n";
00154     INTREPID_TEST_COMMAND( fst::integrate<double>(a_2_2_2_2, a_2_2_2, a_2_2_2, COMP_CPP) );
00155     INTREPID_TEST_COMMAND( fst::integrate<double>(a_2, a_2_2, a_2_2, COMP_CPP) );
00156     INTREPID_TEST_COMMAND( fst::integrate<double>(a_2, a_2_2_3, a_2_2_3, COMP_CPP) );
00157     INTREPID_TEST_COMMAND( fst::integrate<double>(a_2, a_2_2_3_3, a_2_2_3_3, COMP_CPP) );
00158     INTREPID_TEST_COMMAND( fst::integrate<double>(a_2_2, a_2_2, a_2_2_2, COMP_CPP) );
00159     INTREPID_TEST_COMMAND( fst::integrate<double>(a_2_2, a_2_2_3, a_2_2_2_3, COMP_CPP) );
00160     INTREPID_TEST_COMMAND( fst::integrate<double>(a_2_2, a_2_2_3_3, a_2_2_2_3_3, COMP_CPP) );
00161     INTREPID_TEST_COMMAND( fst::integrate<double>(a_2_2_2, a_2_2_2, a_2_2_2, COMP_CPP) );
00162     INTREPID_TEST_COMMAND( fst::integrate<double>(a_2_2_2, a_2_2_2_3, a_2_2_2_3, COMP_CPP) );
00163     INTREPID_TEST_COMMAND( fst::integrate<double>(a_2_2_2, a_2_2_2_3_3, a_2_2_2_3_3, COMP_CPP) );
00164 
00165     *outStream << "\n >>>>> TESTING operatorIntegral:\n";
00166     INTREPID_TEST_COMMAND( fst::operatorIntegral<double>(a_2_2_2, a_2_2, a_2_2_2, COMP_CPP) );
00167     INTREPID_TEST_COMMAND( fst::operatorIntegral<double>(a_2_2_2, a_2_2_2, a_2_2_2, COMP_CPP) );
00168     INTREPID_TEST_COMMAND( fst::operatorIntegral<double>(a_2_2_2, a_2_2_2_3, a_2_2_2_3, COMP_CPP) );
00169     INTREPID_TEST_COMMAND( fst::operatorIntegral<double>(a_2_2_2, a_2_2_2_3_3, a_2_2_2_3_3, COMP_CPP) );
00170 
00171     *outStream << "\n >>>>> TESTING functionalIntegral:\n";
00172     INTREPID_TEST_COMMAND( fst::functionalIntegral<double>(a_2_2, a_2_2_2_3_3, a_2_2_2, COMP_CPP) );
00173     INTREPID_TEST_COMMAND( fst::functionalIntegral<double>(a_2_2, a_2_2, a_2_2_2, COMP_CPP) );
00174     INTREPID_TEST_COMMAND( fst::functionalIntegral<double>(a_2_2, a_2_2_3, a_2_2_2_3, COMP_CPP) );
00175     INTREPID_TEST_COMMAND( fst::functionalIntegral<double>(a_2_2, a_2_2_3_3, a_2_2_2_3_3, COMP_CPP) );
00176 
00177     *outStream << "\n >>>>> TESTING dataIntegral:\n";
00178     INTREPID_TEST_COMMAND( fst::dataIntegral<double>(a_2, a_2, a_2_2_2, COMP_CPP) );
00179     INTREPID_TEST_COMMAND( fst::dataIntegral<double>(a_2, a_2_2, a_2_2, COMP_CPP) );
00180     INTREPID_TEST_COMMAND( fst::dataIntegral<double>(a_2, a_2_2_3, a_2_2_3, COMP_CPP) );
00181     INTREPID_TEST_COMMAND( fst::dataIntegral<double>(a_2, a_2_2_3_3, a_2_2_3_3, COMP_CPP) );
00182 
00183     *outStream << "\n >>>>> TESTING applyLeftFieldSigns:\n";
00184     INTREPID_TEST_COMMAND( fst::applyLeftFieldSigns<double>(a_2, a_2) );
00185     INTREPID_TEST_COMMAND( fst::applyLeftFieldSigns<double>(a_2_2_2, a_2) );
00186     INTREPID_TEST_COMMAND( fst::applyLeftFieldSigns<double>(a_2_2_2, a_3_2) );
00187     INTREPID_TEST_COMMAND( fst::applyLeftFieldSigns<double>(a_2_2_2, a_2_3) );
00188     INTREPID_TEST_COMMAND( fst::applyLeftFieldSigns<double>(a_2_2_2, a_2_2) );
00189 
00190     *outStream << "\n >>>>> TESTING applyRightFieldSigns:\n";
00191     INTREPID_TEST_COMMAND( fst::applyRightFieldSigns<double>(a_2, a_2) );
00192     INTREPID_TEST_COMMAND( fst::applyRightFieldSigns<double>(a_2_2_2, a_2) );
00193     INTREPID_TEST_COMMAND( fst::applyRightFieldSigns<double>(a_2_2_2, a_3_2) );
00194     INTREPID_TEST_COMMAND( fst::applyRightFieldSigns<double>(a_2_2_2, a_2_3) );
00195     INTREPID_TEST_COMMAND( fst::applyRightFieldSigns<double>(a_2_2_2, a_2_2) );
00196 
00197     *outStream << "\n >>>>> TESTING applyFieldSigns:\n";
00198     INTREPID_TEST_COMMAND( fst::applyFieldSigns<double>(a_2, a_2) );
00199     INTREPID_TEST_COMMAND( fst::applyFieldSigns<double>(a_2_2, a_2) );
00200     INTREPID_TEST_COMMAND( fst::applyFieldSigns<double>(a_2_2, a_3_2) );
00201     INTREPID_TEST_COMMAND( fst::applyFieldSigns<double>(a_2_2, a_2_3) );
00202     INTREPID_TEST_COMMAND( fst::applyFieldSigns<double>(a_2_2_2_3_3, a_2_2) );
00203 
00204     *outStream << "\n >>>>> TESTING evaluate:\n";
00205     INTREPID_TEST_COMMAND( fst::evaluate<double>(a_2, a_2, a_2_2) );
00206     INTREPID_TEST_COMMAND( fst::evaluate<double>(a_2, a_2, a_2_2_2_3_3) );
00207     INTREPID_TEST_COMMAND( fst::evaluate<double>(a_2, a_2_2, a_2_2_2_3_3) );
00208     INTREPID_TEST_COMMAND( fst::evaluate<double>(a_2_2_3_3, a_3_2, a_2_2_2_3_3) );
00209     INTREPID_TEST_COMMAND( fst::evaluate<double>(a_2_2_3_3, a_2_3, a_2_2_2_3_3) );
00210     INTREPID_TEST_COMMAND( fst::evaluate<double>(a_3_2_2_2, a_2_2, a_2_2_2_2_2) );
00211     INTREPID_TEST_COMMAND( fst::evaluate<double>(a_2_3_2_2, a_2_2, a_2_2_2_2_2) );
00212     INTREPID_TEST_COMMAND( fst::evaluate<double>(a_2_2_3_2, a_2_2, a_2_2_2_2_2) );
00213     INTREPID_TEST_COMMAND( fst::evaluate<double>(a_2_2_2_3, a_2_2, a_2_2_2_2_2) );
00214     INTREPID_TEST_COMMAND( fst::evaluate<double>(a_2_2_2_2, a_2_2, a_2_2_2_2_2) );
00215 #endif
00216   }
00217   catch (std::logic_error err) {
00218     *outStream << "UNEXPECTED ERROR !!! ----------------------------------------------------------\n";
00219     *outStream << err.what() << '\n';
00220     *outStream << "-------------------------------------------------------------------------------" << "\n\n";
00221     errorFlag = -1000;
00222   };
00223 
00224 #ifdef HAVE_INTREPID_DEBUG
00225   if (Teuchos::TestForException_getThrowNumber() != endThrowNumber)
00226     errorFlag++;
00227 #endif
00228 
00229   *outStream \
00230   << "\n"
00231   << "===============================================================================\n"\
00232   << "| TEST 2: correctness of math operations                                      |\n"\
00233   << "===============================================================================\n";
00234 
00235   outStream->precision(20);
00236 
00237   try {
00238       // cell type: tet
00239       shards::CellTopology cellType = shards::getCellTopologyData< shards::Tetrahedron<> >();
00240 
00241       /* Related to cubature. */
00242       // create cubature factory
00243       DefaultCubatureFactory<double, FieldContainer<double, 1>, FieldContainer<double, 2> > cubFactory;
00244       // cubature degree
00245       int cubDegree = 2;
00246       // create default cubature
00247       Teuchos::RCP<Cubature<double, FieldContainer<double, 1>, FieldContainer<double, 2> > > myCub = cubFactory.create(cellType, cubDegree);
00248       // get spatial dimension 
00249       int spaceDim = myCub->getDimension();
00250       // get number of cubature points
00251       int numCubPoints = myCub->getNumPoints();
00252 
00253       /* Related to basis. */
00254       // create tet basis
00255       Basis_HGRAD_TET_C1_FEM<double, FieldContainer<double, 1> > tetBasis;
00256       // get basis cardinality
00257       int numFields = tetBasis.getCardinality();
00258  
00259       /* Cell geometries. */
00260       int numCells    = 4;
00261       int numNodes    = 4;
00262       int numCellData = numCells*numNodes*spaceDim;
00263       double tetnodes[] = {
00264         // tet 0
00265         0.0, 0.0, 0.0,
00266         1.0, 0.0, 0.0,
00267         0.0, 1.0, 0.0,
00268         0.0, 0.0, 1.0,
00269         // tet 1
00270         4.0, 5.0, 1.0,
00271        -6.0, 2.0, 0.0,
00272         4.0, -3.0, -1.0,
00273         0.0, 2.0, 5.0,
00274         // tet 2
00275         -6.0, -3.0, 1.0,
00276         9.0, 2.0, 1.0,
00277         8.9, 2.1, 0.9,
00278         8.9, 2.1, 1.1,
00279         // tet 3
00280         -6.0, -3.0, 1.0,
00281         12.0, 3.0, 1.0,
00282         2.9, 0.1, 0.9,
00283         2.9, 0.1, 1.1
00284       };
00285 
00286       /* Computational arrays. */
00287       FieldContainer<double,  1> cub_points(numCubPoints, spaceDim);
00288       FieldContainer<double,  2> cub_weights(numCubPoints);
00289       FieldContainer<double,  3> cell_nodes(numCells, numNodes, spaceDim);
00290       FieldContainer<double,  4> jacobian(numCells, numCubPoints, spaceDim, spaceDim);
00291       FieldContainer<double,  5> jacobian_inv(numCells, numCubPoints, spaceDim, spaceDim);
00292       FieldContainer<double,  6> jacobian_det(numCells, numCubPoints);
00293       FieldContainer<double,  7> weighted_measure(numCells, numCubPoints);
00294 
00295       FieldContainer<double,  1> grad_of_basis_at_cub_points(numFields, numCubPoints, spaceDim);
00296       FieldContainer<double,  9> transformed_grad_of_basis_at_cub_points(numCells, numFields, numCubPoints, spaceDim);
00297       FieldContainer<double, 10> weighted_transformed_grad_of_basis_at_cub_points(numCells, numFields, numCubPoints, spaceDim);
00298       FieldContainer<double, 11> stiffness_matrices(numCells, numFields, numFields);
00299 
00300       FieldContainer<double,  1> value_of_basis_at_cub_points(numFields, numCubPoints);
00301       FieldContainer<double, 13> transformed_value_of_basis_at_cub_points(numCells, numFields, numCubPoints);
00302       FieldContainer<double, 14> weighted_transformed_value_of_basis_at_cub_points(numCells, numFields, numCubPoints);
00303       FieldContainer<double, 15> mass_matrices(numCells, numFields, numFields);
00304 
00305       /******************* START COMPUTATION ***********************/
00306 
00307       // get cubature points and weights
00308       myCub->getCubature(cub_points, cub_weights);
00309 
00310       // fill cell vertex array
00311       cell_nodes.setValues(tetnodes, numCellData);
00312 
00313       // compute geometric cell information
00314       CellTools<double>::setJacobian(jacobian, cub_points, cell_nodes, cellType);
00315       CellTools<double>::setJacobianInv(jacobian_inv, jacobian);
00316       CellTools<double>::setJacobianDet(jacobian_det, jacobian);
00317 
00318       // compute weighted measure
00319       fst::computeCellMeasure<double>(weighted_measure, jacobian_det, cub_weights);
00320 
00321       // Computing stiffness matrices:
00322       // tabulate gradients of basis functions at (reference) cubature points
00323       tetBasis.getValues(grad_of_basis_at_cub_points, cub_points, OPERATOR_GRAD);
00324 
00325       // transform gradients of basis functions
00326       fst::HGRADtransformGRAD<double>(transformed_grad_of_basis_at_cub_points,
00327                                       jacobian_inv,
00328                                       grad_of_basis_at_cub_points);
00329 
00330       // multiply with weighted measure
00331       fst::multiplyMeasure<double>(weighted_transformed_grad_of_basis_at_cub_points,
00332                                    weighted_measure,
00333                                    transformed_grad_of_basis_at_cub_points);
00334 
00335       // compute stiffness matrices
00336       fst::integrate<double>(stiffness_matrices,
00337                              transformed_grad_of_basis_at_cub_points,
00338                              weighted_transformed_grad_of_basis_at_cub_points,
00339                              COMP_CPP);
00340 
00341 
00342       // Computing mass matrices:
00343       // tabulate values of basis functions at (reference) cubature points
00344       tetBasis.getValues(value_of_basis_at_cub_points, cub_points, OPERATOR_VALUE);
00345 
00346       // transform values of basis functions
00347       fst::HGRADtransformVALUE<double>(transformed_value_of_basis_at_cub_points,
00348                                        value_of_basis_at_cub_points);
00349 
00350       // multiply with weighted measure
00351       fst::multiplyMeasure<double>(weighted_transformed_value_of_basis_at_cub_points,
00352                                    weighted_measure,
00353                                    transformed_value_of_basis_at_cub_points);
00354 
00355       // compute mass matrices
00356       fst::integrate<double>(mass_matrices,
00357                              transformed_value_of_basis_at_cub_points,
00358                              weighted_transformed_value_of_basis_at_cub_points,
00359                              COMP_CPP);
00360 
00361       /*******************  STOP COMPUTATION ***********************/
00362 
00363 
00364       /******************* START COMPARISON ***********************/
00365       string basedir = "./testdata";
00366       for (int cell_id = 0; cell_id < numCells; cell_id++) {
00367 
00368         stringstream namestream;
00369         string filename;
00370         namestream <<  basedir << "/mass_TET_FEM_P1" << "_" << "0" << cell_id+1 << ".dat";
00371         namestream >> filename;
00372 
00373         ifstream massfile(&filename[0]);
00374         if (massfile.is_open()) {
00375           if (compareToAnalytic<double>(&mass_matrices(cell_id, 0, 0), massfile, 1e-10, 0) > 0)
00376             errorFlag++;
00377           massfile.close();
00378         }
00379         else {
00380           errorFlag = -1;
00381           std::cout << "End Result: TEST FAILED\n";
00382           return errorFlag;
00383         }
00384 
00385         namestream.clear();
00386         namestream << basedir << "/stiff_TET_FEM_P1" << "_" << "0" << cell_id+1 << ".dat";
00387         namestream >> filename;
00388 
00389         ifstream stifffile(&filename[0]);
00390         if (stifffile.is_open())
00391         {
00392           if (compareToAnalytic<double>(&stiffness_matrices(cell_id, 0, 0), stifffile, 1e-10, 0) > 0)
00393             errorFlag++;
00394           stifffile.close();
00395         }
00396         else {
00397           errorFlag = -1;
00398           std::cout << "End Result: TEST FAILED\n";
00399           return errorFlag;
00400         }
00401 
00402       }
00403 
00404       /******************* STOP COMPARISON ***********************/
00405 
00406       *outStream << "\n";
00407   }
00408   catch (std::logic_error err) {
00409     *outStream << "UNEXPECTED ERROR !!! ----------------------------------------------------------\n";
00410     *outStream << err.what() << '\n';
00411     *outStream << "-------------------------------------------------------------------------------" << "\n\n";
00412     errorFlag = -1000;
00413   };
00414 
00415 
00416   if (errorFlag != 0)
00417     std::cout << "End Result: TEST FAILED\n";
00418   else
00419     std::cout << "End Result: TEST PASSED\n";
00420 
00421   // reset format state of std::cout
00422   std::cout.copyfmt(oldFormatState);
00423 
00424   return errorFlag;
00425 }