本文整理汇总了C++中Constraint::dofs方法的典型用法代码示例。如果您正苦于以下问题:C++ Constraint::dofs方法的具体用法?C++ Constraint::dofs怎么用?C++ Constraint::dofs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Constraint
的用法示例。
在下文中一共展示了Constraint::dofs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: delete_constraint
bool ConstraintSet::delete_constraint(int argc, char **argv)
{
assert(argc==3);
// argv[0] == "constraint"
// argv[1] == "delete"
// argv[2] == constraint_name
string name = argv[2];
const bool oncoutpe = ctxt_.oncoutpe();
bool found = false;
// note next loop in reverse: avoid use of invalidated iterators
// after erase operation
vector<Constraint*>::iterator i = constraint_list.begin();
while ( !found && i != constraint_list.end() )
{
Constraint *pc = *i;
assert(pc != 0);
// note structure of if else test to avoid incrementing
// invalidated iterator after erase (see Meyers STL, p.45)
if ( pc->name() == name )
{
found = true;
// update total number of blocked degrees of freedom
ndofs_ -= pc->dofs();
delete pc;
// remove constraint pointer from the list
// note: iterator is incremented before erasing, remains valid
constraint_list.erase(i++);
}
else
{
i++;
}
}
if ( !found )
{
if ( oncoutpe ) cout << " No such constraint" << endl;
return false;
}
return true;
}