本文整理汇总了C++中PatchData::set_free_vertices_soft_fixed方法的典型用法代码示例。如果您正苦于以下问题:C++ PatchData::set_free_vertices_soft_fixed方法的具体用法?C++ PatchData::set_free_vertices_soft_fixed怎么用?C++ PatchData::set_free_vertices_soft_fixed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PatchData
的用法示例。
在下文中一共展示了PatchData::set_free_vertices_soft_fixed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cull_vertices
/*!This function checks the culling method criterion supplied to the object
by the user. If the user does not supply a culling method criterion,
the default criterion is NONE, and in that case, no culling is performed.
If the culling method criterion is satisfied, the interior vertices
of the given patch are flagged as soft_fixed. Otherwise, the soft_fixed
flag is removed from each of the vertices in the patch (interior and
boundary vertices). Also, if the criterion was satisfied, then the
function returns true. Otherwise, the function returns false.
*/
bool TerminationCriterion::cull_vertices(PatchData &pd,
OFEvaluator& of_eval,
MsqError &err)
{
//PRINT_INFO("CULLING_METHOD FLAG = %i",cullingMethodFlag);
//cull_bool will be changed to true if the criterion is satisfied
bool b, cull_bool=false;
double prev_m, init_m;
switch(cullingMethodFlag){
//if no culling is requested, always return false
case NONE:
return cull_bool;
//if culling on quality improvement absolute
case QUALITY_IMPROVEMENT_ABSOLUTE:
//get objective function value
b = of_eval.evaluate(pd, currentOFValue, err);
if (MSQ_CHKERR(err)) return false;
if (!b) {
MSQ_SETERR(err)(MsqError::INVALID_MESH);
return false;
}
//if the improvement was enough, cull
if(currentOFValue <= cullingEps)
{
cull_bool=true;
}
//PRINT_INFO("\ncurrentOFValue = %f, bool = %i\n",currentOFValue,cull_bool);
break;
//if culing on quality improvement relative
case QUALITY_IMPROVEMENT_RELATIVE:
//get objective function value
b = of_eval.evaluate(pd, currentOFValue, err);
if (MSQ_CHKERR(err)) return false;
if(!b){
MSQ_SETERR(err)(MsqError::INVALID_MESH);
return false;
}
//if the improvement was enough, cull
if((currentOFValue-lowerOFBound)<=
(cullingEps*(initialOFValue-lowerOFBound)))
{
cull_bool=true;
}
break;
//if culling on vertex movement absolute
case VERTEX_MOVEMENT_ABSOLUTE:
case VERTEX_MOVEMENT_ABS_EDGE_LENGTH:
//if movement was enough, cull
prev_m = pd.get_max_vertex_movement_squared(previousVerticesMemento,err);
MSQ_ERRZERO(err);
if(prev_m <= cullingEps*cullingEps){
cull_bool=true;
}
break;
//if culling on vertex movement relative
case VERTEX_MOVEMENT_RELATIVE:
//if movement was small enough, cull
prev_m = pd.get_max_vertex_movement_squared(previousVerticesMemento,err);
MSQ_ERRZERO(err);
init_m = pd.get_max_vertex_movement_squared(initialVerticesMemento,err);
MSQ_ERRZERO(err);
if(prev_m <= (cullingEps*cullingEps * init_m)){
cull_bool=true;
}
break;
case UNTANGLED_MESH:
if (!patchInvertedCount)
cull_bool = true;
break;
default:
MSQ_SETERR(err)("Requested culling method not yet implemented.",
MsqError::NOT_IMPLEMENTED);
return false;
};
//Now actually have patch data cull vertices
if(cull_bool)
{
pd.set_free_vertices_soft_fixed(err); MSQ_ERRZERO(err);
}
else
{
pd.set_all_vertices_soft_free(err); MSQ_ERRZERO(err);
}
return cull_bool;
}