Wildmeshing Toolkit
Loading...
Searching...
No Matches
VolumeMap.hpp
1#pragma once
2
3#include "SurfaceMap.hpp"
4
5#include <wmtk/history/VolumeHistory.hpp>
6
7#include <Eigen/Core>
8
9#include <limits>
10#include <map>
11#include <memory>
12#include <optional>
13#include <set>
14#include <string>
15#include <vector>
16
17namespace wmtk::components::tracking {
18
25{
26 static constexpr uint32_t kAnyRegion = uint32_t(-1);
27 Eigen::Vector3d position = Eigen::Vector3d::Constant(std::numeric_limits<double>::quiet_NaN());
28 uint32_t region = kAnyRegion;
29};
30
33{
36 size_t built = 0;
39 size_t failed = 0;
40 std::map<std::string, size_t> failures;
42 size_t real_pairs = 0, fallback_pairs = 0;
44 size_t decompositions = 0;
50 size_t surface_not_kept = 0;
56 size_t inverted_ops = 0;
60 size_t region_changed = 0, through_failed = 0;
63 size_t kept = 0, kept_bytes = 0;
64};
65
68{
72 size_t cache_bytes = size_t(256) << 20;
73};
74
95{
96public:
98 const history::SurfaceHistory& surface,
100 const VolumeMapOptions& options = {});
101 ~VolumeMap();
102 VolumeMap(VolumeMap&&) noexcept;
103
105 std::vector<VolumePoint> to_output(std::vector<VolumePoint> points) const;
107 std::vector<VolumePoint> to_input(std::vector<VolumePoint> points) const;
108
109 const history::VolumeHistory& history() const { return m_volume; }
111 std::optional<uint32_t> region_of(std::vector<int64_t> tags) const;
115 std::optional<uint32_t> region_of_groups(const std::set<std::string>& names) const;
116 const SurfaceMap& surface_map() const { return m_surface; }
118 VolumeMapStats stats() const;
120 void build_all() const;
123 std::vector<std::string> op_kinds(size_t k) const;
124
126 struct OpMap;
127 struct Faces;
128
129private:
130 std::vector<VolumePoint> map(std::vector<VolumePoint> points, bool forward) const;
133 std::shared_ptr<const OpMap> op(size_t k) const;
134
135 history::VolumeHistory m_volume;
136 VolumeMapOptions m_options;
137 SurfaceMap m_surface;
140 std::vector<std::unique_ptr<Faces>> m_faces;
141 std::vector<std::pair<Eigen::Vector3d, Eigen::Vector3d>> m_boxes;
144 Eigen::Vector3d m_grid_lo = Eigen::Vector3d::Zero(), m_grid_hi = Eigen::Vector3d::Zero();
145 double m_grid_cell = 1;
148 struct Shared;
149 std::unique_ptr<Shared> m_shared;
150};
151
152} // namespace wmtk::components::tracking
The map between the first and the last state of a SurfaceHistory.
Definition SurfaceMap.hpp:106
The map between the first and the last state of a tet mesh's volume, region by region,...
Definition VolumeMap.hpp:95
Eigen::Vector3d m_grid_lo
Definition VolumeMap.hpp:144
VolumeMapStats stats() const
What building and using the map found so far.
Definition VolumeMap.cpp:1488
std::optional< uint32_t > region_of(std::vector< int64_t > tags) const
The region of a tag set, if the history has it.
Definition VolumeMap.cpp:1382
void build_all() const
Builds every operation's map, for the stats.
Definition VolumeMap.cpp:1474
std::vector< std::unique_ptr< Faces > > m_faces
Definition VolumeMap.hpp:140
std::vector< VolumePoint > to_input(std::vector< VolumePoint > points) const
Points of the last state, mapped onto the first.
Definition VolumeMap.cpp:1502
std::vector< VolumePoint > to_output(std::vector< VolumePoint > points) const
Points of the first state, mapped onto the last.
Definition VolumeMap.cpp:1497
std::optional< uint32_t > region_of_groups(const std::set< std::string > &names) const
Definition VolumeMap.cpp:1392
std::shared_ptr< const OpMap > op(size_t k) const
Definition VolumeMap.cpp:1413
std::vector< std::string > op_kinds(size_t k) const
Definition VolumeMap.cpp:1479
One operation's map: patch pairs applied in turn, each to the points in its tets.
Definition VolumeMap.cpp:118
How a VolumeMap keeps what it builds.
Definition VolumeMap.hpp:68
size_t cache_bytes
Definition VolumeMap.hpp:72
What building and using a volume map found.
Definition VolumeMap.hpp:33
size_t failed
Definition VolumeMap.hpp:39
size_t kept
Definition VolumeMap.hpp:63
size_t inverted_ops
Definition VolumeMap.hpp:56
size_t built
Definition VolumeMap.hpp:36
size_t region_changed
Definition VolumeMap.hpp:60
size_t surface_not_kept
Definition VolumeMap.hpp:50
size_t real_pairs
Patch pairs mapped on their real geometry, and on a fallback embedding.
Definition VolumeMap.hpp:42
size_t decompositions
Collapses mapped through the decomposition that splits chords.
Definition VolumeMap.hpp:44
Definition VolumeMap.hpp:25
A complex and the edits it went through, in commit order.
Definition History.hpp:101
The tets around every operation that changed a tet mesh's tracked surface, which, with the surface hi...
Definition VolumeHistory.hpp:89