From 917c081ddc1651381f83d8a9b0e095440419814a Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 5 Jan 2025 01:09:01 +0000 Subject: Helper to declare and add OpenMesh property declaratively --- thirdparty/openmesh/helpers.h | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 thirdparty/openmesh/helpers.h (limited to 'thirdparty/openmesh') diff --git a/thirdparty/openmesh/helpers.h b/thirdparty/openmesh/helpers.h new file mode 100644 index 0000000..bed885c --- /dev/null +++ b/thirdparty/openmesh/helpers.h @@ -0,0 +1,11 @@ +#pragma once +#include + +namespace OpenMesh::Helpers { + template typename PropertyT> struct Property : public PropertyT { + template explicit Property(OpenMesh::BaseKernel * kernel, Params &&... params) + { + kernel->add_property(*this, std::forward(params)...); + } + }; +} -- cgit v1.2.3 From ae0d124dc1e0476d6729d5073e0ab438521cf4ff Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 14 Feb 2025 02:31:34 +0000 Subject: Add operator| overload to make OpenMesh XY_range(...) work with std::ranges Wraps the OpenMesh with iota and forwards the adapter --- thirdparty/openmesh/helpers.h | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'thirdparty/openmesh') diff --git a/thirdparty/openmesh/helpers.h b/thirdparty/openmesh/helpers.h index bed885c..d148c06 100644 --- a/thirdparty/openmesh/helpers.h +++ b/thirdparty/openmesh/helpers.h @@ -1,11 +1,28 @@ #pragma once #include +#include +#include -namespace OpenMesh::Helpers { - template typename PropertyT> struct Property : public PropertyT { - template explicit Property(OpenMesh::BaseKernel * kernel, Params &&... params) - { - kernel->add_property(*this, std::forward(params)...); - } - }; +namespace OpenMesh { + template + using IteratorFunction = Iter (OpenMesh::PolyConnectivity::*)(CenterEntityHandle) const; + + template BeginFunc, + IteratorFunction EndFunc, typename Adaptor> + auto + operator|(const OpenMesh::PolyConnectivity::CirculatorRange & range, + Adaptor && adaptor) + { + return std::views::iota(range.begin(), range.end()) | std::forward(adaptor); + } + + namespace Helpers { + template typename PropertyT> struct Property : public PropertyT { + template explicit Property(OpenMesh::BaseKernel * kernel, Params &&... params) + { + kernel->add_property(*this, std::forward(params)...); + } + }; + } } -- cgit v1.2.3