Intrepid
http://trilinos.sandia.gov/packages/docs/r10.12/packages/intrepid/test/Shared/ArrayTools/test_02.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 
00049 #include "Intrepid_ArrayTools.hpp"
00050 #include "Intrepid_FieldContainer.hpp"
00051 #include "Intrepid_RealSpaceTools.hpp"
00052 #include "Teuchos_oblackholestream.hpp"
00053 #include "Teuchos_RCP.hpp"
00054 #include "Teuchos_ScalarTraits.hpp"
00055 #include "Teuchos_GlobalMPISession.hpp"
00056 
00057 using namespace std;
00058 using namespace Intrepid;
00059 
00060 #define INTREPID_TEST_COMMAND( S )                                                                                  \
00061 {                                                                                                                   \
00062   try {                                                                                                             \
00063     S ;                                                                                                             \
00064   }                                                                                                                 \
00065   catch (std::logic_error err) {                                                                                    \
00066       *outStream << "Expected Error ----------------------------------------------------------------\n";            \
00067       *outStream << err.what() << '\n';                                                                             \
00068       *outStream << "-------------------------------------------------------------------------------" << "\n\n";    \
00069   };                                                                                                                \
00070 }
00071 
00072 
00073 int main(int argc, char *argv[]) {
00074 
00075   Teuchos::GlobalMPISession mpiSession(&argc, &argv);
00076 
00077   // This little trick lets us print to std::cout only if
00078   // a (dummy) command-line argument is provided.
00079   int iprint     = argc - 1;
00080   Teuchos::RCP<std::ostream> outStream;
00081   Teuchos::oblackholestream bhs; // outputs nothing
00082   if (iprint > 0)
00083     outStream = Teuchos::rcp(&std::cout, false);
00084   else
00085     outStream = Teuchos::rcp(&bhs, false);
00086 
00087   // Save the format state of the original std::cout.
00088   Teuchos::oblackholestream oldFormatState;
00089   oldFormatState.copyfmt(std::cout);
00090 
00091   *outStream \
00092   << "===============================================================================\n" \
00093   << "|                                                                             |\n" \
00094   << "|                       Unit Test (ArrayTools)                                |\n" \
00095   << "|                                                                             |\n" \
00096   << "|     1) Array operations: scalar multiply                                    |\n" \
00097   << "|                                                                             |\n" \
00098   << "|  Questions? Contact  Pavel Bochev (pbboche@sandia.gov) or                   |\n" \
00099   << "|                      Denis Ridzal (dridzal@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 
00106 
00107   int errorFlag = 0;
00108 #ifdef HAVE_INTREPID_DEBUG
00109   int beginThrowNumber = Teuchos::TestForException_getThrowNumber();
00110   int endThrowNumber = beginThrowNumber + 36;
00111 #endif
00112 
00113   typedef ArrayTools art; 
00114   typedef RealSpaceTools<double> rst; 
00115 #ifdef HAVE_INTREPID_DEBUG
00116   ArrayTools atools;
00117 #endif
00118 
00119   *outStream \
00120   << "\n"
00121   << "===============================================================================\n"\
00122   << "| TEST 1: exceptions                                                          |\n"\
00123   << "===============================================================================\n";
00124 
00125   try{
00126 
00127 #ifdef HAVE_INTREPID_DEBUG
00128     FieldContainer<double> a_2_2(2, 2);
00129     FieldContainer<double> a_10_2(10, 2);
00130     FieldContainer<double> a_10_3(10, 3);
00131     FieldContainer<double> a_10_2_2(10, 2, 2);
00132     FieldContainer<double> a_10_2_3(10, 2, 3);
00133     FieldContainer<double> a_10_3_2(10, 3, 2);
00134     FieldContainer<double> a_9_2_2(9, 2, 2);
00135 
00136     FieldContainer<double> a_10_2_2_2(10, 2, 2, 2);
00137     FieldContainer<double> a_9_2_2_2(9, 2, 2, 2);
00138     FieldContainer<double> a_10_3_2_2(10, 3, 2, 2);
00139     FieldContainer<double> a_10_2_3_2(10, 2, 3, 2);
00140     FieldContainer<double> a_10_2_2_3(10, 2, 2, 3);
00141 
00142     FieldContainer<double> a_10_2_2_2_2(10, 2, 2, 2, 2);
00143     FieldContainer<double> a_9_2_2_2_2(9, 2, 2, 2, 2);
00144     FieldContainer<double> a_10_3_2_2_2(10, 3, 2, 2, 2);
00145     FieldContainer<double> a_10_2_3_2_2(10, 2, 3, 2, 2);
00146     FieldContainer<double> a_10_2_2_3_2(10, 2, 2, 3, 2);
00147     FieldContainer<double> a_10_2_2_2_3(10, 2, 2, 2, 3);
00148 
00149     FieldContainer<double> a_9_2(9, 2);
00150     FieldContainer<double> a_10_1(10, 1);
00151 
00152     FieldContainer<double> a_10_1_2(10, 1, 2);
00153     FieldContainer<double> a_10_1_3(10, 1, 3);
00154 
00155     FieldContainer<double> a_10_1_2_2(10, 1, 2, 2);
00156 
00157     FieldContainer<double> a_2_3_2_2(2, 3, 2, 2);
00158     FieldContainer<double> a_2_2_2_2(2, 2, 2, 2);
00159     FieldContainer<double> a_2_10(2, 10);
00160     FieldContainer<double> a_2(2);
00161 
00162     *outStream << "-> scalarMultiplyDataField:\n";
00163     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataField<double>(a_2_2, a_10_2_2, a_2_2) );
00164     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataField<double>(a_2_2, a_2_2, a_2_2) );
00165     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataField<double>(a_2_2, a_2_2, a_10_2_2) );
00166     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataField<double>(a_10_2_2, a_2_2, a_10_2_2) );
00167     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataField<double>(a_10_2_2, a_10_3, a_10_2_2) );
00168     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataField<double>(a_9_2_2_2_2, a_10_2, a_10_2_2_2_2) );
00169     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataField<double>(a_10_3_2_2_2, a_10_2, a_10_2_2_2_2) );
00170     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataField<double>(a_10_2_3_2_2, a_10_2, a_10_2_2_2_2) );
00171     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataField<double>(a_10_2_2_3_2, a_10_2, a_10_2_2_2_2) );
00172     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataField<double>(a_10_2_2_2_3, a_10_2, a_10_2_2_2_2) );
00173     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataField<double>(a_10_2_2_2_2, a_10_2, a_10_2_2_2_2) );
00174     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataField<double>(a_10_2_2_2_2, a_10_1, a_10_2_2_2_2) );
00175     //
00176     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataField<double>(a_2_2, a_10_2_2, a_2) );
00177     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataField<double>(a_10_2_2_2, a_2_2, a_2) );
00178     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataField<double>(a_10_2_2_2, a_2_2, a_10_2) );
00179     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataField<double>(a_10_2_2, a_10_2, a_2_10) );
00180     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataField<double>(a_10_2_2_2_2, a_9_2, a_2_2_2_2) );
00181     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataField<double>(a_10_3_2_2_2, a_10_2, a_2_2_2_2) );
00182     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataField<double>(a_10_2_3_2_2, a_10_2, a_2_2_2_2) );
00183     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataField<double>(a_10_2_2_3_2, a_10_2, a_2_2_2_2) );
00184     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataField<double>(a_10_2_2_2_3, a_10_2, a_2_2_2_2) );
00185     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataField<double>(a_10_2_2_2_2, a_10_2, a_2_2_2_2) );
00186     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataField<double>(a_10_2_2_2_2, a_10_1, a_2_2_2_2) );
00187 
00188 
00189     FieldContainer<double> a_2_2_2(2, 2, 2);
00190 
00191     *outStream << "-> scalarMultiplyDataData:\n";
00192     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataData<double>(a_2_2, a_10_2_2, a_2_2) );
00193     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataData<double>(a_2, a_2_2, a_2) );
00194     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataData<double>(a_2_2, a_2_2, a_10_2_2) );
00195     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataData<double>(a_10_2_2, a_2_2, a_10_2_2) );
00196     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataData<double>(a_10_2_2, a_10_3, a_10_2_2) );
00197     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataData<double>(a_9_2_2_2, a_10_2, a_10_2_2_2) );
00198     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataData<double>(a_10_3_2_2, a_10_2, a_10_2_2_2) );
00199     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataData<double>(a_10_2_3_2, a_10_2, a_10_2_2_2) );
00200     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataData<double>(a_10_2_2_3, a_10_2, a_10_2_2_2) );
00201     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataData<double>(a_10_2_2_2, a_10_2, a_10_2_2_2) );
00202     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataData<double>(a_10_2_2_2, a_10_1, a_10_2_2_2) );
00203     //
00204     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataData<double>(a_2_2, a_10_2_2, a_2) );
00205     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataData<double>(a_10_2_2_2_2, a_2_2, a_10_2_2_2) );
00206     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataData<double>(a_10_2_2_2, a_2_2, a_10_2) );
00207     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataData<double>(a_10_2_2, a_2_2, a_10_2) );
00208     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataData<double>(a_10_2_2_2, a_9_2, a_2_2_2) );
00209     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataData<double>(a_10_3_2_2, a_10_2, a_2_2_2) );
00210     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataData<double>(a_10_2_3_2, a_10_2, a_2_2_2) );
00211     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataData<double>(a_10_2_2_3, a_10_2, a_2_2_2) );
00212     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataData<double>(a_10_2_2_2, a_10_2, a_2_2_2) );
00213     INTREPID_TEST_COMMAND( atools.scalarMultiplyDataData<double>(a_10_2_2_2, a_10_1, a_2_2_2) );
00214 #endif
00215 
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       { // start scope
00239       *outStream << "\n************ Checking scalarMultiplyDataField, reciprocal=false (branch 1) ************\n";
00240 
00241       int c=5, p=9, f=7, d1=7, d2=13;
00242 
00243       FieldContainer<double> in_c_f_p(c, f, p);
00244       FieldContainer<double> in_c_f_p_d(c, f, p, d1);
00245       FieldContainer<double> in_c_f_p_d_d(c, f, p, d1, d2);
00246       FieldContainer<double> data_c_p(c, p);
00247       FieldContainer<double> datainv_c_p(c, p);
00248       FieldContainer<double> data_c_1(c, 1);
00249       FieldContainer<double> datainv_c_1(c, 1);
00250       FieldContainer<double> out_c_f_p(c, f, p);
00251       FieldContainer<double> outi_c_f_p(c, f, p);
00252       FieldContainer<double> out_c_f_p_d(c, f, p, d1);
00253       FieldContainer<double> outi_c_f_p_d(c, f, p, d1);
00254       FieldContainer<double> out_c_f_p_d_d(c, f, p, d1, d2);
00255       FieldContainer<double> outi_c_f_p_d_d(c, f, p, d1, d2);
00256       double zero = INTREPID_TOL*10000.0;
00257 
00258       // fill with random numbers
00259       for (int i=0; i<in_c_f_p.size(); i++) {
00260         in_c_f_p[i] = Teuchos::ScalarTraits<double>::random();
00261       }
00262       for (int i=0; i<in_c_f_p_d.size(); i++) {
00263         in_c_f_p_d[i] = Teuchos::ScalarTraits<double>::random();
00264       }
00265       for (int i=0; i<in_c_f_p_d_d.size(); i++) {
00266         in_c_f_p_d_d[i] = Teuchos::ScalarTraits<double>::random();
00267       }
00268       for (int i=0; i<data_c_p.size(); i++) {
00269         data_c_p[i] = Teuchos::ScalarTraits<double>::random();
00270         datainv_c_p[i] = 1.0 / data_c_p[i];
00271       }
00272       for (int i=0; i<data_c_1.size(); i++) {
00273         data_c_1[i] = Teuchos::ScalarTraits<double>::random();
00274         datainv_c_1[i] = 1.0 / data_c_1[i];
00275       }
00276 
00277       art::scalarMultiplyDataField<double>(out_c_f_p, data_c_p, in_c_f_p);
00278       art::scalarMultiplyDataField<double>(outi_c_f_p, datainv_c_p, out_c_f_p);
00279       rst::subtract(&outi_c_f_p[0], &in_c_f_p[0], outi_c_f_p.size());
00280       if (rst::vectorNorm(&outi_c_f_p[0], outi_c_f_p.size(), NORM_ONE) > zero) {
00281         *outStream << "\n\nINCORRECT scalarMultiplyDataField (1): check scalar inverse property\n\n";
00282         errorFlag = -1000;
00283       }
00284       art::scalarMultiplyDataField<double>(out_c_f_p_d, data_c_p, in_c_f_p_d);
00285       art::scalarMultiplyDataField<double>(outi_c_f_p_d, datainv_c_p, out_c_f_p_d);
00286       rst::subtract(&outi_c_f_p_d[0], &in_c_f_p_d[0], outi_c_f_p_d.size());
00287       if (rst::vectorNorm(&outi_c_f_p_d[0], outi_c_f_p_d.size(), NORM_ONE) > zero) {
00288         *outStream << "\n\nINCORRECT scalarMultiplyDataField (2): check scalar inverse property\n\n";
00289         errorFlag = -1000;
00290       }
00291       art::scalarMultiplyDataField<double>(out_c_f_p_d_d, data_c_p, in_c_f_p_d_d);
00292       art::scalarMultiplyDataField<double>(outi_c_f_p_d_d, datainv_c_p, out_c_f_p_d_d);
00293       rst::subtract(&outi_c_f_p_d_d[0], &in_c_f_p_d_d[0], outi_c_f_p_d_d.size());
00294       if (rst::vectorNorm(&outi_c_f_p_d_d[0], outi_c_f_p_d_d.size(), NORM_ONE) > zero) {
00295         *outStream << "\n\nINCORRECT scalarMultiplyDataField (3): check scalar inverse property\n\n";
00296         errorFlag = -1000;
00297       }
00298       art::scalarMultiplyDataField<double>(out_c_f_p_d_d, data_c_1, in_c_f_p_d_d);
00299       art::scalarMultiplyDataField<double>(outi_c_f_p_d_d, datainv_c_1, out_c_f_p_d_d);
00300       rst::subtract(&outi_c_f_p_d_d[0], &in_c_f_p_d_d[0], outi_c_f_p_d_d.size());
00301       if (rst::vectorNorm(&outi_c_f_p_d_d[0], outi_c_f_p_d_d.size(), NORM_ONE) > zero) {
00302         *outStream << "\n\nINCORRECT scalarMultiplyDataField (4): check scalar inverse property\n\n";
00303         errorFlag = -1000;
00304       }
00305 
00306       // fill with constants
00307       for (int i=0; i<in_c_f_p_d_d.size(); i++) {
00308         in_c_f_p_d_d[i] = 1.0;
00309       }
00310       for (int i=0; i<data_c_p.size(); i++) {
00311         data_c_p[i] = 5.0;
00312       }
00313       for (int i=0; i<data_c_1.size(); i++) {
00314         data_c_1[i] = 5.0;
00315       }
00316       art::scalarMultiplyDataField<double>(out_c_f_p_d_d, data_c_p, in_c_f_p_d_d);
00317       if (std::abs(rst::vectorNorm(&out_c_f_p_d_d[0], out_c_f_p_d_d.size(), NORM_ONE) - data_c_p[0]*in_c_f_p_d_d[0]*c*p*f*d1*d2) > zero) {
00318         *outStream << "\n\nINCORRECT scalarMultiplyDataField (5): check result: "
00319                    << rst::vectorNorm(&out_c_f_p_d_d[0], out_c_f_p_d_d.size(), NORM_ONE) << " != "
00320                    << data_c_p[0]*in_c_f_p_d_d[0]*c*f*p*d1*d2 << "\n\n";
00321         errorFlag = -1000;
00322       }
00323       art::scalarMultiplyDataField<double>(out_c_f_p_d_d, data_c_1, in_c_f_p_d_d);
00324       if (std::abs(rst::vectorNorm(&out_c_f_p_d_d[0], out_c_f_p_d_d.size(), NORM_ONE) - data_c_1[0]*in_c_f_p_d_d[0]*c*p*f*d1*d2) > zero) {
00325         *outStream << "\n\nINCORRECT scalarMultiplyDataField (6): check result: "
00326                    << rst::vectorNorm(&out_c_f_p_d_d[0], out_c_f_p_d_d.size(), NORM_ONE) << " != "
00327                    << data_c_p[0]*in_c_f_p_d_d[0]*c*f*p*d1*d2 << "\n\n";
00328         errorFlag = -1000;
00329       }
00330       } // end scope
00331 
00332       { // start scope
00333       *outStream << "\n************ Checking scalarMultiplyDataField, reciprocal=false (branch 2) ************\n";
00334 
00335       int c=5, p=9, f=7, d1=7, d2=13;
00336 
00337       FieldContainer<double> in_f_p(f, p);
00338       FieldContainer<double> in_f_p_d(f, p, d1);
00339       FieldContainer<double> in_f_p_d_d(f, p, d1, d2);
00340       FieldContainer<double> in_c_f_p(c, f, p);
00341       FieldContainer<double> in_c_f_p_d(c, f, p, d1);
00342       FieldContainer<double> in_c_f_p_d_d(c, f, p, d1, d2);
00343       FieldContainer<double> data_c_p(c, p);
00344       FieldContainer<double> datainv_c_p(c, p);
00345       FieldContainer<double> data_c_1(c, 1);
00346       FieldContainer<double> datainv_c_1(c, 1);
00347       FieldContainer<double> data_c_p_one(c, p);
00348       FieldContainer<double> data_c_1_one(c, 1);
00349       FieldContainer<double> out_c_f_p(c, f, p);
00350       FieldContainer<double> outi_c_f_p(c, f, p);
00351       FieldContainer<double> out_c_f_p_d(c, f, p, d1);
00352       FieldContainer<double> outi_c_f_p_d(c, f, p, d1);
00353       FieldContainer<double> out_c_f_p_d_d(c, f, p, d1, d2);
00354       FieldContainer<double> outi_c_f_p_d_d(c, f, p, d1, d2);
00355       double zero = INTREPID_TOL*10000.0;
00356 
00357       // fill with random numbers
00358       for (int i=0; i<in_f_p.size(); i++) {
00359         in_f_p[i] = Teuchos::ScalarTraits<double>::random();
00360       }
00361       for (int i=0; i<in_f_p_d.size(); i++) {
00362         in_f_p_d[i] = Teuchos::ScalarTraits<double>::random();
00363       }
00364       for (int i=0; i<in_f_p_d_d.size(); i++) {
00365         in_f_p_d_d[i] = Teuchos::ScalarTraits<double>::random();
00366       }
00367       for (int i=0; i<data_c_p.size(); i++) {
00368         data_c_p[i] = Teuchos::ScalarTraits<double>::random();
00369         datainv_c_p[i] = 1.0 / data_c_p[i];
00370         data_c_p_one[i] = 1.0;
00371       }
00372       for (int i=0; i<data_c_1.size(); i++) {
00373         data_c_1[i] = Teuchos::ScalarTraits<double>::random();
00374         datainv_c_1[i] = 1.0 / data_c_1[i];
00375         data_c_1_one[i] = 1.0;
00376       }
00377 
00378       art::scalarMultiplyDataField<double>(out_c_f_p, data_c_p, in_f_p);
00379       art::scalarMultiplyDataField<double>(outi_c_f_p, datainv_c_p, out_c_f_p);
00380       art::scalarMultiplyDataField<double>(in_c_f_p, data_c_p_one, in_f_p);
00381       rst::subtract(&outi_c_f_p[0], &in_c_f_p[0], outi_c_f_p.size());
00382       if (rst::vectorNorm(&outi_c_f_p[0], outi_c_f_p.size(), NORM_ONE) > zero) {
00383         *outStream << "\n\nINCORRECT scalarMultiplyDataField (1): check scalar inverse property\n\n";
00384         errorFlag = -1000;
00385       }
00386       art::scalarMultiplyDataField<double>(out_c_f_p_d, data_c_p, in_f_p_d);
00387       art::scalarMultiplyDataField<double>(outi_c_f_p_d, datainv_c_p, out_c_f_p_d);
00388       art::scalarMultiplyDataField<double>(in_c_f_p_d, data_c_p_one, in_f_p_d);
00389       rst::subtract(&outi_c_f_p_d[0], &in_c_f_p_d[0], outi_c_f_p_d.size());
00390       if (rst::vectorNorm(&outi_c_f_p_d[0], outi_c_f_p_d.size(), NORM_ONE) > zero) {
00391         *outStream << "\n\nINCORRECT scalarMultiplyDataField (2): check scalar inverse property\n\n";
00392         errorFlag = -1000;
00393       }
00394       art::scalarMultiplyDataField<double>(out_c_f_p_d_d, data_c_p, in_f_p_d_d);
00395       art::scalarMultiplyDataField<double>(outi_c_f_p_d_d, datainv_c_p, out_c_f_p_d_d);
00396       art::scalarMultiplyDataField<double>(in_c_f_p_d_d, data_c_p_one, in_f_p_d_d);
00397       rst::subtract(&outi_c_f_p_d_d[0], &in_c_f_p_d_d[0], outi_c_f_p_d_d.size());
00398       if (rst::vectorNorm(&outi_c_f_p_d_d[0], outi_c_f_p_d_d.size(), NORM_ONE) > zero) {
00399         *outStream << "\n\nINCORRECT scalarMultiplyDataField (3): check scalar inverse property\n\n";
00400         errorFlag = -1000;
00401       }
00402       art::scalarMultiplyDataField<double>(out_c_f_p_d_d, data_c_1, in_f_p_d_d);
00403       art::scalarMultiplyDataField<double>(outi_c_f_p_d_d, datainv_c_1, out_c_f_p_d_d);
00404       art::scalarMultiplyDataField<double>(in_c_f_p_d_d, data_c_p_one, in_f_p_d_d);
00405       rst::subtract(&outi_c_f_p_d_d[0], &in_c_f_p_d_d[0], outi_c_f_p_d_d.size());
00406       if (rst::vectorNorm(&outi_c_f_p_d_d[0], outi_c_f_p_d_d.size(), NORM_ONE) > zero) {
00407         *outStream << "\n\nINCORRECT scalarMultiplyDataField (4): check scalar inverse property\n\n";
00408         errorFlag = -1000;
00409       }
00410 
00411       // fill with constants
00412       for (int i=0; i<in_f_p_d_d.size(); i++) {
00413         in_f_p_d_d[i] = 1.0;
00414       }
00415       for (int i=0; i<data_c_p.size(); i++) {
00416         data_c_p[i] = 5.0;
00417       }
00418       for (int i=0; i<data_c_1.size(); i++) {
00419         data_c_1[i] = 5.0;
00420       }
00421       art::scalarMultiplyDataField<double>(out_c_f_p_d_d, data_c_p, in_f_p_d_d);
00422       if (std::abs(rst::vectorNorm(&out_c_f_p_d_d[0], out_c_f_p_d_d.size(), NORM_ONE) - data_c_p[0]*in_f_p_d_d[0]*c*p*f*d1*d2) > zero) {
00423         *outStream << "\n\nINCORRECT scalarMultiplyDataField (5): check result: "
00424                    << rst::vectorNorm(&out_c_f_p_d_d[0], out_c_f_p_d_d.size(), NORM_ONE) << " != "
00425                    << data_c_p[0]*in_f_p_d_d[0]*c*f*p*d1*d2 << "\n\n";
00426         errorFlag = -1000;
00427       }
00428       art::scalarMultiplyDataField<double>(out_c_f_p_d_d, data_c_1, in_f_p_d_d);
00429       if (std::abs(rst::vectorNorm(&out_c_f_p_d_d[0], out_c_f_p_d_d.size(), NORM_ONE) - data_c_1[0]*in_f_p_d_d[0]*c*p*f*d1*d2) > zero) {
00430         *outStream << "\n\nINCORRECT scalarMultiplyDataField (6): check result: "
00431                    << rst::vectorNorm(&out_c_f_p_d_d[0], out_c_f_p_d_d.size(), NORM_ONE) << " != "
00432                    << data_c_1[0]*in_f_p_d_d[0]*c*f*p*d1*d2 << "\n\n";
00433         errorFlag = -1000;
00434       }
00435       } // end scope
00436 
00437       { // start scope
00438       *outStream << "\n************ Checking scalarMultiplyDataField, reciprocal=true, i.e. division (branch 1) ************\n";
00439 
00440       int c=5, p=9, f=7, d1=7, d2=13;
00441 
00442       FieldContainer<double> in_c_f_p(c, f, p);
00443       FieldContainer<double> in_c_f_p_d(c, f, p, d1);
00444       FieldContainer<double> in_c_f_p_d_d(c, f, p, d1, d2);
00445       FieldContainer<double> data_c_p(c, p);
00446       FieldContainer<double> datainv_c_p(c, p);
00447       FieldContainer<double> data_c_1(c, 1);
00448       FieldContainer<double> datainv_c_1(c, 1);
00449       FieldContainer<double> out_c_f_p(c, f, p);
00450       FieldContainer<double> outi_c_f_p(c, f, p);
00451       FieldContainer<double> out_c_f_p_d(c, f, p, d1);
00452       FieldContainer<double> outi_c_f_p_d(c, f, p, d1);
00453       FieldContainer<double> out_c_f_p_d_d(c, f, p, d1, d2);
00454       FieldContainer<double> outi_c_f_p_d_d(c, f, p, d1, d2);
00455       double zero = INTREPID_TOL*10000.0;
00456 
00457       // fill with random numbers
00458       for (int i=0; i<in_c_f_p.size(); i++) {
00459         in_c_f_p[i] = Teuchos::ScalarTraits<double>::random();
00460       }
00461       for (int i=0; i<in_c_f_p_d.size(); i++) {
00462         in_c_f_p_d[i] = Teuchos::ScalarTraits<double>::random();
00463       }
00464       for (int i=0; i<in_c_f_p_d_d.size(); i++) {
00465         in_c_f_p_d_d[i] = Teuchos::ScalarTraits<double>::random();
00466       }
00467       for (int i=0; i<data_c_p.size(); i++) {
00468         data_c_p[i] = Teuchos::ScalarTraits<double>::random();
00469         datainv_c_p[i] = 1.0 / data_c_p[i];
00470       }
00471       for (int i=0; i<data_c_1.size(); i++) {
00472         data_c_1[i] = Teuchos::ScalarTraits<double>::random();
00473         datainv_c_1[i] = 1.0 / data_c_1[i];
00474       }
00475 
00476       art::scalarMultiplyDataField<double>(out_c_f_p, data_c_p, in_c_f_p, true);
00477       art::scalarMultiplyDataField<double>(outi_c_f_p, datainv_c_p, out_c_f_p, true);
00478       rst::subtract(&outi_c_f_p[0], &in_c_f_p[0], outi_c_f_p.size());
00479       if (rst::vectorNorm(&outi_c_f_p[0], outi_c_f_p.size(), NORM_ONE) > zero) {
00480         *outStream << "\n\nINCORRECT scalarMultiplyDataField (1): check scalar inverse property\n\n";
00481         errorFlag = -1000;
00482       }
00483       art::scalarMultiplyDataField<double>(out_c_f_p_d, data_c_p, in_c_f_p_d, true);
00484       art::scalarMultiplyDataField<double>(outi_c_f_p_d, datainv_c_p, out_c_f_p_d, true);
00485       rst::subtract(&outi_c_f_p_d[0], &in_c_f_p_d[0], outi_c_f_p_d.size());
00486       if (rst::vectorNorm(&outi_c_f_p_d[0], outi_c_f_p_d.size(), NORM_ONE) > zero) {
00487         *outStream << "\n\nINCORRECT scalarMultiplyDataField (2): check scalar inverse property\n\n";
00488         errorFlag = -1000;
00489       }
00490       art::scalarMultiplyDataField<double>(out_c_f_p_d_d, data_c_p, in_c_f_p_d_d, true);
00491       art::scalarMultiplyDataField<double>(outi_c_f_p_d_d, datainv_c_p, out_c_f_p_d_d, true);
00492       rst::subtract(&outi_c_f_p_d_d[0], &in_c_f_p_d_d[0], outi_c_f_p_d_d.size());
00493       if (rst::vectorNorm(&outi_c_f_p_d_d[0], outi_c_f_p_d_d.size(), NORM_ONE) > zero) {
00494         *outStream << "\n\nINCORRECT scalarMultiplyDataField (3): check scalar inverse property\n\n";
00495         errorFlag = -1000;
00496       }
00497       art::scalarMultiplyDataField<double>(out_c_f_p_d_d, data_c_1, in_c_f_p_d_d, true);
00498       art::scalarMultiplyDataField<double>(outi_c_f_p_d_d, datainv_c_1, out_c_f_p_d_d, true);
00499       rst::subtract(&outi_c_f_p_d_d[0], &in_c_f_p_d_d[0], outi_c_f_p_d_d.size());
00500       if (rst::vectorNorm(&outi_c_f_p_d_d[0], outi_c_f_p_d_d.size(), NORM_ONE) > zero) {
00501         *outStream << "\n\nINCORRECT scalarMultiplyDataField (4): check scalar inverse property\n\n";
00502         errorFlag = -1000;
00503       }
00504 
00505       // fill with constants
00506       for (int i=0; i<in_c_f_p_d_d.size(); i++) {
00507         in_c_f_p_d_d[i] = 1.0;
00508       }
00509       for (int i=0; i<data_c_p.size(); i++) {
00510         data_c_p[i] = 5.0;
00511       }
00512       for (int i=0; i<data_c_1.size(); i++) {
00513         data_c_1[i] = 5.0;
00514       }
00515       art::scalarMultiplyDataField<double>(out_c_f_p_d_d, data_c_p, in_c_f_p_d_d, true);
00516       if (std::abs(rst::vectorNorm(&out_c_f_p_d_d[0], out_c_f_p_d_d.size(), NORM_ONE) - (1.0/data_c_p[0])*in_c_f_p_d_d[0]*c*p*f*d1*d2)/rst::vectorNorm(&out_c_f_p_d_d[0], out_c_f_p_d_d.size(), NORM_ONE) > zero) {
00517         *outStream << "\n\nINCORRECT scalarMultiplyDataField (5): check result: "
00518                    << rst::vectorNorm(&out_c_f_p_d_d[0], out_c_f_p_d_d.size(), NORM_ONE) << " != "
00519                    << (1.0/data_c_p[0])*in_c_f_p_d_d[0]*c*p*f*d1*d2 << "\n\n";
00520         errorFlag = -1000;
00521       }
00522       art::scalarMultiplyDataField<double>(out_c_f_p_d_d, data_c_1, in_c_f_p_d_d, true);
00523       if (std::abs(rst::vectorNorm(&out_c_f_p_d_d[0], out_c_f_p_d_d.size(), NORM_ONE) - (1.0/data_c_1[0])*in_c_f_p_d_d[0]*c*p*f*d1*d2)/rst::vectorNorm(&out_c_f_p_d_d[0], out_c_f_p_d_d.size(), NORM_ONE) > zero) {
00524         *outStream << "\n\nINCORRECT scalarMultiplyDataField (6): check result: "
00525                    << rst::vectorNorm(&out_c_f_p_d_d[0], out_c_f_p_d_d.size(), NORM_ONE) << " != "
00526                    << (1.0/data_c_p[0])*in_c_f_p_d_d[0]*c*p*f*d1*d2 << "\n\n";
00527         errorFlag = -1000;
00528       }
00529       } // end scope
00530 
00531       { // start scope
00532       *outStream << "\n************ Checking scalarMultiplyDataField, reciprocal=true, i.e. division (branch 2) ************\n";
00533 
00534       int c=5, p=9, f=7, d1=7, d2=13;
00535 
00536       FieldContainer<double> in_f_p(f, p);
00537       FieldContainer<double> in_f_p_d(f, p, d1);
00538       FieldContainer<double> in_f_p_d_d(f, p, d1, d2);
00539       FieldContainer<double> in_c_f_p(c, f, p);
00540       FieldContainer<double> in_c_f_p_d(c, f, p, d1);
00541       FieldContainer<double> in_c_f_p_d_d(c, f, p, d1, d2);
00542       FieldContainer<double> data_c_p(c, p);
00543       FieldContainer<double> datainv_c_p(c, p);
00544       FieldContainer<double> data_c_1(c, 1);
00545       FieldContainer<double> datainv_c_1(c, 1);
00546       FieldContainer<double> data_c_p_one(c, p);
00547       FieldContainer<double> data_c_1_one(c, 1);
00548       FieldContainer<double> out_c_f_p(c, f, p);
00549       FieldContainer<double> outi_c_f_p(c, f, p);
00550       FieldContainer<double> out_c_f_p_d(c, f, p, d1);
00551       FieldContainer<double> outi_c_f_p_d(c, f, p, d1);
00552       FieldContainer<double> out_c_f_p_d_d(c, f, p, d1, d2);
00553       FieldContainer<double> outi_c_f_p_d_d(c, f, p, d1, d2);
00554       double zero = INTREPID_TOL*10000.0;
00555 
00556       // fill with random numbers
00557       for (int i=0; i<in_f_p.size(); i++) {
00558         in_f_p[i] = Teuchos::ScalarTraits<double>::random();
00559       }
00560       for (int i=0; i<in_f_p_d.size(); i++) {
00561         in_f_p_d[i] = Teuchos::ScalarTraits<double>::random();
00562       }
00563       for (int i=0; i<in_f_p_d_d.size(); i++) {
00564         in_f_p_d_d[i] = Teuchos::ScalarTraits<double>::random();
00565       }
00566       for (int i=0; i<data_c_p.size(); i++) {
00567         data_c_p[i] = Teuchos::ScalarTraits<double>::random();
00568         datainv_c_p[i] = 1.0 / data_c_p[i];
00569         data_c_p_one[i] = 1.0;
00570       }
00571       for (int i=0; i<data_c_1.size(); i++) {
00572         data_c_1[i] = Teuchos::ScalarTraits<double>::random();
00573         datainv_c_1[i] = 1.0 / data_c_1[i];
00574         data_c_1_one[i] = 1.0;
00575       }
00576 
00577       art::scalarMultiplyDataField<double>(out_c_f_p, data_c_p, in_f_p, true);
00578       art::scalarMultiplyDataField<double>(outi_c_f_p, datainv_c_p, out_c_f_p, true);
00579       art::scalarMultiplyDataField<double>(in_c_f_p, data_c_p_one, in_f_p);
00580       rst::subtract(&outi_c_f_p[0], &in_c_f_p[0], outi_c_f_p.size());
00581       if (rst::vectorNorm(&outi_c_f_p[0], outi_c_f_p.size(), NORM_ONE) > zero) {
00582         *outStream << "\n\nINCORRECT scalarMultiplyDataField (1): check scalar inverse property\n\n";
00583         errorFlag = -1000;
00584       }
00585       art::scalarMultiplyDataField<double>(out_c_f_p_d, data_c_p, in_f_p_d, true);
00586       art::scalarMultiplyDataField<double>(outi_c_f_p_d, datainv_c_p, out_c_f_p_d, true);
00587       art::scalarMultiplyDataField<double>(in_c_f_p_d, data_c_p_one, in_f_p_d);
00588       rst::subtract(&outi_c_f_p_d[0], &in_c_f_p_d[0], outi_c_f_p_d.size());
00589       if (rst::vectorNorm(&outi_c_f_p_d[0], outi_c_f_p_d.size(), NORM_ONE) > zero) {
00590         *outStream << "\n\nINCORRECT scalarMultiplyDataField (2): check scalar inverse property\n\n";
00591         errorFlag = -1000;
00592       }
00593       art::scalarMultiplyDataField<double>(out_c_f_p_d_d, data_c_p, in_f_p_d_d, true);
00594       art::scalarMultiplyDataField<double>(outi_c_f_p_d_d, datainv_c_p, out_c_f_p_d_d, true);
00595       art::scalarMultiplyDataField<double>(in_c_f_p_d_d, data_c_p_one, in_f_p_d_d);
00596       rst::subtract(&outi_c_f_p_d_d[0], &in_c_f_p_d_d[0], outi_c_f_p_d_d.size());
00597       if (rst::vectorNorm(&outi_c_f_p_d_d[0], outi_c_f_p_d_d.size(), NORM_ONE) > zero) {
00598         *outStream << "\n\nINCORRECT scalarMultiplyDataField (3): check scalar inverse property\n\n";
00599         errorFlag = -1000;
00600       }
00601       art::scalarMultiplyDataField<double>(out_c_f_p_d_d, data_c_1, in_f_p_d_d, true);
00602       art::scalarMultiplyDataField<double>(outi_c_f_p_d_d, datainv_c_1, out_c_f_p_d_d, true);
00603       art::scalarMultiplyDataField<double>(in_c_f_p_d_d, data_c_p_one, in_f_p_d_d);
00604       rst::subtract(&outi_c_f_p_d_d[0], &in_c_f_p_d_d[0], outi_c_f_p_d_d.size());
00605       if (rst::vectorNorm(&outi_c_f_p_d_d[0], outi_c_f_p_d_d.size(), NORM_ONE) > zero) {
00606         *outStream << "\n\nINCORRECT scalarMultiplyDataField (4): check scalar inverse property\n\n";
00607         errorFlag = -1000;
00608       }
00609 
00610       // fill with constants
00611       for (int i=0; i<in_f_p_d_d.size(); i++) {
00612         in_f_p_d_d[i] = 1.0;
00613       }
00614       for (int i=0; i<data_c_p.size(); i++) {
00615         data_c_p[i] = 5.0;
00616       }
00617       for (int i=0; i<data_c_1.size(); i++) {
00618         data_c_1[i] = 5.0;
00619       }
00620       art::scalarMultiplyDataField<double>(out_c_f_p_d_d, data_c_p, in_f_p_d_d, true);
00621       if (std::abs(rst::vectorNorm(&out_c_f_p_d_d[0], out_c_f_p_d_d.size(), NORM_ONE) - (1.0/data_c_p[0])*in_f_p_d_d[0]*c*p*f*d1*d2)/rst::vectorNorm(&out_c_f_p_d_d[0], out_c_f_p_d_d.size(), NORM_ONE) > zero) {
00622         *outStream << "\n\nINCORRECT scalarMultiplyDataField (5): check result: "
00623                    << rst::vectorNorm(&out_c_f_p_d_d[0], out_c_f_p_d_d.size(), NORM_ONE) << " != "
00624                    << (1.0/data_c_p[0])*in_f_p_d_d[0]*c*p*f*d1*d2 << "\n\n";
00625         errorFlag = -1000;
00626       }
00627       art::scalarMultiplyDataField<double>(out_c_f_p_d_d, data_c_1, in_f_p_d_d, true);
00628       if (std::abs(rst::vectorNorm(&out_c_f_p_d_d[0], out_c_f_p_d_d.size(), NORM_ONE) - (1.0/data_c_1[0])*in_f_p_d_d[0]*c*p*f*d1*d2)/rst::vectorNorm(&out_c_f_p_d_d[0], out_c_f_p_d_d.size(), NORM_ONE) > zero) {
00629         *outStream << "\n\nINCORRECT scalarMultiplyDataField (6): check result: "
00630                    << rst::vectorNorm(&out_c_f_p_d_d[0], out_c_f_p_d_d.size(), NORM_ONE) << " != "
00631                    << (1.0/data_c_1[0])*in_f_p_d_d[0]*c*p*f*d1*d2 << "\n\n";
00632         errorFlag = -1000;
00633       }
00634       } // end scope
00635 
00636 
00637 
00638 
00639       { // start scope
00640       *outStream << "\n************ Checking scalarMultiplyDataData, reciprocal=false (branch 1) ************\n";
00641 
00642       int c=5, p=9, d1=7, d2=13;
00643 
00644       FieldContainer<double> in_c_p(c, p);
00645       FieldContainer<double> in_c_p_d(c, p, d1);
00646       FieldContainer<double> in_c_p_d_d(c, p, d1, d2);
00647       FieldContainer<double> data_c_p(c, p);
00648       FieldContainer<double> datainv_c_p(c, p);
00649       FieldContainer<double> data_c_1(c, 1);
00650       FieldContainer<double> datainv_c_1(c, 1);
00651       FieldContainer<double> out_c_p(c, p);
00652       FieldContainer<double> outi_c_p(c, p);
00653       FieldContainer<double> out_c_p_d(c, p, d1);
00654       FieldContainer<double> outi_c_p_d(c, p, d1);
00655       FieldContainer<double> out_c_p_d_d(c, p, d1, d2);
00656       FieldContainer<double> outi_c_p_d_d(c, p, d1, d2);
00657       double zero = INTREPID_TOL*10000.0;
00658 
00659       // fill with random numbers
00660       for (int i=0; i<in_c_p.size(); i++) {
00661         in_c_p[i] = Teuchos::ScalarTraits<double>::random();
00662       }
00663       for (int i=0; i<in_c_p_d.size(); i++) {
00664         in_c_p_d[i] = Teuchos::ScalarTraits<double>::random();
00665       }
00666       for (int i=0; i<in_c_p_d_d.size(); i++) {
00667         in_c_p_d_d[i] = Teuchos::ScalarTraits<double>::random();
00668       }
00669       for (int i=0; i<data_c_p.size(); i++) {
00670         data_c_p[i] = Teuchos::ScalarTraits<double>::random();
00671         datainv_c_p[i] = 1.0 / data_c_p[i];
00672       }
00673       for (int i=0; i<data_c_1.size(); i++) {
00674         data_c_1[i] = Teuchos::ScalarTraits<double>::random();
00675         datainv_c_1[i] = 1.0 / data_c_1[i];
00676       }
00677 
00678       art::scalarMultiplyDataData<double>(out_c_p, data_c_p, in_c_p);
00679       art::scalarMultiplyDataData<double>(outi_c_p, datainv_c_p, out_c_p);
00680       rst::subtract(&outi_c_p[0], &in_c_p[0], outi_c_p.size());
00681       if (rst::vectorNorm(&outi_c_p[0], outi_c_p.size(), NORM_ONE) > zero) {
00682         *outStream << "\n\nINCORRECT scalarMultiplyDataData (1): check scalar inverse property\n\n";
00683         errorFlag = -1000;
00684       }
00685       art::scalarMultiplyDataData<double>(out_c_p_d, data_c_p, in_c_p_d);
00686       art::scalarMultiplyDataData<double>(outi_c_p_d, datainv_c_p, out_c_p_d);
00687       rst::subtract(&outi_c_p_d[0], &in_c_p_d[0], outi_c_p_d.size());
00688       if (rst::vectorNorm(&outi_c_p_d[0], outi_c_p_d.size(), NORM_ONE) > zero) {
00689         *outStream << "\n\nINCORRECT scalarMultiplyDataData (2): check scalar inverse property\n\n";
00690         errorFlag = -1000;
00691       }
00692       art::scalarMultiplyDataData<double>(out_c_p_d_d, data_c_p, in_c_p_d_d);
00693       art::scalarMultiplyDataData<double>(outi_c_p_d_d, datainv_c_p, out_c_p_d_d);
00694       rst::subtract(&outi_c_p_d_d[0], &in_c_p_d_d[0], outi_c_p_d_d.size());
00695       if (rst::vectorNorm(&outi_c_p_d_d[0], outi_c_p_d_d.size(), NORM_ONE) > zero) {
00696         *outStream << "\n\nINCORRECT scalarMultiplyDataData (3): check scalar inverse property\n\n";
00697         errorFlag = -1000;
00698       }
00699       art::scalarMultiplyDataData<double>(out_c_p_d_d, data_c_1, in_c_p_d_d);
00700       art::scalarMultiplyDataData<double>(outi_c_p_d_d, datainv_c_1, out_c_p_d_d);
00701       rst::subtract(&outi_c_p_d_d[0], &in_c_p_d_d[0], outi_c_p_d_d.size());
00702       if (rst::vectorNorm(&outi_c_p_d_d[0], outi_c_p_d_d.size(), NORM_ONE) > zero) {
00703         *outStream << "\n\nINCORRECT scalarMultiplyDataData (4): check scalar inverse property\n\n";
00704         errorFlag = -1000;
00705       }
00706 
00707       // fill with constants
00708       for (int i=0; i<in_c_p_d_d.size(); i++) {
00709         in_c_p_d_d[i] = 1.0;
00710       }
00711       for (int i=0; i<data_c_p.size(); i++) {
00712         data_c_p[i] = 5.0;
00713       }
00714       for (int i=0; i<data_c_1.size(); i++) {
00715         data_c_1[i] = 5.0;
00716       }
00717       art::scalarMultiplyDataData<double>(out_c_p_d_d, data_c_p, in_c_p_d_d);
00718       if (std::abs(rst::vectorNorm(&out_c_p_d_d[0], out_c_p_d_d.size(), NORM_ONE) - data_c_p[0]*in_c_p_d_d[0]*c*p*d1*d2) > zero) {
00719         *outStream << "\n\nINCORRECT scalarMultiplyDataData (5): check result: "
00720                    << rst::vectorNorm(&out_c_p_d_d[0], out_c_p_d_d.size(), NORM_ONE) << " != "
00721                    << data_c_p[0]*in_c_p_d_d[0]*c*p*d1*d2 << "\n\n";
00722         errorFlag = -1000;
00723       }
00724       art::scalarMultiplyDataData<double>(out_c_p_d_d, data_c_1, in_c_p_d_d);
00725       if (std::abs(rst::vectorNorm(&out_c_p_d_d[0], out_c_p_d_d.size(), NORM_ONE) - data_c_1[0]*in_c_p_d_d[0]*c*p*d1*d2) > zero) {
00726         *outStream << "\n\nINCORRECT scalarMultiplyDataData (6): check result: "
00727                    << rst::vectorNorm(&out_c_p_d_d[0], out_c_p_d_d.size(), NORM_ONE) << " != "
00728                    << data_c_p[0]*in_c_p_d_d[0]*c*p*d1*d2 << "\n\n";
00729         errorFlag = -1000;
00730       }
00731       } // end scope
00732 
00733       { // start scope
00734       *outStream << "\n************ Checking scalarMultiplyDataData, reciprocal=false (branch 2) ************\n";
00735 
00736       int c=5, p=9, d1=7, d2=13;
00737 
00738       FieldContainer<double> in_p(p);
00739       FieldContainer<double> in_p_d(p, d1);
00740       FieldContainer<double> in_p_d_d(p, d1, d2);
00741       FieldContainer<double> in_c_p(c, p);
00742       FieldContainer<double> in_c_p_d(c, p, d1);
00743       FieldContainer<double> in_c_p_d_d(c, p, d1, d2);
00744       FieldContainer<double> data_c_p(c, p);
00745       FieldContainer<double> datainv_c_p(c, p);
00746       FieldContainer<double> data_c_1(c, 1);
00747       FieldContainer<double> datainv_c_1(c, 1);
00748       FieldContainer<double> data_c_p_one(c, p);
00749       FieldContainer<double> data_c_1_one(c, 1);
00750       FieldContainer<double> out_c_p(c, p);
00751       FieldContainer<double> outi_c_p(c, p);
00752       FieldContainer<double> out_c_p_d(c, p, d1);
00753       FieldContainer<double> outi_c_p_d(c, p, d1);
00754       FieldContainer<double> out_c_p_d_d(c, p, d1, d2);
00755       FieldContainer<double> outi_c_p_d_d(c, p, d1, d2);
00756       double zero = INTREPID_TOL*10000.0;
00757 
00758       // fill with random numbers
00759       for (int i=0; i<in_p.size(); i++) {
00760         in_p[i] = Teuchos::ScalarTraits<double>::random();
00761       }
00762       for (int i=0; i<in_p_d.size(); i++) {
00763         in_p_d[i] = Teuchos::ScalarTraits<double>::random();
00764       }
00765       for (int i=0; i<in_p_d_d.size(); i++) {
00766         in_p_d_d[i] = Teuchos::ScalarTraits<double>::random();
00767       }
00768       for (int i=0; i<data_c_p.size(); i++) {
00769         data_c_p[i] = Teuchos::ScalarTraits<double>::random();
00770         datainv_c_p[i] = 1.0 / data_c_p[i];
00771         data_c_p_one[i] = 1.0;
00772       }
00773       for (int i=0; i<data_c_1.size(); i++) {
00774         data_c_1[i] = Teuchos::ScalarTraits<double>::random();
00775         datainv_c_1[i] = 1.0 / data_c_1[i];
00776         data_c_1_one[i] = 1.0;
00777       }
00778 
00779       art::scalarMultiplyDataData<double>(out_c_p, data_c_p, in_p);
00780       art::scalarMultiplyDataData<double>(outi_c_p, datainv_c_p, out_c_p);
00781       art::scalarMultiplyDataData<double>(in_c_p, data_c_p_one, in_p);
00782       rst::subtract(&outi_c_p[0], &in_c_p[0], outi_c_p.size());
00783       if (rst::vectorNorm(&outi_c_p[0], outi_c_p.size(), NORM_ONE) > zero) {
00784         *outStream << "\n\nINCORRECT scalarMultiplyDataData (1): check scalar inverse property\n\n";
00785         errorFlag = -1000;
00786       }
00787       art::scalarMultiplyDataData<double>(out_c_p_d, data_c_p, in_p_d);
00788       art::scalarMultiplyDataData<double>(outi_c_p_d, datainv_c_p, out_c_p_d);
00789       art::scalarMultiplyDataData<double>(in_c_p_d, data_c_p_one, in_p_d);
00790       rst::subtract(&outi_c_p_d[0], &in_c_p_d[0], outi_c_p_d.size());
00791       if (rst::vectorNorm(&outi_c_p_d[0], outi_c_p_d.size(), NORM_ONE) > zero) {
00792         *outStream << "\n\nINCORRECT scalarMultiplyDataData (2): check scalar inverse property\n\n";
00793         errorFlag = -1000;
00794       }
00795       art::scalarMultiplyDataData<double>(out_c_p_d_d, data_c_p, in_p_d_d);
00796       art::scalarMultiplyDataData<double>(outi_c_p_d_d, datainv_c_p, out_c_p_d_d);
00797       art::scalarMultiplyDataData<double>(in_c_p_d_d, data_c_p_one, in_p_d_d);
00798       rst::subtract(&outi_c_p_d_d[0], &in_c_p_d_d[0], outi_c_p_d_d.size());
00799       if (rst::vectorNorm(&outi_c_p_d_d[0], outi_c_p_d_d.size(), NORM_ONE) > zero) {
00800         *outStream << "\n\nINCORRECT scalarMultiplyDataData (3): check scalar inverse property\n\n";
00801         errorFlag = -1000;
00802       }
00803       art::scalarMultiplyDataData<double>(out_c_p_d_d, data_c_1, in_p_d_d);
00804       art::scalarMultiplyDataData<double>(outi_c_p_d_d, datainv_c_1, out_c_p_d_d);
00805       art::scalarMultiplyDataData<double>(in_c_p_d_d, data_c_p_one, in_p_d_d);
00806       rst::subtract(&outi_c_p_d_d[0], &in_c_p_d_d[0], outi_c_p_d_d.size());
00807       if (rst::vectorNorm(&outi_c_p_d_d[0], outi_c_p_d_d.size(), NORM_ONE) > zero) {
00808         *outStream << "\n\nINCORRECT scalarMultiplyDataData (4): check scalar inverse property\n\n";
00809         errorFlag = -1000;
00810       }
00811 
00812       // fill with constants
00813       for (int i=0; i<in_p_d_d.size(); i++) {
00814         in_p_d_d[i] = 1.0;
00815       }
00816       for (int i=0; i<data_c_p.size(); i++) {
00817         data_c_p[i] = 5.0;
00818       }
00819       for (int i=0; i<data_c_1.size(); i++) {
00820         data_c_1[i] = 5.0;
00821       }
00822       art::scalarMultiplyDataData<double>(out_c_p_d_d, data_c_p, in_p_d_d);
00823       if (std::abs(rst::vectorNorm(&out_c_p_d_d[0], out_c_p_d_d.size(), NORM_ONE) - data_c_p[0]*in_p_d_d[0]*c*p*d1*d2) > zero) {
00824         *outStream << "\n\nINCORRECT scalarMultiplyDataData (5): check result: "
00825                    << rst::vectorNorm(&out_c_p_d_d[0], out_c_p_d_d.size(), NORM_ONE) << " != "
00826                    << data_c_p[0]*in_p_d_d[0]*c*p*d1*d2 << "\n\n";
00827         errorFlag = -1000;
00828       }
00829       art::scalarMultiplyDataData<double>(out_c_p_d_d, data_c_1, in_p_d_d);
00830       if (std::abs(rst::vectorNorm(&out_c_p_d_d[0], out_c_p_d_d.size(), NORM_ONE) - data_c_1[0]*in_p_d_d[0]*c*p*d1*d2) > zero) {
00831         *outStream << "\n\nINCORRECT scalarMultiplyDataData (6): check result: "
00832                    << rst::vectorNorm(&out_c_p_d_d[0], out_c_p_d_d.size(), NORM_ONE) << " != "
00833                    << data_c_1[0]*in_p_d_d[0]*c*p*d1*d2 << "\n\n";
00834         errorFlag = -1000;
00835       }
00836       } // end scope
00837 
00838       { // start scope
00839       *outStream << "\n************ Checking scalarMultiplyDataData, reciprocal=true, i.e. division (branch 1) ************\n";
00840 
00841       int c=5, p=9, d1=7, d2=13;
00842 
00843       FieldContainer<double> in_c_p(c, p);
00844       FieldContainer<double> in_c_p_d(c, p, d1);
00845       FieldContainer<double> in_c_p_d_d(c, p, d1, d2);
00846       FieldContainer<double> data_c_p(c, p);
00847       FieldContainer<double> datainv_c_p(c, p);
00848       FieldContainer<double> data_c_1(c, 1);
00849       FieldContainer<double> datainv_c_1(c, 1);
00850       FieldContainer<double> out_c_p(c, p);
00851       FieldContainer<double> outi_c_p(c, p);
00852       FieldContainer<double> out_c_p_d(c, p, d1);
00853       FieldContainer<double> outi_c_p_d(c, p, d1);
00854       FieldContainer<double> out_c_p_d_d(c, p, d1, d2);
00855       FieldContainer<double> outi_c_p_d_d(c, p, d1, d2);
00856       double zero = INTREPID_TOL*10000.0;
00857 
00858       // fill with random numbers
00859       for (int i=0; i<in_c_p.size(); i++) {
00860         in_c_p[i] = Teuchos::ScalarTraits<double>::random();
00861       }
00862       for (int i=0; i<in_c_p_d.size(); i++) {
00863         in_c_p_d[i] = Teuchos::ScalarTraits<double>::random();
00864       }
00865       for (int i=0; i<in_c_p_d_d.size(); i++) {
00866         in_c_p_d_d[i] = Teuchos::ScalarTraits<double>::random();
00867       }
00868       for (int i=0; i<data_c_p.size(); i++) {
00869         data_c_p[i] = Teuchos::ScalarTraits<double>::random();
00870         datainv_c_p[i] = 1.0 / data_c_p[i];
00871       }
00872       for (int i=0; i<data_c_1.size(); i++) {
00873         data_c_1[i] = Teuchos::ScalarTraits<double>::random();
00874         datainv_c_1[i] = 1.0 / data_c_1[i];
00875       }
00876 
00877       art::scalarMultiplyDataData<double>(out_c_p, data_c_p, in_c_p, true);
00878       art::scalarMultiplyDataData<double>(outi_c_p, datainv_c_p, out_c_p, true);
00879       rst::subtract(&outi_c_p[0], &in_c_p[0], outi_c_p.size());
00880       if (rst::vectorNorm(&outi_c_p[0], outi_c_p.size(), NORM_ONE) > zero) {
00881         *outStream << "\n\nINCORRECT scalarMultiplyDataData (1): check scalar inverse property\n\n";
00882         errorFlag = -1000;
00883       }
00884       art::scalarMultiplyDataData<double>(out_c_p_d, data_c_p, in_c_p_d, true);
00885       art::scalarMultiplyDataData<double>(outi_c_p_d, datainv_c_p, out_c_p_d, true);
00886       rst::subtract(&outi_c_p_d[0], &in_c_p_d[0], outi_c_p_d.size());
00887       if (rst::vectorNorm(&outi_c_p_d[0], outi_c_p_d.size(), NORM_ONE) > zero) {
00888         *outStream << "\n\nINCORRECT scalarMultiplyDataData (2): check scalar inverse property\n\n";
00889         errorFlag = -1000;
00890       }
00891       art::scalarMultiplyDataData<double>(out_c_p_d_d, data_c_p, in_c_p_d_d, true);
00892       art::scalarMultiplyDataData<double>(outi_c_p_d_d, datainv_c_p, out_c_p_d_d, true);
00893       rst::subtract(&outi_c_p_d_d[0], &in_c_p_d_d[0], outi_c_p_d_d.size());
00894       if (rst::vectorNorm(&outi_c_p_d_d[0], outi_c_p_d_d.size(), NORM_ONE) > zero) {
00895         *outStream << "\n\nINCORRECT scalarMultiplyDataData (3): check scalar inverse property\n\n";
00896         errorFlag = -1000;
00897       }
00898       art::scalarMultiplyDataData<double>(out_c_p_d_d, data_c_1, in_c_p_d_d, true);
00899       art::scalarMultiplyDataData<double>(outi_c_p_d_d, datainv_c_1, out_c_p_d_d, true);
00900       rst::subtract(&outi_c_p_d_d[0], &in_c_p_d_d[0], outi_c_p_d_d.size());
00901       if (rst::vectorNorm(&outi_c_p_d_d[0], outi_c_p_d_d.size(), NORM_ONE) > zero) {
00902         *outStream << "\n\nINCORRECT scalarMultiplyDataData (4): check scalar inverse property\n\n";
00903         errorFlag = -1000;
00904       }
00905 
00906       // fill with constants
00907       for (int i=0; i<in_c_p_d_d.size(); i++) {
00908         in_c_p_d_d[i] = 1.0;
00909       }
00910       for (int i=0; i<data_c_p.size(); i++) {
00911         data_c_p[i] = 5.0;
00912       }
00913       for (int i=0; i<data_c_1.size(); i++) {
00914         data_c_1[i] = 5.0;
00915       }
00916       art::scalarMultiplyDataData<double>(out_c_p_d_d, data_c_p, in_c_p_d_d, true);
00917       if (std::abs(rst::vectorNorm(&out_c_p_d_d[0], out_c_p_d_d.size(), NORM_ONE) - (1.0/data_c_p[0])*in_c_p_d_d[0]*c*p*d1*d2)/rst::vectorNorm(&out_c_p_d_d[0], out_c_p_d_d.size(), NORM_ONE) > zero) {
00918         *outStream << "\n\nINCORRECT scalarMultiplyDataData (5): check result: "
00919                    << rst::vectorNorm(&out_c_p_d_d[0], out_c_p_d_d.size(), NORM_ONE) << " != "
00920                    << (1.0/data_c_p[0])*in_c_p_d_d[0]*c*p*d1*d2 << "\n\n";
00921         errorFlag = -1000;
00922       }
00923       art::scalarMultiplyDataData<double>(out_c_p_d_d, data_c_1, in_c_p_d_d, true);
00924       if (std::abs(rst::vectorNorm(&out_c_p_d_d[0], out_c_p_d_d.size(), NORM_ONE) - (1.0/data_c_1[0])*in_c_p_d_d[0]*c*p*d1*d2)/rst::vectorNorm(&out_c_p_d_d[0], out_c_p_d_d.size(), NORM_ONE) > zero) {
00925         *outStream << "\n\nINCORRECT scalarMultiplyDataData (6): check result: "
00926                    << rst::vectorNorm(&out_c_p_d_d[0], out_c_p_d_d.size(), NORM_ONE) << " != "
00927                    << (1.0/data_c_p[0])*in_c_p_d_d[0]*c*p*d1*d2 << "\n\n";
00928         errorFlag = -1000;
00929       }
00930       } // end scope
00931 
00932       { // start scope
00933       *outStream << "\n************ Checking scalarMultiplyDataData, reciprocal=true, i.e. division (branch 2) ************\n";
00934 
00935       int c=5, p=9, d1=7, d2=13;
00936 
00937       FieldContainer<double> in_p(p);
00938       FieldContainer<double> in_p_d(p, d1);
00939       FieldContainer<double> in_p_d_d(p, d1, d2);
00940       FieldContainer<double> in_c_p(c, p);
00941       FieldContainer<double> in_c_p_d(c, p, d1);
00942       FieldContainer<double> in_c_p_d_d(c, p, d1, d2);
00943       FieldContainer<double> data_c_p(c, p);
00944       FieldContainer<double> datainv_c_p(c, p);
00945       FieldContainer<double> data_c_1(c, 1);
00946       FieldContainer<double> datainv_c_1(c, 1);
00947       FieldContainer<double> data_c_p_one(c, p);
00948       FieldContainer<double> data_c_1_one(c, 1);
00949       FieldContainer<double> out_c_p(c, p);
00950       FieldContainer<double> outi_c_p(c, p);
00951       FieldContainer<double> out_c_p_d(c, p, d1);
00952       FieldContainer<double> outi_c_p_d(c, p, d1);
00953       FieldContainer<double> out_c_p_d_d(c, p, d1, d2);
00954       FieldContainer<double> outi_c_p_d_d(c, p, d1, d2);
00955       double zero = INTREPID_TOL*10000.0;
00956 
00957       // fill with random numbers
00958       for (int i=0; i<in_p.size(); i++) {
00959         in_p[i] = Teuchos::ScalarTraits<double>::random();
00960       }
00961       for (int i=0; i<in_p_d.size(); i++) {
00962         in_p_d[i] = Teuchos::ScalarTraits<double>::random();
00963       }
00964       for (int i=0; i<in_p_d_d.size(); i++) {
00965         in_p_d_d[i] = Teuchos::ScalarTraits<double>::random();
00966       }
00967       for (int i=0; i<data_c_p.size(); i++) {
00968         data_c_p[i] = Teuchos::ScalarTraits<double>::random();
00969         datainv_c_p[i] = 1.0 / data_c_p[i];
00970         data_c_p_one[i] = 1.0;
00971       }
00972       for (int i=0; i<data_c_1.size(); i++) {
00973         data_c_1[i] = Teuchos::ScalarTraits<double>::random();
00974         datainv_c_1[i] = 1.0 / data_c_1[i];
00975         data_c_1_one[i] = 1.0;
00976       }
00977 
00978       art::scalarMultiplyDataData<double>(out_c_p, data_c_p, in_p, true);
00979       art::scalarMultiplyDataData<double>(outi_c_p, datainv_c_p, out_c_p, true);
00980       art::scalarMultiplyDataData<double>(in_c_p, data_c_p_one, in_p);
00981       rst::subtract(&outi_c_p[0], &in_c_p[0], outi_c_p.size());
00982       if (rst::vectorNorm(&outi_c_p[0], outi_c_p.size(), NORM_ONE) > zero) {
00983         *outStream << "\n\nINCORRECT scalarMultiplyDataData (1): check scalar inverse property\n\n";
00984         errorFlag = -1000;
00985       }
00986       art::scalarMultiplyDataData<double>(out_c_p_d, data_c_p, in_p_d, true);
00987       art::scalarMultiplyDataData<double>(outi_c_p_d, datainv_c_p, out_c_p_d, true);
00988       art::scalarMultiplyDataData<double>(in_c_p_d, data_c_p_one, in_p_d);
00989       rst::subtract(&outi_c_p_d[0], &in_c_p_d[0], outi_c_p_d.size());
00990       if (rst::vectorNorm(&outi_c_p_d[0], outi_c_p_d.size(), NORM_ONE) > zero) {
00991         *outStream << "\n\nINCORRECT scalarMultiplyDataData (2): check scalar inverse property\n\n";
00992         errorFlag = -1000;
00993       }
00994       art::scalarMultiplyDataData<double>(out_c_p_d_d, data_c_p, in_p_d_d, true);
00995       art::scalarMultiplyDataData<double>(outi_c_p_d_d, datainv_c_p, out_c_p_d_d, true);
00996       art::scalarMultiplyDataData<double>(in_c_p_d_d, data_c_p_one, in_p_d_d);
00997       rst::subtract(&outi_c_p_d_d[0], &in_c_p_d_d[0], outi_c_p_d_d.size());
00998       if (rst::vectorNorm(&outi_c_p_d_d[0], outi_c_p_d_d.size(), NORM_ONE) > zero) {
00999         *outStream << "\n\nINCORRECT scalarMultiplyDataData (3): check scalar inverse property\n\n";
01000         errorFlag = -1000;
01001       }
01002       art::scalarMultiplyDataData<double>(out_c_p_d_d, data_c_1, in_p_d_d, true);
01003       art::scalarMultiplyDataData<double>(outi_c_p_d_d, datainv_c_1, out_c_p_d_d, true);
01004       art::scalarMultiplyDataData<double>(in_c_p_d_d, data_c_p_one, in_p_d_d);
01005       rst::subtract(&outi_c_p_d_d[0], &in_c_p_d_d[0], outi_c_p_d_d.size());
01006       if (rst::vectorNorm(&outi_c_p_d_d[0], outi_c_p_d_d.size(), NORM_ONE) > zero) {
01007         *outStream << "\n\nINCORRECT scalarMultiplyDataData (4): check scalar inverse property\n\n";
01008         errorFlag = -1000;
01009       }
01010 
01011       // fill with constants
01012       for (int i=0; i<in_p_d_d.size(); i++) {
01013         in_p_d_d[i] = 1.0;
01014       }
01015       for (int i=0; i<data_c_p.size(); i++) {
01016         data_c_p[i] = 5.0;
01017       }
01018       for (int i=0; i<data_c_1.size(); i++) {
01019         data_c_1[i] = 5.0;
01020       }
01021       art::scalarMultiplyDataData<double>(out_c_p_d_d, data_c_p, in_p_d_d, true);
01022       if (std::abs(rst::vectorNorm(&out_c_p_d_d[0], out_c_p_d_d.size(), NORM_ONE) - (1.0/data_c_p[0])*in_p_d_d[0]*c*p*d1*d2)/rst::vectorNorm(&out_c_p_d_d[0], out_c_p_d_d.size(), NORM_ONE) > zero) {
01023         *outStream << "\n\nINCORRECT scalarMultiplyDataData (5): check result: "
01024                    << rst::vectorNorm(&out_c_p_d_d[0], out_c_p_d_d.size(), NORM_ONE) << " != "
01025                    << (1.0/data_c_p[0])*in_p_d_d[0]*c*p*d1*d2 << "\n\n";
01026         errorFlag = -1000;
01027       }
01028       art::scalarMultiplyDataData<double>(out_c_p_d_d, data_c_1, in_p_d_d, true);
01029       if (std::abs(rst::vectorNorm(&out_c_p_d_d[0], out_c_p_d_d.size(), NORM_ONE) - (1.0/data_c_1[0])*in_p_d_d[0]*c*p*d1*d2)/rst::vectorNorm(&out_c_p_d_d[0], out_c_p_d_d.size(), NORM_ONE) > zero) {
01030         *outStream << "\n\nINCORRECT scalarMultiplyDataData (6): check result: "
01031                    << rst::vectorNorm(&out_c_p_d_d[0], out_c_p_d_d.size(), NORM_ONE) << " != "
01032                    << (1.0/data_c_1[0])*in_p_d_d[0]*c*p*d1*d2 << "\n\n";
01033         errorFlag = -1000;
01034       }
01035       } // end scope
01036 
01037       /******************************************/
01038       *outStream << "\n";
01039   }
01040   catch (std::logic_error err) {
01041     *outStream << "UNEXPECTED ERROR !!! ----------------------------------------------------------\n";
01042     *outStream << err.what() << '\n';
01043     *outStream << "-------------------------------------------------------------------------------" << "\n\n";
01044     errorFlag = -1000;
01045   };
01046 
01047 
01048   if (errorFlag != 0)
01049     std::cout << "End Result: TEST FAILED\n";
01050   else
01051     std::cout << "End Result: TEST PASSED\n";
01052 
01053   // reset format state of std::cout
01054   std::cout.copyfmt(oldFormatState);
01055 
01056   return errorFlag;
01057 }