FEI Version of the Day
Loading...
Searching...
No Matches
fei_Factory_Trilinos.hpp
1/*
2// @HEADER
3// ************************************************************************
4// FEI: Finite Element Interface to Linear Solvers
5// Copyright (2005) Sandia Corporation.
6//
7// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the
8// U.S. Government retains certain rights in this software.
9//
10// Redistribution and use in source and binary forms, with or without
11// modification, are permitted provided that the following conditions are
12// met:
13//
14// 1. Redistributions of source code must retain the above copyright
15// notice, this list of conditions and the following disclaimer.
16//
17// 2. Redistributions in binary form must reproduce the above copyright
18// notice, this list of conditions and the following disclaimer in the
19// documentation and/or other materials provided with the distribution.
20//
21// 3. Neither the name of the Corporation nor the names of the
22// contributors may be used to endorse or promote products derived from
23// this software without specific prior written permission.
24//
25// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36//
37// Questions? Contact Alan Williams (william@sandia.gov)
38//
39// ************************************************************************
40// @HEADER
41*/
42
43
44#ifndef _fei_Factory_Trilinos_hpp_
45#define _fei_Factory_Trilinos_hpp_
46
47#include "fei_trilinos_macros.hpp"
48
49#include <fei_mpi.h>
50
51#include <fei_Include_Trilinos.hpp>
52
53#ifdef HAVE_FEI_EPETRA
54#include <fei_VectorTraits_Epetra.hpp>
55#include <fei_MatrixTraits_Epetra.hpp>
56#include <fei_Trilinos_Helpers.hpp>
57#include <fei_LinProbMgr_EpetraBasic.hpp>
58#endif
59
60#include <fei_Factory.hpp>
61#include <fei_ParameterSet.hpp>
62#include <fei_Reducer.hpp>
63#include <fei_Vector_Impl.hpp>
64#include <fei_Matrix_Impl.hpp>
65#include <fei_MatrixGraph_Impl2.hpp>
66#include <fei_SparseRowGraph.hpp>
67#include <fei_utils.hpp>
68
69#undef fei_file
70#define fei_file "fei_Factory_Trilinos.hpp"
71#include <fei_ErrMacros.hpp>
72
73/*** Implementation of an fei::Factory which creates instances that use Trilinos
74 objects (Epetra and AztecOO) as the underlying objects.
75*/
76class Factory_Trilinos : public fei::Factory {
77 public:
78 Factory_Trilinos(MPI_Comm comm);
79
80 virtual ~Factory_Trilinos();
81
84 {
85 fei::SharedPtr<fei::Factory> factory(new Factory_Trilinos(comm_));
86 return(factory);
87 }
88
90 virtual int parameters(int numParams,
91 const char* const* paramStrings);
92
94 virtual void parameters(const fei::ParameterSet& parameterset);
95
100 const char* name);
101
104 createVector(fei::SharedPtr<fei::VectorSpace> vecSpace, int numVectors=1);
105
106#ifdef HAVE_FEI_EPETRA
112 wrapVector(fei::SharedPtr<fei::VectorSpace> vecSpace,
114
120 wrapVector(fei::SharedPtr<fei::MatrixGraph> matGraph,
122#endif
123
127 bool isSolutionVector,
128 int numVectors=1);
129
133 int numVectors=1);
134
138 bool isSolutionVector,
139 int numVectors=1);
140
143
144 fei::SharedPtr<fei::Solver> createSolver(const char* name=0);
145
146 int getOutputLevel() const { return(outputLevel_); }
147
148 private:
149 void create_LinProbMgr(bool replace_if_already_created=false);
150
151 MPI_Comm comm_;
152
155 bool use_lpm_epetrabasic_;
156 bool useAmesos_;
157 bool useBelos_;
158 bool use_feiMatrixLocal_;
159 bool blockEntryMatrix_;
160 bool orderRowsWithLocalColsFirst_;
161
162 int outputLevel_;
163};
164
165#endif // _Factory_Trilinos_hpp_
166
virtual fei::SharedPtr< Factory > clone() const =0
virtual int getOutputLevel() const =0
virtual fei::SharedPtr< fei::MatrixGraph > createMatrixGraph(fei::SharedPtr< fei::VectorSpace > rowSpace, fei::SharedPtr< fei::VectorSpace > columnSpace, const char *name)=0
virtual fei::SharedPtr< fei::Matrix > createMatrix(fei::SharedPtr< fei::MatrixGraph > matrixGraph)=0
virtual fei::SharedPtr< fei::Solver > createSolver(const char *name=0)=0
virtual fei::SharedPtr< fei::Vector > createVector(fei::SharedPtr< fei::VectorSpace > vecSpace, int numVectors=1)=0