FEI Version of the Day
fei_Factory_Trilinos.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 
00044 #ifndef _fei_Factory_Trilinos_hpp_
00045 #define _fei_Factory_Trilinos_hpp_
00046 
00047 #include "fei_trilinos_macros.hpp"
00048 
00049 #include <fei_mpi.h>
00050 
00051 #include <fei_Include_Trilinos.hpp>
00052 
00053 #ifdef HAVE_FEI_EPETRA
00054 #include <fei_VectorTraits_Epetra.hpp>
00055 #include <fei_MatrixTraits_Epetra.hpp>
00056 #include <fei_Trilinos_Helpers.hpp>
00057 #include <fei_LinProbMgr_EpetraBasic.hpp>
00058 #endif
00059 
00060 #include <fei_Factory.hpp>
00061 #include <fei_ParameterSet.hpp>
00062 #include <fei_Reducer.hpp>
00063 #include <fei_Vector_Impl.hpp>
00064 #include <fei_Matrix_Impl.hpp>
00065 #include <fei_MatrixGraph_Impl2.hpp>
00066 #include <fei_SparseRowGraph.hpp>
00067 #include <fei_utils.hpp>
00068 
00069 #undef fei_file
00070 #define fei_file "fei_Factory_Trilinos.hpp"
00071 #include <fei_ErrMacros.hpp>
00072 
00073 /*** Implementation of an fei::Factory which creates instances that use Trilinos
00074      objects (Epetra and AztecOO) as the underlying objects.
00075 */
00076 class Factory_Trilinos : public fei::Factory {
00077  public:
00078   Factory_Trilinos(MPI_Comm comm);
00079 
00080   virtual ~Factory_Trilinos();
00081 
00083   fei::SharedPtr<fei::Factory> clone() const
00084     {
00085       fei::SharedPtr<fei::Factory> factory(new Factory_Trilinos(comm_));
00086       return(factory);
00087     }
00088 
00090     virtual int parameters(int numParams,
00091                            const char* const* paramStrings);
00092 
00094     virtual void parameters(const fei::ParameterSet& parameterset);
00095 
00097   fei::SharedPtr<fei::MatrixGraph>
00098     createMatrixGraph(fei::SharedPtr<fei::VectorSpace> rowSpace,
00099                       fei::SharedPtr<fei::VectorSpace> colSpace,
00100                       const char* name);
00101 
00103   fei::SharedPtr<fei::Vector>
00104     createVector(fei::SharedPtr<fei::VectorSpace> vecSpace, int numVectors=1);
00105 
00106 #ifdef HAVE_FEI_EPETRA
00107 
00111   fei::SharedPtr<fei::Vector>
00112     wrapVector(fei::SharedPtr<fei::VectorSpace> vecSpace,
00113                fei::SharedPtr<Epetra_MultiVector> multiVec);
00114 
00119   fei::SharedPtr<fei::Vector>
00120     wrapVector(fei::SharedPtr<fei::MatrixGraph> matGraph,
00121                fei::SharedPtr<Epetra_MultiVector> multiVec);
00122 #endif
00123 
00125   fei::SharedPtr<fei::Vector>
00126     createVector(fei::SharedPtr<fei::VectorSpace> vecSpace,
00127       bool isSolutionVector,
00128       int numVectors=1);
00129 
00131   fei::SharedPtr<fei::Vector>
00132     createVector(fei::SharedPtr<fei::MatrixGraph> matrixGraph,
00133       int numVectors=1);
00134 
00136   fei::SharedPtr<fei::Vector>
00137     createVector(fei::SharedPtr<fei::MatrixGraph> matrixGraph,
00138       bool isSolutionVector,
00139       int numVectors=1);
00140 
00141   fei::SharedPtr<fei::Matrix>
00142     createMatrix(fei::SharedPtr<fei::MatrixGraph> matrixGraph);
00143 
00144   fei::SharedPtr<fei::Solver> createSolver(const char* name=0);
00145 
00146   int getOutputLevel() const { return(outputLevel_); }
00147 
00148  private:
00149   void create_LinProbMgr(bool replace_if_already_created=false);
00150 
00151   MPI_Comm comm_;
00152 
00153   fei::SharedPtr<fei::Reducer> reducer_;
00154   fei::SharedPtr<fei::LinearProblemManager> lpm_epetrabasic_;
00155   bool use_lpm_epetrabasic_;
00156   bool useAmesos_;
00157   bool useBelos_;
00158   bool use_feiMatrixLocal_;
00159   bool blockEntryMatrix_;
00160   bool orderRowsWithLocalColsFirst_;
00161 
00162   int outputLevel_;
00163 };
00164 
00165 #endif // _Factory_Trilinos_hpp_
00166 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends