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