Commit 90dd92cd authored by Chuanren Wu's avatar Chuanren Wu

more information

parent 804c0d89
......@@ -5,6 +5,7 @@
#include <cmath>
#include <algorithm>
#include <cassert>
#include <numeric>
#include <iterator>
#ifndef NDEBUG
......@@ -80,10 +81,10 @@ static bool balance(
std::vector<int> &res
)
{
const long maxIter = 1000;
const long MAX_ITERATION = 1000;
long iterations = 0;
bool trigger = true;
while (trigger && iterations < maxIter) {
while (trigger && iterations < MAX_ITERATION) {
trigger = false;
for (const auto &c : vc) {
if (validate(c, minRes, vl, res)) {
......@@ -92,7 +93,7 @@ static bool balance(
}
++iterations;
}
if (iterations >= maxIter) {
if (iterations >= MAX_ITERATION) {
#ifndef NDEBUG
std::cout << "max iteration number reached, failed to solve\n";
#endif
......@@ -145,7 +146,11 @@ std::vector<int> discretizeImpl(
needRefine = refine(vc, minRes, vl, res);
if (needRefine) {
#ifndef NDEBUG
std::cout << "refine!\n";
std::cout << "need refinement iteration = "
<< refineIterations
<< " total = "
<< std::accumulate(res.cbegin(), res.cend(), 0)
<< '\n';
#endif
++refineIterations;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment