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 TSFOPWITHBACKWARDSCOMPATIBLEAPPLY_HPP
00030 #define TSFOPWITHBACKWARDSCOMPATIBLEAPPLY_HPP
00031
00032 #include "Thyra_VectorBase.hpp"
00033 #include "Thyra_MultiVectorBase.hpp"
00034 #include "Thyra_AssertOp.hpp"
00035 #include "Thyra_DefaultColumnwiseMultiVector.hpp"
00036 #include "Teuchos_TestForException.hpp"
00037 #include "SundanceObjectWithVerbosity.hpp"
00038 #include "SundanceNamedObject.hpp"
00039 #include "SundanceOut.hpp"
00040
00041 namespace TSFExtended
00042 {
00043 using namespace Teuchos;
00044 using namespace Thyra;
00045 using namespace Sundance;
00046
00047
00048 template <class Scalar>
00049 class OpWithBackwardsCompatibleApply :
00050 public LinearOpBase<Scalar>,
00051 public DefaultObjectWithVerbosity
00052 {
00053 public:
00054
00055
00056 bool opSupportedImpl(Thyra::EOpTransp M_trans) const
00057 {
00058 return (M_trans == Thyra::NOTRANS);
00059 }
00060
00061
00062 virtual void applyImpl(
00063 const Thyra::EOpTransp M_trans,
00064 const Thyra::MultiVectorBase<Scalar> &X,
00065 const Ptr<Thyra::MultiVectorBase<Scalar> > &Y,
00066 const Scalar alpha,
00067 const Scalar beta
00068 ) const
00069 {
00070 generalApply(M_trans, X, &*Y, alpha, beta);
00071 }
00072
00073
00074
00075
00076
00077
00078 virtual void generalApply(const Thyra::EOpTransp M_trans,
00079 const Thyra::MultiVectorBase<Scalar> &x,
00080 Thyra::MultiVectorBase<Scalar> *y,
00081 const Scalar alpha,
00082 const Scalar beta) const
00083 {
00084
00085 using Teuchos::dyn_cast;
00086
00087 THYRA_ASSERT_LINEAR_OP_MULTIVEC_APPLY_SPACES(
00088 "OpWithBackwardsCompatibleApply<Scalar>::applyImpl(...)",
00089 *this, M_trans, x, y );
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099 int nXCols = x.domain()->dim();
00100
00101 for (int i=0; i < nXCols; i++)
00102 {
00103 generalApply(M_trans, *x.col(i), &*y->col(i), alpha, beta);
00104
00105 }
00106 }
00107
00108
00109
00110
00111 virtual void generalApply(const Thyra::EOpTransp M_trans,
00112 const Thyra::VectorBase<Scalar> &x,
00113 Thyra::VectorBase<Scalar>* y,
00114 const Scalar alpha = Teuchos::ScalarTraits<Scalar>::one(),
00115 const Scalar beta = Teuchos::ScalarTraits<Scalar>::zero()) const = 0 ;
00116 };
00117
00118 }
00119
00120 #endif