本文整理汇总了C++中meb::OutArgs::set_g方法的典型用法代码示例。如果您正苦于以下问题:C++ OutArgs::set_g方法的具体用法?C++ OutArgs::set_g怎么用?C++ OutArgs::set_g使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类meb::OutArgs
的用法示例。
在下文中一共展示了OutArgs::set_g方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
int TriKota::ThyraDirectApplicInterface::derived_map_ac(const Dakota::String& ac_name)
{
if (App != Teuchos::null) {
// Test for consistency of problem definition between ModelEval and Dakota
TEST_FOR_EXCEPTION(numVars > numParameters, std::logic_error,
"TriKota_Dakota Adapter Error: ");
TEST_FOR_EXCEPTION(numFns > numResponses, std::logic_error,
"TriKota_Dakota Adapter Error: ");
TEST_FOR_EXCEPTION(hessFlag, std::logic_error,
"TriKota_Dakota Adapter Error: ");
MEB::InArgs<double> inArgs = App->createInArgs();
MEB::OutArgs<double> outArgs = App->createOutArgs();
TEST_FOR_EXCEPTION(gradFlag && !supportsSensitivities, std::logic_error,
"TriKota_Dakota Adapter Error: ");
// Load parameters from Dakota to ModelEval data structure
{
Thyra::DetachedVectorView<double> my_p(model_p);
for (unsigned int i=0; i<numVars; i++) my_p[i]=xC[i];
}
// Evaluate model
inArgs.set_p(0,model_p);
outArgs.set_g(0,model_g);
if (gradFlag) outArgs.set_DgDp(0,0,
MEB::DerivativeMultiVector<double>(model_dgdp,orientation));
App->evalModel(inArgs, outArgs);
Thyra::DetachedVectorView<double> my_g(model_g);
for (unsigned int j=0; j<numFns; j++) fnVals[j]= my_g[j];
if (gradFlag) {
if (orientation == MEB::DERIV_MV_BY_COL) {
for (unsigned int j=0; j<numVars; j++) {
Thyra::DetachedVectorView<double>
my_dgdp_j(model_dgdp->col(j));
for (unsigned int i=0; i<numFns; i++) fnGrads[i][j]= my_dgdp_j[i];
}
}
else {
for (unsigned int j=0; j<numFns; j++) {
Thyra::DetachedVectorView<double>
my_dgdp_j(model_dgdp->col(j));
for (unsigned int i=0; i<numVars; i++) fnGrads[j][i]= my_dgdp_j[i];
}
}
}
}
else {
TEST_FOR_EXCEPTION(parallelLib.parallel_configuration().ea_parallel_level().server_intra_communicator()
!= MPI_COMM_NULL, std::logic_error,
"\nTriKota Parallelism Error: ModelEvaluator=null, but analysis_comm != MPI_COMMM_NULL");
}
return 0;
}