From 7d01b58e760d98440f651529ae9b718bfcc2e058 Mon Sep 17 00:00:00 2001 From: godardma Date: Thu, 23 Apr 2026 09:48:04 +0200 Subject: [PATCH 1/7] [pave] paving_multithread in C++ --- examples/01_batman/main.cpp | 2 +- src/core/paver/codac2_pave.cpp | 104 +++++++++++++++++++++++++++++++++ src/core/paver/codac2_pave.h | 22 +++++++ 3 files changed, 127 insertions(+), 1 deletion(-) diff --git a/examples/01_batman/main.cpp b/examples/01_batman/main.cpp index 91bfadec8..3fd21c222 100644 --- a/examples/01_batman/main.cpp +++ b/examples/01_batman/main.cpp @@ -51,4 +51,4 @@ int main() DefaultFigure::draw_box(bi, { Color::black(), Color::red(0.4) }); } #endif -} \ No newline at end of file +} diff --git a/src/core/paver/codac2_pave.cpp b/src/core/paver/codac2_pave.cpp index 987cff977..fe8775bd8 100644 --- a/src/core/paver/codac2_pave.cpp +++ b/src/core/paver/codac2_pave.cpp @@ -8,6 +8,8 @@ */ #include "codac2_pave.h" +#include "codac2_threading.h" +#include using namespace std; using namespace codac2; @@ -178,4 +180,106 @@ namespace codac2 }, eps, verbose); } + + PavingInOut pave_multithread(const IntervalVector& x0, + const std::function& test, + double eps, bool verbose) + { + assert_release(eps > 0.); + assert_release(!x0.is_empty()); + + auto start_time = std::chrono::high_resolution_clock::now(); + + int bisect_level = int(log2(nb_threads())); + + int nthreads = std::pow(2,bisect_level); + + int bisect_count = 0; + + for (int i = 0; i < bisect_level; i++) + bisect_count += std::pow(2,i); + + PavingInOut p(x0); + std::list> l { p.tree() }; + + for (int i = 0; i < bisect_count; i++) + { + auto n = l.front(); + l.pop_front(); + + n->bisect(); + l.push_back(n->left()); + l.push_back(n->right()); + } + + std::vector> l_vec(l.begin(), l.end()); + + auto worker = [&](int tid) + { + auto xi = l_vec[tid]; + std::list> li = { xi }; + while(!li.empty()) + { + auto ni = li.front(); + li.pop_front(); + + if(ni->unknown().max_diam() > eps) + { + ni->bisect(); + li.push_back(ni->left()); + li.push_back(ni->right()); + } + else + { + auto b = test(std::get<1>(ni->boxes())); + switch(b) + { + case BoolInterval::TRUE: + std::get<1>(ni->boxes()).set_empty(); + break; + + case BoolInterval::FALSE: + std::get<0>(ni->boxes()).set_empty(); + break; + + default: + continue; + } + } + + } + }; + + std::vector threads; + for (int tid = 0; tid < nthreads; tid++) + { + auto xi = l_vec[tid]; + auto b = test(std::get<1>(xi->boxes())); + switch(b) + { + case BoolInterval::TRUE: + std::get<1>(xi->boxes()).set_empty(); + break; + + case BoolInterval::FALSE: + std::get<0>(xi->boxes()).set_empty(); + break; + + default: + threads.emplace_back(worker, tid); + } + } + + + for (auto& th : threads) th.join(); + + if (verbose) + { + printf("Number of thread used: %d\n", nthreads); + std::chrono::duration elapsed = std::chrono::high_resolution_clock::now() - start_time; + printf("Computation time: %.4fs\n\n", elapsed.count()); + } + + return p; + } } \ No newline at end of file diff --git a/src/core/paver/codac2_pave.h b/src/core/paver/codac2_pave.h index d1b2781a1..38944901b 100644 --- a/src/core/paver/codac2_pave.h +++ b/src/core/paver/codac2_pave.h @@ -50,4 +50,26 @@ namespace codac2 } PavingInOut pave_tube(const IntervalVector& x0, const SlicedTube& f, double eps, bool verbose = false); + + PavingInOut pave_multithread(const IntervalVector& x0, const std::function& test, double eps, bool verbose = false); + + template + PavingInOut pave_multithread(const IntervalVector& x0, const AnalyticFunction& f, const typename Y::Domain& y, double eps, bool verbose = false) + { + return pave_multithread(x0, + [&y,&f](const IntervalVector& x) + { + auto eval = f.eval(x); + + if(eval.is_subset(y)) + return BoolInterval::TRUE; + + else if(!eval.intersects(y)) + return BoolInterval::FALSE; + + else + return BoolInterval::UNKNOWN; + }, + eps, verbose); + } } \ No newline at end of file From db6bca8b4b4f08e4faf01c3e4629eee2ac6c9bd0 Mon Sep 17 00:00:00 2001 From: godardma Date: Thu, 23 Apr 2026 10:13:54 +0200 Subject: [PATCH 2/7] [pave] paving_multithread v2 --- examples/03_sivia/main.cpp | 4 +++- src/core/paver/codac2_pave.cpp | 43 +++++++++++++++++----------------- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/examples/03_sivia/main.cpp b/examples/03_sivia/main.cpp index 8ecc1a449..8898afeec 100644 --- a/examples/03_sivia/main.cpp +++ b/examples/03_sivia/main.cpp @@ -4,8 +4,10 @@ using namespace codac2; int main() { + set_nb_threads(max_threads()); + VectorVar x(2); AnalyticFunction f { {x}, sqr(x[0])*sin(sqr(x[0])+sqr(x[1]))-sqr(x[1]) }; - auto p = sivia({{-5,5},{-4,4}}, f, {0,oo}, 1e-2, true); + auto p = pave_multithread({{-5,5},{-4,4}}, f, {0,oo}, 1e-1, true); DefaultFigure::draw_paving(p); } \ No newline at end of file diff --git a/src/core/paver/codac2_pave.cpp b/src/core/paver/codac2_pave.cpp index fe8775bd8..435e01926 100644 --- a/src/core/paver/codac2_pave.cpp +++ b/src/core/paver/codac2_pave.cpp @@ -223,34 +223,30 @@ namespace codac2 auto ni = li.front(); li.pop_front(); - if(ni->unknown().max_diam() > eps) + auto b = test(std::get<1>(ni->boxes())); + switch(b) { - ni->bisect(); - li.push_back(ni->left()); - li.push_back(ni->right()); + case BoolInterval::TRUE: + std::get<1>(ni->boxes()).set_empty(); + break; + + case BoolInterval::FALSE: + std::get<0>(ni->boxes()).set_empty(); + break; + + default: + if(ni->unknown().max_diam() > eps) + { + ni->bisect(); + li.push_back(ni->left()); + li.push_back(ni->right()); + } } - else - { - auto b = test(std::get<1>(ni->boxes())); - switch(b) - { - case BoolInterval::TRUE: - std::get<1>(ni->boxes()).set_empty(); - break; - - case BoolInterval::FALSE: - std::get<0>(ni->boxes()).set_empty(); - break; - - default: - continue; - } - } - } }; std::vector threads; + int nthreads_unused = 0; for (int tid = 0; tid < nthreads; tid++) { auto xi = l_vec[tid]; @@ -259,10 +255,12 @@ namespace codac2 { case BoolInterval::TRUE: std::get<1>(xi->boxes()).set_empty(); + nthreads_unused++; break; case BoolInterval::FALSE: std::get<0>(xi->boxes()).set_empty(); + nthreads_unused++; break; default: @@ -276,6 +274,7 @@ namespace codac2 if (verbose) { printf("Number of thread used: %d\n", nthreads); + printf("Number of thread not launched: %d\n", nthreads_unused); std::chrono::duration elapsed = std::chrono::high_resolution_clock::now() - start_time; printf("Computation time: %.4fs\n\n", elapsed.count()); } From 74fc70e90e1a23211a19df70366df58c0468469b Mon Sep 17 00:00:00 2001 From: godardma Date: Thu, 23 Apr 2026 10:14:11 +0200 Subject: [PATCH 3/7] [pave] paving_multithread v2 --- examples/03_sivia/main.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/examples/03_sivia/main.cpp b/examples/03_sivia/main.cpp index 8898afeec..8ecc1a449 100644 --- a/examples/03_sivia/main.cpp +++ b/examples/03_sivia/main.cpp @@ -4,10 +4,8 @@ using namespace codac2; int main() { - set_nb_threads(max_threads()); - VectorVar x(2); AnalyticFunction f { {x}, sqr(x[0])*sin(sqr(x[0])+sqr(x[1]))-sqr(x[1]) }; - auto p = pave_multithread({{-5,5},{-4,4}}, f, {0,oo}, 1e-1, true); + auto p = sivia({{-5,5},{-4,4}}, f, {0,oo}, 1e-2, true); DefaultFigure::draw_paving(p); } \ No newline at end of file From e9ec0db2e7db64b29e6409862f599520407d54f0 Mon Sep 17 00:00:00 2001 From: godardma Date: Thu, 23 Apr 2026 10:21:13 +0200 Subject: [PATCH 4/7] [pave] rename for coherence --- examples/03_sivia/main.cpp | 2 +- src/core/paver/codac2_pave.cpp | 2 +- src/core/paver/codac2_pave.h | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/03_sivia/main.cpp b/examples/03_sivia/main.cpp index 8ecc1a449..68c299412 100644 --- a/examples/03_sivia/main.cpp +++ b/examples/03_sivia/main.cpp @@ -6,6 +6,6 @@ int main() { VectorVar x(2); AnalyticFunction f { {x}, sqr(x[0])*sin(sqr(x[0])+sqr(x[1]))-sqr(x[1]) }; - auto p = sivia({{-5,5},{-4,4}}, f, {0,oo}, 1e-2, true); + auto p = sivia_multithread({{-5,5},{-4,4}}, f, {0,oo}, 1e-2, true); DefaultFigure::draw_paving(p); } \ No newline at end of file diff --git a/src/core/paver/codac2_pave.cpp b/src/core/paver/codac2_pave.cpp index 435e01926..066a01ff3 100644 --- a/src/core/paver/codac2_pave.cpp +++ b/src/core/paver/codac2_pave.cpp @@ -181,7 +181,7 @@ namespace codac2 eps, verbose); } - PavingInOut pave_multithread(const IntervalVector& x0, + PavingInOut regular_pave_multithread(const IntervalVector& x0, const std::function& test, double eps, bool verbose) { diff --git a/src/core/paver/codac2_pave.h b/src/core/paver/codac2_pave.h index 38944901b..3e6243390 100644 --- a/src/core/paver/codac2_pave.h +++ b/src/core/paver/codac2_pave.h @@ -51,12 +51,12 @@ namespace codac2 PavingInOut pave_tube(const IntervalVector& x0, const SlicedTube& f, double eps, bool verbose = false); - PavingInOut pave_multithread(const IntervalVector& x0, const std::function& test, double eps, bool verbose = false); + PavingInOut regular_pave_multithread(const IntervalVector& x0, const std::function& test, double eps, bool verbose = false); template - PavingInOut pave_multithread(const IntervalVector& x0, const AnalyticFunction& f, const typename Y::Domain& y, double eps, bool verbose = false) + PavingInOut sivia_multithread(const IntervalVector& x0, const AnalyticFunction& f, const typename Y::Domain& y, double eps, bool verbose = false) { - return pave_multithread(x0, + return regular_pave_multithread(x0, [&y,&f](const IntervalVector& x) { auto eval = f.eval(x); From 1e50ac0fd3d2f34ccd9d9145cd88c37602b739c7 Mon Sep 17 00:00:00 2001 From: godardma Date: Thu, 23 Apr 2026 10:37:23 +0200 Subject: [PATCH 5/7] [pave] cleaner and faster implementation of multithread sivia --- src/core/paver/codac2_pave.cpp | 55 ++++++++++++++-------------------- 1 file changed, 22 insertions(+), 33 deletions(-) diff --git a/src/core/paver/codac2_pave.cpp b/src/core/paver/codac2_pave.cpp index 066a01ff3..516e1088a 100644 --- a/src/core/paver/codac2_pave.cpp +++ b/src/core/paver/codac2_pave.cpp @@ -11,6 +11,9 @@ #include "codac2_threading.h" #include +// TO DELETE +#include + using namespace std; using namespace codac2; @@ -190,26 +193,32 @@ namespace codac2 auto start_time = std::chrono::high_resolution_clock::now(); - int bisect_level = int(log2(nb_threads())); - - int nthreads = std::pow(2,bisect_level); - - int bisect_count = 0; - - for (int i = 0; i < bisect_level; i++) - bisect_count += std::pow(2,i); + int nthreads = nb_threads(); PavingInOut p(x0); std::list> l { p.tree() }; - for (int i = 0; i < bisect_count; i++) + while (l.size() < nthreads) { auto n = l.front(); l.pop_front(); - n->bisect(); - l.push_back(n->left()); - l.push_back(n->right()); + auto b = test(std::get<1>(n->boxes())); + switch(b) + { + case BoolInterval::TRUE: + std::get<1>(n->boxes()).set_empty(); + break; + + case BoolInterval::FALSE: + std::get<0>(n->boxes()).set_empty(); + break; + + default: + n->bisect(); + l.push_back(n->left()); + l.push_back(n->right()); + } } std::vector> l_vec(l.begin(), l.end()); @@ -248,33 +257,13 @@ namespace codac2 std::vector threads; int nthreads_unused = 0; for (int tid = 0; tid < nthreads; tid++) - { - auto xi = l_vec[tid]; - auto b = test(std::get<1>(xi->boxes())); - switch(b) - { - case BoolInterval::TRUE: - std::get<1>(xi->boxes()).set_empty(); - nthreads_unused++; - break; - - case BoolInterval::FALSE: - std::get<0>(xi->boxes()).set_empty(); - nthreads_unused++; - break; - - default: - threads.emplace_back(worker, tid); - } - } - + threads.emplace_back(worker, tid); for (auto& th : threads) th.join(); if (verbose) { printf("Number of thread used: %d\n", nthreads); - printf("Number of thread not launched: %d\n", nthreads_unused); std::chrono::duration elapsed = std::chrono::high_resolution_clock::now() - start_time; printf("Computation time: %.4fs\n\n", elapsed.count()); } From 8075fe412dafbc8ec1d6610516df1659927b0f2e Mon Sep 17 00:00:00 2001 From: godardma Date: Thu, 23 Apr 2026 12:03:43 +0200 Subject: [PATCH 6/7] [pave] minor modification on multithread sivia --- src/core/paver/codac2_pave.cpp | 54 ++++++++++++++++------------------ src/core/paver/codac2_pave.h | 25 +++++++++------- 2 files changed, 39 insertions(+), 40 deletions(-) diff --git a/src/core/paver/codac2_pave.cpp b/src/core/paver/codac2_pave.cpp index 516e1088a..485572f34 100644 --- a/src/core/paver/codac2_pave.cpp +++ b/src/core/paver/codac2_pave.cpp @@ -8,12 +8,8 @@ */ #include "codac2_pave.h" -#include "codac2_threading.h" #include -// TO DELETE -#include - using namespace std; using namespace codac2; @@ -161,29 +157,6 @@ namespace codac2 return p; } - PavingInOut pave_tube(const IntervalVector& x0, const SlicedTube& f, double eps, bool verbose) - { - return regular_pave(x0, - [&f](const IntervalVector& x) -> BoolInterval - { - bool is_out = true; - for(const auto& s : f) - { - if(!s.is_gate() && s.codomain().intersects(x)) - { - is_out = false; - if(s.codomain().is_superset(x)) - return BoolInterval::TRUE; - } - } - - if(is_out) - return BoolInterval::FALSE; - return BoolInterval::UNKNOWN; - }, - eps, verbose); - } - PavingInOut regular_pave_multithread(const IntervalVector& x0, const std::function& test, double eps, bool verbose) @@ -198,7 +171,7 @@ namespace codac2 PavingInOut p(x0); std::list> l { p.tree() }; - while (l.size() < nthreads) + while (l.size() < static_cast(nthreads)) { auto n = l.front(); l.pop_front(); @@ -255,7 +228,7 @@ namespace codac2 }; std::vector threads; - int nthreads_unused = 0; + for (int tid = 0; tid < nthreads; tid++) threads.emplace_back(worker, tid); @@ -270,4 +243,27 @@ namespace codac2 return p; } + + PavingInOut pave_tube(const IntervalVector& x0, const SlicedTube& f, double eps, bool verbose) + { + return regular_pave(x0, + [&f](const IntervalVector& x) -> BoolInterval + { + bool is_out = true; + for(const auto& s : f) + { + if(!s.is_gate() && s.codomain().intersects(x)) + { + is_out = false; + if(s.codomain().is_superset(x)) + return BoolInterval::TRUE; + } + } + + if(is_out) + return BoolInterval::FALSE; + return BoolInterval::UNKNOWN; + }, + eps, verbose); + } } \ No newline at end of file diff --git a/src/core/paver/codac2_pave.h b/src/core/paver/codac2_pave.h index 3e6243390..441b5bf2c 100644 --- a/src/core/paver/codac2_pave.h +++ b/src/core/paver/codac2_pave.h @@ -16,6 +16,8 @@ #include "codac2_BoolInterval.h" #include "codac2_SlicedTube.h" +#include "codac2_threading.h" + namespace codac2 { // eps: accuracy of the paving algorithm, the undefined boxes will have their max_diam <= eps @@ -29,10 +31,14 @@ namespace codac2 PavingInOut regular_pave(const IntervalVector& x0, const std::function& test, double eps, bool verbose = false); + PavingInOut regular_pave_multithread(const IntervalVector& x0, const std::function& test, double eps, bool verbose = false); + template PavingInOut sivia(const IntervalVector& x0, const AnalyticFunction& f, const typename Y::Domain& y, double eps, bool verbose = false) { - return regular_pave(x0, + if (nb_threads()==1) + { + return regular_pave(x0, [&y,&f](const IntervalVector& x) { auto eval = f.eval(x); @@ -47,16 +53,10 @@ namespace codac2 return BoolInterval::UNKNOWN; }, eps, verbose); - } - - PavingInOut pave_tube(const IntervalVector& x0, const SlicedTube& f, double eps, bool verbose = false); - - PavingInOut regular_pave_multithread(const IntervalVector& x0, const std::function& test, double eps, bool verbose = false); - - template - PavingInOut sivia_multithread(const IntervalVector& x0, const AnalyticFunction& f, const typename Y::Domain& y, double eps, bool verbose = false) - { - return regular_pave_multithread(x0, + } + else + { + return regular_pave_multithread(x0, [&y,&f](const IntervalVector& x) { auto eval = f.eval(x); @@ -71,5 +71,8 @@ namespace codac2 return BoolInterval::UNKNOWN; }, eps, verbose); + } } + + PavingInOut pave_tube(const IntervalVector& x0, const SlicedTube& f, double eps, bool verbose = false); } \ No newline at end of file From e86939a5ee2a6127a7be67bfcf2878924addc39c Mon Sep 17 00:00:00 2001 From: godardma Date: Fri, 24 Apr 2026 00:32:41 +0200 Subject: [PATCH 7/7] [pave] multihread pave with contractors and separators --- src/core/paver/codac2_pave.cpp | 169 ++++++++++++++++++++++++++++++++- src/core/paver/codac2_pave.h | 10 +- 2 files changed, 173 insertions(+), 6 deletions(-) diff --git a/src/core/paver/codac2_pave.cpp b/src/core/paver/codac2_pave.cpp index 485572f34..836fcb2e5 100644 --- a/src/core/paver/codac2_pave.cpp +++ b/src/core/paver/codac2_pave.cpp @@ -24,10 +24,18 @@ namespace codac2 PavingOut pave(const IntervalVector& x0, const CtcBase& c, double eps, bool verbose) { double time = 0; - return pave(x0,c,eps,time,verbose); + return pave(x0, c, eps, time, verbose); } PavingOut pave(const IntervalVector& x0, const CtcBase& c, double eps, double& time, bool verbose) + { + if (nb_threads()==1) + return pave_monothread(x0, c, eps, time, verbose); + else + return pave_multithread(x0, c, eps, time, verbose); + } + + PavingOut pave_monothread(const IntervalVector& x0, const CtcBase& c, double eps, double& time, bool verbose) { assert_release(eps > 0.); assert_release(!x0.is_empty()); @@ -73,6 +81,87 @@ namespace codac2 return p; } + PavingOut pave_multithread(const IntervalVector& x0, const CtcBase& c, double eps, double& time, bool verbose) + { + assert_release(eps > 0.); + assert_release(!x0.is_empty()); + + auto start_time = std::chrono::high_resolution_clock::now(); + + int nthreads = nb_threads(); + + PavingOut p(x0); + // In order to be able to reconstruct the initial box, the first level represents the + // initial domain x0 (the left node is x0, the right one is an empty box). + p.tree()->bisect(); + p.tree()->left()->boxes() = { x0 }; + get<0>(p.tree()->right()->boxes()).set_empty(); + + std::shared_ptr n; + list> l { p.tree()->left() }; + + while (l.size() < static_cast(nthreads)) + { + n = l.front(); + l.pop_front(); + + c.contract(get<0>(n->boxes())); + + if(!get<0>(n->boxes()).is_empty()) + { + if(get<0>(n->boxes()).max_diam() > eps) + { + n->bisect(); + l.push_back(n->left()); + l.push_back(n->right()); + } + } + } + + std::vector> l_vec(l.begin(), l.end()); + + auto worker = [&](int tid) + { + auto xi = l_vec[tid]; + std::list> li = { xi }; + while(!li.empty()) + { + auto ni = li.front(); + li.pop_front(); + + c.contract(get<0>(ni->boxes())); + + if(!get<0>(ni->boxes()).is_empty()) + { + if(get<0>(ni->boxes()).max_diam() > eps) + { + ni->bisect(); + li.push_back(ni->left()); + li.push_back(ni->right()); + } + } + } + }; + + std::vector threads; + for (int tid = 0; tid < nthreads; tid++) + threads.emplace_back(worker, tid); + + for (auto& th : threads) th.join(); + + std::chrono::duration elapsed = std::chrono::high_resolution_clock::now() - start_time; + + time = elapsed.count(); + + if(verbose) + { + printf("Number of thread used: %d\n", nthreads); + printf("Computation time: %.4fs\n\n", time); + } + + return p; + } + PavingInOut pave(const IntervalVector& x0, std::shared_ptr s, double eps, bool verbose) { @@ -80,6 +169,14 @@ namespace codac2 } PavingInOut pave(const IntervalVector& x0, const SepBase& s, double eps, bool verbose) + { + if (nb_threads()==1) + return pave_monothread(x0, s, eps, verbose); + else + return pave_multithread(x0, s, eps, verbose); + } + + PavingInOut pave_monothread(const IntervalVector& x0, const SepBase& s, double eps, bool verbose) { assert_release(eps > 0.); assert_release(!x0.is_empty()); @@ -112,6 +209,75 @@ namespace codac2 return p; } + PavingInOut pave_multithread(const IntervalVector& x0, const SepBase& s, double eps, bool verbose) + { + assert_release(eps > 0.); + assert_release(!x0.is_empty()); + + auto start_time = std::chrono::high_resolution_clock::now(); + + int nthreads = nb_threads(); + + PavingInOut p(x0); + std::shared_ptr n; + list> l { p.tree() }; + + while (l.size() < static_cast(nthreads)) + { + n = l.front(); + l.pop_front(); + + auto xs = s.separate(get<0>(n->boxes())); + auto boundary = (xs.inner & xs.outer); + n->boxes() = { xs.outer, xs.inner }; + + if(!boundary.is_empty() && boundary.max_diam() > eps) + { + n->bisect(); + l.push_back(n->left()); + l.push_back(n->right()); + } + } + + std::vector> l_vec(l.begin(), l.end()); + + auto worker = [&](int tid) + { + auto xi = l_vec[tid]; + std::list> li = { xi }; + while(!li.empty()) + { + auto ni = li.front(); + li.pop_front(); + + auto xs = s.separate(get<0>(ni->boxes())); + auto boundary = (xs.inner & xs.outer); + ni->boxes() = { xs.outer, xs.inner }; + + if(!boundary.is_empty() && boundary.max_diam() > eps) + { + ni->bisect(); + li.push_back(ni->left()); + li.push_back(ni->right()); + } + } + }; + + std::vector threads; + for (int tid = 0; tid < nthreads; tid++) + threads.emplace_back(worker, tid); + + for (auto& th : threads) th.join(); + + if(verbose) + { + printf("Number of thread used: %d\n", nthreads); + std::chrono::duration elapsed = std::chrono::high_resolution_clock::now() - start_time; + printf("Computation time: %.4fs\n\n", elapsed.count()); + } + return p; + } + PavingInOut regular_pave(const IntervalVector& x0, const std::function& test, double eps, bool verbose) @@ -228,7 +394,6 @@ namespace codac2 }; std::vector threads; - for (int tid = 0; tid < nthreads; tid++) threads.emplace_back(worker, tid); diff --git a/src/core/paver/codac2_pave.h b/src/core/paver/codac2_pave.h index 441b5bf2c..981d33b86 100644 --- a/src/core/paver/codac2_pave.h +++ b/src/core/paver/codac2_pave.h @@ -15,22 +15,24 @@ #include "codac2_AnalyticFunction.h" #include "codac2_BoolInterval.h" #include "codac2_SlicedTube.h" - #include "codac2_threading.h" namespace codac2 { // eps: accuracy of the paving algorithm, the undefined boxes will have their max_diam <= eps - PavingOut pave(const IntervalVector& x0, std::shared_ptr> c, double eps, bool verbose = false); PavingOut pave(const IntervalVector& x0, const CtcBase& c, double eps, double& time, bool verbose = false); + PavingOut pave(const IntervalVector& x0, std::shared_ptr> c, double eps, bool verbose = false); PavingOut pave(const IntervalVector& x0, const CtcBase& c, double eps, bool verbose = false); + PavingOut pave_monothread(const IntervalVector& x0, const CtcBase& c, double eps, double& time, bool verbose = false); + PavingOut pave_multithread(const IntervalVector& x0, const CtcBase& c, double eps, double& time, bool verbose = false); PavingInOut pave(const IntervalVector& x0, std::shared_ptr s, double eps, bool verbose = false); PavingInOut pave(const IntervalVector& x0, const SepBase& s, double eps, bool verbose = false); + PavingInOut pave_monothread(const IntervalVector& x0, const SepBase& s, double eps, bool verbose = false); + PavingInOut pave_multithread(const IntervalVector& x0, const SepBase& s, double eps, bool verbose = false); PavingInOut regular_pave(const IntervalVector& x0, const std::function& test, double eps, bool verbose = false); - PavingInOut regular_pave_multithread(const IntervalVector& x0, const std::function& test, double eps, bool verbose = false); template @@ -73,6 +75,6 @@ namespace codac2 eps, verbose); } } - + PavingInOut pave_tube(const IntervalVector& x0, const SlicedTube& f, double eps, bool verbose = false); } \ No newline at end of file