本文整理汇总了C++中meb::OutArgs::get_DfDp方法的典型用法代码示例。如果您正苦于以下问题:C++ OutArgs::get_DfDp方法的具体用法?C++ OutArgs::get_DfDp怎么用?C++ OutArgs::get_DfDp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类meb::OutArgs
的用法示例。
在下文中一共展示了OutArgs::get_DfDp方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: totalTimer
//.........这里部分代码省略.........
typedef Teuchos::VerboseObjectTempState<ModelEvaluatorBase> VOTSME;
//VOTSME thyraModel_outputTempState(rcp(&wrappedThyraModel,false),out,verbLevel);
typedef Teuchos::VerboseObjectTempState<NonlinearSolverBase<Scalar> > VOTSNSB;
VOTSNSB statSolver_outputTempState(
stateSolver_,out
,static_cast<int>(verbLevel) >= static_cast<int>(Teuchos::VERB_LOW) ? Teuchos::VERB_LOW : Teuchos::VERB_NONE
);
if(out.get() && static_cast<int>(verbLevel) >= static_cast<int>(Teuchos::VERB_EXTREME))
*out
<< "\ninArgs =\n" << Teuchos::describe(inArgs,verbLevel)
<< "\noutArgs on input =\n" << Teuchos::describe(outArgs,Teuchos::VERB_LOW);
if(out.get() && static_cast<int>(verbLevel) >= static_cast<int>(Teuchos::VERB_LOW))
*out << "\nSolving f(x,...) for x ...\n";
wrappedThyraModel_->setNominalValues(
rcp(new MEB::InArgs<Scalar>(wrappedNominalValues))
);
SolveStatus<Scalar> solveStatus = stateSolver_->solve(&*x_guess_solu_,NULL);
if( solveStatus.solveStatus == SOLVE_STATUS_CONVERGED ) {
if(out.get() && static_cast<int>(verbLevel) >= static_cast<int>(Teuchos::VERB_LOW))
*out << "\nComputing the output functions at the solved state solution ...\n";
MEB::InArgs<Scalar> wrappedInArgs = thyraModel->createInArgs();
MEB::OutArgs<Scalar> wrappedOutArgs = thyraModel->createOutArgs();
wrappedInArgs.setArgs(inArgs,true);
wrappedInArgs.set_x(x_guess_solu_);
wrappedOutArgs.setArgs(outArgs,true);
for( int l = 0; l < Np; ++l ) {
for( int j = 0; j < Ng; ++j ) {
if(
outArgs.supports(MEB::OUT_ARG_DgDp,j,l).none()==false
&& outArgs.get_DgDp(j,l).isEmpty()==false
)
{
// Set DfDp(l) and DgDx(j) to be computed!
//wrappedOutArgs.set_DfDp(l,...);
//wrappedOutArgs.set_DgDx(j,...);
TEST_FOR_EXCEPT(true);
}
}
}
thyraModel->evalModel(wrappedInArgs,wrappedOutArgs);
//
// Compute DgDp(j,l) using direct sensitivties
//
for( int l = 0; l < Np; ++l ) {
if(
wrappedOutArgs.supports(MEB::OUT_ARG_DfDp,l).none()==false
&& wrappedOutArgs.get_DfDp(l).isEmpty()==false
)
{
//
// Compute: D(l) = -inv(DfDx)*DfDp(l)
//
TEST_FOR_EXCEPT(true);
for( int j = 0; j < Ng; ++j ) {
if(
outArgs.supports(MEB::OUT_ARG_DgDp,j,l).none()==false
&& outArgs.get_DgDp(j,l).isEmpty()==false
)
{
//
// Compute: DgDp(j,l) = DgDp(j,l) + DgDx(j)*D
//
TEST_FOR_EXCEPT(true);
}
}
}
}
// ToDo: Add a mode to compute DgDp(l) using adjoint sensitivities?
}
else {
if(out.get() && static_cast<int>(verbLevel) >= static_cast<int>(Teuchos::VERB_LOW))
*out << "\nFailed to converge, returning NaNs ...\n";
outArgs.setFailed();
}
if(out.get() && static_cast<int>(verbLevel) >= static_cast<int>(Teuchos::VERB_EXTREME))
*out
<< "\noutArgs on output =\n" << Teuchos::describe(outArgs,verbLevel);
totalTimer.stop();
if(out.get() && static_cast<int>(verbLevel) >= static_cast<int>(Teuchos::VERB_LOW))
*out
<< "\nTotal evaluation time = "<<totalTimer.totalElapsedTime()<<" sec\n"
<< "\nLeaving Thyra::DefaultStateEliminationModelEvaluator<Scalar>::evalModel(...) ...\n";
}