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_ADDED_LINEAR_OP_DECL_HPP
00030 #define THYRA_DEFAULT_ADDED_LINEAR_OP_DECL_HPP
00031
00032
00033 #include "Thyra_AddedLinearOpBase.hpp"
00034 #include "Thyra_SingleScalarLinearOpBase.hpp"
00035 #include "Teuchos_ConstNonconstObjectContainer.hpp"
00036 #include "Teuchos_arrayArg.hpp"
00037
00038
00039 namespace Thyra {
00040
00041
00073 template<class Scalar>
00074 class DefaultAddedLinearOp
00075 : virtual public AddedLinearOpBase<Scalar>
00076 , virtual protected SingleScalarLinearOpBase<Scalar>
00077 {
00078 public:
00079
00080 #ifdef THYRA_INJECT_USING_DECLARATIONS
00081 using SingleScalarLinearOpBase<Scalar>::apply;
00082 #endif
00083
00086
00093 DefaultAddedLinearOp();
00094
00100 DefaultAddedLinearOp(
00101 const int numOps,
00102 const RCP<LinearOpBase<Scalar> > Ops[]
00103 );
00104
00110 DefaultAddedLinearOp(
00111 const int numOps,
00112 const RCP<const LinearOpBase<Scalar> > Ops[]
00113 );
00114
00134 void initialize(
00135 const int numOps,
00136 const RCP<LinearOpBase<Scalar> > Ops[]
00137 );
00138
00158 void initialize(
00159 const int numOps,
00160 const RCP<const LinearOpBase<Scalar> > Ops[]
00161 );
00162
00169 void uninitialize();
00170
00172
00175
00177 int numOps() const;
00179 bool opIsConst(const int k) const;
00181 RCP<LinearOpBase<Scalar> > getNonconstOp(const int k);
00183 RCP<const LinearOpBase<Scalar> > getOp(const int k) const;
00184
00186
00189
00193 RCP< const VectorSpaceBase<Scalar> > range() const;
00194
00198 RCP< const VectorSpaceBase<Scalar> > domain() const;
00199
00201 RCP<const LinearOpBase<Scalar> > clone() const;
00202
00204
00207
00211 std::string description() const;
00212
00220 void describe(
00221 Teuchos::FancyOStream &out,
00222 const Teuchos::EVerbosityLevel verbLevel
00223 ) const;
00224
00226
00227 protected:
00228
00231
00235 bool opSupported(EOpTransp M_trans) const;
00236
00238 void apply(
00239 const EOpTransp M_trans,
00240 const MultiVectorBase<Scalar> &X,
00241 MultiVectorBase<Scalar> *Y,
00242 const Scalar alpha,
00243 const Scalar beta
00244 ) const;
00245
00247
00248 private:
00249
00250 std::vector<Teuchos::ConstNonconstObjectContainer<LinearOpBase<Scalar> > > Ops_;
00251
00252 void assertInitialized() const;
00253 void validateOps();
00254 void setupDefaultObjectLabel();
00255
00256
00257 DefaultAddedLinearOp(const DefaultAddedLinearOp&);
00258 DefaultAddedLinearOp& operator=(const DefaultAddedLinearOp&);
00259
00260 };
00261
00262
00267 template<class Scalar>
00268 RCP<LinearOpBase<Scalar> >
00269 nonconstAdd(
00270 const RCP<LinearOpBase<Scalar> > &A,
00271 const RCP<LinearOpBase<Scalar> > &B,
00272 const std::string &label = ""
00273 );
00274
00275
00280 template<class Scalar>
00281 RCP<const LinearOpBase<Scalar> >
00282 add(
00283 const RCP<const LinearOpBase<Scalar> > &A,
00284 const RCP<const LinearOpBase<Scalar> > &B,
00285 const std::string &label = ""
00286 );
00287
00288
00293 template<class Scalar>
00294 RCP<LinearOpBase<Scalar> >
00295 nonconstSubtract(
00296 const RCP<LinearOpBase<Scalar> > &A,
00297 const RCP<LinearOpBase<Scalar> > &B,
00298 const std::string &label = ""
00299 );
00300
00301
00306 template<class Scalar>
00307 RCP<const LinearOpBase<Scalar> >
00308 subtract(
00309 const RCP<const LinearOpBase<Scalar> > &A,
00310 const RCP<const LinearOpBase<Scalar> > &B,
00311 const std::string &label = ""
00312 );
00313
00314
00315
00316
00317
00318
00319 template<class Scalar>
00320 inline
00321 void DefaultAddedLinearOp<Scalar>::assertInitialized() const
00322 {
00323 #ifdef TEUCHOS_DEBUG
00324 TEST_FOR_EXCEPT( !( numOps() > 0 ) );
00325 #endif
00326 }
00327
00328
00329 }
00330
00331
00332 #endif // THYRA_DEFAULT_ADDED_LINEAR_OP_DECL_HPP