PlayaEpetraMatrix.hpp
00001
00002
00003
00004
00005 #ifndef PLAYA_EPETRAMATRIX_HPP
00006 #define PLAYA_EPETRAMATRIX_HPP
00007
00008 #include "PlayaLoadableMatrix.hpp"
00009 #include "PlayaLinearOperatorDecl.hpp"
00010 #include "PlayaLinearOpWithSpacesDecl.hpp"
00011 #include "PlayaRowAccessibleOp.hpp"
00012 #include "PlayaPrintable.hpp"
00013 #include "PlayaILUFactorizableOp.hpp"
00014 #include "Epetra_CrsMatrix.h"
00015 #include "PlayaLinearOpWithSpacesDecl.hpp"
00016
00017 namespace Playa
00018 {
00019 using namespace Teuchos;
00020
00021
00022
00024 class EpetraMatrix : public LinearOpWithSpaces<double>,
00025 public LoadableMatrix<double>,
00026 public RowAccessibleOp<double>,
00027 public Printable,
00028 public ILUFactorizableOp<double>
00029 {
00030 public:
00031
00034 EpetraMatrix(const Epetra_CrsGraph& graph,
00035 const VectorSpace<double>& domain,
00036 const VectorSpace<double>& range);
00037
00039 EpetraMatrix(const RCP<Epetra_CrsMatrix>& mat,
00040 const VectorSpace<double>& domain,
00041 const VectorSpace<double>& range);
00042
00044 virtual void apply(
00045 Teuchos::ETransp applyType,
00046 const Vector<double>& in,
00047 Vector<double> out) const ;
00048
00049
00050
00064 virtual void addToRow(int globalRowIndex,
00065 int nElemsToInsert,
00066 const int* globalColumnIndices,
00067 const double* elementValues) ;
00068
00069
00073 virtual void addToElementBatch(int numRows,
00074 int rowBlockSize,
00075 const int* globalRowIndices,
00076 int numColumnsPerRow,
00077 const int* globalColumnIndices,
00078 const double* values,
00079 const int* skipRow);
00080
00082 virtual void zero() ;
00083
00085
00100 virtual void getILUKPreconditioner(int fillLevels,
00101 int overlapFill,
00102 double relaxationValue,
00103 double relativeThreshold,
00104 double absoluteThreshold,
00105 LeftOrRight leftOrRight,
00106 Preconditioner<double>& rtn) const ;
00108
00109
00113 void getRow(const int& row,
00114 Teuchos::Array<int>& indices,
00115 Teuchos::Array<double>& values) const;
00117
00118
00122 virtual void print(std::ostream& os) const ;
00124
00126 std::ostream& describe(
00127 std::ostream &out
00128 ,const Teuchos::EVerbosityLevel verbLevel
00129 ,const std::string leadingIndent
00130 , const std::string indentSpacer
00131 ) const
00132 {
00133 out << leadingIndent << indentSpacer << this->description() << std::endl;
00134 return out;
00135 }
00137 std::string description() const ;
00139
00141 static Epetra_CrsMatrix& getConcrete(const LinearOperator<double>& A);
00142
00144 static RCP<const Epetra_CrsMatrix> getConcretePtr(const LinearOperator<double>& A);
00145
00149 const Epetra_CrsMatrix* crsMatrix() const ;
00150
00151 private:
00152
00153 Epetra_CrsMatrix* crsMatrix();
00154
00155 RCP<Epetra_CrsMatrix> matrix_;
00156
00157 const Epetra_Map& getRangeMap() const;
00158 const Epetra_Map& getDomainMap() const;
00159 };
00160
00161
00162
00163 }
00164
00165 #endif