4#include "SurfaceMap.hpp"
5#include "VolumeMap.hpp"
6#include "volume_io.hpp"
8#include <wmtk/history/History.hpp>
11#include <nlohmann/json.hpp>
12#include <wmtk/MeshData.hpp>
23namespace wmtk::components::tracking {
26constexpr uint64_t kNoId = std::numeric_limits<uint64_t>::max();
42 Eigen::Vector3d bary = Eigen::Vector3d::Constant(1. / 3);
45 std::array<uint64_t, 3>
vertices = {{kNoId, kNoId, kNoId}};
62 std::array<uint64_t, 3>
vertices = {{kNoId, kNoId, kNoId}};
63 Eigen::Vector3d bary = Eigen::Vector3d::Constant(1. / 3);
91 const std::vector<InputPoint>& points,
97 const std::vector<OutputPoint>& points,
110 const std::vector<std::array<uint64_t, 3>>&
input_faces()
const {
return m_map.input_faces(); }
111 const SurfaceMap& map()
const {
return m_map; }
118 std::vector<uint64_t> ids;
119 std::map<uint64_t, uint64_t> history_vertex;
125 const std::vector<std::array<uint64_t, 3>>& faces,
126 const std::map<std::array<uint64_t, 3>, uint64_t>& face_of,
127 const std::array<uint64_t, 3>& vertices,
128 const Eigen::Vector3d& bary);
131 const std::vector<std::array<uint64_t, 3>>& faces,
132 const std::vector<uint8_t>& alive);
134 static std::vector<std::array<uint64_t, 3>>
triangles(
136 const std::vector<std::array<uint64_t, 3>>& faces,
137 const std::vector<uint8_t>& alive);
153 uint64_t segment = kNoId;
154 Eigen::Vector2d bary = Eigen::Vector2d::Constant(0.5);
170 std::array<uint64_t, 2>
vertices = {{kNoId, kNoId}};
171 Eigen::Vector2d bary = Eigen::Vector2d::Constant(0.5);
179 uint64_t input_vertex = kNoId;
180 uint64_t output_vertex = kNoId;
206 const std::vector<InputCurvePoint>& points,
210 std::vector<InputCurvePoint>
to_input(
211 const std::vector<OutputCurvePoint>& points,
220 return m_map.input_segments();
224 const CurveMap& map()
const {
return m_map; }
235nlohmann::json warnings_report(
const MapWarnings& w);
245 uint64_t tet = kNoId;
246 Eigen::Vector4d bary = Eigen::Vector4d::Constant(0.25);
288 const std::string& surface_history,
289 const std::string& volume_history,
291 const std::string& output_mesh,
297 std::vector<TetPoint>
to_output(
const std::vector<TetPoint>& points)
const;
299 std::vector<TetPoint>
to_input(
const std::vector<TetPoint>& points)
const;
306 const std::vector<Eigen::Vector3d>& positions,
308 const std::vector<uint32_t>& regions = {})
const;
310 const VolumeMap& map()
const {
return *m_map; }
313 const TetMeshData& output_mesh()
const;
316 std::vector<TetPoint> map_points(
const std::vector<TetPoint>& points,
bool forward)
const;
319 std::shared_ptr<const VolumeMap> m_map;
320 std::optional<TetLocator> m_in, m_out;
325void tracking(nlohmann::json json_params);
339ComponentResult tracking(nlohmann::json json_params,
const MeshMap& meshes);
The map between the first and the last state of a CurveHistory.
Definition CurveMap.hpp:75
The map between a curve application's input curves and its output's, read from the tracking file the ...
Definition tracking.hpp:193
std::vector< InputCurvePoint > to_input(const std::vector< OutputCurvePoint > &points, CurveMapWarnings *warnings=nullptr) const
Definition tracking.cpp:223
std::map< uint64_t, uint64_t > m_history_vertex
Output vertex -> vertex of the last state.
Definition tracking.hpp:231
std::vector< uint64_t > m_output_ids
The output's id of each vertex of the history's last state; empty for a curve output.
Definition tracking.hpp:229
std::vector< std::array< uint64_t, 2 > > output_segments() const
Definition tracking.cpp:181
std::vector< OutputCurvePoint > to_output(const std::vector< InputCurvePoint > &points, CurveMapWarnings *warnings=nullptr) const
Definition tracking.cpp:196
static CurveTracking load(const std::string &path, const CurveMapOptions &options={})
The tracking file an application wrote.
Definition tracking.cpp:176
bool output_by_vertices() const
Definition tracking.hpp:201
std::vector< FeaturePoint > feature_points() const
The input's feature points and where each ended (see FeaturePoint).
Definition tracking.cpp:266
const std::vector< std::array< uint64_t, 2 > > & input_segments() const
The segments of the input files, in order, as the history holds them.
Definition tracking.hpp:218
The map between the first and the last state of a SurfaceHistory.
Definition SurfaceMap.hpp:106
The map between an application's input and its output, read from the tracking file the application wr...
Definition tracking.hpp:76
const std::vector< std::array< uint64_t, 3 > > & input_faces() const
The triangles of the input files, in order, as the history holds them.
Definition tracking.hpp:110
std::vector< std::array< uint64_t, 3 > > output_triangles() const
Definition tracking.cpp:90
std::map< std::array< uint64_t, 3 >, uint64_t > m_output_face_of
Definition tracking.hpp:145
static std::vector< std::array< uint64_t, 3 > > triangles(const Naming &naming, const std::vector< std::array< uint64_t, 3 > > &faces, const std::vector< uint8_t > &alive)
The live faces of a side, by the naming's vertex ids if it has them.
Definition tracking.cpp:46
static std::map< std::array< uint64_t, 3 >, uint64_t > faces_by_corners(const std::vector< std::array< uint64_t, 3 > > &faces, const std::vector< uint8_t > &alive)
The live faces by their sorted corners.
Definition tracking.cpp:32
bool output_by_vertices() const
Whether output points are named by vertex triplets (a tet output) rather than triangles.
Definition tracking.hpp:83
std::vector< OutputPoint > to_output(const std::vector< InputPoint > &points, MapWarnings *warnings=nullptr) const
Definition tracking.cpp:100
std::vector< InputPoint > to_input(const std::vector< OutputPoint > &points, MapWarnings *warnings=nullptr) const
Definition tracking.cpp:132
Naming m_output
Definition tracking.hpp:142
std::vector< std::array< uint64_t, 3 > > input_triangles() const
Definition tracking.cpp:95
static SurfacePoint by_vertices(const Naming &naming, const std::vector< std::array< uint64_t, 3 > > &faces, const std::map< std::array< uint64_t, 3 >, uint64_t > &face_of, const std::array< uint64_t, 3 > &vertices, const Eigen::Vector3d &bary)
Definition tracking.cpp:63
bool input_by_vertices() const
Definition tracking.hpp:86
static Tracking load(const std::string &path, const SurfaceMapOptions &options={})
The tracking file an application wrote.
Definition tracking.cpp:27
The map of a tet mesh's volume between the mesh its volume history starts from and the one it ends at...
Definition tracking.hpp:270
static VolumeTracking load(const std::string &surface_history, const std::string &volume_history, const std::string &input_mesh, const std::string &output_mesh, const VolumeMapOptions &options={})
The files an application wrote: the two histories and the two meshes.
Definition tracking.cpp:336
std::vector< TetPoint > to_input(const std::vector< TetPoint > &points) const
Points of the output mesh to the input mesh, the inverse map. Throws without the meshes.
Definition tracking.cpp:387
std::vector< TetPoint > to_output(const std::vector< TetPoint > &points) const
Points of the input mesh to the output mesh. Throws without the meshes.
Definition tracking.cpp:382
std::vector< VolumePoint > map_positions(const std::vector< Eigen::Vector3d > &positions, bool forward, const std::vector< uint32_t > ®ions={}) const
Definition tracking.cpp:363
const TetMeshData & input_mesh() const
The meshes; they throw without them.
Definition tracking.cpp:351
bool has_meshes() const
Whether it has the meshes, which TetPoints are of.
Definition tracking.hpp:295
Definition MeshData.hpp:48
How a CurveMap is built.
Definition CurveMap.hpp:49
Where a curve map stops being a bijection. Counted, never fatal: the map still answers.
Definition CurveMap.hpp:26
Definition tracking.hpp:178
Where a map stops being a bijection. Counted, never fatal: the map still answers.
Definition SurfaceMap.hpp:24
A point on an application's output curves.
Definition tracking.hpp:166
std::array< uint64_t, 2 > vertices
Triangle mesh outputs: the output's vertices at the ends of the tracked edge holding it.
Definition tracking.hpp:170
uint64_t segment
Curve outputs: the output segment.
Definition tracking.hpp:168
A point on an application's output surface.
Definition tracking.hpp:58
std::array< uint64_t, 3 > vertices
Tet outputs: the output's vertices at the corners of the tracked face holding the point.
Definition tracking.hpp:62
uint64_t face
Surface outputs: the output triangle.
Definition tracking.hpp:60
How a SurfaceMap is built.
Definition SurfaceMap.hpp:90
Definition SurfaceMap.hpp:17
Definition tracking.hpp:244
Definition tracking.hpp:117
How a VolumeMap keeps what it builds.
Definition VolumeMap.hpp:68
What building and using a volume map found.
Definition VolumeMap.hpp:33
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