本文整理汇总了C++中meb::InArgs::get_x_dot方法的典型用法代码示例。如果您正苦于以下问题:C++ InArgs::get_x_dot方法的具体用法?C++ InArgs::get_x_dot怎么用?C++ InArgs::get_x_dot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类meb::InArgs
的用法示例。
在下文中一共展示了InArgs::get_x_dot方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setDefaultInitialConditionFromNominalValues
bool setDefaultInitialConditionFromNominalValues(
const Thyra::ModelEvaluator<Scalar>& model,
const Ptr<StepperBase<Scalar> >& stepper
)
{
typedef ScalarTraits<Scalar> ST;
typedef Thyra::ModelEvaluatorBase MEB;
if (isInitialized(*stepper))
return false; // Already has an initial condition
MEB::InArgs<Scalar> initCond = model.getNominalValues();
if (!is_null(initCond.get_x())) {
// IC has x, we will assume that initCont.get_t() is the valid start time.
// Therefore, we just need to check that x_dot is also set or we will
// create a zero x_dot
#ifdef RYTHMOS_DEBUG
THYRA_ASSERT_VEC_SPACES( "setInitialConditionIfExists(...)",
*model.get_x_space(), *initCond.get_x()->space() );
#endif
if (initCond.supports(MEB::IN_ARG_x_dot)) {
if (is_null(initCond.get_x_dot())) {
const RCP<Thyra::VectorBase<Scalar> > x_dot =
createMember(model.get_x_space());
assign(x_dot.ptr(), ST::zero());
}
else {
#ifdef RYTHMOS_DEBUG
THYRA_ASSERT_VEC_SPACES( "setInitialConditionIfExists(...)",
*model.get_x_space(), *initCond.get_x_dot()->space() );
#endif
}
}
stepper->setInitialCondition(initCond);
return true;
}
// The model has not nominal values for which to set the initial
// conditions so wo don't do anything! The stepper will still have not
return false;
}
示例2: main
//.........这里部分代码省略.........
// The above call will result in stateStepper and nonlinearSolver being
// cloned. This helps to ensure consistency between the state and
// sensitivity computations!
}
//
// Set the initial condition for the state and forward sensitivities
//
RCP<Thyra::VectorBase<Scalar> > s_bar_init
= createMember(stateAndSensStepper->getFwdSensModel()->get_x_space());
assign( s_bar_init.ptr(), 0.0 );
RCP<Thyra::VectorBase<Scalar> > s_bar_dot_init
= createMember(stateAndSensStepper->getFwdSensModel()->get_x_space());
assign( s_bar_dot_init.ptr(), 0.0 );
// Above, I believe that these are the correct initial conditions for
// s_bar and s_bar_dot given how the EpetraExt::DiagonalTransientModel
// is currently implemented!
RCP<const Rythmos::StateAndForwardSensitivityModelEvaluator<Scalar> >
stateAndSensModel = stateAndSensStepper->getStateAndFwdSensModel();
MEB::InArgs<Scalar>
state_and_sens_ic = stateAndSensStepper->getModel()->createInArgs();
// Copy time, parameters etc.
state_and_sens_ic.setArgs(state_ic);
// Set initial condition for x_bar = [ x; s_bar ]
state_and_sens_ic.set_x(
stateAndSensModel->create_x_bar_vec(state_ic.get_x(),s_bar_init)
);
// Set initial condition for x_bar_dot = [ x_dot; s_bar_dot ]
state_and_sens_ic.set_x_dot(
stateAndSensModel->create_x_bar_vec(state_ic.get_x_dot(),s_bar_dot_init)
);
*out << "\nstate_and_sens_ic:\n" << describe(state_and_sens_ic,verbLevel);
stateAndSensStepper->setInitialCondition(state_and_sens_ic);
//
// Use a StepperAsModelEvaluator to integrate the state+sens
//
RCP<Rythmos::StepperAsModelEvaluator<Scalar> >
stateAndSensIntegratorAsModel = Rythmos::stepperAsModelEvaluator(
rcp_implicit_cast<Rythmos::StepperBase<Scalar> >(stateAndSensStepper),
integrator, state_and_sens_ic
);
stateAndSensIntegratorAsModel->setVerbLevel(verbLevel);
*out << "\nUse the StepperAsModelEvaluator to integrate state + sens x_bar(p,finalTime) ... \n";
RCP<Thyra::VectorBase<Scalar> > x_bar_final;
{
Teuchos::OSTab tab(out);
x_bar_final = createMember(stateAndSensIntegratorAsModel->get_g_space(0));
eval_g(
*stateAndSensIntegratorAsModel,
0, *state_ic.get_p(0),
finalTime,
0, &*x_bar_final