Wildmeshing Toolkit
Loading...
Searching...
No Matches
Classes | Typedefs | Enumerations | Functions | Variables
wmtk::history Namespace Reference

The history types by name, for headers that only hold them (History.hpp defines them). More...

Classes

class  BasicRecorder
 Collects the edits of operations that may commit concurrently. More...
 
class  BasicReplay
 A complex driven by the edits of a History: a surface (N = 3) or a curve network (N = 2). More...
 
struct  Edit
 One committed operation. More...
 
struct  History
 A complex and the edits it went through, in commit order. More...
 
struct  SurfaceKey
 
class  TrackedRecorder
 Records a tracked complex: some of the faces of a mesh, or some of its edges, which the mesh gives no ids of their own – the tracked faces of a tet mesh (N = 3), the tracked edges of a triangle mesh (N = 2). More...
 
struct  VertexMove
 
struct  VolumeCapture
 
struct  VolumeEdit
 One operation that changed the tracked surface of a tet mesh, as the tets around it saw it: the tets before and after, their regions, and where their vertices were. More...
 
struct  VolumeHistory
 The tets around every operation that changed a tet mesh's tracked surface, which, with the surface history, is what a map of the volume needs: every other operation leaves each region where it is in space. More...
 
class  VolumeRecorder
 Records a VolumeHistory alongside a TrackedSurfaceRecorder. An operation captures the tets around it before it changes the mesh and at its commit point (TetMesh does both), and commits them here with the range of surface edits its surface commit made; one that made none is not recorded. Commits may come concurrently: they are kept, encoded, in the order they come, and ordered by surface edit when read. The mesh's vertices get ids of their own here, which a consolidation (renumber) does not change, so a vertex's position is written again only when it moved. More...
 

Typedefs

using SurfaceHistory = History< 3 >
 A surface: faces are triangles.
 
using CurveHistory = History< 2 >
 A curve network: faces are segments.
 
using Recorder = BasicRecorder< 3 >
 
using CurveRecorder = BasicRecorder< 2 >
 
using Replay = BasicReplay< 3 >
 
using CurveReplay = BasicReplay< 2 >
 
using TrackedSurfaceRecorder = TrackedRecorder< 3 >
 
using TrackedCurveRecorder = TrackedRecorder< 2 >
 

Enumerations

enum class  EditKind : uint8_t {
  split_edge = 1 , split_face = 2 , collapse_edge = 3 , swap_edge = 4 ,
  move_vertices = 5 , consolidate = 6 , replace_faces = 7 , relabel = 8 ,
  embed = 9
}
 The kinds of edit a complex goes through. More...
 
enum class  VolumeOp : uint8_t {
  collapse = 0 , swap_32 = 1 , swap_44 = 2 , swap_56 = 3 ,
  swap_23 = 4 , smooth = 5
}
 The tet operations a volume history records.
 

Functions

template<int N>
bool append (History< N > &h, const History< N > &next)
 The history of a pipeline: h, then next, which starts where h ends – the same complex, ids and positions included (a mesh built from h's last state, recording from there). Appends next's edits. False, appending nothing, if next does not start there.
 
template<int N>
void append_embedded (History< N > &h, const History< N > &next, const std::vector< std::vector< uint64_t > > &sources)
 h, then next, which starts on a complex lying on h's last state: the same surface or curves, cut differently (an insertion into a tet mesh, an arrangement). Appends an embed edit onto next's first state – sources[f] the faces of h's last state that next's face f lies on, every one where they overlap – then next's edits. Every face and vertex of next's first state must be alive.
 
std::vector< uint8_t > read_history (const std::filesystem::path &path)
 The bytes of a history file, as History::from_bytes takes them – or VolumeHistory::from_bytes, for a volume history (volume_history_output): io::read_mesh for a history. Only the header is checked – that it is a history of a surface, of a curve network or of a volume, this build reads – not the rest, which loading checks.
 
void write_history (const std::filesystem::path &path, const std::vector< uint8_t > &bytes)
 
int face_size (const std::vector< uint8_t > &bytes)
 
int face_size (const std::string &path)
 
template bool append (History< 2 > &, const History< 2 > &)
 
template bool append (History< 3 > &, const History< 3 > &)
 
template void append_embedded (History< 2 > &, const History< 2 > &, const std::vector< std::vector< uint64_t > > &)
 
template void append_embedded (History< 3 > &, const History< 3 > &, const std::vector< std::vector< uint64_t > > &)
 
SurfaceHistory from_input (const io::ReadProvenance &read, const std::vector< Eigen::Vector3d > &welded, const SurfaceHistory &recorded)
 A surface application's history from its input file as read.
 
CurveHistory curves_from_input (const io::ReadProvenance &read, const MatrixXd &V_in, const MatrixXi &E_in, const std::vector< Edit > &collapses, const MatrixXd &V_out, const MatrixXi &E_out, const std::vector< int > &surviving_vertices)
 A curve application's history from its input files as read, to the network it inserts.
 
bool is_volume_history (const std::vector< uint8_t > &bytes, const std::string &name)
 
SurfaceKey surface_key (const SurfaceHistory &h)
 

Variables

constexpr uint64_t kNoVertex = uint64_t(-1)
 No vertex: in a relabel, the slot of one that goes.
 

Detailed Description

The history types by name, for headers that only hold them (History.hpp defines them).

Enumeration Type Documentation

◆ EditKind

enum class wmtk::history::EditKind : uint8_t
strong

The kinds of edit a complex goes through.

A complex is a surface, made of triangles, or a curve network, made of segments (see History); either way its cells are called faces here. Every kind is described on the complex alone – vertex and face ids, positions – never on the mesh class that performed it, so a tet mesh can report the changes to its tracked surface, and a triangle mesh the changes to its tracked curves, in the same terms as a TriMesh reports its own. The ids are the recording mesh's slots: a split names the slots it was handed, and a consolidation renumbers every live vertex and face by rank, as the meshes do.

Enumerator
split_edge 

v = {v0, v1, new_v}. faces = {f, new_f} for each face on the edge: f keeps the v0 half (v1 renamed to new_v in place) and new_f is f with v0 renamed to new_v. On a curve the face on the edge is the segment (v0, v1) itself, if it is one.

split_face 

Surfaces only. v = {v0, v1, v2, new_v}. faces = {f, new_f1, new_f2}: f with v0, new_f1 with v1 and new_f2 with v2 renamed to new_v, each in place.

collapse_edge 

v = {removed, kept}. Faces with both endpoints go; removed is renamed to kept elsewhere. Duplicate faces this leaves at kept merge into the smallest fid, and a vertex it leaves without faces is retired – unless, on a curve, it is a feature point.

swap_edge 

Surfaces only. v = {v0, v1, a, b}, faces = {fa, fb}: edge (v0,v1) becomes (a,b). In fa, which holds the apex b, v1 is renamed to a; in fb, which holds a, v0 is renamed to b.

move_vertices 

Only vertex positions change (smoothing, or a sweep outside any operation).

consolidate 

Live vertices and faces renumbered by rank, in id order.

replace_faces 

v = the corners of the faces it adds, a face's worth each; faces = the faces it removes, then the ones it adds, as many as v has faces. A change no other kind describes – a tracked surface re-derived, say – with no correspondence between what goes and what comes. A vertex it leaves without faces is retired, as by a collapse; one an added face names is alive, its position among the moves if it was not alive before.

relabel 

v = the new id of every vertex slot, kNoVertex for one that goes; faces = the new id of every face slot, kNoVertex for one that goes, or empty; moves = the position of every new vertex. Vertices are renamed in place in every face – several may become one – and a face left with a repeated corner goes; the faces that stay take the ids faces gives, or are renumbered by rank. Several faces given one id – duplicates a weld leaves – become one, with the first's corners. A weld of coincident vertices, a change of coordinates, a reordering: each face keeps its corners, so a point keeps its barycentric coordinates.

embed 

The complex is replaced by one lying on it – the same surface or curves, cut differently (an insertion into a tet mesh, an arrangement of segments). v = the corners of its faces, a face's worth each, in its own vertex ids from 0; faces = per face, how many faces before it lies on, then those, and after them its features, how many then their vertices; moves = the position of every vertex. A point stays where it is in space.

Function Documentation

◆ curves_from_input()

CurveHistory wmtk::history::curves_from_input ( const io::ReadProvenance &  read,
const MatrixXd &  V_in,
const MatrixXi &  E_in,
const std::vector< Edit > &  collapses,
const MatrixXd &  V_out,
const MatrixXi &  E_out,
const std::vector< int > &  surviving_vertices 
)

A curve application's history from its input files as read, to the network it inserts.

The files' segments, as io::read_edge_mesh read them; a relabel to the welded network the application ran on; the input simplification's collapses on that network; and a relabel onto the rows the simplification left. A user's point on the input is then a segment of the files themselves. The feature points are the welded network's vertices with other than two segments – curve ends, junctions, input points – each named by the first vertex of the files that became it.

Parameters
readthe files as read – the curve files' vertices and segments, then the point files' vertices – and where each went in V_in, E_in
V_in,E_inthe welded network (two or three columns; z is dropped)
collapsesutils::simplify_segments' collapses on V_in, E_in; empty if it did not run
V_out,E_outthe network the simplification left, the one inserted
surviving_verticesfor each row of V_out, its row of V_in
Exceptions
ifthe collapses do not leave E_out's segments

◆ face_size()

int wmtk::history::face_size ( const std::string &  path)

The number of corners of a face of the history saved at path, or held by bytes: 3 for a surface, 2 for a curve network. Throws if they hold no history, or a volume history.

◆ from_input()

SurfaceHistory wmtk::history::from_input ( const io::ReadProvenance &  read,
const std::vector< Eigen::Vector3d > &  welded,
const SurfaceHistory &  recorded 
)

A surface application's history from its input file as read.

The file's triangles, as io::read_triangle_mesh read them; a relabel to the welded mesh the application ran on; then the history the application's mesh recorded from it (TriMesh:: start_history right after create_mesh). A user's point on the input is then a triangle of the file itself. The recorded history's feature edges are taken back onto the file's vertices, where the relabel carries them over.

Parameters
readwhat read_triangle_mesh returned as provenance
weldedthe positions of the mesh it returned, the one the application ran on
recordedthe history recorded from that mesh
Exceptions
ifrecorded does not start at the welded mesh

◆ is_volume_history()

bool wmtk::history::is_volume_history ( const std::vector< uint8_t > &  bytes,
const std::string &  name = "the history given" 
)

Whether bytes are a volume history's, by their header – what read_history and write_history take as well as a surface's or curves' history. Throws, name in the message, for a volume history of a version this build does not read.

◆ surface_key()

SurfaceKey wmtk::history::surface_key ( const SurfaceHistory &  h)

The key of a surface history: its number of edits, and a hash of them and of the size of its snapshot – the same for a history and the one saved from it and loaded.

◆ write_history()

void wmtk::history::write_history ( const std::filesystem::path &  path,
const std::vector< uint8_t > &  bytes 
)

Writes the bytes of a history (History::to_bytes, VolumeHistory::to_bytes) to a file: io::write_mesh for a history. Refuses bytes whose header is not a history's.