Wildmeshing Toolkit
|
A Curiously Recurring Template Pattern shim to enable generic specialization of functions. More...
#include <MeshCRTP.hpp>
Public Member Functions | |
Derived & | derived () |
CRTP utility to extract the derived type of this. More... | |
const Derived & | derived () const |
CRTP utility to extract the derived type of this with constnesss. More... | |
Tuple | switch_tuple (const Tuple &tuple, PrimitiveType type) const override |
switch the orientation of the Tuple of the given dimension More... | |
template<typename ContainerType > | |
Tuple | switch_tuples (const Tuple &tuple, const ContainerType &op_sequence) const |
Performs a sequence of switch_tuple operations in the order specified in op_sequence. More... | |
Tuple | switch_tuples (const Tuple &tuple, const std::initializer_list< PrimitiveType > &op_sequence) const |
annoying initializer list prototype to catch switch_tuples(t, {PV,PE}) More... | |
bool | is_ccw (const Tuple &tuple) const override |
returns if a tuple is counterclockwise or not More... | |
bool | is_boundary (PrimitiveType pt, const Tuple &tuple) const override |
returns if a simplex is on the boundary of hte mesh. For anything but dimension - 1 this checks if this is the face of any boundary dimension-1 facet More... | |
template<typename T , int Dim = Eigen::Dynamic> | |
attribute::Accessor< T, Derived, Dim > | create_accessor (const TypedAttributeHandle< T > &handle) |
constructs an accessor that is aware of the derived mesh's type More... | |
template<typename T , int Dim = Eigen::Dynamic> | |
const attribute::Accessor< T, Derived, Dim > | create_const_accessor (const attribute::TypedAttributeHandle< T > &handle) const |
constructs a const accessor that is aware of the derived mesh's type More... | |
template<typename T , int Dim = Eigen::Dynamic> | |
attribute::Accessor< T, Derived, Dim > | create_accessor (const attribute::MeshAttributeHandle &handle) |
constructs a accessor that is aware of the derived mesh's type More... | |
template<typename T , int Dim = Eigen::Dynamic> | |
const attribute::Accessor< T, Derived, Dim > | create_const_accessor (const attribute::MeshAttributeHandle &handle) const |
constructs a const accessor that is aware of the derived mesh's type More... | |
Mesh (const int64_t &dimension) | |
Mesh (const int64_t &dimension, const int64_t &max_primitive_type_id, PrimitiveType hash_type) | |
Mesh (Mesh &&other) | |
Mesh (const Mesh &other)=delete | |
Public Member Functions inherited from wmtk::Mesh | |
int64_t | top_cell_dimension () const |
PrimitiveType | top_simplex_type () const |
bool | is_free () const |
std::map< std::string, const wmtk::utils::Hashable * > | child_hashables () const override |
std::map< std::string, std::size_t > | child_hashes () const override |
Mesh (const int64_t &dimension) | |
Mesh (const int64_t &dimension, const int64_t &max_primitive_type_id, PrimitiveType hash_type) | |
Mesh (Mesh &&other) | |
Mesh (const Mesh &other)=delete | |
Mesh & | operator= (const Mesh &other)=delete |
Mesh & | operator= (Mesh &&other) |
virtual | ~Mesh () |
void | serialize (MeshWriter &writer, const Mesh *local_root=nullptr) const |
std::vector< Tuple > | get_all (PrimitiveType type) const |
Generate a vector of Tuples from global vertex/edge/triangle/tetrahedron index. More... | |
std::vector< simplex::IdSimplex > | get_all_id_simplex (PrimitiveType type) const |
simplex::IdSimplex | get_id_simplex (const Tuple &tuple, PrimitiveType pt) const |
Retrieve the IdSimplex that is represented by the tuple and primitive type. More... | |
simplex::IdSimplex | get_id_simplex (const simplex::Simplex &s) const |
simplex::Simplex | get_simplex (const simplex::IdSimplex &s) const |
Convert an IdSimplex into a Simplex. More... | |
Tuple | get_tuple_from_id_simplex (const simplex::IdSimplex &s) const |
virtual std::tuple< std::vector< std::vector< int64_t > >, std::vector< std::vector< int64_t > > > | consolidate () |
Consolidate the attributes, moving all valid simplexes at the beginning of the corresponding vector. More... | |
virtual std::vector< std::vector< TypedAttributeHandle< int64_t > > > | connectivity_attributes () const =0 |
Returns a vector of vectors of attribute handles. More... | |
std::vector< attribute::MeshAttributeHandle::HandleVariant > | builtin_attributes () const |
std::vector< attribute::MeshAttributeHandle::HandleVariant > | custom_attributes () const |
template<typename T > | |
attribute::MeshAttributeHandle | register_attribute (const std::string &name, PrimitiveType type, int64_t size, bool replace=false, T default_value=T(0)) |
template<typename T > | |
attribute::TypedAttributeHandle< T > | register_attribute_typed (const std::string &name, PrimitiveType type, int64_t size, bool replace=false, T default_value=T(0)) |
template<typename T > | |
bool | has_attribute (const std::string &name, const PrimitiveType ptype) const |
template<typename T > | |
attribute::MeshAttributeHandle | get_attribute_handle (const std::string &name, const PrimitiveType ptype) const |
template<typename T > | |
attribute::TypedAttributeHandle< T > | get_attribute_handle_typed (const std::string &name, const PrimitiveType ptype) const |
template<typename T , int D = Eigen::Dynamic> | |
attribute::Accessor< T, Mesh, D > | create_accessor (const attribute::MeshAttributeHandle &handle) |
template<typename T , int D = Eigen::Dynamic> | |
const attribute::Accessor< T, Mesh, D > | create_const_accessor (const attribute::MeshAttributeHandle &handle) const |
template<typename T , int D = Eigen::Dynamic> | |
attribute::Accessor< T, Mesh, D > | create_accessor (const TypedAttributeHandle< T > &handle) |
template<typename T , int D = Eigen::Dynamic> | |
const attribute::Accessor< T, Mesh, D > | create_const_accessor (const TypedAttributeHandle< T > &handle) const |
template<typename T > | |
int64_t | get_attribute_dimension (const TypedAttributeHandle< T > &handle) const |
template<typename T > | |
const T & | get_attribute_default_value (const TypedAttributeHandle< T > &handle) const |
template<typename T > | |
std::string | get_attribute_name (const TypedAttributeHandle< T > &handle) const |
std::string | get_attribute_name (const attribute::MeshAttributeHandle::HandleVariant &handle) const |
void | clear_attributes (const std::vector< attribute::MeshAttributeHandle::HandleVariant > &keep_attributes) |
Remove all custom attributes besides the one passed in. More... | |
void | clear_attributes () |
void | clear_attributes (const std::vector< attribute::MeshAttributeHandle > &keep_attributes) |
void | delete_attribute (const attribute::MeshAttributeHandle &to_delete) |
void | delete_attribute (const attribute::MeshAttributeHandle::HandleVariant &to_delete) |
multimesh::attribute::AttributeScopeHandle | create_scope () |
template<typename Functor , typename... Args> | |
decltype(auto) | parent_scope (Functor &&f, Args &&... args) const |
Evaluate the passed in function inside the parent scope. More... | |
const attribute::Accessor< char > | get_flag_accessor (PrimitiveType type) const |
const attribute::Accessor< char > | get_const_flag_accessor (PrimitiveType type) const |
bool | operator== (const Mesh &other) const |
void | assert_capacity_valid () const |
virtual bool | is_connectivity_valid () const =0 |
virtual std::vector< Tuple > | orient_vertices (const Tuple &t) const =0 |
template<typename ContainerType > | |
Tuple | switch_tuples (const Tuple &tuple, const ContainerType &op_sequence) const |
Tuple | switch_tuples (const Tuple &tuple, const std::initializer_list< PrimitiveType > &op_sequence) const |
template<typename ContainerType > | |
Tuple | switch_tuples_unsafe (const Tuple &tuple, const ContainerType &op_sequence) const |
Tuple | switch_tuples_unsafe (const Tuple &tuple, const std::initializer_list< PrimitiveType > &op_sequence) const |
void | set_capacities_from_flags () |
int64_t | capacity (PrimitiveType type) const |
read in the m_capacities return the upper bound for the number of entities of the given dimension More... | |
bool | is_boundary (const simplex::Simplex &tuple) const |
check if a simplex lies on a boundary or not More... | |
bool | is_hash_valid (const Tuple &tuple, const attribute::Accessor< int64_t > &hash_accessor) const |
bool | is_hash_valid (const Tuple &tuple) const |
virtual bool | is_valid (const Tuple &tuple) const |
check validity of tuple including its hash More... | |
bool | is_removed (const Tuple &tuple) const |
bool | is_removed (const Tuple &tuple, PrimitiveType pt) const |
bool | is_valid (const simplex::Simplex &s) const |
Check if the cached id in a simplex is up-to-date. More... | |
bool | is_multi_mesh_root () const |
return true if this mesh is the root of a multimesh tree More... | |
Mesh & | get_multi_mesh_root () |
returns a reference to the root of a multimesh tree More... | |
const Mesh & | get_multi_mesh_root () const |
returns a const reference to the root of a multimesh tree More... | |
Mesh & | get_multi_mesh_mesh (const std::vector< int64_t > &absolute_id) |
const Mesh & | get_multi_mesh_mesh (const std::vector< int64_t > &absolute_id) const |
Mesh & | get_multi_mesh_child_mesh (const std::vector< int64_t > &relative_id) |
const Mesh & | get_multi_mesh_child_mesh (const std::vector< int64_t > &relative_id) const |
std::vector< std::shared_ptr< Mesh > > | get_child_meshes () const |
returns the direct multimesh child meshes for the current mesh More... | |
std::vector< std::shared_ptr< Mesh > > | get_all_child_meshes () const |
returns all multimesh child meshes More... | |
std::vector< std::shared_ptr< const Mesh > > | get_all_meshes () const |
returns all meshes in multimesh More... | |
std::vector< int64_t > | absolute_multi_mesh_id () const |
returns a unique identifier for this mesh within a single multimesh structure More... | |
void | register_child_mesh (const std::shared_ptr< Mesh > &child_mesh_ptr, const std::vector< std::array< Tuple, 2 >> &map_tuples) |
register a mesh as the child of this mesh More... | |
void | deregister_child_mesh (const std::shared_ptr< Mesh > &child_mesh_ptr) |
Deregister a child mesh. More... | |
std::vector< simplex::Simplex > | map (const Mesh &other_mesh, const simplex::Simplex &my_simplex) const |
maps a simplex from this mesh to any other mesh More... | |
std::vector< simplex::Simplex > | map (const Mesh &other_mesh, const std::vector< simplex::Simplex > &my_simplices) const |
std::vector< simplex::Simplex > | lub_map (const Mesh &other_mesh, const simplex::Simplex &my_simplex) const |
maps a simplex from this mesh to any other mesh using LUB mesh as root More... | |
std::vector< simplex::Simplex > | lub_map (const Mesh &other_mesh, const std::vector< simplex::Simplex > &my_simplices) const |
simplex::Simplex | map_to_parent (const simplex::Simplex &my_simplex) const |
optimized map from a simplex from this mesh to its direct parent More... | |
simplex::Simplex | map_to_root (const simplex::Simplex &my_simplex) const |
maps a simplex from this mesh to the root mesh More... | |
std::vector< simplex::Simplex > | map_to_child (const Mesh &child_mesh, const simplex::Simplex &my_simplex) const |
optimized map fromsimplex from this mesh to one of its direct children More... | |
std::vector< Tuple > | map_tuples (const Mesh &other_mesh, const simplex::Simplex &my_simplex) const |
maps a simplex from this mesh to any other mesh More... | |
std::vector< Tuple > | map_tuples (const Mesh &other_mesh, PrimitiveType pt, const std::vector< Tuple > &my_simplices) const |
std::vector< Tuple > | lub_map_tuples (const Mesh &other_mesh, const simplex::Simplex &my_simplex) const |
maps a simplex from this mesh to any other mesh using LUB mesh as root More... | |
std::vector< Tuple > | lub_map_tuples (const Mesh &other_mesh, PrimitiveType pt, const std::vector< Tuple > &my_simplices) const |
Tuple | map_to_parent_tuple (const simplex::Simplex &my_simplex) const |
optimized map from a simplex from this mesh to its direct parent More... | |
Tuple | map_to_root_tuple (const simplex::Simplex &my_simplex) const |
maps a simplex from this mesh to the root mesh More... | |
std::vector< Tuple > | map_to_child_tuples (const Mesh &child_mesh, const simplex::Simplex &my_simplex) const |
optimized map fromsimplex from this mesh to one of its direct children More... | |
bool | can_map (const Mesh &other_mesh, const simplex::Simplex &my_simplex) const |
void | update_vertex_operation_hashes (const Tuple &vertex, attribute::Accessor< int64_t > &hash_accessor) |
wrapper function to update hashes (for parent mesh *this and its child meshes) after vertex operations More... | |
bool | has_child_mesh_in_dimension (int64_t dimension) const |
returns if the mesh has a child mesh in the given dimension More... | |
bool | has_child_mesh () const |
bool | is_from_same_multi_mesh_structure (const Mesh &other) const |
template<typename T , int D> | |
auto | create_accessor (const TypedAttributeHandle< T > &handle) -> attribute::Accessor< T, Mesh, D > |
template<typename T , int D> | |
auto | create_const_accessor (const TypedAttributeHandle< T > &handle) const -> const attribute::Accessor< T, Mesh, D > |
template<typename T , int D> | |
auto | create_accessor (const attribute::MeshAttributeHandle &handle) -> attribute::Accessor< T, Mesh, D > |
template<typename T , int D> | |
auto | create_const_accessor (const attribute::MeshAttributeHandle &handle) const -> const attribute::Accessor< T, Mesh, D > |
Public Member Functions inherited from wmtk::utils::MerkleTreeInteriorNode | |
std::map< std::string, std::size_t > | child_hashes () const override |
Public Member Functions inherited from wmtk::utils::Hashable | |
Hashable () | |
Hashable (const Hashable &) | |
Hashable (Hashable &&) | |
Hashable & | operator= (const Hashable &) |
Hashable & | operator= (Hashable &&) |
virtual | ~Hashable () |
virtual std::size_t | hash () const |
Protected Member Functions | |
int64_t | id (const Tuple &tuple, PrimitiveType type) const |
Returns the id of a simplex encoded in a tuple. More... | |
int64_t | id_virtual (const Tuple &tuple, PrimitiveType type) const final override |
internal utility for overriding the mesh class's id function without having the final override block the derived class's override (we can't have Mesh::id be virtual, MeshCRTP<Derived>::id final override, and TriMesh::id. More... | |
int64_t | id (const simplex::Simplex &s) const final override |
variant of id that can cache internally held values More... | |
Tuple | tuple_from_id (const PrimitiveType type, const int64_t gid) const override |
internal function that returns the tuple of requested type, and has the global index cid More... | |
int64_t | id (const Tuple &tuple, PrimitiveType type) const |
return the global id of the Tuple of the given dimension More... | |
int64_t | id (const simplex::NavigatableSimplex &s) const |
int64_t | id (const simplex::IdSimplex &s) const |
virtual int64_t | id (const simplex::Simplex &s) const=0 |
Forwarding version of id on simplices that does id caching. More... | |
Protected Member Functions inherited from wmtk::Mesh | |
attribute::Accessor< char > | get_flag_accessor (PrimitiveType type) |
simplex::NavigatableSimplex | simplex_from_id (const PrimitiveType type, const int64_t gid) const |
std::vector< std::vector< int64_t > > | simplices_to_gids (const std::vector< std::vector< simplex::Simplex >> &simplices) const |
void | reserve_attributes_to_fit () |
reserve space for all attributes data types for all dimensional simplices More... | |
void | reserve_attributes (PrimitiveType type, int64_t size) |
void | reserve_attributes (int64_t dimension, int64_t size) |
void | set_capacities (std::vector< int64_t > capacities) |
void | reserve_more_attributes (PrimitiveType type, int64_t size) |
void | reserve_more_attributes (const std::vector< int64_t > &sizes) |
void | guarantee_more_attributes (PrimitiveType type, int64_t size) |
void | guarantee_more_attributes (const std::vector< int64_t > &sizes) |
void | guarantee_at_least_attributes (PrimitiveType type, int64_t size) |
void | guarantee_at_least_attributes (const std::vector< int64_t > &sizes) |
std::vector< int64_t > | request_simplex_indices (PrimitiveType type, int64_t count) |
bool | is_removed (int64_t index) const |
bool | is_removed (int64_t index, PrimitiveType pt) const |
attribute::AttributeScopeHandle | create_single_mesh_scope () |
int64_t | id (const Tuple &tuple, PrimitiveType type) const |
return the global id of the Tuple of the given dimension More... | |
int64_t | id (const simplex::NavigatableSimplex &s) const |
int64_t | id (const simplex::IdSimplex &s) const |
Friends | |
template<typename U , typename MeshType , int Dim> | |
class | attribute::Accessor |
template<int64_t cell_dimension, typename NodeFunctor > | |
class | multimesh::MultiMeshSimplexVisitor |
Additional Inherited Members | |
Static Protected Member Functions inherited from wmtk::Mesh | |
template<typename T , typename MeshType > | |
static auto & | get_index_access (attribute::Accessor< T, MeshType > &attr) |
template<typename T , typename MeshType > | |
static auto & | get_index_access (const attribute::Accessor< T, MeshType > &attr) |
Protected Attributes inherited from wmtk::Mesh | |
attribute::AttributeManager | m_attribute_manager |
multimesh::MultiMeshManager | m_multi_mesh_manager |
int64_t | m_top_cell_dimension = -1 |
bool | m_is_free = false |
A Curiously Recurring Template Pattern shim to enable generic specialization of functions.
CRTP allows us to shift from dynamic to static (inline-able) polymorphism for functions that are frequently called (like id and switch_tuple). It also allows us to create slightly different interfaces to return different types of accessors to take advantage of the static polymorphism.
Definition at line 23 of file MeshCRTP.hpp.
|
inline |
constructs a accessor that is aware of the derived mesh's type
Definition at line 82 of file MeshCRTP.hpp.
References wmtk::attribute::MeshAttributeHandle::as(), wmtk::attribute::MeshAttributeHandle::holds(), and wmtk::attribute::MeshAttributeHandle::mesh().
|
inline |
constructs an accessor that is aware of the derived mesh's type
Definition at line 67 of file MeshCRTP.hpp.
References wmtk::MeshCRTP< Derived >::derived().
Referenced by wmtk::components::internal::edge_insertion(), wmtk::operations::utils::UpdateEdgeOperationMultiMeshMapFunctor::operator()(), and wmtk::operations::utils::UpdateEdgeOperationMultiMeshMapFunctor::update_ear_replacement().
|
inline |
constructs a const accessor that is aware of the derived mesh's type
Definition at line 93 of file MeshCRTP.hpp.
References wmtk::attribute::MeshAttributeHandle::as(), wmtk::attribute::MeshAttributeHandle::holds(), and wmtk::attribute::MeshAttributeHandle::mesh().
|
inline |
constructs a const accessor that is aware of the derived mesh's type
Definition at line 74 of file MeshCRTP.hpp.
References wmtk::MeshCRTP< Derived >::derived().
Referenced by wmtk::SimplexInversionInvariant< T >::after(), wmtk::components::delaunay(), and wmtk::components::points_to_rowvectors().
|
inline |
CRTP utility to extract the derived type of this.
Definition at line 36 of file MeshCRTP.hpp.
Referenced by wmtk::MeshCRTP< Derived >::create_accessor(), wmtk::MeshCRTP< Derived >::create_const_accessor(), wmtk::MeshCRTP< Derived >::id(), wmtk::MeshCRTP< Derived >::is_boundary(), wmtk::MeshCRTP< Derived >::is_ccw(), wmtk::MeshCRTP< Derived >::switch_tuple(), and wmtk::MeshCRTP< Derived >::tuple_from_id().
|
inline |
CRTP utility to extract the derived type of this with constnesss.
Definition at line 38 of file MeshCRTP.hpp.
|
inlineprotected |
|
inlineprotected |
|
inlinefinaloverrideprotectedvirtual |
variant of id that can cache internally held values
Implements wmtk::Mesh.
Definition at line 112 of file MeshCRTP.hpp.
References wmtk::MeshCRTP< Derived >::id().
|
protected |
Forwarding version of id on simplices that does id caching.
|
inlineprotected |
Returns the id of a simplex encoded in a tuple.
Definition at line 103 of file MeshCRTP.hpp.
References wmtk::MeshCRTP< Derived >::derived().
|
inlineprotected |
return the global id of the Tuple of the given dimension
This function uses the implementation defined in a derived class (like a Tri/TetMesh) using a virtual function, but to enable more opportunities teh actual virtual function is id_virtual
m | |
type | d-0 -> vertex d-1 -> edge d-2 -> face d-3 -> tetrahedron |
Definition at line 810 of file Mesh.hpp.
Referenced by wmtk::MeshCRTP< Derived >::id(), and wmtk::MeshCRTP< Derived >::id_virtual().
|
inlinefinaloverrideprotectedvirtual |
internal utility for overriding the mesh class's id function without having the final override block the derived class's override (we can't have Mesh::id be virtual, MeshCRTP<Derived>::id final override, and TriMesh::id.
This indirection pushes the final override to this other function
Implements wmtk::Mesh.
Definition at line 106 of file MeshCRTP.hpp.
References wmtk::MeshCRTP< Derived >::id().
|
inlineoverridevirtual |
returns if a simplex is on the boundary of hte mesh. For anything but dimension - 1 this checks if this is the face of any boundary dimension-1 facet
Implements wmtk::Mesh.
Definition at line 60 of file MeshCRTP.hpp.
References wmtk::MeshCRTP< Derived >::derived().
|
inlineoverridevirtual |
returns if a tuple is counterclockwise or not
Implements wmtk::Mesh.
Definition at line 58 of file MeshCRTP.hpp.
References wmtk::MeshCRTP< Derived >::derived().
wmtk::Mesh::Mesh |
Definition at line 153 of file Mesh_construction.cpp.
wmtk::Mesh::Mesh |
Definition at line 155 of file Mesh_construction.cpp.
|
delete |
wmtk::Mesh::Mesh |
Definition at line 156 of file Mesh_construction.cpp.
|
inlineoverridevirtual |
switch the orientation of the Tuple of the given dimension
m | |
type | d-0 -> switch vertex d-1 -> switch edge d-2 -> switch face d-3 -> switch tetrahedron |
Implements wmtk::Mesh.
Definition at line 40 of file MeshCRTP.hpp.
References wmtk::MeshCRTP< Derived >::derived(), and wmtk::Mesh::top_simplex_type().
Tuple wmtk::MeshCRTP< Derived >::switch_tuples | ( | const Tuple & | tuple, |
const ContainerType & | op_sequence | ||
) | const |
Performs a sequence of switch_tuple operations in the order specified in op_sequence.
in debug mode this will assert a failure, in release this will return a null tuple
Definition at line 135 of file MeshCRTP.hpp.
Referenced by wmtk::SimplexInversionInvariant< T >::after(), wmtk::components::internal::edge_insertion(), wmtk::simplex::link(), wmtk::simplex::link_condition(), wmtk::simplex::link_single_dimension(), wmtk::TriMesh::TriMeshOperationExecutor::next_edge(), and wmtk::simplex::open_star().
Tuple wmtk::MeshCRTP< Derived >::switch_tuples | ( | const Tuple & | tuple, |
const std::initializer_list< PrimitiveType > & | op_sequence | ||
) | const |
annoying initializer list prototype to catch switch_tuples(t, {PV,PE})
Definition at line 158 of file MeshCRTP.hpp.
|
inlineoverrideprotectedvirtual |
internal function that returns the tuple of requested type, and has the global index cid
gid |
Implements wmtk::Mesh.
Definition at line 123 of file MeshCRTP.hpp.
References wmtk::MeshCRTP< Derived >::derived().
|
friend |
Definition at line 31 of file MeshCRTP.hpp.
|
friend |
Definition at line 33 of file MeshCRTP.hpp.