Intrepid
/usr/src/RPM/BUILD/trilinos10-10.6.4/packages/intrepid/test/Discretization/Basis/HGRAD_TRI_Cn_FEM_ORTH/test_01.cpp
Go to the documentation of this file.
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 // This library is free software; you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as
00012 // published by the Free Software Foundation; either version 2.1 of the
00013 // License, or (at your option) any later version.
00014 //
00015 // This library is distributed in the hope that it will be useful, but
00016 // WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023 // USA
00024 // Questions? Contact Pavel Bochev (pbboche@sandia.gov) or
00025 //                    Denis Ridzal (dridzal@sandia.gov) or
00026 //                    Robert Kirby (robert.c.kirby@ttu.edu)
00027 //
00028 // ************************************************************************
00029 // @HEADER
00030 
00031 
00037 #include "Intrepid_FieldContainer.hpp"
00038 #include "Teuchos_oblackholestream.hpp"
00039 #include "Teuchos_RCP.hpp"
00040 #include "Teuchos_GlobalMPISession.hpp"
00041 #include "Intrepid_HGRAD_TRI_Cn_FEM_ORTH.hpp"
00042 #include "Intrepid_CubatureDirectTriDefault.hpp"
00043 #include "Intrepid_PointTools.hpp"
00044 #include "Shards_CellTopology.hpp"
00045 #include <iostream>
00046 using namespace Intrepid;
00047 
00053 int main(int argc, char *argv[]) {
00054 
00055   Teuchos::GlobalMPISession mpiSession(&argc, &argv);
00056   
00057   // This little trick lets us print to std::cout only if a (dummy) command-line argument is provided.
00058   int iprint     = argc - 1;
00059   
00060   Teuchos::RCP<std::ostream> outStream;
00061   Teuchos::oblackholestream bhs; // outputs nothing
00062   
00063   if (iprint > 0)
00064     outStream = Teuchos::rcp(&std::cout, false);
00065   else
00066     outStream = Teuchos::rcp(&bhs, false);
00067   
00068   // Save the format state of the original std::cout.
00069   Teuchos::oblackholestream oldFormatState;
00070   oldFormatState.copyfmt(std::cout);
00071   
00072   *outStream \
00073     << "===============================================================================\n" \
00074     << "|                                                                             |\n" \
00075     << "|                           Unit Test OrthogonalBases                         |\n" \
00076     << "|                                                                             |\n" \
00077     << "|     1) Tests orthogonality of triangular orthogonal basis (Dubiner)         |\n" \
00078     << "|                                                                             |\n" \
00079     << "|  Questions? Contact  Pavel Bochev (pbboche@sandia.gov) or                   |\n" \
00080     << "|                      Denis Ridzal (dridzal@sandia.gov) or                   |\n" \
00081     << "|                      Robert Kirby (robert.c.kirby@ttu.edu)                  |\n" \
00082     << "|                                                                             |\n" \
00083     << "|  Intrepid's website: http://trilinos.sandia.gov/packages/intrepid           |\n" \
00084     << "|  Trilinos website:   http://trilinos.sandia.gov                             |\n" \
00085     << "|                                                                             |\n" \
00086     << "===============================================================================\n";
00087   
00088   int errorFlag  = 0;
00089   
00090   // First, get a reference quadrature rule
00091   try {
00092     CubatureDirectTriDefault<double,FieldContainer<double> > myCub(20);
00093     FieldContainer<double> cubPts( myCub.getNumPoints() , 2 );
00094     FieldContainer<double> cubWts( myCub.getNumPoints() );
00095     
00096     myCub.getCubature( cubPts , cubWts );
00097     
00098     // Tabulate the basis functions at the cubature points
00099     const int deg =3;
00100     Basis_HGRAD_TRI_Cn_FEM_ORTH<double,FieldContainer<double> > myBasis( deg );
00101     const int polydim = myBasis.getCardinality();
00102 
00103     FieldContainer<double> basisAtCubPts( polydim , myCub.getNumPoints() );
00104     
00105     myBasis.getValues( basisAtCubPts , cubPts , OPERATOR_VALUE );
00106     
00107     // Now let's compute the mass matrix
00108     for (int i=0;i<polydim;i++) {
00109       for (int j=i;j<polydim;j++) {
00110         double cur = 0;
00111         for (int k=0;k<myCub.getNumPoints();k++) {
00112           cur += cubWts(k) * basisAtCubPts( i , k ) * basisAtCubPts( j , k );
00113         }
00114         if (i != j && fabs( cur ) > INTREPID_TOL) {
00115           errorFlag++;
00116         }
00117         else if (i == j && fabs( cur ) < INTREPID_TOL ) {
00118           errorFlag++;
00119         }
00120         
00121       }
00122     }
00123   }
00124   catch ( std::exception err) {
00125     *outStream << err.what() << "\n\n";
00126     errorFlag = -1000;
00127   }
00128 
00129   // compare the points against FIAT-tabulated values on a lattice 
00130   try {
00131     const int deg = 3;
00132     Basis_HGRAD_TRI_Cn_FEM_ORTH<double,FieldContainer<double> > myBasis( deg );
00133     shards::CellTopology myTri_3( shards::getCellTopologyData< shards::Triangle<3> >() );  
00134     const int np_lattice = PointTools::getLatticeSize( myTri_3 , deg , 0 );
00135     FieldContainer<double> lattice( np_lattice , 2);
00136     PointTools::getLattice<double,FieldContainer<double> >( lattice , 
00137                                                             myTri_3 , 
00138                                                             deg , 
00139                                                             0 , 
00140                                                             POINTTYPE_EQUISPACED );
00141     const int polydim = myBasis.getCardinality();
00142     
00143     FieldContainer<double> dBasisAtLattice( polydim , np_lattice , 2 );
00144     myBasis.getValues( dBasisAtLattice , lattice , OPERATOR_D1 );
00145     
00146     double fiat_vals[] =  {
00147 0.000000000000000e+00, 0.000000000000000e+00,
00148 0.000000000000000e+00, 0.000000000000000e+00,
00149 0.000000000000000e+00, 0.000000000000000e+00,
00150 0.000000000000000e+00, 0.000000000000000e+00,
00151 0.000000000000000e+00, 0.000000000000000e+00,
00152 0.000000000000000e+00, 0.000000000000000e+00,
00153 0.000000000000000e+00, 0.000000000000000e+00,
00154 0.000000000000000e+00, 0.000000000000000e+00,
00155 0.000000000000000e+00, 0.000000000000000e+00,
00156 0.000000000000000e+00, 0.000000000000000e+00,
00157 3.464101615137754e+00, 1.732050807568877e+00,
00158 3.464101615137754e+00, 1.732050807568877e+00,
00159 3.464101615137754e+00, 1.732050807568877e+00,
00160 3.464101615137754e+00, 1.732050807568877e+00,
00161 3.464101615137754e+00, 1.732050807568877e+00,
00162 3.464101615137754e+00, 1.732050807568877e+00,
00163 3.464101615137754e+00, 1.732050807568877e+00,
00164 3.464101615137754e+00, 1.732050807568877e+00,
00165 3.464101615137754e+00, 1.732050807568877e+00,
00166 3.464101615137754e+00, 1.732050807568877e+00,
00167 0.000000000000000e+00, 3.000000000000000e+00,
00168 0.000000000000000e+00, 3.000000000000000e+00,
00169 0.000000000000000e+00, 3.000000000000000e+00,
00170 0.000000000000000e+00, 3.000000000000000e+00,
00171 0.000000000000000e+00, 3.000000000000000e+00,
00172 0.000000000000000e+00, 3.000000000000000e+00,
00173 0.000000000000000e+00, 3.000000000000000e+00,
00174 0.000000000000000e+00, 3.000000000000000e+00,
00175 0.000000000000000e+00, 3.000000000000000e+00,
00176 0.000000000000000e+00, 3.000000000000000e+00,
00177 -1.643167672515498e+01, -5.477225575051661e+00,
00178 -5.477225575051661e+00, 0.000000000000000e+00,
00179 5.477225575051660e+00, 5.477225575051660e+00,
00180 1.643167672515498e+01, 1.095445115010332e+01,
00181 -1.095445115010332e+01, -3.651483716701107e+00,
00182 -9.121412916732176e-16, 1.825741858350553e+00,
00183 1.095445115010332e+01, 7.302967433402213e+00,
00184 -5.477225575051661e+00, -1.825741858350554e+00,
00185 5.477225575051660e+00, 3.651483716701107e+00,
00186 0.000000000000000e+00, 0.000000000000000e+00,
00187 -4.242640687119285e+00, -1.272792206135786e+01,
00188 -4.242640687119285e+00, -5.656854249492381e+00,
00189 -4.242640687119285e+00, 1.414213562373094e+00,
00190 -4.242640687119285e+00, 8.485281374238570e+00,
00191 2.828427124746189e+00, -5.656854249492381e+00,
00192 2.828427124746189e+00, 1.414213562373094e+00,
00193 2.828427124746189e+00, 8.485281374238568e+00,
00194 9.899494936611664e+00, 1.414213562373094e+00,
00195 9.899494936611664e+00, 8.485281374238568e+00,
00196 1.697056274847714e+01, 8.485281374238570e+00,
00197 0.000000000000000e+00, -9.797958971132712e+00,
00198 0.000000000000000e+00, -9.797958971132712e+00,
00199 0.000000000000000e+00, -9.797958971132710e+00,
00200 0.000000000000000e+00, -9.797958971132712e+00,
00201 0.000000000000000e+00, -1.632993161855452e+00,
00202 0.000000000000000e+00, -1.632993161855452e+00,
00203 0.000000000000000e+00, -1.632993161855452e+00,
00204 0.000000000000000e+00, 6.531972647421806e+00,
00205 0.000000000000000e+00, 6.531972647421806e+00,
00206 0.000000000000000e+00, 1.469693845669907e+01,
00207 4.489988864128730e+01, 1.122497216032182e+01,
00208 -4.988876515698587e+00, -6.236095644623235e+00,
00209 -4.988876515698591e+00, 1.247219128924645e+00,
00210 4.489988864128730e+01, 3.367491648096547e+01,
00211 1.995550606279436e+01, 4.988876515698590e+00,
00212 -4.988876515698589e+00, -2.494438257849295e+00,
00213 1.995550606279435e+01, 1.496662954709576e+01,
00214 4.988876515698590e+00, 1.247219128924648e+00,
00215 4.988876515698586e+00, 3.741657386773940e+00,
00216 0.000000000000000e+00, 0.000000000000000e+00,
00217 1.897366596101028e+01, 2.846049894151541e+01,
00218 6.324555320336759e+00, -7.378647873726218e+00,
00219 -6.324555320336757e+00, -1.370320319406298e+01,
00220 -1.897366596101028e+01, 9.486832980505138e+00,
00221 -1.686548085423136e+01, 4.216370213557840e+00,
00222 -1.404333387430680e-15, -2.108185106778921e+00,
00223 1.686548085423135e+01, 2.108185106778919e+01,
00224 -2.319003617456811e+01, -5.270462766947300e+00,
00225 2.319003617456811e+01, 1.791957340762081e+01,
00226 0.000000000000000e+00, 0.000000000000000e+00,
00227 4.898979485566356e+00, 3.184336665618131e+01,
00228 4.898979485566356e+00, 1.224744871391589e+01,
00229 4.898979485566356e+00, -7.348469228349532e+00,
00230 4.898979485566356e+00, -2.694438717061496e+01,
00231 -3.265986323710904e+00, -4.898979485566356e+00,
00232 -3.265986323710904e+00, -1.632993161855452e+00,
00233 -3.265986323710904e+00, 1.632993161855451e+00,
00234 1.143095213298816e+01, -7.348469228349537e+00,
00235 1.143095213298816e+01, 1.877942136133769e+01,
00236 4.898979485566356e+01, 2.449489742783178e+01,
00237 0.000000000000000e+00, 2.121320343559643e+01,
00238 0.000000000000000e+00, 2.121320343559643e+01,
00239 0.000000000000000e+00, 2.121320343559642e+01,
00240 0.000000000000000e+00, 2.121320343559643e+01,
00241 0.000000000000000e+00, -4.714045207910317e+00,
00242 0.000000000000000e+00, -4.714045207910317e+00,
00243 0.000000000000000e+00, -4.714045207910317e+00,
00244 0.000000000000000e+00, 2.357022603955157e+00,
00245 0.000000000000000e+00, 2.357022603955157e+00,
00246 0.000000000000000e+00, 4.242640687119285e+01
00247     };
00248     
00249     int fiat_index_cur = 0;
00250     for (int i=0;i<polydim;i++) {
00251       for (int j=0;j<np_lattice;j++) {
00252         for (int k=0;k<2;k++) {
00253           if (std::abs( dBasisAtLattice(i,j,k) - fiat_vals[fiat_index_cur] ) > INTREPID_TOL ) {
00254             errorFlag++;
00255             *outStream << std::setw(70) << "^^^^----FAILURE!" << "\n";
00256             
00257             // Output the multi-index of the value where the error is:
00258             *outStream << " At multi-index { ";
00259             *outStream << i << " " << j << " " << k;
00260             *outStream << "}  computed value: " << dBasisAtLattice(i,j,k)
00261                       << " but correct value: " << fiat_vals[fiat_index_cur] << "\n";
00262             *outStream << "Difference: " << std::abs( dBasisAtLattice(i,j,k) - fiat_vals[fiat_index_cur] ) << "\n";
00263           }
00264           fiat_index_cur++;
00265         }
00266       }
00267     }
00268   }
00269   catch ( std::exception err) {
00270     *outStream << err.what() << "\n\n";
00271     errorFlag = -1000;
00272   }
00273 
00274   // do second order derivatives
00275   try {
00276     const int deg = 3;
00277     shards::CellTopology myTri_3( shards::getCellTopologyData< shards::Triangle<3> >() );  
00278     Basis_HGRAD_TRI_Cn_FEM_ORTH<double,FieldContainer<double> > myBasis( deg );
00279     const int polydim = myBasis.getCardinality();
00280     const int np_lattice = PointTools::getLatticeSize( myTri_3 , deg , 0 );
00281     FieldContainer<double> lattice( np_lattice , 2);
00282     PointTools::getLattice<double,FieldContainer<double> >( lattice , 
00283                                                             myTri_3 , 
00284                                                             deg , 
00285                                                             0 , 
00286                                                             POINTTYPE_EQUISPACED );
00287 
00288     
00289     FieldContainer<double> dBasisAtLattice( polydim , np_lattice , 3 );
00290     myBasis.getValues( dBasisAtLattice , lattice , OPERATOR_D2 );
00291 
00292     const double fiat_vals[] = {
00293 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
00294 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
00295 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
00296 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
00297 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
00298 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
00299 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
00300 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
00301 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
00302 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
00303 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
00304 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
00305 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
00306 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
00307 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
00308 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
00309 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
00310 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
00311 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
00312 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
00313 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
00314 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
00315 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
00316 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
00317 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
00318 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
00319 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
00320 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
00321 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
00322 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
00323 3.286335345030997e+01, 1.643167672515498e+01, 5.477225575051661e+00,
00324 3.286335345030997e+01, 1.643167672515498e+01, 5.477225575051661e+00,
00325 3.286335345030997e+01, 1.643167672515498e+01, 5.477225575051661e+00,
00326 3.286335345030997e+01, 1.643167672515498e+01, 5.477225575051661e+00,
00327 3.286335345030997e+01, 1.643167672515498e+01, 5.477225575051661e+00,
00328 3.286335345030997e+01, 1.643167672515498e+01, 5.477225575051661e+00,
00329 3.286335345030997e+01, 1.643167672515498e+01, 5.477225575051661e+00,
00330 3.286335345030997e+01, 1.643167672515498e+01, 5.477225575051661e+00,
00331 3.286335345030997e+01, 1.643167672515498e+01, 5.477225575051661e+00,
00332 3.286335345030997e+01, 1.643167672515498e+01, 5.477225575051661e+00,
00333 0.000000000000000e+00, 2.121320343559642e+01, 2.121320343559642e+01,
00334 0.000000000000000e+00, 2.121320343559642e+01, 2.121320343559642e+01,
00335 0.000000000000000e+00, 2.121320343559642e+01, 2.121320343559642e+01,
00336 0.000000000000000e+00, 2.121320343559642e+01, 2.121320343559642e+01,
00337 0.000000000000000e+00, 2.121320343559642e+01, 2.121320343559642e+01,
00338 0.000000000000000e+00, 2.121320343559642e+01, 2.121320343559642e+01,
00339 0.000000000000000e+00, 2.121320343559642e+01, 2.121320343559642e+01,
00340 0.000000000000000e+00, 2.121320343559642e+01, 2.121320343559642e+01,
00341 0.000000000000000e+00, 2.121320343559642e+01, 2.121320343559642e+01,
00342 0.000000000000000e+00, 2.121320343559642e+01, 2.121320343559642e+01,
00343 0.000000000000000e+00, 0.000000000000000e+00, 2.449489742783178e+01,
00344 0.000000000000000e+00, 0.000000000000000e+00, 2.449489742783178e+01,
00345 0.000000000000000e+00, 0.000000000000000e+00, 2.449489742783177e+01,
00346 0.000000000000000e+00, 0.000000000000000e+00, 2.449489742783178e+01,
00347 0.000000000000000e+00, 0.000000000000000e+00, 2.449489742783178e+01,
00348 0.000000000000000e+00, 0.000000000000000e+00, 2.449489742783178e+01,
00349 0.000000000000000e+00, 0.000000000000000e+00, 2.449489742783178e+01,
00350 0.000000000000000e+00, 0.000000000000000e+00, 2.449489742783177e+01,
00351 0.000000000000000e+00, 0.000000000000000e+00, 2.449489742783177e+01,
00352 0.000000000000000e+00, 0.000000000000000e+00, 2.449489742783178e+01,
00353 -2.244994432064365e+02, -8.979977728257460e+01, -2.244994432064365e+01,
00354 -7.483314773547885e+01, -1.496662954709577e+01, 7.483314773547880e+00,
00355 7.483314773547882e+01, 5.986651818838305e+01, 3.741657386773942e+01,
00356 2.244994432064365e+02, 1.346996659238619e+02, 6.734983296193094e+01,
00357 -1.496662954709577e+02, -5.986651818838306e+01, -1.496662954709577e+01,
00358 -1.246222254316567e-14, 1.496662954709576e+01, 1.496662954709576e+01,
00359 1.496662954709576e+02, 8.979977728257458e+01, 4.489988864128730e+01,
00360 -7.483314773547885e+01, -2.993325909419154e+01, -7.483314773547884e+00,
00361 7.483314773547882e+01, 4.489988864128729e+01, 2.244994432064365e+01,
00362 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
00363 -3.794733192202055e+01, -1.517893276880822e+02, -9.486832980505139e+01,
00364 -3.794733192202055e+01, -6.324555320336759e+01, -6.324555320336759e+00,
00365 -3.794733192202055e+01, 2.529822128134703e+01, 8.221921916437785e+01,
00366 -3.794733192202055e+01, 1.138419957660617e+02, 1.707629936490925e+02,
00367 5.059644256269407e+01, -6.324555320336759e+01, -5.059644256269407e+01,
00368 5.059644256269407e+01, 2.529822128134703e+01, 3.794733192202055e+01,
00369 5.059644256269407e+01, 1.138419957660616e+02, 1.264911064067352e+02,
00370 1.391402170474087e+02, 2.529822128134704e+01, -6.324555320336762e+00,
00371 1.391402170474087e+02, 1.138419957660617e+02, 8.221921916437786e+01,
00372 2.276839915321233e+02, 1.138419957660617e+02, 3.794733192202055e+01,
00373 0.000000000000000e+00, -5.878775382679627e+01, -1.616663230236897e+02,
00374 0.000000000000000e+00, -5.878775382679627e+01, -9.308061022576078e+01,
00375 0.000000000000000e+00, -5.878775382679627e+01, -2.449489742783179e+01,
00376 0.000000000000000e+00, -5.878775382679627e+01, 4.409081537009720e+01,
00377 0.000000000000000e+00, 9.797958971132708e+00, -5.878775382679628e+01,
00378 0.000000000000000e+00, 9.797958971132708e+00, 9.797958971132703e+00,
00379 0.000000000000000e+00, 9.797958971132708e+00, 7.838367176906168e+01,
00380 0.000000000000000e+00, 7.838367176906168e+01, 4.409081537009718e+01,
00381 0.000000000000000e+00, 7.838367176906168e+01, 1.126765281680262e+02,
00382 0.000000000000000e+00, 1.469693845669907e+02, 1.469693845669907e+02,
00383 0.000000000000000e+00, 0.000000000000000e+00, -1.272792206135786e+02,
00384 0.000000000000000e+00, 0.000000000000000e+00, -1.272792206135786e+02,
00385 0.000000000000000e+00, 0.000000000000000e+00, -1.272792206135785e+02,
00386 0.000000000000000e+00, 0.000000000000000e+00, -1.272792206135786e+02,
00387 0.000000000000000e+00, 0.000000000000000e+00, -2.828427124746190e+01,
00388 0.000000000000000e+00, 0.000000000000000e+00, -2.828427124746190e+01,
00389 0.000000000000000e+00, 0.000000000000000e+00, -2.828427124746190e+01,
00390 0.000000000000000e+00, 0.000000000000000e+00, 7.071067811865474e+01,
00391 0.000000000000000e+00, 0.000000000000000e+00, 7.071067811865474e+01,
00392 0.000000000000000e+00, 0.000000000000000e+00, 1.697056274847714e+02
00393 
00394     };
00395     int fiat_index_cur = 0;
00396     for (int i=0;i<polydim;i++) {
00397       for (int j=0;j<np_lattice;j++) {
00398         for (int k=0;k<3;k++) {
00399           if (std::abs( dBasisAtLattice(i,j,k) - fiat_vals[fiat_index_cur] ) > 10.0*INTREPID_TOL ) {
00400             errorFlag++;
00401             *outStream << std::setw(70) << "^^^^----FAILURE!" << "\n";
00402             
00403             // Output the multi-index of the value where the error is:
00404             *outStream << " At multi-index { ";
00405             *outStream << i << " " << j << " " << k;
00406             *outStream << "}  computed value: " << dBasisAtLattice(i,j,k)
00407                       << " but correct value: " << fiat_vals[fiat_index_cur] << "\n";
00408             *outStream << "Difference: " << std::abs( dBasisAtLattice(i,j,k) - fiat_vals[fiat_index_cur] ) << "\n";
00409           }
00410           fiat_index_cur++;
00411         }
00412       }
00413     }
00414   }
00415   catch ( std::exception err) {
00416     *outStream << err.what() << "\n\n";
00417     errorFlag = -1000;
00418   }
00419 
00420 
00421   if (errorFlag != 0)
00422     std::cout << "End Result: TEST FAILED\n";
00423   else
00424     std::cout << "End Result: TEST PASSED\n";
00425   
00426   // reset format state of std::cout
00427   std::cout.copyfmt(oldFormatState);
00428   
00429   return errorFlag;
00430 }