From d236358ec6e3ab49175d3e90237ccac730fcb00c Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Thu, 6 Dec 2012 17:31:31 +0000 Subject: [PATCH] [1D] Fixed oscillations in grid refinement when pruning is enabled Points which are needed to satisfy the 'ratio' requirement are not removed when pruning. Previously, it was possible for the solver to get stuck in a loop where the same points were added and removed after successive grid refinements. --- src/oneD/refine.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/oneD/refine.cpp b/src/oneD/refine.cpp index a521baf1d..44755f263 100644 --- a/src/oneD/refine.cpp +++ b/src/oneD/refine.cpp @@ -169,6 +169,12 @@ int Refiner::analyze(size_t n, const doublereal* z, m_loc[j-1] = 1; m_c["point "+int2str(j-1)] = 1; } + if (j > 1 && z[j+1]-z[j] > m_ratio * dz[j-2]) { + m_keep[j] = 1; + } + if (j < n-2 && z[j+1]-z[j] > m_ratio * dz[j+1]) { + m_keep[j] = 1; + } //if (m_loc.size() + n > m_npmax) goto done; }