FEI Version of the Day
snl_fei_tester.hpp
00001 /*
00002 // @HEADER
00003 // ************************************************************************
00004 //             FEI: Finite Element Interface to Linear Solvers
00005 //                  Copyright (2005) Sandia Corporation.
00006 //
00007 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the
00008 // U.S. Government retains certain rights in this software.
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 Alan Williams (william@sandia.gov) 
00038 //
00039 // ************************************************************************
00040 // @HEADER
00041 */
00042 
00043 #ifndef _snl_fei_tester_h_
00044 #define _snl_fei_tester_h_
00045 
00046 #include <fei_macros.hpp>
00047 #include <fei_mpi.h>
00048 #include <fei_SharedPtr.hpp>
00049 
00050 #include <test_utils/feitester.hpp>
00051 #include <test_utils/DataReader.hpp>
00052 
00053 #include <fei_fwd.hpp>
00054 
00055 class snl_fei_tester : public feitester {
00056  public:
00057   snl_fei_tester(fei::SharedPtr<DataReader> data_reader,
00058      MPI_Comm comm, int localProc, int numProcs);
00059   ~snl_fei_tester();
00060 
00061   const char* getName()
00062     {
00063       static const char name[] = "snl_fei_tester";
00064       return((const char*)name);
00065     }
00066 
00067   int testInitialization();
00068 
00069   int testLoading();
00070 
00071   int testSolve();
00072 
00073   int testCheckResult();
00074 
00075   void dumpMatrixFiles();
00076 
00077   void setParameter(const char* param);
00078 
00079  private:
00080   void defineFieldsAndIDTypes();
00081   int initElemBlocks();
00082   int loadElemBlocks();
00083   int initConstraints();
00084   int loadConstraints();
00085   void definePattern(ElemBlock& eb, int& patternID);
00086   int createLibraryInstance(const char* solverName);
00087 
00088   int save_block_node_soln(DataReader& data, fei::Vector* vec,
00089          const char* solnFileName, int numProcs,
00090          int localProc, int solveCounter);
00091 
00092   int save_block_elem_soln(DataReader& data, fei::Vector* vec,
00093          const char* solnFileName,
00094          int numProcs, int localProc, int solveCounter);
00095 
00096   int save_multiplier_soln(DataReader& data, fei::Vector* vec,
00097          const char* solnFileName,
00098          int numProcs, int localProc, int solveCounter);
00099 
00100   int checkSolution(int localProc, int numProcs,
00101       const char* solnFileName, const char* checkFileName,
00102       const char* extension, int solveCounter);
00103 
00104   MPI_Comm comm_;
00105 
00106   fei::SharedPtr<fei::Factory> factory_;
00107 
00108   fei::SharedPtr<fei::VectorSpace> vecSpace_;
00109   fei::SharedPtr<fei::MatrixGraph> matrixGraph_;
00110 
00111   fei::SharedPtr<fei::Matrix> A_;
00112   fei::SharedPtr<fei::Vector> x_;
00113   fei::SharedPtr<fei::Vector> b_;
00114 
00115   fei::SharedPtr<fei::LinearSystem> linSys_;
00116 
00117   LinearSystemCore* linSysCore_;
00118   FiniteElementData* feData_;
00119 
00120   fei::SharedPtr<DataReader> data_;
00121 
00122   std::vector<int> idTypes_;
00123   int numPatterns_;
00124   int nodeTypeOffset_, elemTypeOffset_, constraintTypeOffset_;
00125 
00126   int localProc_, numProcs_;
00127 };
00128 
00129 #endif // _snl_fei_tester_h_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends