[CSStep] Rework how orphaned constraints are handled by splitter/component steps

Orphaned constraints can be re-introduced to the system by `setup`
of the component, and all of them could be returned back by
`SplitterStep::resume` there so no need to use destructor for that.

Also, orphan constraints have to be registered as regular constraints
by components as well as marked as "orphaned".
This commit is contained in:
Pavel Yaskevich
2018-09-10 22:14:37 -07:00
parent a6682ec5f2
commit a2ba0021c3
2 changed files with 13 additions and 11 deletions

View File

@@ -41,10 +41,6 @@ ComponentStep::Scope::Scope(ComponentStep &component)
auto &workList = CS.InactiveConstraints;
workList.splice(workList.end(), *component.Constraints);
auto &CG = CS.getConstraintGraph();
if (component.OrphanedConstraint)
CG.setOrphanedConstraint(component.OrphanedConstraint);
SolverScope = new ConstraintSystem::SolverScope(CS);
PrevPartialScope = CS.solverState->PartialSolutionScope;
CS.solverState->PartialSolutionScope = SolverScope;
@@ -148,8 +144,14 @@ void SplitterStep::computeFollowupSteps(
numComponents - CG.getOrphanedConstraints().size();
{
unsigned component = firstOrphanedConstraint;
for (auto constraint : CG.getOrphanedConstraints())
componentSteps[component++]->recordOrphan(constraint);
for (auto *constraint : CG.getOrphanedConstraints()) {
// Register this orphan constraint both as associated with
// a given component as a regular constrant, as well as an
// "orphan" constraint, so it can be proccessed correctly.
constraintComponent[constraint] = component;
componentSteps[component]->recordOrphan(constraint);
++component;
}
}
// Transfer all of the constraints from the work list to