本文整理汇总了C++中meb::OutArgs::set_DfDp方法的典型用法代码示例。如果您正苦于以下问题:C++ OutArgs::set_DfDp方法的具体用法?C++ OutArgs::set_DfDp怎么用?C++ OutArgs::set_DfDp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类meb::OutArgs
的用法示例。
在下文中一共展示了OutArgs::set_DfDp方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: stateModel_outputTempState
void ForwardSensitivityExplicitModelEvaluator<Scalar>::computeDerivativeMatrices(
const Thyra::ModelEvaluatorBase::InArgs<Scalar> &point
) const
{
TEUCHOS_ASSERT( !is_null(stateModel_) );
typedef Thyra::ModelEvaluatorBase MEB;
typedef Teuchos::VerboseObjectTempState<MEB> VOTSME;
Teuchos::RCP<Teuchos::FancyOStream> out = this->getOStream();
Teuchos::EVerbosityLevel verbLevel = this->getVerbLevel();
MEB::InArgs<Scalar> inArgs = stateBasePoint_;
MEB::OutArgs<Scalar> outArgs = stateModel_->createOutArgs();
if (is_null(DfDx_)) {
DfDx_ = stateModel_->create_W_op();
}
if (inArgs.supports(MEB::IN_ARG_beta)) {
inArgs.set_beta(1.0);
}
outArgs.set_W_op(DfDx_);
if (is_null(DfDp_)) {
DfDp_ = Thyra::create_DfDp_mv(
*stateModel_,p_index_,
MEB::DERIV_MV_BY_COL
).getMultiVector();
}
outArgs.set_DfDp(
p_index_,
MEB::Derivative<Scalar>(DfDp_,MEB::DERIV_MV_BY_COL)
);
VOTSME stateModel_outputTempState(stateModel_,out,verbLevel);
stateModel_->evalModel(inArgs,outArgs);
}
示例2: if
void ModelEvaluatorDefaultBase<Scalar>::evalModel(
const ModelEvaluatorBase::InArgs<Scalar> &inArgs,
const ModelEvaluatorBase::OutArgs<Scalar> &outArgs
) const
{
using Teuchos::outArg;
typedef ModelEvaluatorBase MEB;
lazyInitializeDefaultBase();
const int l_Np = outArgs.Np();
const int l_Ng = outArgs.Ng();
//
// A) Assert that the inArgs and outArgs object match this class!
//
#ifdef TEUCHOS_DEBUG
assertInArgsEvalObjects(*this,inArgs);
assertOutArgsEvalObjects(*this,outArgs,&inArgs);
#endif
//
// B) Setup the OutArgs object for the underlying implementation's
// evalModelImpl(...) function
//
MEB::OutArgs<Scalar> outArgsImpl = this->createOutArgsImpl();
Array<MultiVectorAdjointPair> DgDp_temp_adjoint_copies;
{
outArgsImpl.setArgs(outArgs,true);
// DfDp(l)
if (outArgsImpl.supports(MEB::OUT_ARG_f)) {
for ( int l = 0; l < l_Np; ++l ) {
const DefaultDerivLinearOpSupport defaultLinearOpSupport =
DfDp_default_op_support_[l];
if (defaultLinearOpSupport.provideDefaultLinearOp()) {
outArgsImpl.set_DfDp( l,
getOutArgImplForDefaultLinearOpSupport(
outArgs.get_DfDp(l), defaultLinearOpSupport
)
);
}
else {
// DfDp(l) already set by outArgsImpl.setArgs(...)!
}
}
}
// DgDx_dot(j)
for ( int j = 0; j < l_Ng; ++j ) {
const DefaultDerivLinearOpSupport defaultLinearOpSupport =
DgDx_dot_default_op_support_[j];
if (defaultLinearOpSupport.provideDefaultLinearOp()) {
outArgsImpl.set_DgDx_dot( j,
getOutArgImplForDefaultLinearOpSupport(
outArgs.get_DgDx_dot(j), defaultLinearOpSupport
)
);
}
else {
// DgDx_dot(j) already set by outArgsImpl.setArgs(...)!
}
}
// DgDx(j)
for ( int j = 0; j < l_Ng; ++j ) {
const DefaultDerivLinearOpSupport defaultLinearOpSupport =
DgDx_default_op_support_[j];
if (defaultLinearOpSupport.provideDefaultLinearOp()) {
outArgsImpl.set_DgDx( j,
getOutArgImplForDefaultLinearOpSupport(
outArgs.get_DgDx(j), defaultLinearOpSupport
)
);
}
else {
// DgDx(j) already set by outArgsImpl.setArgs(...)!
}
}
// DgDp(j,l)
for ( int j = 0; j < l_Ng; ++j ) {
const Array<DefaultDerivLinearOpSupport> &DgDp_default_op_support_j =
DgDp_default_op_support_[j];
const Array<DefaultDerivMvAdjointSupport> &DgDp_default_mv_support_j =
DgDp_default_mv_support_[j];
for ( int l = 0; l < l_Np; ++l ) {
const DefaultDerivLinearOpSupport defaultLinearOpSupport =
DgDp_default_op_support_j[l];
const DefaultDerivMvAdjointSupport defaultMvAdjointSupport =
DgDp_default_mv_support_j[l];
MEB::Derivative<Scalar> DgDp_j_l;
if (!outArgs.supports(MEB::OUT_ARG_DgDp,j,l).none())
DgDp_j_l = outArgs.get_DgDp(j,l);
if (
//.........这里部分代码省略.........