Suppress dof calculation flag

This commit is contained in:
EvilSpirit 2017-05-11 20:55:41 +07:00 committed by phkahler
parent 7f86a78472
commit 4d58f95b43
4 changed files with 17 additions and 9 deletions

View File

@ -551,9 +551,9 @@ void SolveSpaceUI::SolveGroup(hGroup hg, bool andFindFree) {
SolveResult SolveSpaceUI::TestRankForGroup(hGroup hg, int *rank) {
Group *g = SK.GetGroup(hg);
// If redundant is allowed, there is
// If we don't calculate dof or redundant is allowed, there is
// no point to solve rank because this result is not meaningful
if(g->allowRedundant) return SolveResult::OKAY;
if(g->suppressDofCalculation || g->allowRedundant) return SolveResult::OKAY;
WriteEqSystemForGroup(hg);
SolveResult result = sys.SolveRank(g, rank);
FreeAllTemporary();

View File

@ -175,6 +175,7 @@ public:
bool suppress;
bool relaxConstraints;
bool allowRedundant;
bool suppressDofCalculation;
bool allDimsReference;
double scale;

View File

@ -500,9 +500,9 @@ SolveResult System::Solve(Group *g, int *rank, int *dof, List<hConstraint> *bad,
param.ClearTags();
eq.ClearTags();
// Since we are allowing redundant, we
// don't want to catch result of dof checking without substitution
if(g->allowRedundant || !forceDofCheck) {
// Since we are suppressing dof calculation or allowing redundant, we
// can't / don't want to catch result of dof checking without substitution
if(g->suppressDofCalculation || g->allowRedundant || !forceDofCheck) {
SolveBySubstitution();
}
@ -542,15 +542,16 @@ SolveResult System::Solve(Group *g, int *rank, int *dof, List<hConstraint> *bad,
}
// Clear dof value in order to have indication when dof is actually not calculated
if(dof != NULL) *dof = -1;
// We are allowing redundant, so we no need to catch unsolveable + redundant
rankOk = (!g->allowRedundant) ? TestRank(dof) : true;
// We are suppressing or allowing redundant, so we no need to catch unsolveable + redundant
rankOk = (!g->suppressDofCalculation && !g->allowRedundant) ? TestRank(dof) : true;
// And do the leftovers as one big system
if(!NewtonSolve(0)) {
goto didnt_converge;
}
rankOk = TestRank(dof);
// Here we are want to calculate dof even when redundant is allowed, so just handle suppressing
rankOk = (!g->suppressDofCalculation) ? TestRank(dof) : true;
if(!rankOk) {
if(andFindBad) FindWhichToRemoveToFixJacobian(g, bad, forceDofCheck);
} else {
@ -614,7 +615,7 @@ SolveResult System::SolveRank(Group *g, int *rank, int *dof, List<hConstraint> *
if(!rankOk) {
// When we are testing with redundant allowed, we don't want to have additional info
// about redundants since this test is working only for single redundant constraint
if(!g->allowRedundant) {
if(!g->suppressDofCalculation && !g->allowRedundant) {
if(andFindBad) FindWhichToRemoveToFixJacobian(g, bad, true);
}
} else {

View File

@ -261,6 +261,8 @@ void TextWindow::ScreenChangeGroupOption(int link, uint32_t v) {
case 'e': g->allowRedundant = !(g->allowRedundant); break;
case 'D': g->suppressDofCalculation = !(g->suppressDofCalculation); break;
case 'v': g->visible = !(g->visible); break;
case 'd': g->allDimsReference = !(g->allDimsReference); break;
@ -511,6 +513,10 @@ void TextWindow::ShowGroupInfo() {
&TextWindow::ScreenChangeGroupOption,
g->allowRedundant ? CHECK_TRUE : CHECK_FALSE);
Printf(false, " %f%LD%Fd%s suppress dof calculation (improves solver performance)",
&TextWindow::ScreenChangeGroupOption,
g->suppressDofCalculation ? CHECK_TRUE : CHECK_FALSE);
Printf(false, " %f%Ld%Fd%s treat all dimensions as reference",
&TextWindow::ScreenChangeGroupOption,
g->allDimsReference ? CHECK_TRUE : CHECK_FALSE);