From beea4444abd1fb3501c2d29cf56b72014f7d665b Mon Sep 17 00:00:00 2001 From: whitequark Date: Fri, 24 May 2019 15:43:20 +0000 Subject: [PATCH] Move logic for handling allowRedundant out of System. NFC. --- src/generate.cpp | 2 +- src/system.cpp | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/generate.cpp b/src/generate.cpp index c58589f..edcd0ab 100644 --- a/src/generate.cpp +++ b/src/generate.cpp @@ -542,7 +542,7 @@ void SolveSpaceUI::SolveGroup(hGroup hg, bool andFindFree) { SolveResult how = sys.Solve(g, NULL, &(g->solved.dof), &(g->solved.remove), - /*andFindBad=*/true, + /*andFindBad=*/!g->allowRedundant, /*andFindFree=*/andFindFree, /*forceDofCheck=*/!g->dofCheckOk); if(how == SolveResult::OKAY) { diff --git a/src/system.cpp b/src/system.cpp index b9af8d7..3d1a947 100644 --- a/src/system.cpp +++ b/src/system.cpp @@ -470,9 +470,7 @@ SolveResult System::Solve(Group *g, int *rank, int *dof, List *bad, rankOk = TestRank(rank); if(!rankOk) { - if(!g->allowRedundant) { - if(andFindBad) FindWhichToRemoveToFixJacobian(g, bad, forceDofCheck); - } + if(andFindBad) FindWhichToRemoveToFixJacobian(g, bad, forceDofCheck); } else { // This is not the full Jacobian, but any substitutions or single-eq // solves removed one equation and one unknown, therefore no effect @@ -536,9 +534,7 @@ SolveResult System::SolveRank(Group *g, int *rank, int *dof, List * bool rankOk = TestRank(rank); if(!rankOk) { - if(!g->allowRedundant) { - if(andFindBad) FindWhichToRemoveToFixJacobian(g, bad, /*forceDofCheck=*/true); - } + if(andFindBad) FindWhichToRemoveToFixJacobian(g, bad, /*forceDofCheck=*/true); } else { if(dof) *dof = CalculateDof(); MarkParamsFree(andFindFree);