29 #ifndef Rythmos_IMPLICITBDF_STEPPER_ERR_WT_VEC_CALC_H
30 #define Rythmos_IMPLICITBDF_STEPPER_ERR_WT_VEC_CALC_H
32 #include "Rythmos_ErrWtVecCalcBase.hpp"
36 template<
class Scalar>
37 class ImplicitBDFStepperErrWtVecCalc
38 :
virtual public ErrWtVecCalcBase<Scalar>
44 Thyra::VectorBase<Scalar>* weight
45 ,
const Thyra::VectorBase<Scalar>& vector
53 void setParameterList(RCP<Teuchos::ParameterList>
const& paramList);
56 RCP<Teuchos::ParameterList> getNonconstParameterList();
59 RCP<Teuchos::ParameterList> unsetParameterList();
62 RCP<const Teuchos::ParameterList> getValidParameters()
const;
67 RCP<Teuchos::ParameterList> paramList_;
71 template<
class Scalar>
72 void ImplicitBDFStepperErrWtVecCalc<Scalar>::errWtVecSet(
73 Thyra::VectorBase<Scalar>* weight
74 ,
const Thyra::VectorBase<Scalar>& vector
80 using Teuchos::ptrFromRef;
81 typedef Teuchos::ScalarTraits<Scalar> ST;
82 TEUCHOS_TEST_FOR_EXCEPT(weight==NULL);
83 TEUCHOS_TEST_FOR_EXCEPTION(
84 ( ( relTol == ST::zero() ) && ( absTol == ST::zero() ) ),
86 "Error, relTol and absTol cannot both be zero!\n");
87 Thyra::VectorBase<Scalar> &w = *weight;
88 Thyra::abs(vector, ptrFromRef(w));
89 Vt_S(ptrFromRef(w), relTol);
90 Vp_S(ptrFromRef(w), absTol);
91 reciprocal(w, ptrFromRef(w));
92 Vt_StV(ptrFromRef(w), ST::one(), w);
95 int N = vector.space()->dim();
96 Vt_S(ptrFromRef(w), as<Scalar>(1.0/N));
100 RCP<Teuchos::FancyOStream> out = this->getOStream();
101 Teuchos::EVerbosityLevel verbLevel = this->getVerbLevel();
102 Teuchos::OSTab ostab(out,1,
"errWtVecSet");
104 if ( as<int>(verbLevel) >= as<int>(Teuchos::VERB_EXTREME) ) {
105 *out <<
"weight = " << std::endl;
106 weight->describe(*out,verbLevel);
110 template<
class Scalar>
111 void ImplicitBDFStepperErrWtVecCalc<Scalar>::setParameterList(
112 RCP<Teuchos::ParameterList>
const& paramList
115 TEUCHOS_TEST_FOR_EXCEPT(paramList == Teuchos::null);
116 paramList->validateParameters(*this->getValidParameters(),0);
117 paramList_ = paramList;
118 Teuchos::readVerboseObjectSublist(&*paramList_,
this);
121 template<
class Scalar>
122 RCP<Teuchos::ParameterList>
123 ImplicitBDFStepperErrWtVecCalc<Scalar>::unsetParameterList()
125 RCP<Teuchos::ParameterList> temp_param_list = paramList_;
126 paramList_ = Teuchos::null;
127 return(temp_param_list);
130 template<
class Scalar>
131 RCP<Teuchos::ParameterList>
132 ImplicitBDFStepperErrWtVecCalc<Scalar>::getNonconstParameterList()
137 template<
class Scalar>
138 RCP<const Teuchos::ParameterList>
139 ImplicitBDFStepperErrWtVecCalc<Scalar>::getValidParameters()
const
141 static RCP<Teuchos::ParameterList> validPL;
142 if (is_null(validPL)) {
143 RCP<Teuchos::ParameterList>
144 pl = Teuchos::parameterList();
145 Teuchos::setupVerboseObjectSublist(&*pl);
153 #endif // Rythmos_IMPLICITBDF_STEPPER_ERR_WT_VEC_CALC_H