Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef TSFEPETRAMATRIX_HPP
00030 #define TSFEPETRAMATRIX_HPP
00031
00032 #include "TSFEpetraVectorSpace.hpp"
00033 #include "TSFEpetraMatrixFactory.hpp"
00034 #include "TSFLoadableMatrix.hpp"
00035 #include "TSFLinearOperatorDecl.hpp"
00036 #include "TSFRowAccessibleOp.hpp"
00037 #include "SundanceHandleable.hpp"
00038 #include "SundancePrintable.hpp"
00039 #include "TSFILUFactorizableOp.hpp"
00040 #include "Epetra_CrsMatrix.h"
00041 #include "Thyra_LinearOpDefaultBase.hpp"
00042 #include "Thyra_EpetraLinearOpBase.hpp"
00043
00044 namespace TSFExtended
00045 {
00046 using namespace Teuchos;
00047 using namespace Thyra;
00048
00049 class EpetraMatrix : virtual public LinearOpDefaultBase<double>,
00050 public LoadableMatrix<double>,
00051 public RowAccessibleOp<double>,
00052 public Printable,
00053 public NamedObject,
00054 public ILUFactorizableOp<double>,
00055 virtual public EpetraLinearOpBase
00056 {
00057 public:
00058
00059
00060
00061 EpetraMatrix(const Epetra_CrsGraph& graph,
00062 const RCP<const EpetraVectorSpace>& domain,
00063 const RCP<const EpetraVectorSpace>& range);
00064
00065
00066 EpetraMatrix(const RCP<Epetra_CrsMatrix>& mat,
00067 const RCP<const EpetraVectorSpace>& domain,
00068 const RCP<const EpetraVectorSpace>& range);
00069
00070
00071 RCP< const VectorSpaceBase<double> > domain() const {return domain_;}
00072
00073
00074 RCP< const VectorSpaceBase<double> > range() const {return range_;}
00075
00076
00077 bool opSupportedImpl(Thyra::EOpTransp M_trans) const;
00078
00079
00080 void applyImpl(
00081 const Thyra::EOpTransp M_trans,
00082 const Thyra::MultiVectorBase<double> &x,
00083 const Teuchos::Ptr<Thyra::MultiVectorBase<double> > &y,
00084 const double alpha,
00085 const double beta
00086 ) const ;
00087
00088
00089
00090
00091
00092 void getNonconstEpetraOpView(
00093 const Teuchos::Ptr<Teuchos::RCP<Epetra_Operator> > &epetraOp,
00094 const Teuchos::Ptr<Thyra::EOpTransp> &epetraOpTransp,
00095 const Teuchos::Ptr<Thyra::EApplyEpetraOpAs> &epetraOpApplyAs,
00096 const Teuchos::Ptr<Thyra::EAdjointEpetraOp> &epetraOpAdjointSupport
00097 );
00098
00099 void getEpetraOpView(
00100 const Teuchos::Ptr<Teuchos::RCP<const Epetra_Operator> > &epetraOp,
00101 const Teuchos::Ptr<Thyra::EOpTransp> &epetraOpTransp,
00102 const Teuchos::Ptr<Thyra::EApplyEpetraOpAs> &epetraOpApplyAs,
00103 const Teuchos::Ptr<Thyra::EAdjointEpetraOp> &epetraOpAdjointSupport
00104 ) const;
00105
00106 Teuchos::RCP< const ScalarProdVectorSpaceBase<double> > rangeScalarProdVecSpc() const;
00107
00108 Teuchos::RCP< const ScalarProdVectorSpaceBase<double> > domainScalarProdVecSpc() const;
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123 virtual void addToRow(int globalRowIndex,
00124 int nElemsToInsert,
00125 const int* globalColumnIndices,
00126 const double* elementValues) ;
00127
00128
00129
00130
00131
00132 virtual void addToElementBatch(int numRows,
00133 int rowBlockSize,
00134 const int* globalRowIndices,
00135 int numColumnsPerRow,
00136 const int* globalColumnIndices,
00137 const double* values,
00138 const int* skipRow);
00139
00140
00141 virtual void zero() ;
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158 virtual void getILUKPreconditioner(int fillLevels,
00159 int overlapFill,
00160 double relaxationValue,
00161 double relativeThreshold,
00162 double absoluteThreshold,
00163 LeftOrRight leftOrRight,
00164 Preconditioner<double>& rtn) const ;
00165
00166
00167 virtual void print(std::ostream& os) const ;
00168
00169
00170
00171 std::ostream& describe(
00172 std::ostream &out
00173 ,const Teuchos::EVerbosityLevel verbLevel
00174 ,const std::string leadingIndent
00175 , const std::string indentSpacer
00176 ) const
00177 {
00178 out << leadingIndent << indentSpacer << this->description() << std::endl;
00179 return out;
00180 }
00181
00182
00183
00184 std::string description() const ;
00185
00186
00187 static Epetra_CrsMatrix& getConcrete(const LinearOperator<double>& A);
00188
00189
00190 static RCP<const Epetra_CrsMatrix> getConcretePtr(const LinearOperator<double>& A);
00191
00192
00193
00194
00195 const Epetra_CrsMatrix* crsMatrix() const ;
00196
00197 protected:
00198
00199
00200 void getRow(const int& row,
00201 Teuchos::Array<int>& indices,
00202 Teuchos::Array<double>& values) const;
00203
00204 private:
00205
00206 Epetra_CrsMatrix* crsMatrix();
00207
00208 RCP<Epetra_CrsMatrix> matrix_;
00209
00210 RCP<const VectorSpaceBase<double> > range_;
00211
00212 RCP<const VectorSpaceBase<double> > domain_;
00213
00214 const Epetra_Map& getRangeMap() const;
00215 const Epetra_Map& getDomainMap() const;
00216 };
00217
00218
00219
00220 }
00221
00222 #endif