本文整理汇总了C++中QualityMetric::evaluate_with_indices方法的典型用法代码示例。如果您正苦于以下问题:C++ QualityMetric::evaluate_with_indices方法的具体用法?C++ QualityMetric::evaluate_with_indices怎么用?C++ QualityMetric::evaluate_with_indices使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QualityMetric
的用法示例。
在下文中一共展示了QualityMetric::evaluate_with_indices方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: evaluate_with_indices
bool CompareMetric::evaluate_with_indices( PatchData& pd,
size_t handle,
double& value,
std::vector<size_t>& indices,
MsqError& err )
{
double m2val;
bool r1, r2;
m2Handles.clear();
r1 = metric1->evaluate_with_indices( pd, handle, value, indices, err ); MSQ_ERRZERO(err);
r2 = metric2->evaluate_with_indices( pd, handle, m2val, m2Handles, err ); MSQ_ERRZERO(err);
if (r1 != r2 || (r1 && fabs(value - m2val) > epsilon)) {
MSQ_SETERR(err)(MsqError::INVALID_STATE,
"Metrics returned different values for handle %lu "
"in evaluate_with_indices:\n"
"\t%s %f vs. %s %f\n", (unsigned long)handle,
r1?"true":"false",value,r2?"true":"false",m2val);
}
else {
bool same = (indices.size() == m2Handles.size());
std::sort( m2Handles.begin(), m2Handles.end() );
for (std::vector<size_t>::iterator i = indices.begin(); i != indices.end(); ++i)
if (!std::binary_search( m2Handles.begin(), m2Handles.end(), *i ))
same = false;
if (!same) {
MSQ_SETERR(err)(MsqError::INVALID_STATE,
"Metrics returned incompatible lists of vertex indices"
" for handle %lu in evaluate_with_indices\n.",
(unsigned long)handle );
}
}
return r1 && !err;
}