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_MULTIPLIED_LINEAR_OP_DECL_HPP
00030 #define THYRA_DEFAULT_MULTIPLIED_LINEAR_OP_DECL_HPP
00031
00032 #include "Thyra_MultipliedLinearOpBase.hpp"
00033 #include "Thyra_SingleScalarLinearOpBase.hpp"
00034 #include "Teuchos_ConstNonconstObjectContainer.hpp"
00035 #include "Teuchos_arrayArg.hpp"
00036 #include "Teuchos_Handleable.hpp"
00037
00038
00039 namespace Thyra {
00040
00041
00109 template<class Scalar>
00110 class DefaultMultipliedLinearOp
00111 : virtual public MultipliedLinearOpBase<Scalar>,
00112 virtual protected SingleScalarLinearOpBase<Scalar>,
00113 virtual public Teuchos::Handleable<LinearOpBase<Scalar> >
00114 {
00115 public:
00116
00117 TEUCHOS_GET_RCP(LinearOpBase<Scalar>);
00118
00120 using SingleScalarLinearOpBase<Scalar>::apply;
00121
00124
00131 DefaultMultipliedLinearOp();
00132
00138 DefaultMultipliedLinearOp(
00139 const int numOps,
00140 const Teuchos::RCP<LinearOpBase<Scalar> > Ops[]
00141 );
00142
00148 DefaultMultipliedLinearOp(
00149 const int numOps,
00150 const Teuchos::RCP<const LinearOpBase<Scalar> > Ops[]
00151 );
00152
00172 void initialize(
00173 const int numOps,
00174 const Teuchos::RCP<LinearOpBase<Scalar> > Ops[]
00175 );
00176
00196 void initialize(
00197 const int numOps,
00198 const Teuchos::RCP<const LinearOpBase<Scalar> > Ops[]
00199 );
00200
00207 void uninitialize();
00208
00210
00213
00215 int numOps() const;
00217 bool opIsConst(const int k) const;
00219 Teuchos::RCP<LinearOpBase<Scalar> > getNonconstOp(const int k);
00221 Teuchos::RCP<const LinearOpBase<Scalar> > getOp(const int k) const;
00222
00224
00227
00231 Teuchos::RCP< const VectorSpaceBase<Scalar> > range() const;
00232
00236 Teuchos::RCP< const VectorSpaceBase<Scalar> > domain() const;
00237
00239 Teuchos::RCP<const LinearOpBase<Scalar> > clone() const;
00240
00242
00245
00249 std::string description() const;
00250
00258 void describe(
00259 Teuchos::FancyOStream &out,
00260 const Teuchos::EVerbosityLevel verbLevel
00261 ) const;
00262
00264
00265 protected:
00266
00269
00273 bool opSupported(ETransp M_trans) const;
00274
00276 void apply(
00277 const ETransp M_trans,
00278 const MultiVectorBase<Scalar> &X,
00279 MultiVectorBase<Scalar> *Y,
00280 const Scalar alpha,
00281 const Scalar beta
00282 ) const;
00283
00285
00286 private:
00287
00288 Teuchos::Array<Teuchos::ConstNonconstObjectContainer<LinearOpBase<Scalar> > > Ops_;
00289
00290 void assertInitialized() const;
00291 void validateOps();
00292 void setupDefaultObjectLabel();
00293
00294
00295 DefaultMultipliedLinearOp(const DefaultMultipliedLinearOp&);
00296 DefaultMultipliedLinearOp& operator=(const DefaultMultipliedLinearOp&);
00297
00298 };
00299
00300
00305 template<class Scalar>
00306 Teuchos::RCP<LinearOpBase<Scalar> >
00307 nonconstMultiply(
00308 const Teuchos::RCP<LinearOpBase<Scalar> > &A,
00309 const Teuchos::RCP<LinearOpBase<Scalar> > &B,
00310 const std::string &M_label = ""
00311 );
00312
00313
00318 template<class Scalar>
00319 Teuchos::RCP<const LinearOpBase<Scalar> >
00320 multiply(
00321 const Teuchos::RCP<const LinearOpBase<Scalar> > &A,
00322 const Teuchos::RCP<const LinearOpBase<Scalar> > &B,
00323 const std::string &M_label = ""
00324 );
00325
00326
00331 template<class Scalar>
00332 Teuchos::RCP<const LinearOpBase<Scalar> >
00333 multiply(
00334 const Teuchos::RCP<const LinearOpBase<Scalar> > &A,
00335 const Teuchos::RCP<const LinearOpBase<Scalar> > &B,
00336 const Teuchos::RCP<const LinearOpBase<Scalar> > &C,
00337 const std::string &M_label = ""
00338 );
00339
00340
00341
00342
00343
00344 template<class Scalar>
00345 inline
00346 void DefaultMultipliedLinearOp<Scalar>::assertInitialized() const
00347 {
00348 #ifdef TEUCHOS_DEBUG
00349 TEST_FOR_EXCEPT( !( numOps() > 0 ) );
00350 #endif
00351 }
00352
00353 }
00354
00355 #endif // THYRA_DEFAULT_MULTIPLIED_LINEAR_OP_DECL_HPP