Skip to content
Snippets Groups Projects
Commit a7159916 authored by Joseph Mirabel's avatar Joseph Mirabel Committed by Joseph Mirabel
Browse files

Fix bugs related to empty LockedJointPtr_t and NumericalConstraintPtr_t

parent ce4be08d
No related branches found
No related tags found
No related merge requests found
...@@ -49,8 +49,10 @@ namespace hpp { ...@@ -49,8 +49,10 @@ namespace hpp {
NumericalConstraints_t::const_iterator it; NumericalConstraints_t::const_iterator it;
IntervalsContainer_t::const_iterator itpdof = pdof.begin (); IntervalsContainer_t::const_iterator itpdof = pdof.begin ();
for (it = nc.begin (); it != nc.end (); ++it) { for (it = nc.begin (); it != nc.end (); ++it) {
if (forPath) n->addNumericalConstraintForPath (*it, *itpdof); if (*it) {
else comp->addNumericalConstraint (*it, *itpdof); if (forPath) n->addNumericalConstraintForPath (*it, *itpdof);
else comp->addNumericalConstraint (*it, *itpdof);
}
++itpdof; ++itpdof;
} }
assert (itpdof == pdof.end ()); assert (itpdof == pdof.end ());
...@@ -63,8 +65,10 @@ namespace hpp { ...@@ -63,8 +65,10 @@ namespace hpp {
NumericalConstraints_t::const_iterator it; NumericalConstraints_t::const_iterator it;
IntervalsContainer_t::const_iterator itpdof = pdof.begin (); IntervalsContainer_t::const_iterator itpdof = pdof.begin ();
for (it = nc.begin (); it != nc.end (); ++it) { for (it = nc.begin (); it != nc.end (); ++it) {
if (param) lse->insertParamConstraint (*it, *itpdof); if (*it) {
else lse->insertConditionConstraint (*it, *itpdof); if (param) lse->insertParamConstraint (*it, *itpdof);
else lse->insertConditionConstraint (*it, *itpdof);
}
++itpdof; ++itpdof;
} }
assert (itpdof == pdof.end ()); assert (itpdof == pdof.end ());
...@@ -75,7 +79,8 @@ namespace hpp { ...@@ -75,7 +79,8 @@ namespace hpp {
nc.addToComp <false> (comp); nc.addToComp <false> (comp);
for (LockedJoints_t::const_iterator it = lj.begin (); for (LockedJoints_t::const_iterator it = lj.begin ();
it != lj.end (); ++it) it != lj.end (); ++it)
comp->addLockedJointConstraint (*it); if (*it && (*it)->numberDof() > 0)
comp->addLockedJointConstraint (*it);
nc_path.addToComp <true> (comp); nc_path.addToComp <true> (comp);
} }
...@@ -84,7 +89,8 @@ namespace hpp { ...@@ -84,7 +89,8 @@ namespace hpp {
nc_fol.addToComp <false> (comp); nc_fol.addToComp <false> (comp);
for (LockedJoints_t::const_iterator it = lj_fol.begin (); for (LockedJoints_t::const_iterator it = lj_fol.begin ();
it != lj_fol.end (); ++it) it != lj_fol.end (); ++it)
comp->addLockedJointConstraint (*it); if (*it && (*it)->numberDof() > 0)
(*it) comp->addLockedJointConstraint (*it);
} }
void FoliatedManifold::specifyFoliation (LevelSetEdgePtr_t lse) const void FoliatedManifold::specifyFoliation (LevelSetEdgePtr_t lse) const
...@@ -92,7 +98,8 @@ namespace hpp { ...@@ -92,7 +98,8 @@ namespace hpp {
nc.specifyFoliation <false> (lse); nc.specifyFoliation <false> (lse);
for (LockedJoints_t::const_iterator it = lj.begin (); for (LockedJoints_t::const_iterator it = lj.begin ();
it != lj.end (); ++it) it != lj.end (); ++it)
lse->insertConditionConstraint (*it); if (*it && (*it)->numberDof() > 0)
lse->insertConditionConstraint (*it);
nc_fol.specifyFoliation <true> (lse); nc_fol.specifyFoliation <true> (lse);
for (LockedJoints_t::const_iterator it = lj_fol.begin (); for (LockedJoints_t::const_iterator it = lj_fol.begin ();
...@@ -468,20 +475,24 @@ namespace hpp { ...@@ -468,20 +475,24 @@ namespace hpp {
const LockedJoints_t objectLocks, const LockedJoints_t objectLocks,
FoliatedManifold& place, FoliatedManifold& preplace) FoliatedManifold& place, FoliatedManifold& preplace)
{ {
place.nc.nc.push_back (placement); if (placement) {
place.nc.pdof.push_back (SizeIntervals_t()); place.nc.nc.push_back (placement);
// The placement constraints are not required in the path, as long as place.nc.pdof.push_back (SizeIntervals_t());
// they are satisfied at both ends and the object does not move. The // The placement constraints are not required in the path, as long as
// former condition is ensured by the placement constraints on both // they are satisfied at both ends and the object does not move. The
// ends and the latter is ensure by the LockedJoint constraints. // former condition is ensured by the placement constraints on both
// place.nc_path.nc.push_back (placement); // ends and the latter is ensure by the LockedJoint constraints.
// place.nc_path.pdof.push_back (SizeIntervals_t()); // place.nc_path.nc.push_back (placement);
// place.nc_path.pdof.push_back (SizeIntervals_t());
}
std::copy (objectLocks.begin(), objectLocks.end(), std::back_inserter(place.lj_fol)); std::copy (objectLocks.begin(), objectLocks.end(), std::back_inserter(place.lj_fol));
preplace.nc.nc.push_back (preplacement); if (placement && preplacement) {
preplace.nc.pdof.push_back (SizeIntervals_t()); preplace.nc.nc.push_back (preplacement);
preplace.nc_path.nc.push_back (preplacement); preplace.nc.pdof.push_back (SizeIntervals_t());
preplace.nc_path.pdof.push_back (SizeIntervals_t()); // preplace.nc_path.nc.push_back (preplacement);
// preplace.nc_path.pdof.push_back (SizeIntervals_t());
}
} }
namespace { namespace {
......
...@@ -165,8 +165,9 @@ namespace hpp { ...@@ -165,8 +165,9 @@ namespace hpp {
{ {
ConfigProjectorPtr_t p = f_.parametrizer ()->configProjector(); ConfigProjectorPtr_t p = f_.parametrizer ()->configProjector();
if (p) { if (p) {
threshold_ = p->errorThreshold () / if (p->rightHandSide ().size () > 0)
sqrt((double)p->rightHandSide ().size ()); threshold_ = p->errorThreshold () /
sqrt((double)p->rightHandSide ().size ());
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment