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 #include "Thyra_AddedLinearOpBase.hpp"
00033 #include "Thyra_SingleScalarLinearOpBase.hpp"
00034 #include "Teuchos_ConstNonconstObjectContainer.hpp"
00035 #include "Teuchos_arrayArg.hpp"
00036
00037 namespace Thyra {
00038
00070 template<class Scalar>
00071 class DefaultAddedLinearOp
00072 : virtual public AddedLinearOpBase<Scalar>
00073 , virtual protected SingleScalarLinearOpBase<Scalar>
00074 {
00075 public:
00076
00078 using SingleScalarLinearOpBase<Scalar>::apply;
00079
00082
00089 DefaultAddedLinearOp();
00090
00096 DefaultAddedLinearOp(
00097 const int numOps
00098 ,const Teuchos::RCP<LinearOpBase<Scalar> > Ops[]
00099 );
00100
00106 DefaultAddedLinearOp(
00107 const int numOps
00108 ,const Teuchos::RCP<const LinearOpBase<Scalar> > Ops[]
00109 );
00110
00130 void initialize(
00131 const int numOps
00132 ,const Teuchos::RCP<LinearOpBase<Scalar> > Ops[]
00133 );
00134
00154 void initialize(
00155 const int numOps
00156 ,const Teuchos::RCP<const LinearOpBase<Scalar> > Ops[]
00157 );
00158
00165 void uninitialize();
00166
00168
00171
00173 int numOps() const;
00175 bool opIsConst(const int k) const;
00177 Teuchos::RCP<LinearOpBase<Scalar> > getNonconstOp(const int k);
00179 Teuchos::RCP<const LinearOpBase<Scalar> > getOp(const int k) const;
00180
00182
00185
00189 Teuchos::RCP< const VectorSpaceBase<Scalar> > range() const;
00190
00194 Teuchos::RCP< const VectorSpaceBase<Scalar> > domain() const;
00195
00197 Teuchos::RCP<const LinearOpBase<Scalar> > clone() const;
00198
00200
00203
00207 std::string description() const;
00208
00216 void describe(
00217 Teuchos::FancyOStream &out
00218 ,const Teuchos::EVerbosityLevel verbLevel
00219 ) const;
00220
00222
00223 protected:
00224
00227
00231 bool opSupported(ETransp M_trans) const;
00232
00234 void apply(
00235 const ETransp M_trans
00236 ,const MultiVectorBase<Scalar> &X
00237 ,MultiVectorBase<Scalar> *Y
00238 ,const Scalar alpha
00239 ,const Scalar beta
00240 ) const;
00241
00243
00244 private:
00245
00246 std::vector<Teuchos::ConstNonconstObjectContainer<LinearOpBase<Scalar> > > Ops_;
00247
00248 void assertInitialized() const;
00249 void validateOps();
00250 void setupDefaultObjectLabel();
00251
00252
00253 DefaultAddedLinearOp(const DefaultAddedLinearOp&);
00254 DefaultAddedLinearOp& operator=(const DefaultAddedLinearOp&);
00255
00256 };
00257
00262 template<class Scalar>
00263 Teuchos::RCP<LinearOpBase<Scalar> >
00264 nonconstAdd(
00265 const Teuchos::RCP<LinearOpBase<Scalar> > &A
00266 ,const Teuchos::RCP<LinearOpBase<Scalar> > &B
00267 );
00268
00273 template<class Scalar>
00274 Teuchos::RCP<const LinearOpBase<Scalar> >
00275 add(
00276 const Teuchos::RCP<const LinearOpBase<Scalar> > &A
00277 ,const Teuchos::RCP<const LinearOpBase<Scalar> > &B
00278 );
00279
00280
00281
00282
00283 template<class Scalar>
00284 inline
00285 void DefaultAddedLinearOp<Scalar>::assertInitialized() const
00286 {
00287 #ifdef TEUCHOS_DEBUG
00288 TEST_FOR_EXCEPT( !( numOps() > 0 ) );
00289 #endif
00290 }
00291
00292 }
00293
00294 #endif // THYRA_DEFAULT_ADDED_LINEAR_OP_DECL_HPP