1#ifndef TATOOINE_POINTSET_H
2#define TATOOINE_POINTSET_H
4#include <tatooine/available_libraries.h>
9#include <boost/range/algorithm/find.hpp>
10#if TATOOINE_FLANN_AVAILABLE
11#include <flann/flann.hpp>
31namespace detail::pointset {
32#if TATOOINE_CGAL_AVAILABLE
33template <
floating_po
int Real, std::
size_t NumDimensions,
typename ValueType>
34struct natural_neighbor_coordinates_sampler;
36template <floating_point Real, std::size_t NumDimensions,
typename ValueType,
38struct natural_neighbor_coordinates_sampler_with_gradients;
41#if TATOOINE_FLANN_AVAILABLE
42template <floating_point Real, std::size_t NumDimensions,
typename ValueType,
44struct moving_least_squares_sampler;
47template <
floating_po
int Real, std::
size_t NumDimensions,
typename ValueType>
48requires(flann_available())
49struct inverse_distance_weighting_sampler;
51#if TATOOINE_BLAS_AND_LAPACK_AVAILABLE
52template <floating_point Real, std::size_t NumDimensions,
typename ValueType,
53 invocable<Real> Kernel>
56template <floating_point Real, std::size_t NumDimensions,
typename ValueType,
57 typename GradientType>
61template <
floating_po
int Real, std::
size_t NumDimensions>
62struct vertex_container;
64template <
floating_po
int Real, std::
size_t NumDimensions>
65struct const_vertex_container;
68template <
floating_po
int Real, std::
size_t NumDimensions>
79#if TATOOINE_FLANN_AVAILABLE || defined(TATOOINE_DOC_ONLY)
98 std::map<std::string, std::unique_ptr<vertex_property_type>>;
103#if TATOOINE_CGAL_AVAILABLE
104 template <
typename T>
108 template <
typename T,
typename Gradient>
111 Real, NumDimensions, T, Gradient>;
120#if TATOOINE_FLANN_AVAILABLE || defined(TATOOINE_DOC_ONLY)
169 if (&other ==
this) {
175 for (
auto const &[name, prop] : other.vertex_properties()) {
218 auto vertex_at(std::size_t
const i)
const ->
auto const & {
244 requires(
sizeof...(ts) == NumDimensions)
250#if TATOOINE_FLANN_AVAILABLE
254 m_kd_tree->addPoints(flann::Matrix<Real>{
268#if TATOOINE_FLANN_AVAILABLE
272 m_kd_tree->addPoints(flann::Matrix<Real>{
286#if TATOOINE_FLANN_AVAILABLE
290 m_kd_tree->addPoints(flann::Matrix<Real>{
310 auto cleaned_positions = std::vector<pos_type>{};
313 auto i = std::size_t{};
319 cleaned_positions.push_back(pos);
337#if TATOOINE_FLANN_AVAILABLE
348 return v.is_valid() &&
362 template <invocable<pos_type> F>
368 template <invocable<pos_type> F>
372 using T = std::invoke_result_t<F, pos_type>;
373 auto &prop = vertex_property<T>(name);
377 }
catch (std::exception &) {
378 if constexpr (tensor_num_components<T> == 1) {
379 prop[v] = T{nan<T>()};
388 template <invocable<pos_type> F>
392 using T = std::invoke_result_t<F, pos_type>;
393 auto &prop = vertex_property<T>(name);
394#pragma omp parallel for
398 }
catch (std::exception &) {
399 if constexpr (tensor_num_components<T> == 1) {
400 prop[v] = T{nan<T>()};
410 for (
auto v : other.vertices()) {
416 std::vector<std::pair<vertex_handle, vertex_handle>> duplicates;
499 template <
typename T>
503 return insert_vertex_property<T>(name);
505 if (
typeid(T) != it->second->type()) {
506 throw std::runtime_error{
507 "type of property \"" + name +
"\"(" +
508 boost::core::demangle(it->second->type().name()) +
509 ") does not match specified type " + type_name<T>() +
"."};
516 template <
typename T>
520 throw std::runtime_error{
"property \"" + name +
"\" not found"};
522 if (
typeid(T) != it->second->type()) {
523 throw std::runtime_error{
524 "type of property \"" + name +
"\"(" +
525 boost::core::demangle(it->second->type().name()) +
526 ") does not match specified type " + type_name<T>() +
"."};
534 return vertex_property<tatooine::real_number>(name);
538 return vertex_property<tatooine::real_number>(name);
542 return vertex_property<vec2>(name);
546 return vertex_property<vec2>(name);
550 return vertex_property<vec3>(name);
554 return vertex_property<vec3>(name);
558 return vertex_property<vec4>(name);
562 return vertex_property<vec4>(name);
566 return vertex_property<mat2>(name);
570 return vertex_property<mat2>(name);
574 return vertex_property<mat3>(name);
578 return vertex_property<mat3>(name);
582 return vertex_property<mat4>(name);
586 return vertex_property<mat4>(name);
589 template <
typename T>
593 name, std::make_unique<typed_vertex_property_type<T>>(value)});
594 auto prop =
dynamic_cast<typed_vertex_property_type<T> *
>(it->second.get());
600 std::string
const &name,
601 tatooine::real_number
const value = tatooine::real_number{}) ->
auto & {
602 return insert_vertex_property<tatooine::real_number>(name, value);
608 return insert_vertex_property<vec2>(name, value);
614 return insert_vertex_property<vec3>(name, value);
620 return insert_vertex_property<vec4>(name, value);
626 return insert_vertex_property<mat2>(name, value);
632 return insert_vertex_property<mat3>(name, value);
638 return insert_vertex_property<mat4>(name, value);
643 auto write(filesystem::path
const &path)
const {
644 auto const ext = path.extension();
645 if constexpr (NumDimensions == 2 || NumDimensions == 3) {
649 }
else if (ext ==
".vtp") {
654 throw std::runtime_error(
655 "Could not write pointset. Unknown file extension: \"" + ext.string() +
660 std::string
const &title =
"Tatooine pointset") const ->
void
661 requires(NumDimensions == 3 || NumDimensions == 2)
664 if (writer.is_open()) {
665 writer.set_title(title);
666 writer.write_header();
676 using namespace std::ranges;
677 if constexpr (NumDimensions == 2) {
681 auto v3s = std::vector<vec<Real, 3>>(
vertices().size());
682 auto three_dimensional = views::transform(three_dims);
685 }
else if constexpr (NumDimensions == 3) {
689 auto vertex_indices = std::vector<std::vector<std::size_t>>(
692 vertex_indices.front().begin());
696 template <
typename T>
699 writer.write_scalars(name, prop.internal_container());
702 template <
typename... Ts>
710 auto const &[name, prop] = p;
711 if (prop->type() ==
typeid(Ts)) {
721 auto file = std::ofstream{path, std::ios::binary};
722 if (!file.is_open()) {
723 throw std::runtime_error{
"Could not write " + path.string()};
725 auto offset = std::size_t{};
726 using header_type = std::uint64_t;
727 using verts_connectivity_int_type = std::int64_t;
728 using verts_offset_int_type = verts_connectivity_int_type;
729 auto const num_bytes_points =
731 auto const num_bytes_verts_connectivity =
732 vertices().size() *
sizeof(verts_connectivity_int_type);
733 auto const num_bytes_verts_offsets =
734 sizeof(verts_offset_int_type) *
vertices().size();
736 <<
" type=\"PolyData\""
737 <<
" version=\"1.0\""
738 <<
" byte_order=\"LittleEndian\""
744 <<
" NumberOfPoints=\"" <<
vertices().size() <<
"\""
745 <<
" NumberOfPolys=\"0\""
746 <<
" NumberOfVerts=\"" <<
vertices().size() <<
"\""
747 <<
" NumberOfLines=\"0\""
748 <<
" NumberOfStrips=\"0\""
753 <<
" format=\"appended\""
754 <<
" offset=\"" << offset <<
"\""
756 <<
"\" NumberOfComponents=\"3\"/>"
758 offset += num_bytes_points +
sizeof(header_type);
762 <<
"<DataArray format=\"appended\" offset=\"" << offset <<
"\" type=\""
764 vtk::xml::to_data_type<verts_connectivity_int_type>())
765 <<
"\" Name=\"connectivity\"/>\n";
766 offset += num_bytes_verts_connectivity +
sizeof(header_type);
768 file <<
"<DataArray format=\"appended\" offset=\"" << offset <<
"\" type=\""
770 <<
"\" Name=\"offsets\"/>\n";
771 offset += num_bytes_verts_offsets +
sizeof(header_type);
772 file <<
"</Verts>\n";
776 file <<
"<PointData>\n";
778 offset += write_vertex_property_data_array_vtp<float, header_type>(
779 name, prop, file, offset);
780 offset += write_vertex_property_data_array_vtp<vec2f, header_type>(
781 name, prop, file, offset);
782 offset += write_vertex_property_data_array_vtp<vec3f, header_type>(
783 name, prop, file, offset);
784 offset += write_vertex_property_data_array_vtp<vec4f, header_type>(
785 name, prop, file, offset);
786 offset += write_vertex_property_data_array_vtp<mat2f, header_type>(
787 name, prop, file, offset);
788 offset += write_vertex_property_data_array_vtp<mat3f, header_type>(
789 name, prop, file, offset);
790 offset += write_vertex_property_data_array_vtp<mat4f, header_type>(
791 name, prop, file, offset);
792 offset += write_vertex_property_data_array_vtp<double, header_type>(
793 name, prop, file, offset);
794 offset += write_vertex_property_data_array_vtp<vec2d, header_type>(
795 name, prop, file, offset);
796 offset += write_vertex_property_data_array_vtp<vec3d, header_type>(
797 name, prop, file, offset);
798 offset += write_vertex_property_data_array_vtp<vec4d, header_type>(
799 name, prop, file, offset);
800 offset += write_vertex_property_data_array_vtp<mat2d, header_type>(
801 name, prop, file, offset);
802 offset += write_vertex_property_data_array_vtp<mat3d, header_type>(
803 name, prop, file, offset);
804 offset += write_vertex_property_data_array_vtp<mat4d, header_type>(
805 name, prop, file, offset);
807 file <<
"</PointData>\n";
811 <<
"<AppendedData encoding=\"raw\">\n_";
813 using namespace std::ranges;
815 file.write(
reinterpret_cast<char const *
>(&num_bytes_points),
816 sizeof(header_type));
817 if constexpr (NumDimensions == 2) {
818 auto point_data = std::vector<vec<Real, 3>>(
vertices().size());
819 auto position = [
this](
auto const v) ->
auto &{
return at(v); };
820 constexpr auto to_3d = [](
auto const &p) {
821 return vec{p.x(), p.y(), Real(0)};
825 file.write(
reinterpret_cast<char const *
>(point_data.data()),
827 }
else if constexpr (NumDimensions == 3) {
828 file.write(
reinterpret_cast<char const *
>(
vertices().data()),
835 auto connectivity_data =
836 std::vector<verts_connectivity_int_type>(
vertices().
size());
837 copy(views::iota(verts_connectivity_int_type(0),
839 begin(connectivity_data));
840 file.write(
reinterpret_cast<char const *
>(&num_bytes_verts_connectivity),
841 sizeof(header_type));
842 file.write(
reinterpret_cast<char const *
>(connectivity_data.data()),
843 num_bytes_verts_connectivity);
848 auto offsets = std::vector<verts_offset_int_type>(
vertices().
size(), 1);
849 for (std::size_t i = 1; i <
size(offsets); ++i) {
850 offsets[i] += offsets[i - 1];
852 file.write(
reinterpret_cast<char const *
>(&num_bytes_verts_offsets),
853 sizeof(header_type));
854 file.write(
reinterpret_cast<char const *
>(offsets.data()),
855 num_bytes_verts_offsets);
858 write_vertex_property_appended_data_vtp<float, header_type>(prop, file);
859 write_vertex_property_appended_data_vtp<vec2f, header_type>(prop, file);
860 write_vertex_property_appended_data_vtp<vec3f, header_type>(prop, file);
861 write_vertex_property_appended_data_vtp<vec4f, header_type>(prop, file);
862 write_vertex_property_appended_data_vtp<mat2f, header_type>(prop, file);
863 write_vertex_property_appended_data_vtp<mat3f, header_type>(prop, file);
864 write_vertex_property_appended_data_vtp<mat4f, header_type>(prop, file);
865 write_vertex_property_appended_data_vtp<double, header_type>(prop, file);
866 write_vertex_property_appended_data_vtp<vec2d, header_type>(prop, file);
867 write_vertex_property_appended_data_vtp<vec3d, header_type>(prop, file);
868 write_vertex_property_appended_data_vtp<vec4d, header_type>(prop, file);
869 write_vertex_property_appended_data_vtp<mat2d, header_type>(prop, file);
870 write_vertex_property_appended_data_vtp<mat3d, header_type>(prop, file);
871 write_vertex_property_appended_data_vtp<mat4d, header_type>(prop, file);
873 file <<
"\n</AppendedData>\n"
879 template <
typename T,
typename header_type>
881 auto &file,
auto offset)
const
883 if (prop->type() ==
typeid(T)) {
884 if constexpr (tensor_rank<T> <= 1) {
886 <<
" Name=\"" << name <<
"\""
887 <<
" format=\"appended\""
888 <<
" offset=\"" << offset <<
"\""
892 <<
"\" NumberOfComponents=\""
893 << tensor_num_components<T> <<
"\"/>\n";
894 return vertices().size() *
sizeof(T) +
sizeof(header_type);
895 }
else if constexpr (tensor_rank<T> == 2) {
896 for (std::size_t i = 0; i < T::dimension(1); ++i) {
898 <<
" Name=\"" << name <<
"_col_" << i <<
"\""
899 <<
" format=\"appended\""
900 <<
" offset=\"" << offset <<
"\""
904 <<
"\" NumberOfComponents=\"" << T::dimension(0) <<
"\"/>\n";
906 tensor_dimension<T, 0> +
910 tensor_num_components<T> +
911 sizeof(header_type) * tensor_dimension<T, 1>;
917 template <
typename T,
typename header_type>
920 if (prop->type() ==
typeid(T)) {
921 auto const &typed_prop = prop->template cast_to_typed<T>();
922 if constexpr (tensor_rank<T> <= 1) {
923 auto const num_bytes =
926 file.write(
reinterpret_cast<char const *
>(&num_bytes),
927 sizeof(header_type));
928 file.write(
reinterpret_cast<char const *
>(typed_prop.data()),
930 }
else if constexpr (tensor_rank<T> == 2) {
931 auto const num_bytes = header_type(
934 for (std::size_t i = 0; i < tensor_dimension<T, 1>; ++i) {
935 file.write(
reinterpret_cast<char const *
>(&num_bytes),
936 sizeof(header_type));
938 auto data_begin = &typed_prop[v](0, i);
940 reinterpret_cast<char const *
>(data_begin),
951 auto read(filesystem::path
const &p) {
952 if (p.extension() ==
".vtp") {
957 auto read_vtp(filesystem::path
const &path) ->
void
958 requires(NumDimensions == 2) || (NumDimensions == 3)
961 auto &poly_data = *reader.poly_data();
963 for (
auto const &piece : poly_data.pieces) {
964 piece.points.visit_data([&](
auto const &point_data) {
966 for (std::size_t i = 0; i < point_data.size(); i += 3) {
971 insert_vertex(point_data[i], point_data[i + 1], point_data[i + 2]);
975 for (
auto const &[name, prop] : piece.point_data) {
976 prop.visit_data([&]<
typename T>(std::vector<T>
const &data) {
978 if (prop.num_components() == 1) {
979 [[maybe_unused]]
auto &prop = vertex_property<T>(name);
980 for (std::size_t i = 0; i < data.size(); ++i, ++v) {
983 }
else if (prop.num_components() == 2) {
984 [[maybe_unused]]
auto &prop = vertex_property<vec<T, 2>>(name);
985 for (std::size_t i = 0; i < data.size(); i += 2, ++v) {
986 prop[v] =
vec{data[i], data[i + 1]};
988 }
else if (prop.num_components() == 3) {
989 auto &prop = vertex_property<vec<T, 3>>(name);
990 for (std::size_t i = 0; i < data.size(); i += 3, ++v) {
991 prop[v] =
vec{data[i], data[i + 1], data[i + 2]};
993 }
else if (prop.num_components() == 4) {
994 [[maybe_unused]]
auto &prop = vertex_property<vec<T, 4>>(name);
995 for (std::size_t i = 0; i < data.size(); i += 4, ++v) {
996 prop[v] =
vec{data[i], data[i + 1], data[i + 2], data[i + 3]};
1007#if TATOOINE_FLANN_AVAILABLE || defined(TATOOINE_DOC_ONLY)
1024 flann::Matrix<Real> dataset{
1027 m_kd_tree = std::make_unique<flann_index_type>(
1028 dataset, flann::KDTreeSingleIndexParams{});
1048 auto indices = std::vector<std::vector<int>>{};
1049 auto distances = std::vector<std::vector<Real>>{};
1050 auto params = flann::SearchParams{};
1051 h->knnSearch(qm, indices, distances, 1, params);
1053 vertex_handle{
static_cast<std::size_t
>(indices.front().front())},
1054 distances.front().front()};
1060 std::size_t
const num_nearest_neighbors,
1061 flann::SearchParams
const params = {})
const {
1064 return std::pair{std::vector<int>{}, std::vector<Real>{}};
1068 auto indices = std::vector<std::vector<int>>{};
1069 auto distances = std::vector<std::vector<Real>>{};
1070 h->knnSearch(qm, indices, distances, num_nearest_neighbors, params);
1071 return std::pair{std::move(indices.front()), std::move(distances.front())};
1075 std::size_t
const num_nearest_neighbors)
const {
1077 auto handles = std::pair{std::vector<vertex_handle>(
size(indices)),
1078 std::move(distances)};
1079 std::ranges::copy(indices | std::views::transform([](
auto const i) {
1082 begin(handles.first));
1089 flann::SearchParams
const params = {})
const
1090 -> std::pair<std::vector<int>, std::vector<Real>> {
1093 return std::pair{std::vector<int>{}, std::vector<Real>{}};
1095 flann::Matrix<Real> qm{
const_cast<Real *
>(x.
data()),
1097 std::vector<std::vector<int>> indices;
1098 std::vector<std::vector<Real>> distances;
1101 h->radiusSearch(qm, indices, distances,
static_cast<float>(radius),
1104 return {std::move(indices.front()), std::move(distances.front())};
1109 auto handles = std::pair{std::vector<vertex_handle>(
size(indices)),
1110 std::move(distances)};
1111 std::ranges::copy(indices | std::views::transform([](
auto const i) {
1114 begin(handles.first));
1121 template <
typename T>
1128#if TATOOINE_FLANN_AVAILABLE
1140 template <
typename T>
1144 requires(NumDimensions == 3 || NumDimensions == 2)
1148 *
this, prop, radius, std::forward<decltype(weighting)>(weighting)};
1162 template <
typename T>
1164 Real
const radius)
const
1165 requires(NumDimensions == 3 || NumDimensions == 2)
1171 return 1 - 6 * d * d + 8 * d * d * d - 3 * d * d * d * d;
1182#if TATOOINE_BLAS_AND_LAPACK_AVAILABLE
1190 template <
typename T>
1194 prop, [](
auto const sqr_dist) {
return gcem::sqrt(sqr_dist); });
1204 template <
typename T>
1208 return sqr_dist * gcem::sqrt(sqr_dist);
1219 template <
typename T>
1223 return std::exp(-(epsilon * epsilon * sqr_dist));
1233 template <
typename T>
1243 template <
typename T>
1247 *
this, prop, std::forward<decltype(f)>(f)};
1252 template <
typename T>
1263 template <
typename ValueType,
typename GradientType>
1268 *
this, values, gradients};
1273#if TATOOINE_CGAL_AVAILABLE
1275 template <
typename T>
1281 template <
typename T,
typename Gradient>
1287 *
this, prop, gradients};
1296template <std::
size_t NumDimensions>
1307#if TATOOINE_CGAL_AVAILABLE
1312#if TATOOINE_BLAS_AND_LAPACK_AVAILABLE
constexpr auto data() -> ValueType *
Definition: static_multidim_array.h:260
Definition: vtk_legacy.h:448
auto write_points(std::vector< std::array< Real, 2 > > const &points) -> void
Definition: vtk_legacy.h:637
auto write_vertices(std::vector< std::vector< std::size_t > > const &vertices) -> void
Definition: concepts.h:33
Definition: concepts.h:121
radial_basis_functions_sampler(tatooine::pointset< Real, NumDimensions > const &ps, typed_vector_property< typename tatooine::pointset< Real, NumDimensions >::vertex_handle, T >, Kernel &&kernel) -> radial_basis_functions_sampler< Real, NumDimensions, T, std::decay_t< Kernel > >
radial_basis_functions_sampler_with_gradients(tatooine::pointset< Real, NumDimensions > const &ps, typed_vector_property< typename tatooine::pointset< Real, NumDimensions >::vertex_handle, ValueType > const &, typed_vector_property< typename tatooine::pointset< Real, NumDimensions >::vertex_handle, GradientType > const &) -> radial_basis_functions_sampler_with_gradients< Real, NumDimensions, ValueType, GradientType >
static constexpr sequential_t sequential
Definition: tags.h:63
auto to_string(data_type const t) -> std::string_view
static auto constexpr to_data_type()
Definition: data_type.h:88
Definition: algorithm.h:6
VecF< 3 > vec3f
Definition: vec_typedefs.h:40
auto begin(Range &&range)
Definition: iterator_facade.h:318
typename value_type_impl< T >::type value_type
Definition: type_traits.h:280
auto end(Range &&range)
Definition: iterator_facade.h:322
auto constexpr thin_plate_spline_from_squared
Definition: thin_plate_spline.h:15
VecD< 3 > vec3d
Definition: vec_typedefs.h:51
axis_aligned_bounding_box< Real, NumDimensions > aabb
Definition: axis_aligned_bounding_box.h:553
VecD< 2 > vec2d
Definition: vec_typedefs.h:50
VecF< 4 > vec4f
Definition: vec_typedefs.h:41
constexpr auto approx_equal(T0 const &lhs, T1 const &rhs, common_type< tatooine::value_type< T0 >, tatooine::value_type< T1 > > eps=1e-6)
for comparison
Definition: tensor_utility.h:11
auto size(vec< ValueType, N > const &v)
Definition: vec.h:148
auto next(Iter iter)
Definition: iterator_facade.h:325
auto nan(const char *arg="")
Definition: nan.h:26
VecF< 2 > vec2f
Definition: vec_typedefs.h:39
Definition: axis_aligned_bounding_box.h:103
Definition: vertex_container.h:73
Definition: inverse_distance_weighting_sampler.h:10
Definition: moving_least_squares_samplerN.h:12
Definition: natural_neighbor_coordinates_sampler_with_gradients.h:19
Definition: natural_neighbor_coordinates_sampler.h:15
Definition: radial_basis_functions_sampler_with_gradients.h:100
Definition: radial_basis_functions_sampler.h:15
Definition: vertex_container.h:192
auto index() const
Definition: handle.h:64
constexpr handle()
Definition: handle.h:24
static constexpr auto invalid()
Definition: mesh.h:49
Definition: pointset.h:83
Definition: pointset.h:69
auto insert_vec2_vertex_property(std::string const &name, tatooine::vec2 const value=tatooine::vec2{}) -> auto &
Definition: pointset.h:605
auto vertex_properties() -> auto &
Definition: pointset.h:192
auto operator[](vertex_handle const v) -> auto &
Definition: pointset.h:223
auto operator=(pointset &&other) noexcept -> pointset &=default
auto mat2_vertex_property(std::string const &name) const -> auto const &
Definition: pointset.h:565
auto insert_vertex(pos_type const &v)
Definition: pointset.h:263
auto has_vertex_property(std::string const &name) const
Definition: pointset.h:194
auto build_kd_tree_index()
Definition: pointset.h:1013
auto scalar_vertex_property(std::string const &name) -> auto &
Definition: pointset.h:537
auto clear_vertices()
Definition: pointset.h:353
auto find_duplicates(Real eps=1e-6)
Definition: pointset.h:415
auto nearest_neighbors(pos_type const &x, std::size_t const num_nearest_neighbors) const
Definition: pointset.h:1074
auto insert_mat2_vertex_property(std::string const &name, tatooine::mat2 const value=tatooine::mat2{}) -> auto &
Definition: pointset.h:623
std::unique_ptr< flann_index_type > m_kd_tree
Definition: pointset.h:121
flann::Index< flann::L2< Real > > flann_index_type
Definition: pointset.h:80
auto write_vtp(filesystem::path const &path) const
Definition: pointset.h:720
pointset(std::initializer_list< pos_type > &&vertices)
Definition: pointset.h:129
auto scalar_vertex_property(std::string const &name) const -> auto const &
Definition: pointset.h:533
auto mat3_vertex_property(std::string const &name) -> auto &
Definition: pointset.h:577
auto insert_vertex_property(std::string const &name, T const &value=T{}) -> auto &
Definition: pointset.h:590
auto write_vtk(filesystem::path const &path, std::string const &title="Tatooine pointset") const -> void requires(NumDimensions==3||NumDimensions==2)
Definition: pointset.h:659
auto num_vertices() const
Definition: pointset.h:229
pointset< Real, NumDimensions > this_type
Definition: pointset.h:76
auto insert_vertex(arithmetic auto const ... ts)
Definition: pointset.h:243
auto nearest_neighbors_raw(pos_type const &x, std::size_t const num_nearest_neighbors, flann::SearchParams const params={}) const
Definition: pointset.h:1059
auto write_vertex_property_appended_data_vtp(auto const &prop, auto &file) const
Definition: pointset.h:918
auto operator=(pointset const &other) -> pointset &
Definition: pointset.h:168
auto vec4_vertex_property(std::string const &name) const -> auto const &
Definition: pointset.h:557
auto radial_basis_functions_sampler(typed_vertex_property_type< T > const &prop) const
Constructs a radial basis functions interpolator with thin plate spline kernel.
Definition: pointset.h:1253
auto moving_least_squares_sampler(typed_vertex_property_type< T > const &prop, Real const radius, invocable< real_type > auto &&weighting) const
Moving Least Squares Sampler.
Definition: pointset.h:1141
vertex_property_container_type m_vertex_properties
Definition: pointset.h:119
auto sample_to_vertex_property(F &&f, std::string const &name, execution_policy::sequential_t) -> auto &
Definition: pointset.h:369
auto vertices()
Definition: pointset.h:227
auto write(filesystem::path const &path) const
Definition: pointset.h:643
std::map< std::string, std::unique_ptr< vertex_property_type > > vertex_property_container_type
Definition: pointset.h:98
auto write_prop_vtk(vtk::legacy_file_writer &writer) const -> void
Definition: pointset.h:703
auto mat2_vertex_property(std::string const &name) -> auto &
Definition: pointset.h:569
auto at(vertex_handle const v) -> auto &
Definition: pointset.h:198
auto nearest_neighbors_radius_raw(pos_type const &x, Real const radius, flann::SearchParams const params={}) const -> std::pair< std::vector< int >, std::vector< Real > >
Definition: pointset.h:1088
auto radial_basis_functions_sampler_with_linear_kernel(typed_vertex_property_type< T > const &prop) const
Constructs a radial basis functions interpolator.
Definition: pointset.h:1191
auto vertex_property(std::string const &name) const -> const auto &
Definition: pointset.h:517
auto tidy_up()
tidies up invalid vertices
Definition: pointset.h:301
auto operator[](vertex_handle const v) const -> auto const &
Definition: pointset.h:224
auto at(vertex_handle const v) const -> auto const &
Definition: pointset.h:201
auto axis_aligned_bounding_box() const
Definition: pointset.h:183
auto mat3_vertex_property(std::string const &name) const -> auto const &
Definition: pointset.h:573
auto join(this_type const &other)
Definition: pointset.h:409
auto insert_scalar_vertex_property(std::string const &name, tatooine::real_number const value=tatooine::real_number{}) -> auto &
Definition: pointset.h:599
auto invalidate_kd_tree() const
Definition: pointset.h:1036
auto vertex_position_data() const -> auto const &
Definition: pointset.h:235
auto vec3_vertex_property(std::string const &name) const -> auto const &
Definition: pointset.h:549
auto read(filesystem::path const &p)
Definition: pointset.h:951
auto radial_basis_functions_sampler_with_gaussian_kernel(typed_vertex_property_type< T > const &prop, Real const epsilon) const
Constructs a radial basis functions interpolator.
Definition: pointset.h:1220
auto inverse_distance_weighting_sampler(typed_vertex_property_type< T > const &prop, Real const radius=1) const
Definition: pointset.h:1122
auto moving_least_squares_sampler(typed_vertex_property_type< T > const &prop, Real const radius) const
Moving Least Squares Sampler.
Definition: pointset.h:1163
auto radial_basis_functions_sampler(typed_vertex_property_type< T > const &prop, invocable< Real > auto &&f) const
Constructs a radial basis functions interpolator.
Definition: pointset.h:1244
auto vec2_vertex_property(std::string const &name) -> auto &
Definition: pointset.h:545
static constexpr auto num_dimensions() -> std::size_t
Definition: pointset.h:72
auto sample_to_vertex_property(F &&f, std::string const &name) -> auto &
Definition: pointset.h:363
auto write_vertex_property_data_array_vtp(auto const &name, auto const &prop, auto &file, auto offset) const -> std::size_t
Definition: pointset.h:880
auto radial_basis_functions_sampler_with_thin_plate_spline_kernel(typed_vertex_property_type< T > const &prop) const
Constructs a radial basis functions interpolator.
Definition: pointset.h:1234
auto insert_vertex(pos_type &&v)
Definition: pointset.h:281
pointset(pointset const &other)
Definition: pointset.h:147
auto nearest_neighbor(pos_type const &x) const
Definition: pointset.h:1041
auto invalid_vertices() const -> auto const &
Definition: pointset.h:239
std::set< vertex_handle > m_invalid_vertices
Definition: pointset.h:118
auto build_kd_tree() const -> auto &
Definition: pointset.h:1021
auto vertex_property(std::string const &name) -> auto &
using specified vertices of point_set
Definition: pointset.h:500
auto vec3_vertex_property(std::string const &name) -> auto &
Definition: pointset.h:553
pointset(std::vector< pos_type > &&vertices)
Definition: pointset.h:163
auto vertices() const
Definition: pointset.h:226
auto write_prop_vtk(vtk::legacy_file_writer &writer, std::string const &name, typed_vertex_property_type< T > const &prop) const -> void
Definition: pointset.h:697
vec< Real, NumDimensions > vec_type
Definition: pointset.h:77
std::mutex m_flann_mutex
Definition: pointset.h:122
auto radial_basis_functions_sampler(typed_vertex_property_type< ValueType > const &values, typed_vertex_property_type< GradientType > const &gradients) const
Constructs a radial basis functions interpolator that also takes the gradients of the property.
Definition: pointset.h:1264
constexpr auto is_valid(vertex_handle const v) const -> bool
Definition: pointset.h:347
auto natural_neighbor_coordinates_sampler(typed_vertex_property_type< T > const &prop) const
Definition: pointset.h:1276
auto clear()
Definition: pointset.h:360
Real real_type
Definition: pointset.h:75
auto vertex_at(vertex_handle const v) -> auto &
Definition: pointset.h:205
auto vec2_vertex_property(std::string const &name) const -> auto const &
Definition: pointset.h:541
auto nearest_neighbors_radius(pos_type const &x, Real const radius) const
Definition: pointset.h:1107
auto vertex_at(std::size_t const i) -> auto &
Definition: pointset.h:214
std::vector< pos_type > m_vertex_position_data
Definition: pointset.h:115
auto natural_neighbor_coordinates_sampler_with_gradients(typed_vertex_property_type< T > const &prop, typed_vertex_property_type< Gradient > const &gradients) const
Definition: pointset.h:1282
auto radial_basis_functions_sampler_with_cubic_kernel(typed_vertex_property_type< T > const &prop) const
Constructs a radial basis functions interpolator.
Definition: pointset.h:1205
auto vertex_at(vertex_handle const v) const -> auto const &
Definition: pointset.h:209
pointset(pointset &&other) noexcept
Definition: pointset.h:155
auto mat4_vertex_property(std::string const &name) -> auto &
Definition: pointset.h:585
pointset(filesystem::path const &path)
Definition: pointset.h:166
auto num_vertex_properties() const
Definition: pointset.h:233
auto insert_vec4_vertex_property(std::string const &name, tatooine::vec4 const value=tatooine::vec4{}) -> auto &
Definition: pointset.h:617
pointset(std::vector< pos_type > const &vertices)
Definition: pointset.h:160
auto insert_mat3_vertex_property(std::string const &name, tatooine::mat3 const value=tatooine::mat3{}) -> auto &
Definition: pointset.h:629
auto insert_mat4_vertex_property(std::string const &name, tatooine::mat4 const value=tatooine::mat4{}) -> auto &
Definition: pointset.h:635
auto insert_vec3_vertex_property(std::string const &name, tatooine::vec3 const value=tatooine::vec3{}) -> auto &
Definition: pointset.h:611
auto write_vertices_vtk(vtk::legacy_file_writer &writer) const
Definition: pointset.h:675
auto sample_to_vertex_property(F &&f, std::string const &name, execution_policy::parallel_t) -> auto &
Definition: pointset.h:389
auto read_vtp(filesystem::path const &path) -> void requires(NumDimensions==2)||(NumDimensions==3)
Definition: pointset.h:957
auto vertex_properties() const -> auto const &
Definition: pointset.h:191
auto vec4_vertex_property(std::string const &name) -> auto &
Definition: pointset.h:561
auto remove(vertex_handle const v)
Definition: pointset.h:332
auto mat4_vertex_property(std::string const &name) const -> auto const &
Definition: pointset.h:581
auto rebuild_kd_tree()
Definition: pointset.h:1009
auto vertex_at(std::size_t const i) const -> auto const &
Definition: pointset.h:218
Definition: property.h:66
Definition: property.h:16