Skip to content
Snippets Groups Projects
Commit c69c56ae authored by Mikhail Svechnikov's avatar Mikhail Svechnikov
Browse files

limit with assert

parent 9ef19041
No related branches found
No related tags found
1 merge request!2700Visualize rough interfaces in Img3D
......@@ -205,8 +205,11 @@ void RoughnessMap::createMap()
double2d_t h_map = mapFromHeights();
double2d_t s_map = mapFromSpectrum();
// number of iterations is limited even if no convergence
for (int i = 0; i < 100; i++) {
int iter = 0;
while (true) {
// number of iterations is limited even if no convergence
ASSERT(iter < 100);
double2d_t h_map_old = h_map;
s_map = applySpectrumToHeights(h_map, s_map);
h_map = applyHeightsToSpectrum(h_map, s_map);
......@@ -214,6 +217,7 @@ void RoughnessMap::createMap()
// adjust tolerance for proper speed/accuracy
if (::converged(h_map_old, h_map, 1e-4))
break;
iter++;
}
// 's_map' has "perfect" original spectrum and tolerable height statistics.
......
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