From 9754d0f43176fbbebacb8d56e6a40090456c7474 Mon Sep 17 00:00:00 2001 From: Simon Rohou Date: Tue, 21 Jul 2026 16:39:01 +0200 Subject: [PATCH 1/2] [sep] SepInter and SepUnion can be built from a list of separators --- python/src/core/separators/codac2_py_SepInter.cpp | 11 +++++++++++ python/src/core/separators/codac2_py_SepUnion.cpp | 11 +++++++++++ src/core/separators/codac2_SepInter.h | 8 ++++++++ src/core/separators/codac2_SepUnion.h | 8 ++++++++ 4 files changed, 38 insertions(+) diff --git a/python/src/core/separators/codac2_py_SepInter.cpp b/python/src/core/separators/codac2_py_SepInter.cpp index d650f67c1..4d2d2382d 100644 --- a/python/src/core/separators/codac2_py_SepInter.cpp +++ b/python/src/core/separators/codac2_py_SepInter.cpp @@ -24,6 +24,17 @@ void export_SepInter(py::module& m, py::class_& pysep) py::class_ exported(m, "SepInter", pysep, SEPINTER_MAIN); exported + .def(py::init( + [](const py::list& l) + { + Collection l_copy; + for(const auto& li : l) + l_copy.push_back(li.cast().copy()); + return std::make_unique(l_copy); + }), + SEPINTER_SEPINTER_CONST_COLLECTION_T_REF, + "s"_a) + .def(py::init( [](const SepBase& s) { diff --git a/python/src/core/separators/codac2_py_SepUnion.cpp b/python/src/core/separators/codac2_py_SepUnion.cpp index c8d32c0f4..29ea6ff70 100644 --- a/python/src/core/separators/codac2_py_SepUnion.cpp +++ b/python/src/core/separators/codac2_py_SepUnion.cpp @@ -24,6 +24,17 @@ void export_SepUnion(py::module& m, py::class_& pysep) py::class_ exported(m, "SepUnion", pysep, SEPUNION_MAIN); exported + .def(py::init( + [](const py::list& l) + { + Collection l_copy; + for(const auto& li : l) + l_copy.push_back(li.cast().copy()); + return std::make_unique(l_copy); + }), + SEPUNION_SEPUNION_CONST_COLLECTION_T_REF, + "s"_a) + .def(py::init( [](const SepBase& s) { diff --git a/src/core/separators/codac2_SepInter.h b/src/core/separators/codac2_SepInter.h index 979d2a753..23f95617b 100644 --- a/src/core/separators/codac2_SepInter.h +++ b/src/core/separators/codac2_SepInter.h @@ -20,6 +20,14 @@ namespace codac2 { public: + template + SepInter(const Collection& c) + : Sep([&c]() { + assert_release(!c.empty()); + return size_of(c.front()); + }()), _seps(c) + { } + template requires (IsSepBaseOrPtr && !std::is_same_v) SepInter(const S& s) diff --git a/src/core/separators/codac2_SepUnion.h b/src/core/separators/codac2_SepUnion.h index 33e5a87c8..e39461e07 100644 --- a/src/core/separators/codac2_SepUnion.h +++ b/src/core/separators/codac2_SepUnion.h @@ -20,6 +20,14 @@ namespace codac2 { public: + template + SepUnion(const Collection& c) + : Sep([&c]() { + assert_release(!c.empty()); + return size_of(c.front()); + }()), _seps(c) + { } + template requires (IsSepBaseOrPtr && !std::is_same_v) SepUnion(const S& s) From 8fb98f99c2bed3c869b2b846ef18108030386181 Mon Sep 17 00:00:00 2001 From: Simon Rohou Date: Tue, 21 Jul 2026 16:41:44 +0200 Subject: [PATCH 2/2] [doc] toctree file --- doc/manual/manual/contractors/shape/index.rst | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 doc/manual/manual/contractors/shape/index.rst diff --git a/doc/manual/manual/contractors/shape/index.rst b/doc/manual/manual/contractors/shape/index.rst new file mode 100644 index 000000000..87ef31424 --- /dev/null +++ b/doc/manual/manual/contractors/shape/index.rst @@ -0,0 +1,9 @@ +Shape contractors +================= + +.. toctree:: + + CtcCtcBoundary + CtcWrapper + CtcImage + CtcDiscreteSet \ No newline at end of file