本文整理汇总了C++中meb::InArgs::set_step_size方法的典型用法代码示例。如果您正苦于以下问题:C++ InArgs::set_step_size方法的具体用法?C++ InArgs::set_step_size怎么用?C++ InArgs::set_step_size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类meb::InArgs
的用法示例。
在下文中一共展示了InArgs::set_step_size方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createMember
void DiagonalImplicitRKModelEvaluator<Scalar>::evalModelImpl(
const Thyra::ModelEvaluatorBase::InArgs<Scalar>& inArgs_stage,
const Thyra::ModelEvaluatorBase::OutArgs<Scalar>& outArgs_stage
) const
{
typedef ScalarTraits<Scalar> ST;
typedef Thyra::ModelEvaluatorBase MEB;
typedef typename Thyra::ModelEvaluatorBase::InArgs<Scalar>::ScalarMag TScalarMag;
TEUCHOS_TEST_FOR_EXCEPTION( !isInitialized_, std::logic_error,
"Error! initializeDIRKModel must be called before evalModel\n"
);
TEUCHOS_TEST_FOR_EXCEPTION( !setTimeStepPointCalled_, std::logic_error,
"Error! setTimeStepPoint must be called before evalModel"
);
TEUCHOS_TEST_FOR_EXCEPTION( currentStage_ == -1, std::logic_error,
"Error! setCurrentStage must be called before evalModel"
);
THYRA_MODEL_EVALUATOR_DECORATOR_EVAL_MODEL_GEN_BEGIN(
"Rythmos::DiagonalImplicitRKModelEvaluator",inArgs_stage,outArgs_stage,daeModel_
);
//
// A) Unwrap the inArgs and outArgs
//
const RCP<const Thyra::VectorBase<Scalar> > x_in = inArgs_stage.get_x();
const RCP<Thyra::VectorBase<Scalar> > f_out = outArgs_stage.get_f();
const RCP<Thyra::LinearOpBase<Scalar> > W_op_out = outArgs_stage.get_W_op();
//
// B) Assemble f_out and W_op_out for given stage
//
MEB::InArgs<Scalar> daeInArgs = daeModel_->createInArgs();
MEB::OutArgs<Scalar> daeOutArgs = daeModel_->createOutArgs();
const RCP<Thyra::VectorBase<Scalar> > x_i = createMember(daeModel_->get_x_space());
daeInArgs.setArgs(basePoint_);
// B.1) Setup the DAE's inArgs for stage f(currentStage_) ...
V_V(stage_derivatives_->getNonconstVectorBlock(currentStage_).ptr(),*x_in);
assembleIRKState( currentStage_, dirkButcherTableau_->A(), delta_t_, *x_old_, *stage_derivatives_, outArg(*x_i) );
daeInArgs.set_x( x_i );
daeInArgs.set_x_dot( x_in );
daeInArgs.set_t( t_old_ + dirkButcherTableau_->c()(currentStage_) * delta_t_ );
daeInArgs.set_alpha(ST::one());
daeInArgs.set_beta( delta_t_ * dirkButcherTableau_->A()(currentStage_,currentStage_) );
if (daeInArgs.supports(MEB::IN_ARG_step_size)) {
TScalarMag scaled_dt;
if (currentStage_ == 0 && dirkButcherTableau_->A()(currentStage_,currentStage_) == 0) {
scaled_dt = Scalar( delta_t_ /dirkButcherTableau_->numStages() );
} else {
scaled_dt = dirkButcherTableau_->c()(currentStage_) * delta_t_;
}
daeInArgs.set_step_size( scaled_dt );
}
if (daeInArgs.supports(MEB::IN_ARG_stage_number)) {
daeInArgs.set_stage_number( dirkButcherTableau_->c()(currentStage_) );
}
// B.2) Setup the DAE's outArgs for stage f(i) ...
if (!is_null(f_out))
daeOutArgs.set_f( f_out );
if (!is_null(W_op_out))
daeOutArgs.set_W_op(W_op_out);
// B.3) Compute f_out(i) and/or W_op_out ...
daeModel_->evalModel( daeInArgs, daeOutArgs );
daeOutArgs.set_f(Teuchos::null);
daeOutArgs.set_W_op(Teuchos::null);
THYRA_MODEL_EVALUATOR_DECORATOR_EVAL_MODEL_END();
}