FEI  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
fei_LinProbMgr_EpetraBasic.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_LinProbMgr_EpetraBasic_hpp_
45 #define _fei_LinProbMgr_EpetraBasic_hpp_
46 
47 #include <fei_LinearProblemManager.hpp>
48 
49 #include <fei_Include_Trilinos.hpp>
50 #include <fei_SharedPtr.hpp>
51 
52 #include <vector>
53 
54 class LinProbMgr_EpetraBasic : public fei::LinearProblemManager {
55  public:
56  LinProbMgr_EpetraBasic(MPI_Comm comm);
57  virtual ~LinProbMgr_EpetraBasic();
58 
63  void setRowDistribution(const std::vector<int>& ownedGlobalRows);
64 
69 
72  void setMatrixValues(double scalar);
73 
81  void setVectorValues(double scalar, bool soln_vector);
82 
86  int getLocalNumRows();
87 
91  int getRowLength(int row);
92 
105  int copyOutMatrixRow(int row, int len,
106  double* coefs, int* indices);
107 
115  int insertMatrixValues(int numRows, const int* rows,
116  int numCols, const int* cols,
117  const double* const* values,
118  bool sum_into);
119 
142  int insertVectorValues(int numValues,
143  const int* globalIndices,
144  const double* values,
145  bool sum_into,
146  bool soln_vector,
147  int vectorIndex=0);
148 
152  int copyOutVectorValues(int numValues,
153  const int* globalIndices,
154  double* values,
155  bool soln_vector,
156  int vectorIndex=0);
157 
163  double* getLocalVectorValuesPtr(bool soln_vector,
164  int vectorIndex=0);
165 
171  int globalAssemble();
172 
175  fei::SharedPtr<Epetra_CrsMatrix> get_A_matrix();
176 
179  fei::SharedPtr<Epetra_MultiVector> get_rhs_vector();
180 
183  fei::SharedPtr<Epetra_MultiVector> get_solution_vector();
184 
185  private:
186  MPI_Comm comm_;
187  std::vector<int> ownedRows_;
188  fei::SharedPtr<Epetra_Comm> epetra_comm_;
189  fei::SharedPtr<Epetra_Map> epetra_rowmap_;
193  int numVectors_;
196 };
197 
198 #endif // _LinProbMgr_EpetraBasic_hpp_
199 
virtual int insertVectorValues(int numValues, const int *globalIndices, const double *values, bool sum_into, bool soln_vector, int vectorIndex=0)=0
virtual int copyOutVectorValues(int numValues, const int *globalIndices, double *values, bool soln_vector, int vectorIndex=0)=0
virtual void setVectorValues(double scalar, bool soln_vector)=0
virtual int insertMatrixValues(int numRows, const int *rows, int numCols, const int *cols, const double *const *values, bool sum_into)=0
virtual int copyOutMatrixRow(int row, int len, double *coefs, int *indices)=0
virtual int getLocalNumRows()=0
virtual void setMatrixValues(double scalar)=0
virtual void setRowDistribution(const std::vector< int > &ownedGlobalRows)=0
virtual int getRowLength(int row)=0
virtual double * getLocalVectorValuesPtr(bool soln_vector, int vectorIndex=0)=0
virtual int globalAssemble()=0
virtual void setMatrixGraph(fei::SharedPtr< fei::SparseRowGraph > matrixGraph)=0