Commit 6210be47 authored by Michaël Roynard's avatar Michaël Roynard
Browse files

Merge branch 'development/ranges' into development/transform_view

# Conflicts:
#	doc/source/core.rst
#	doc/source/core/concepts/domains.rst
#	doc/source/core/concepts/pixels.rst
#	doc/source/core/concepts/ranges.rst
#	doc/source/core/domains.rst
#	doc/source/core/pixels.rst
#	doc/source/core/points.rst
#	doc/source/core/ranges.rst
#	pylene/CMakeLists.txt
#	pylene/include/mln/core/concept/new/cmcstl2.hpp
#	pylene/include/mln/core/concept/new/concepts.hpp
#	pylene/include/mln/core/concept/new/domains.hpp
#	pylene/include/mln/core/concept/new/indexes.hpp
#	pylene/include/mln/core/concept/new/pixels.hpp
#	pylene/include/mln/core/concept/new/points.hpp
#	pylene/include/mln/core/concept/new/ranges.hpp
#	pylene/include/mln/core/concept/new/values.hpp
#	pylene/include/mln/core/image/ndimage.hpp
#	pylene/include/mln/core/image/private/image_traits.hpp
#	pylene/include/mln/core/rangev3/private/multidimensional_range.hpp
#	pylene/include/mln/core/rangev3/range_traits.hpp
#	pylene/include/mln/core/rangev3/view/remove_if.hpp
#	pylene/include/mln/core/rangev3/view/reverse.hpp
#	pylene/include/mln/core/rangev3/view/transform.hpp
#	pylene/include/mln/core/rangev3/view/zip.hpp
#	pylene/include/mln/core/rangev3/view/zip_with.hpp
#	tests/core/CMakeLists.txt
#	tests/core/concept/domains.cpp
#	tests/core/concept/indexes.cpp
#	tests/core/concept/pixels.cpp
#	tests/core/concept/points.cpp
#	tests/core/concept/ranges.cpp
#	tests/core/concept/values.cpp
#	tests/core/range/multi_indices.cpp
#	tests/core/range/multi_span.cpp
#	tests/core/range/reverse.cpp
#	tests/core/range/transform.cpp
#	tests/core/range/zip.cpp
parents 06a0f4e8 9b65c422
Pipeline #12297 passed with stages
in 14 minutes and 37 seconds
......@@ -34,7 +34,8 @@
"/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed",
"/usr/include/x86_64-linux-gnu",
"/usr/include",
"${workspaceRoot}"
"${workspaceRoot}",
"${workspaceFolder}/pylene/include"
],
"defines": [],
"intelliSenseMode": "clang-x64",
......
{
"C_Cpp.intelliSenseEngineFallback": "Disabled",
"C_Cpp.configurationWarnings": "Disabled",
"files.associations": {
"tuple": "cpp",
"slist": "cpp",
......@@ -27,7 +25,39 @@
"sstream": "cpp",
"string": "cpp",
"utility": "cpp",
"vector": "cpp"
"vector": "cpp",
"__bit_reference": "cpp",
"__hash_table": "cpp",
"__split_buffer": "cpp",
"__tree": "cpp",
"deque": "cpp",
"iterator": "cpp",
"regex": "cpp",
"set": "cpp",
"string_view": "cpp",
"unordered_set": "cpp",
"bitset": "cpp",
"memory": "cpp",
"optional": "cpp",
"variant": "cpp",
"random": "cpp",
"__debug": "cpp",
"__functional_03": "cpp",
"__functional_base": "cpp",
"__functional_base_03": "cpp",
"__string": "cpp",
"__tuple": "cpp",
"atomic": "cpp",
"limits": "cpp",
"complex": "cpp",
"list": "cpp",
"unordered_map": "cpp",
"valarray": "cpp",
"chrono": "cpp",
"ratio": "cpp",
"system_error": "cpp",
"thread": "cpp"
},
"python.pythonPath": "/usr/bin/python3"
"python.pythonPath": "/usr/bin/python3",
"C_Cpp.configurationWarnings": "Disabled"
}
\ No newline at end of file
......@@ -81,6 +81,21 @@
"group": "build",
"problemMatcher": "$gcc"
},
{
"label": "build-doc-remote",
"dependsOn": "configure-remote",
"type": "shell",
"command": "ssh node7 'cd /work/mroynard/lrde/pylene/build-remote && source ../venv_python371/bin/activate && cmake --build . --target doc -- -j12'",
"group": "build",
"problemMatcher": "$gcc"
},
{
"label": "only-build-doc-remote",
"type": "shell",
"command": "ssh node7 'cd /work/mroynard/lrde/pylene/build-remote && source ../venv_python371/bin/activate && cmake --build . --target doc -- -j12'",
"group": "build",
"problemMatcher": "$gcc"
},
{
"label": "clean-remote",
"type": "shell",
......
......@@ -13,6 +13,7 @@ Core Module
core/domains
core/indexes
core/ranges
core/images
core/neighborhood
core/algorithms
core/stl
......@@ -61,11 +62,6 @@ Core Module
* :ref:`Point <concept-points-Point>`
.. topic:: Predefined points
* :doc:`core/points/point2d`
* :doc:`core/points/point3d`
......@@ -81,10 +77,6 @@ Core Module
* :ref:`Pixel <concept-pixels-Pixel>`
.. topic:: Predefined points
* :doc:`core/pixels/ndpixel`
......@@ -100,11 +92,6 @@ Core Module
* :ref:`Domain <concept-domains-Domain>`
.. topic:: Predefined domains
* :doc:`core/domains/box2d`
* :doc:`core/domains/box3d`
......@@ -123,6 +110,40 @@ Core Module
.. raw:: html
<h2>Images</h2>
:doc:`core/images` represent an image and all its properties.
.. topic:: Concepts
* :ref:`Image <concept-images-Image>`
* :ref:`IndexableImage <concept-images-IndexableImage>`
* :ref:`AccessibleImage <concept-images-AccessibleImage>`
* :ref:`ReversibleImage <concept-images-ReversibleImage>`
* :ref:`RandomAccessImage <concept-images-RandomAccessImage>`
* :ref:`ExtendedImage <concept-images-ExtendedImage>`
* :ref:`ChValueImage <concept-images-ChValueImage>`
* :ref:`RawImage <concept-images-RawImage>`
* :ref:`WritableImage <concept-images-WritableImage>`
* :ref:`ViewImage <concept-images-ViewImage>`
* :ref:`ConcreteImage <concept-images-ConcreteImage>`
.. topic:: Utilities
TODO
.. topic:: Images
* :doc:`core/images/ndimage`
.. raw:: html
<h2>Ranges</h2>
......@@ -133,8 +154,8 @@ Core Module
.. topic:: Concepts
* :cpp:concept:`Segmented Range <mln::ranges::SegmentedRange>`
* :cpp:concept:`Reversible Range <mln::ranges::ReversibleRange>`
* :ref:`Segmented Range <concept-ranges-SegmentedRange>`
* :ref:`Reversible Range <concept-ranges-ReversibleRange>`
.. topic:: Utilities
......
......@@ -18,7 +18,6 @@ Domain
#. Refines the :cpp:concept:`Regular <stl::Regular>` concept.
#. ``Dom::point_type`` models :cpp:concept:`Point <Point>` concept.
#. ``Dom::codomain_type`` models :cpp:concept:`Value <Value>` concept, is non-const and is not a reference.
#. ``Dom`` provides methods `has`, `shape`, `empty`, `is_continuous`, `is_discrete` and `points`.
**Notation**
......@@ -52,12 +51,10 @@ Domain
- :cpp:expr:`cdom.has(p)` return-type models :cpp:concept:`Boolean <stl::Boolean>`.
- :cpp:expr:`cdom.empty()` return-type models :cpp:concept:`Boolean <stl::Boolean>`.
- :cpp:expr:`cdom.is_continuous()` return-type models :cpp:concept:`Boolean <stl::Boolean>`.
- :cpp:expr:`cdom.is_discrete()` return-type models :cpp:concept:`Boolean <stl::Boolean>`.
- :cpp:expr:`cdom.points()` return-type models :cpp:concept:`BidirectionalRange <stl::BidirectionalRange>`.
- :cpp:expr:`cdom.size()` return-type models :cpp:concept:`UnsignedIntegral <stl::UnsignedIntegral>`.
**Implementation**
.. literalinclude:: ../../../../pylene/include/mln/core/concept/new/domains.hpp
:language: cpp
:lines: 17-34
:lines: 17-25
================
Images (details)
================
TODO
......@@ -19,7 +19,7 @@ Pixel
#. Refines the :cpp:concept:`Regular (stl) <stl::Regular>` concept.
#. ``Pix::value_type`` models the :cpp:concept:`Value <Value>` concept, is non-const and is not a reference.
#. ``Pix::point_type`` models the :cpp:concept:`Point <Point>` concept.
#. ``Pix`` provides methods ``value`` and ``point``.
#. ``Pix`` provides methods ``val`` and ``point``.
**Notation**
......@@ -51,7 +51,7 @@ Pixel
- :cpp:expr:`u == t` return-type models :cpp:concept:`template<typename B> Boolean`.
- :cpp:expr:`u != t` return-type models :cpp:concept:`template<typename B> Boolean`.
- :cpp:expr:`cpix.value()` returns :cpp:expr:`const reference`.
- :cpp:expr:`cpix.val()` returns :cpp:expr:`const reference`.
- :cpp:expr:`cpix.point()` returns :cpp:expr:`const point_type`.
**Implementation**
......
......@@ -17,26 +17,24 @@ SegmentedRange
.. cpp:concept:: template <typename SegRng> SegmentedRange
#. Refines the :cpp:concept:`ForwardRange (stl) <stl::ForwardRange>` concept.
#. ``SegRng`` must derive from ``multidimensional_range_base``.
#. ``SegRng`` provides the method ``rows``.
**Notation**
.. cpp:var:: const SegRng crng
.. cpp:var:: SegRng rng
**Valid Expressions**
- All expression from :cpp:concept:`ForwardRange (stl) <stl::ForwardRange>` are valid.
- :cpp:expr:`std::is_base_of_v<mln::ranges::multidimensional_range_base, SegRng>` returns ``true``.
- :cpp:expr:`rng.rows()` return-type models :cpp:concept:`ForwardRange (stl) <stl::ForwardRange>`.
- :cpp:expr:`stl::iter_value_t<stl::iterator_t<stl::iter_value_t<stl::iterator_t<decltype(rng.rows())>>>>` must be the same as :cpp:expr:`stl::iter_value_t<stl::iterator_t<SegRng>>`.
- :cpp:expr:`crng.rows()` return-type models :cpp:concept:`ForwardRange (stl) <stl::ForwardRange>`.
**Implementation**d
**Implementation**
.. literalinclude:: ../../../../pylene/include/mln/core/concept/new/ranges.hpp
:language: cpp
:lines: 15-21
:lines: 15-23
ReversibleRange
......@@ -49,16 +47,17 @@ ReversibleRange
**Notation**
.. cpp:var:: const RevRng crng
.. cpp:var:: RevRng rng
**Valid Expressions**
- All expression from :cpp:concept:`ForwardRange (stl) <stl::ForwardRange>` are valid.
- :cpp:expr:`crng.reversed()` return-type models :cpp:concept:`ForwardRange (stl) <stl::ForwardRange>`.
- :cpp:expr:`rng.reversed()` return-type models :cpp:concept:`ForwardRange (stl) <stl::ForwardRange>`.
- :cpp:expr:`stl::iter_value_t<stl::iterator_t<decltype(rng.reversed())>>>` must be the same as :cpp:expr:`stl::iter_value_t<stl::iterator_t<RevRng>>`.
**Implementation**d
**Implementation**
.. literalinclude:: ../../../../pylene/include/mln/core/concept/new/ranges.hpp
:language: cpp
:lines: 25-30
:lines: 27-35
......@@ -54,35 +54,19 @@ Let :
Then we have the following valid expressions :
+--------------------------+----------------------------------+---------------+----------------+-------------------------------------------------------------+
| Expression | Return type | Pre-condition | Post-condition | Description |
+==========================+==================================+===============+================+=============================================================+
| ``lhs == rhs`` | ``bool`` | none | none | Compare wether two domains are equal |
+--------------------------+----------------------------------+---------------+----------------+-------------------------------------------------------------+
| ``lhs != rhs`` | ``bool`` | none | none | Compare wether two domains are different |
+--------------------------+----------------------------------+---------------+----------------+-------------------------------------------------------------+
| ``cdom.has(p)`` | ``bool`` | none | none | Check wether ``p`` belongs to the domain ``cdom`` |
+--------------------------+----------------------------------+---------------+----------------+-------------------------------------------------------------+
| ``cdom.empty()`` | ``bool`` | none | none | Check wether ``cdom`` is an empty domain |
+--------------------------+----------------------------------+---------------+----------------+-------------------------------------------------------------+
| ``cdom.is_continuous()`` | ``bool`` | none | none | Check wether ``cdom`` is a continuous domain |
+--------------------------+----------------------------------+---------------+----------------+-------------------------------------------------------------+
| ``cdom.is_discrete()`` | ``bool`` | none | none | Check wether ``cdom`` is a discrete domain |
+--------------------------+----------------------------------+---------------+----------------+-------------------------------------------------------------+
| ``cdom.points()`` | ``/* implementation defined */`` | none | none | - Return a range of points to iterate over it |
| | | | | - Return-type models :cpp:concept:`stl::BidirectionalRange` |
+--------------------------+----------------------------------+---------------+----------------+-------------------------------------------------------------+
Predefined domains
------------------
.. toctree::
domains/box2d
domains/box3d
+------------------+----------------------------------------------------------------------+---------------+----------------+---------------------------------------------------+
| Expression | Return type | Pre-condition | Post-condition | Description |
+==================+======================================================================+===============+================+===================================================+
| ``lhs == rhs`` | ``bool`` | none | none | Compare wether two domains are equal |
+------------------+----------------------------------------------------------------------+---------------+----------------+---------------------------------------------------+
| ``lhs != rhs`` | ``bool`` | none | none | Compare wether two domains are different |
+------------------+----------------------------------------------------------------------+---------------+----------------+---------------------------------------------------+
| ``cdom.has(p)`` | ``bool`` | none | none | Check wether ``p`` belongs to the domain ``cdom`` |
+------------------+----------------------------------------------------------------------+---------------+----------------+---------------------------------------------------+
| ``cdom.empty()`` | ``bool`` | none | none | Check wether ``cdom`` is an empty domain |
+------------------+----------------------------------------------------------------------+---------------+----------------+---------------------------------------------------+
| ``cdom.size()`` | models :cpp:concept:`UnsignedIntegral (stl) <stl::UnsignedIntegral>` | none | none | Return the size of the domain. |
+------------------+----------------------------------------------------------------------+---------------+----------------+---------------------------------------------------+
......
=====
Image
=====
operator== return a point-wise view where == comp is done on each pixel.
Images defined by a vector of point -> value are not accessible (ima(p))
Forsee to add pdim (point) and vdim (value) for dimension constant in iamge concept
.. contents::
:local:
Concepts
--------
.. cpp:namespace:: mln::concepts
.. _concept-images-Image:
Image
#####
.. _concept-images-IndexableImage:
IndexableImage
##############
.. _concept-images-AccessibleImage:
AccessibleImage
###############
.. _concept-images-ReversibleImage:
ReversibleImage
###############
.. _concept-images-RandomAccessImage:
RandomAccessImage
#################
.. _concept-images-ExtendedImage:
ExtendedImage
#############
.. _concept-images-ChValueImage:
ChValueImage
############
.. _concept-images-RawImage:
RawImage
########
.. _concept-images-WritableImage:
WritableImage
#############
.. _concept-images-ViewImage:
ViewImage
#########
.. _concept-images-ConcreteImage:
ConcreteImage
#############
Predefined images
-----------------
.. toctree::
images/ndimage
Concepts detail
---------------
.. toctree::
concepts/images
......@@ -62,7 +62,7 @@ Then we have the following valid expressions :
+------------------+----------------+---------------+----------------+-----------------------------------------+
| ``lhs != rhs`` | ``bool`` | none | none | Compare wether two pixels are different |
+------------------+----------------+---------------+----------------+-----------------------------------------+
| ``cpix.value()`` | ``reference`` | none | none | Access the value of the pixel ``pix`` |
| ``cpix.val()`` | ``reference`` | none | none | Access the value of the pixel ``pix`` |
+------------------+----------------+---------------+----------------+-----------------------------------------+
| ``cpix.point()`` | ``point_type`` | none | none | Access the point of the pixel ``pix`` |
+------------------+----------------+---------------+----------------+-----------------------------------------+
......@@ -74,16 +74,6 @@ If the `value_type` is constant then the value returned by `value()` (which retu
Predefined pixels
-----------------
.. toctree::
pixels/ndpixel
Concepts detail
---------------
......
......@@ -55,17 +55,6 @@ Then we have the following valid expressions :
Predefined points
-----------------
.. toctree::
points/point2d
points/point3d
Concepts detail
---------------
......
......@@ -22,8 +22,8 @@ Concepts
.. _concept-ranges-SegmentedRange:
SegmentedRange (Multidimensional)
#################################
Segmented (Multidimensional) Range
##################################
Let `SegRng` be a type that models :cpp:concept:`SegmentedRange (details) <SegmentedRange>`.
......@@ -38,19 +38,17 @@ Let `SegRng` inherit all types defined for :cpp:concept:`ForwardRange (stl) <stl
.. rubric:: Expressions
Let `SegRng` inherit all valid expressions defined for :cpp:concept:`ForwardRange (stl) <stl::ForwardRange>`.
Let :
- ``crng`` be an instance of `const SegRng`.
Let:
- ``rng`` be an instance of `SegRng`.
Then we have the following valid expressions :
+-----------------------------------------------+----------------------------------+---------------+----------------+---------------------------------------------------------------------------+
| Expression | Return type | Pre-condition | Post-condition | Description |
+===============================================+==================================+===============+================+===========================================================================+
| ``is_base_of_v<multidimensional_range_base>`` | ``bool`` | none | none | Must return ``true``. |
+-----------------------------------------------+----------------------------------+---------------+----------------+---------------------------------------------------------------------------+
| ``crng.rows()`` | ``/* implementation defined */`` | none | none | Return-type models :cpp:concept:`ForwardRange (stl) <stl::ForwardRange>`. |
+-----------------------------------------------+----------------------------------+---------------+----------------+---------------------------------------------------------------------------+
+----------------+------------------------------------------------------------------------+---------------+----------------+------------------------------------------------------------------------------------------------------+
| Expression | Return type | Pre-condition | Post-condition | Description |
+================+========================================================================+===============+================+======================================================================================================+
| ``rng.rows()`` | - models :cpp:concept:`ForwardRange (stl) <stl::ForwardRange>` | none | none | Return a range of sub-range where each sub-range is a "line" from the original non-segmented range. |
| | - The subrange's `value_type` must be the same as `SegRng::value_type` | | | |
+----------------+------------------------------------------------------------------------+---------------+----------------+------------------------------------------------------------------------------------------------------+
.. rubric:: Description
......@@ -75,8 +73,8 @@ Example:
.. _concept-ranges-ReversibleRange:
ReversibleRange
###############
Reversible Range
################
Let `RevRng` be a type that models :cpp:concept:`ReversibleRange (details) <ReversibleRange>`.
......@@ -91,17 +89,17 @@ Let `RevRng` inherit all types defined for :cpp:concept:`ForwardRange (stl) <stl
.. rubric:: Expressions
Let `RevRng` inherit all valid expressions defined for :cpp:concept:`ForwardRange (stl) <stl::ForwardRange>`.
Let :
- ``crng`` be an instance of `const RevRng`.
Let:
- ``rng`` be an instance of `RevRng`.
Then we have the following valid expressions :
+---------------------+----------------------------------+---------------+----------------+---------------------------------------------------------------------------+
| Expression | Return type | Pre-condition | Post-condition | Description |
+=====================+==================================+===============+================+===========================================================================+
| ``crng.reversed()`` | ``/* implementation defined */`` | none | none | Return-type models :cpp:concept:`ForwardRange (stl) <stl::ForwardRange>`. |
+---------------------+----------------------------------+---------------+----------------+---------------------------------------------------------------------------+
+--------------------+------------------------------------------------------------------------------+---------------+----------------+----------------------------------------------------------------------------------------------------+
| Expression | Return type | Pre-condition | Post-condition | Description |
+====================+==============================================================================+===============+================+====================================================================================================+
| ``rng.reversed()`` | - models :cpp:concept:`ForwardRange (stl) <stl::ForwardRange>` | none | none | Return a range whose forward browsing is done in the reverse order comparing to the orignal range. |
| | - The returned range's `value_type` must be the same as `SegRng::value_type` | | | |
+--------------------+------------------------------------------------------------------------------+---------------+----------------+----------------------------------------------------------------------------------------------------+
.. rubric:: Description
......
......@@ -49,7 +49,8 @@ if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.2)
target_compile_options(Pylene INTERFACE -fconcepts)
find_package(cmcstl2 REQUIRED)
target_link_libraries(Pylene INTERFACE stl2)
target_compile_definitions(Pylene INTERFACE CONCEPT_TS_ENABLED)
target_compile_definitions(Pylene INTERFACE PYLENE_CONCEPT_TS_ENABLED)
target_compile_definitions(Pylene INTERFACE concept="concept bool")
endif()
......
#pragma once
#include <mln/core/concept/new/archetype/point.hpp>
#include <mln/core/concept/new/domains.hpp>
namespace mln::archetypes
{
struct Domain final
{
using value_type = Point;
using reference = Point&;
value_type* begin();
value_type* end();
bool has(value_type) const;
bool empty() const;
unsigned size() const;
};
#ifdef PYLENE_CONCEPT_TS_ENABLED
static_assert(mln::concepts::Domain<Domain>, "Domain archetype does not model the Domain concept!");
#endif // PYLENE_CONCEPT_TS_ENABLED
} // namespace mln::archetypes
#pragma once
#include <mln/core/concept/new/archetype/domain.hpp>
#include <mln/core/concept/new/archetype/pixel.hpp>
#include <mln/core/concept/new/images.hpp>
#include <mln/core/domain/private/domain_traits.hpp>
#include <mln/core/image/private/image_traits.hpp>
#include <mln/core/image/private/pixel_traits.hpp>
#include <type_traits>
namespace mln::archetypes
{
struct Image;
struct Image
{
using new_pixel_type = Pixel;
using value_type = pixel_value_t<Pixel>;
using reference = pixel_reference_t<Pixel>;
using point_type = domain_point_t<Domain>;
using domain_type = Domain;
using category_type = forward_image_tag;
using concrete_type = Image;
#ifdef PYLENE_CONCEPT_TS_ENABLED
template <mln::concepts::Value Val>
#else