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 THYRA_DEFAULT_BLOCKED_TRIANGULAR_LINEAR_OP_WITH_SOLVE_DECL_HPP
00030 #define THYRA_DEFAULT_BLOCKED_TRIANGULAR_LINEAR_OP_WITH_SOLVE_DECL_HPP
00031
00032
00033 #include "Thyra_PhysicallyBlockedLinearOpWithSolveBase.hpp"
00034 #include "Thyra_SingleScalarLinearOpWithSolveBase.hpp"
00035 #include "Thyra_ProductVectorSpaceBase.hpp"
00036 #include "Teuchos_ConstNonconstObjectContainer.hpp"
00037 #include "Teuchos_Array.hpp"
00038
00039
00040 namespace Thyra {
00041
00042
00051 template<class Scalar>
00052 class DefaultBlockedTriangularLinearOpWithSolve
00053 : virtual public PhysicallyBlockedLinearOpWithSolveBase<Scalar>,
00054 virtual protected SingleScalarLinearOpWithSolveBase<Scalar>
00055 {
00056 public:
00057
00060
00062 DefaultBlockedTriangularLinearOpWithSolve();
00063
00065
00068
00070 bool acceptsLOWSBlock(const int i, const int j) const;
00072 void setNonconstLOWSBlock(
00073 const int i, const int j,
00074 const Teuchos::RCP<LinearOpWithSolveBase<Scalar> > &block
00075 );
00077 void setLOWSBlock(
00078 const int i, const int j,
00079 const Teuchos::RCP<const LinearOpWithSolveBase<Scalar> > &block
00080 );
00081
00083
00086
00088 void beginBlockFill();
00090 void beginBlockFill(
00091 const int numRowBlocks, const int numColBlocks
00092 );
00094 void beginBlockFill(
00095 const Teuchos::RCP<const ProductVectorSpaceBase<Scalar> > &productRange,
00096 const Teuchos::RCP<const ProductVectorSpaceBase<Scalar> > &productDomain
00097 );
00099 bool blockFillIsActive() const;
00101 bool acceptsBlock(const int i, const int j) const;
00103 void setNonconstBlock(
00104 const int i, const int j,
00105 const Teuchos::RCP<LinearOpBase<Scalar> > &block
00106 );
00108 void setBlock(
00109 const int i, const int j,
00110 const Teuchos::RCP<const LinearOpBase<Scalar> > &block
00111 );
00113 void endBlockFill();
00115 void uninitialize();
00116
00118
00121
00123 Teuchos::RCP<LinearOpWithSolveBase<Scalar> >
00124 getNonconstLOWSBlock(const int i, const int j);
00126 Teuchos::RCP<const LinearOpWithSolveBase<Scalar> >
00127 getLOWSBlock(const int i, const int j) const;
00128
00130
00133
00135 Teuchos::RCP<const ProductVectorSpaceBase<Scalar> >
00136 productRange() const;
00138 Teuchos::RCP<const ProductVectorSpaceBase<Scalar> >
00139 productDomain() const;
00141 bool blockExists(const int i, const int j) const;
00143 bool blockIsConst(const int i, const int j) const;
00145 Teuchos::RCP<LinearOpBase<Scalar> >
00146 getNonconstBlock(const int i, const int j);
00148 Teuchos::RCP<const LinearOpBase<Scalar> >
00149 getBlock(const int i, const int j) const;
00150
00152
00155
00157 Teuchos::RCP< const VectorSpaceBase<Scalar> > range() const;
00159 Teuchos::RCP< const VectorSpaceBase<Scalar> > domain() const;
00161 Teuchos::RCP<const LinearOpBase<Scalar> > clone() const;
00162
00164
00167
00171 std::string description() const;
00172
00180 void describe(
00181 Teuchos::FancyOStream &out,
00182 const Teuchos::EVerbosityLevel verbLevel
00183 ) const;
00184
00186
00187 protected:
00188
00191
00193 bool solveSupportsTrans(ETransp M_trans) const;
00195 bool solveSupportsSolveMeasureType(
00196 ETransp M_trans, const SolveMeasureType& solveMeasureType ) const;
00198 void solve(
00199 const ETransp M_trans,
00200 const MultiVectorBase<Scalar> &B,
00201 MultiVectorBase<Scalar> *X,
00202 const int numBlocks,
00203 const BlockSolveCriteria<Scalar> blockSolveCriteria[],
00204 SolveStatus<Scalar> blockSolveStatus[]
00205 ) const;
00206
00208
00211
00215 bool opSupported(ETransp M_trans) const;
00216
00218 void apply(
00219 const ETransp M_trans,
00220 const MultiVectorBase<Scalar> &X,
00221 MultiVectorBase<Scalar> *Y,
00222 const Scalar alpha,
00223 const Scalar beta
00224 ) const;
00225
00227
00228 private:
00229
00230
00231
00232
00233 typedef Teuchos::ConstNonconstObjectContainer<LinearOpWithSolveBase<Scalar> >
00234 CNCLOWS;
00235
00236
00237
00238
00239 bool blockFillIsActive_;
00240
00241 Teuchos::RCP<const ProductVectorSpaceBase<Scalar> > productRange_;
00242 Teuchos::RCP<const ProductVectorSpaceBase<Scalar> > productDomain_;
00243 int numDiagBlocks_;
00244
00245 Teuchos::Array<CNCLOWS> diagonalBlocks_;
00246
00247
00248
00249
00250
00251
00252 void assertBlockFillIsActive(bool) const;
00253
00254 void assertBlockRowCol(const int i, const int j) const;
00255
00256 template<class LinearOpWithSolveType>
00257 void setLOWSBlockImpl(
00258 const int i, const int j
00259 ,const Teuchos::RCP<LinearOpWithSolveType> &block
00260 );
00261
00262
00263 DefaultBlockedTriangularLinearOpWithSolve(
00264 const DefaultBlockedTriangularLinearOpWithSolve& );
00265 DefaultBlockedTriangularLinearOpWithSolve&
00266 operator=(const DefaultBlockedTriangularLinearOpWithSolve&);
00267
00268 };
00269
00270
00271 }
00272
00273
00274 #endif // THYRA_DEFAULT_BLOCKED_TRIANGULAR_LINEAR_OP_WITH_SOLVE_DECL_HPP