PolyFEM
Loading...
Searching...
No Matches
polyfem::mesh::WildRemesher< WMTKMesh > Class Template Referenceabstract

#include <WildRemesher.hpp>

Inheritance diagram for polyfem::mesh::WildRemesher< WMTKMesh >:
[legend]
Collaboration diagram for polyfem::mesh::WildRemesher< WMTKMesh >:
[legend]

Classes

struct  BoundaryAttributes
 
struct  EdgeAttributes
 
struct  ElementAttributes
 
struct  VertexAttributes
 

Public Types

using VectorNd = Eigen::Matrix< double, DIM, 1 >
 
using Tuple = typename WMTKMesh::Tuple
 
- Public Types inherited from polyfem::mesh::Remesher
template<typename T >
using EdgeMap = std::unordered_map< std::array< size_t, 2 >, T, polyfem::utils::HashUnorderedArray< size_t, 2 >, polyfem::utils::EqualUnorderedArray< size_t, 2 > >
 Map from a (sorted) edge to an integer (ID)
 
template<typename T >
using FaceMap = std::unordered_map< std::array< size_t, 3 >, T, polyfem::utils::HashUnorderedArray< size_t, 3 >, polyfem::utils::EqualUnorderedArray< size_t, 3 > >
 Map from a (sorted) edge to an integer (ID)
 
template<typename T >
using TetMap = std::unordered_map< std::array< size_t, 4 >, T, polyfem::utils::HashUnorderedArray< size_t, 4 >, polyfem::utils::EqualUnorderedArray< size_t, 4 > >
 
template<typename T >
using BoundaryMap = std::variant< EdgeMap< T >, FaceMap< T > >
 

Public Member Functions

 WildRemesher (const State &state, const Eigen::MatrixXd &obstacle_displacements, const Eigen::MatrixXd &obstacle_vals, const double current_time, const double starting_energy)
 Construct a new WildRemesher object.
 
virtual ~WildRemesher ()=default
 
virtual void init (const Eigen::MatrixXd &rest_positions, const Eigen::MatrixXd &positions, const Eigen::MatrixXi &elements, const Eigen::MatrixXd &projection_quantities, const BoundaryMap< int > &boundary_to_id, const std::vector< int > &body_ids, const EdgeMap< double > &elastic_energy, const EdgeMap< double > &contact_energy) override
 Initialize the mesh.
 
bool execute () override
 Execute the remeshing.
 
virtual void split_edges ()=0
 
virtual void collapse_edges ()=0
 
virtual void smooth_vertices ()
 
virtual void swap_edges ()
 
int dim () const override
 Dimension of the mesh.
 
Eigen::MatrixXd rest_positions () const override
 Exports rest positions of the stored mesh.
 
Eigen::MatrixXd displacements () const override
 Exports positions of the stored mesh.
 
Eigen::MatrixXd positions () const override
 Exports displacements of the stored mesh.
 
Eigen::MatrixXi edges () const override
 Exports edges of the stored mesh.
 
Eigen::MatrixXi elements () const override
 Exports elements of the stored mesh.
 
Eigen::MatrixXi boundary_edges () const override
 Exports boundary edges of the stored mesh.
 
Eigen::MatrixXi boundary_faces () const override
 Exports boundary faces of the stored mesh.
 
Eigen::MatrixXd projection_quantities () const override
 Exports projected quantities of the stored mesh.
 
BoundaryMap< int > boundary_ids () const override
 Exports boundary ids of the stored mesh.
 
std::vector< int > body_ids () const override
 Exports body ids of the stored mesh.
 
std::vector< int > boundary_nodes (const Eigen::VectorXi &vertex_to_basis) const override
 Get the boundary nodes of the stored mesh.
 
int n_quantities () const override
 Number of projection quantities (not including the position)
 
std::vector< Tupleget_facets () const
 Get a vector of all facets (edges or triangles)
 
std::vector< Tupleget_elements () const
 Get a vector of all elements (triangles or tetrahedra)
 
void set_rest_positions (const Eigen::MatrixXd &positions) override
 Set rest positions of the stored mesh.
 
void set_positions (const Eigen::MatrixXd &positions) override
 Set deformed positions of the stored mesh.
 
void set_projection_quantities (const Eigen::MatrixXd &projection_quantities) override
 Set projected quantities of the stored mesh.
 
void set_fixed (const std::vector< bool > &fixed) override
 Set if a vertex is fixed.
 
void set_boundary_ids (const BoundaryMap< int > &boundary_to_id) override
 Set the boundary IDs of all edges.
 
void set_body_ids (const std::vector< int > &body_ids) override
 Set the body IDs of all elements.
 
double rest_edge_length (const Tuple &e) const
 Compute the length of an edge.
 
double deformed_edge_length (const Tuple &e) const
 
VectorNd rest_edge_center (const Tuple &e) const
 Compute the center of the edge.
 
VectorNd deformed_edge_center (const Tuple &e) const
 
Eigen::VectorXd edge_adjacent_element_volumes (const Tuple &e) const
 
double element_volume (const Tuple &e) const
 Compute the volume (area) of an tetrahedron (triangle) element.
 
bool is_boundary_vertex (const Tuple &v) const
 Is the given vertex tuple on the boundary of the mesh?
 
bool is_body_boundary_vertex (const Tuple &v) const
 Is the given vertex tuple on the boundary of a body?
 
bool is_boundary_edge (const Tuple &e) const
 Is the given edge tuple on the boundary of the mesh?
 
bool is_body_boundary_edge (const Tuple &e) const
 Is the given edge tuple on the boundary of a body?
 
bool is_boundary_facet (const Tuple &t) const
 Is the given tuple on the boundary of the mesh?
 
bool is_boundary_op () const
 Is the currently cached operation a boundary operation?
 
std::vector< Tupleboundary_facets (std::vector< int > *boundary_ids=nullptr) const
 Get the boundary facets of the mesh.
 
std::array< Tuple, DIMfacet_vertices (const Tuple &t) const
 Get the vertex tuples of a facet.
 
std::array< size_t, DIMfacet_vids (const Tuple &t) const
 Get the vertex ids of a facet.
 
std::array< Tuple, VERTICES_PER_ELEMENTelement_vertices (const Tuple &t) const
 Get the vertex tuples of an element.
 
std::array< size_t, VERTICES_PER_ELEMENTelement_vids (const Tuple &t) const
 Get the vertex ids of an element.
 
void element_aabb (const Tuple &t, polyfem::VectorNd &el_min, polyfem::VectorNd &el_max) const
 Get a AABB for an element.
 
std::array< size_t, VERTICES_PER_ELEMENTorient_preserve_element_reorder (const std::array< size_t, VERTICES_PER_ELEMENT > &conn, const size_t v0) const
 Reorder the element vertices so that the first vertex is v0.
 
std::vector< Tupleget_one_ring_elements_for_vertex (const Tuple &t) const
 Get the one ring of elements around a vertex.
 
std::vector< Tupleget_one_ring_boundary_edges_for_vertex (const Tuple &v) const
 
std::array< Tuple, 2 > get_boundary_faces_for_edge (const Tuple &e) const
 
std::vector< Tupleget_one_ring_boundary_faces_for_vertex (const Tuple &v) const
 
std::vector< Tupleget_edges_for_elements (const std::vector< Tuple > &elements) const
 
size_t facet_id (const Tuple &t) const
 Get the id of a facet (edge for triangle, triangle for tetrahedra)
 
size_t element_id (const Tuple &t) const
 Get the id of an element (triangle or tetrahedra)
 
Tuple tuple_from_element (size_t elem_id) const
 Get a tuple of an element.
 
Tuple tuple_from_facet (size_t elem_id, int local_facet_id) const
 Get a tuple of an element with a local facet.
 
std::vector< Tupleget_incident_elements_for_edge (const Tuple &t) const
 Get the incident elements for an edge.
 
void extend_local_patch (std::vector< Tuple > &patch) const
 Extend the local patch by including neighboring elements.
 
Tuple opposite_vertex_on_face (const Tuple &e) const
 Get the opposite vertex on a face.
 
CollapseEdgeTo collapse_boundary_edge_to (const Tuple &e) const
 Determine where to collapse an edge to.
 
void write_edge_ranks_mesh (const EdgeMap< typename EdgeAttributes::EnergyRank > &elastic_ranks, const EdgeMap< typename EdgeAttributes::EnergyRank > &contact_ranks) const
 
EdgeAttributesedge_attr (const size_t e_id)
 Get a reference to an edge's attributes.
 
const EdgeAttributesedge_attr (const size_t e_id) const
 Get a const reference to an edge's attributes.
 
- Public Member Functions inherited from polyfem::mesh::Remesher
 Remesher (const State &state, const Eigen::MatrixXd &obstacle_displacements, const Eigen::MatrixXd &obstacle_quantities, const double current_time, const double starting_energy)
 Construct a new Remesher object.
 
virtual ~Remesher ()=default
 
virtual bool is_volume () const
 Is the mesh a volumetric mesh.
 
const Obstacleobstacle () const
 Get a reference to the collision obstacles.
 
const Eigen::MatrixXd & obstacle_displacements () const
 Get a reference to the collision obstacles' displacements.
 
const Eigen::MatrixXd & obstacle_quantities () const
 Get a reference to the collision obstacles' extra quantities.
 
void write_mesh (const std::string &path) const
 Writes a VTU mesh file.
 
void init_assembler (const std::vector< int > &body_ids) const
 Create an assembler object.
 

Public Attributes

wmtk::AttributeCollection< VertexAttributesvertex_attrs
 
wmtk::AttributeCollection< BoundaryAttributesboundary_attrs
 
wmtk::AttributeCollection< ElementAttributeselement_attrs
 
- Public Attributes inherited from polyfem::mesh::Remesher
const Statestate
 Reference to the simulation state.
 
int max_op_attempts = 1
 

Static Public Attributes

static constexpr int DIM
 
static constexpr int VERTICES_PER_ELEMENT
 
static constexpr int EDGES_PER_ELEMENT
 
static constexpr int FACETS_PER_ELEMENT
 
static constexpr wmtk::ExecutionPolicy EXECUTION_POLICY = wmtk::ExecutionPolicy::kSeq
 Current execuation policy (sequencial or parallel)
 
- Static Public Attributes inherited from polyfem::mesh::Remesher
static std::unordered_map< std::string, utils::Timingtimings
 Timings for the remeshing operations.
 
static double total_time = 0
 
static size_t num_solves = 0
 
static size_t total_ndofs = 0
 

Protected Types

using Operations = std::vector< std::pair< std::string, Tuple > >
 

Protected Member Functions

void init_attributes_and_connectivity (const size_t num_vertices, const Eigen::MatrixXi &elements) override
 Create an internal mesh representation and associate attributes.
 
virtual bool split_edge_before (const Tuple &t) override
 
virtual bool split_edge_after (const Tuple &t) override
 
virtual bool collapse_edge_before (const Tuple &t) override
 
virtual bool collapse_edge_after (const Tuple &t) override
 
virtual bool swap_edge_before (const Tuple &t) override
 
virtual bool swap_edge_after (const Tuple &t) override
 
virtual bool smooth_before (const Tuple &t) override
 
virtual bool smooth_after (const Tuple &t) override
 
bool invariants (const std::vector< Tuple > &new_tris) override
 Check if invariants are satisfied.
 
bool is_rest_inverted (const Tuple &loc) const
 Check if a triangle's rest shape is inverted.
 
bool is_inverted (const Tuple &loc) const
 Check if a triangle's rest and deformed shapes are inverted.
 
virtual Operations renew_neighbor_tuples (const std::string &op, const std::vector< Tuple > &tris) const
 
void cache_split_edge (const Tuple &e)
 Cache the split edge operation.
 
void cache_collapse_edge (const Tuple &e, const CollapseEdgeTo collapse_to)
 Cache the edge collapse operation.
 
void cache_swap_edge (const Tuple &e)
 Cache the edge swap operation.
 
void map_edge_split_edge_attributes (const Tuple &t)
 
void map_edge_split_boundary_attributes (const Tuple &t)
 
void map_edge_split_element_attributes (const Tuple &t)
 
void map_edge_collapse_vertex_attributes (const Tuple &t)
 
void map_edge_collapse_boundary_attributes (const Tuple &t)
 
void map_edge_collapse_edge_attributes (const Tuple &t)
 
void map_edge_swap_edge_attributes (const Tuple &t)
 
void map_edge_swap_element_attributes (const Tuple &t)
 
- Protected Member Functions inherited from polyfem::mesh::Remesher
void project_quantities ()
 Update the mesh positions and other projection quantities.
 
void cache_before ()
 Cache quantities before applying an operation.
 

Protected Attributes

wmtk::ExecutePass< WildRemesher, EXECUTION_POLICYexecutor
 
int m_n_quantities
 
double total_volume
 
std::conditional< std::is_same< WMTKMesh, wmtk::TriMesh >::value, std::shared_ptr< TriOperationCache >, std::shared_ptr< TetOperationCache > >::type op_cache
 
- Protected Attributes inherited from polyfem::mesh::Remesher
GlobalProjectionCache global_projection_cache
 
const json args
 Copy of remesh args.
 
const Eigen::MatrixXd m_obstacle_displacements
 Collision obstacles' displacements.
 
Eigen::MatrixXd m_obstacle_quantities
 Collision obstacles' extra quantities.
 
const double current_time
 Current time.
 
const double starting_energy
 Starting energy.
 

Private Types

using This = WildRemesher< WMTKMesh >
 

Private Attributes

wmtk::AttributeCollection< EdgeAttributesedge_attrs
 

Additional Inherited Members

- Static Public Member Functions inherited from polyfem::mesh::Remesher
static Eigen::MatrixXd combine_time_integrator_quantities (const std::shared_ptr< time_integrator::ImplicitTimeIntegrator > &time_integrator)
 Combine the quantities of a time integrator into a single matrix (one column per quantity)
 
static void split_time_integrator_quantities (const Eigen::MatrixXd &quantities, const int dim, Eigen::MatrixXd &x_prevs, Eigen::MatrixXd &v_prevs, Eigen::MatrixXd &a_prevs)
 Split the quantities of a time integrator into separate vectors.
 
static int build_bases (const Mesh &mesh, const std::string &assembler_formulation, std::vector< polyfem::basis::ElementBases > &bases, std::vector< LocalBoundary > &local_boundary, Eigen::VectorXi &vertex_to_basis)
 Build bases for a given mesh (V, F)
 
static void log_timings ()
 

Detailed Description

template<class WMTKMesh>
class polyfem::mesh::WildRemesher< WMTKMesh >

Definition at line 26 of file WildRemesher.hpp.

Member Typedef Documentation

◆ Operations

template<class WMTKMesh >
using polyfem::mesh::WildRemesher< WMTKMesh >::Operations = std::vector<std::pair<std::string, Tuple> >
protected

Definition at line 292 of file WildRemesher.hpp.

◆ This

template<class WMTKMesh >
using polyfem::mesh::WildRemesher< WMTKMesh >::This = WildRemesher<WMTKMesh>
private

Definition at line 28 of file WildRemesher.hpp.

◆ Tuple

template<class WMTKMesh >
using polyfem::mesh::WildRemesher< WMTKMesh >::Tuple = typename WMTKMesh::Tuple

Definition at line 64 of file WildRemesher.hpp.

◆ VectorNd

template<class WMTKMesh >
using polyfem::mesh::WildRemesher< WMTKMesh >::VectorNd = Eigen::Matrix<double, DIM, 1>

Definition at line 62 of file WildRemesher.hpp.

Constructor & Destructor Documentation

◆ WildRemesher()

template<class WMTKMesh >
polyfem::mesh::WildRemesher< WMTKMesh >::WildRemesher ( const State state,
const Eigen::MatrixXd &  obstacle_displacements,
const Eigen::MatrixXd &  obstacle_vals,
const double  current_time,
const double  starting_energy 
)

Construct a new WildRemesher object.

Parameters
stateSimulation current state

Definition at line 34 of file WildRemesher.cpp.

◆ ~WildRemesher()

template<class WMTKMesh >
virtual polyfem::mesh::WildRemesher< WMTKMesh >::~WildRemesher ( )
virtualdefault

Member Function Documentation

◆ body_ids()

template<class WMTKMesh >
std::vector< int > polyfem::mesh::WildRemesher< WMTKMesh >::body_ids ( ) const
overridevirtual

Exports body ids of the stored mesh.

Implements polyfem::mesh::Remesher.

Definition at line 196 of file WildRemesher.cpp.

◆ boundary_edges()

template<class WMTKMesh >
Eigen::MatrixXi polyfem::mesh::WildRemesher< WMTKMesh >::boundary_edges ( ) const
overridevirtual

Exports boundary edges of the stored mesh.

Implements polyfem::mesh::Remesher.

◆ boundary_faces()

template<class WMTKMesh >
Eigen::MatrixXi polyfem::mesh::WildRemesher< WMTKMesh >::boundary_faces ( ) const
overridevirtual

Exports boundary faces of the stored mesh.

Implements polyfem::mesh::Remesher.

◆ boundary_facets()

template<class WMTKMesh >
std::vector< typename WMTKMesh::Tuple > polyfem::mesh::WildRemesher< WMTKMesh >::boundary_facets ( std::vector< int > *  boundary_ids = nullptr) const

Get the boundary facets of the mesh.

Definition at line 245 of file WildRemesher.cpp.

References POLYFEM_REMESHER_SCOPED_TIMER.

◆ boundary_ids()

template<class WMTKMesh >
BoundaryMap< int > polyfem::mesh::WildRemesher< WMTKMesh >::boundary_ids ( ) const
overridevirtual

Exports boundary ids of the stored mesh.

Implements polyfem::mesh::Remesher.

◆ boundary_nodes()

template<class WMTKMesh >
std::vector< int > polyfem::mesh::WildRemesher< WMTKMesh >::boundary_nodes ( const Eigen::VectorXi &  vertex_to_basis) const
overridevirtual

Get the boundary nodes of the stored mesh.

Implements polyfem::mesh::Remesher.

Definition at line 208 of file WildRemesher.cpp.

◆ cache_collapse_edge()

template<class WMTKMesh >
void polyfem::mesh::WildRemesher< WMTKMesh >::cache_collapse_edge ( const Tuple e,
const CollapseEdgeTo  collapse_to 
)
protected

Cache the edge collapse operation.

Parameters
eedge tuple
collapse_tocollapse to which vertex

Definition at line 11 of file Collapse.cpp.

◆ cache_split_edge()

template<class WMTKMesh >
void polyfem::mesh::WildRemesher< WMTKMesh >::cache_split_edge ( const Tuple e)
protected

Cache the split edge operation.

Parameters
eedge tuple

Definition at line 6 of file Split.cpp.

◆ cache_swap_edge()

template<class WMTKMesh >
void polyfem::mesh::WildRemesher< WMTKMesh >::cache_swap_edge ( const Tuple e)
protected

Cache the edge swap operation.

Parameters
eedge tuple

Definition at line 8 of file Swap.cpp.

References polyfem::mesh::TetOperationCache::swap_32(), and polyfem::mesh::TriOperationCache::swap_edge().

Here is the call graph for this function:

◆ collapse_boundary_edge_to()

template<class WMTKMesh >
CollapseEdgeTo polyfem::mesh::WildRemesher< WMTKMesh >::collapse_boundary_edge_to ( const Tuple e) const

Determine where to collapse an edge to.

Parameters
eedge tuple
Returns
Enumeration of possible collapse locations

◆ collapse_edge_after()

template<class WMTKMesh >
bool polyfem::mesh::WildRemesher< WMTKMesh >::collapse_edge_after ( const Tuple t)
overrideprotectedvirtual

◆ collapse_edge_before()

template<class WMTKMesh >
bool polyfem::mesh::WildRemesher< WMTKMesh >::collapse_edge_before ( const Tuple t)
overrideprotectedvirtual

Reimplemented in polyfem::mesh::PhysicsRemesher< WMTKMesh >, polyfem::mesh::PhysicsRemesher< wmtk::TetMesh >, and polyfem::mesh::PhysicsRemesher< wmtk::TriMesh >.

Definition at line 18 of file Collapse.cpp.

References polyfem::mesh::ILLEGAL, and polyfem::mesh::max_edge_length().

Here is the call graph for this function:

◆ collapse_edges()

◆ deformed_edge_center()

template<class WMTKMesh >
WildRemesher< WMTKMesh >::VectorNd polyfem::mesh::WildRemesher< WMTKMesh >::deformed_edge_center ( const Tuple e) const

Definition at line 417 of file WildRemesher.cpp.

◆ deformed_edge_length()

template<class WMTKMesh >
double polyfem::mesh::WildRemesher< WMTKMesh >::deformed_edge_length ( const Tuple e) const

Definition at line 399 of file WildRemesher.cpp.

◆ dim()

template<class WMTKMesh >
int polyfem::mesh::WildRemesher< WMTKMesh >::dim ( ) const
inlineoverridevirtual

Dimension of the mesh.

Implements polyfem::mesh::Remesher.

Definition at line 152 of file WildRemesher.hpp.

References polyfem::mesh::WildRemesher< WMTKMesh >::DIM.

Referenced by polyfem::mesh::PhysicsRemesher< wmtk::TetMesh >::smooth_after().

Here is the caller graph for this function:

◆ displacements()

template<class WMTKMesh >
Eigen::MatrixXd polyfem::mesh::WildRemesher< WMTKMesh >::displacements ( ) const
overridevirtual

Exports positions of the stored mesh.

Implements polyfem::mesh::Remesher.

◆ edge_adjacent_element_volumes()

template<class WMTKMesh >
Eigen::VectorXd polyfem::mesh::WildRemesher< WMTKMesh >::edge_adjacent_element_volumes ( const Tuple e) const

Definition at line 437 of file WildRemesher.cpp.

◆ edge_attr() [1/2]

template<class WMTKMesh >
EdgeAttributes & polyfem::mesh::WildRemesher< WMTKMesh >::edge_attr ( const size_t  e_id)

Get a reference to an edge's attributes.

Parameters
e_idedge id
Returns
reference to the edge's attributes

Referenced by polyfem::mesh::PhysicsTriRemesher::swap_edge_before().

Here is the caller graph for this function:

◆ edge_attr() [2/2]

template<class WMTKMesh >
const EdgeAttributes & polyfem::mesh::WildRemesher< WMTKMesh >::edge_attr ( const size_t  e_id) const

Get a const reference to an edge's attributes.

Parameters
e_idedge id
Returns
const reference to the edge's attributes

◆ edges()

template<class WMTKMesh >
Eigen::MatrixXi polyfem::mesh::WildRemesher< WMTKMesh >::edges ( ) const
overridevirtual

Exports edges of the stored mesh.

Implements polyfem::mesh::Remesher.

Definition at line 150 of file WildRemesher.cpp.

◆ element_aabb()

template<class WMTKMesh >
void polyfem::mesh::WildRemesher< WMTKMesh >::element_aabb ( const Tuple t,
polyfem::VectorNd el_min,
polyfem::VectorNd el_max 
) const

Get a AABB for an element.

Definition at line 490 of file WildRemesher.cpp.

◆ element_id()

template<class WMTKMesh >
size_t polyfem::mesh::WildRemesher< WMTKMesh >::element_id ( const Tuple t) const

Get the id of an element (triangle or tetrahedra)

◆ element_vertices()

template<class WMTKMesh >
std::array< Tuple, VERTICES_PER_ELEMENT > polyfem::mesh::WildRemesher< WMTKMesh >::element_vertices ( const Tuple t) const

Get the vertex tuples of an element.

◆ element_vids()

template<class WMTKMesh >
std::array< size_t, VERTICES_PER_ELEMENT > polyfem::mesh::WildRemesher< WMTKMesh >::element_vids ( const Tuple t) const

Get the vertex ids of an element.

Referenced by polyfem::mesh::get_quality().

Here is the caller graph for this function:

◆ element_volume()

template<class WMTKMesh >
double polyfem::mesh::WildRemesher< WMTKMesh >::element_volume ( const Tuple e) const

Compute the volume (area) of an tetrahedron (triangle) element.

Referenced by polyfem::mesh::compute_area_ratio_energy().

Here is the caller graph for this function:

◆ elements()

template<class WMTKMesh >
Eigen::MatrixXi polyfem::mesh::WildRemesher< WMTKMesh >::elements ( ) const
overridevirtual

Exports elements of the stored mesh.

Implements polyfem::mesh::Remesher.

Definition at line 164 of file WildRemesher.cpp.

References polyfem::F.

◆ execute()

template<class WMTKMesh >
bool polyfem::mesh::WildRemesher< WMTKMesh >::execute ( )
overridevirtual

Execute the remeshing.

Parameters
splitPerform splitting operations
collapsePerform collapsing operations
smoothPerform smoothing operations
swapPerform edge swapping operations
max_opsMaximum number of operations to perform (default: unlimited)
Returns
True if any operation was performed.

Implements polyfem::mesh::Remesher.

Definition at line 13 of file Execute.cpp.

References polyfem::logger(), polyfem::mesh::WildRemesher< WMTKMesh >::renew_neighbor_tuples(), and polyfem::utils::Timer::start().

Here is the call graph for this function:

◆ extend_local_patch()

template<class WMTKMesh >
void polyfem::mesh::WildRemesher< WMTKMesh >::extend_local_patch ( std::vector< Tuple > &  patch) const

Extend the local patch by including neighboring elements.

Parameters
patchlocal patch of elements

Definition at line 461 of file WildRemesher.cpp.

◆ facet_id()

template<class WMTKMesh >
size_t polyfem::mesh::WildRemesher< WMTKMesh >::facet_id ( const Tuple t) const

Get the id of a facet (edge for triangle, triangle for tetrahedra)

◆ facet_vertices()

template<class WMTKMesh >
std::array< Tuple, DIM > polyfem::mesh::WildRemesher< WMTKMesh >::facet_vertices ( const Tuple t) const

Get the vertex tuples of a facet.

◆ facet_vids()

template<class WMTKMesh >
std::array< size_t, DIM > polyfem::mesh::WildRemesher< WMTKMesh >::facet_vids ( const Tuple t) const

Get the vertex ids of a facet.

◆ get_boundary_faces_for_edge()

template<class WMTKMesh >
std::array< Tuple, 2 > polyfem::mesh::WildRemesher< WMTKMesh >::get_boundary_faces_for_edge ( const Tuple e) const

◆ get_edges_for_elements()

template<class WMTKMesh >
std::vector< typename WMTKMesh::Tuple > polyfem::mesh::WildRemesher< WMTKMesh >::get_edges_for_elements ( const std::vector< Tuple > &  elements) const

Definition at line 425 of file WildRemesher.cpp.

Referenced by polyfem::mesh::PhysicsRemesher< WMTKMesh >::collapse_edges().

Here is the caller graph for this function:

◆ get_elements()

template<class WMTKMesh >
std::vector< Tuple > polyfem::mesh::WildRemesher< WMTKMesh >::get_elements ( ) const

Get a vector of all elements (triangles or tetrahedra)

◆ get_facets()

template<class WMTKMesh >
std::vector< Tuple > polyfem::mesh::WildRemesher< WMTKMesh >::get_facets ( ) const

Get a vector of all facets (edges or triangles)

◆ get_incident_elements_for_edge()

template<class WMTKMesh >
std::vector< Tuple > polyfem::mesh::WildRemesher< WMTKMesh >::get_incident_elements_for_edge ( const Tuple t) const

Get the incident elements for an edge.

◆ get_one_ring_boundary_edges_for_vertex()

template<class WMTKMesh >
std::vector< Tuple > polyfem::mesh::WildRemesher< WMTKMesh >::get_one_ring_boundary_edges_for_vertex ( const Tuple v) const

◆ get_one_ring_boundary_faces_for_vertex()

template<class WMTKMesh >
std::vector< Tuple > polyfem::mesh::WildRemesher< WMTKMesh >::get_one_ring_boundary_faces_for_vertex ( const Tuple v) const

◆ get_one_ring_elements_for_vertex()

template<class WMTKMesh >
std::vector< Tuple > polyfem::mesh::WildRemesher< WMTKMesh >::get_one_ring_elements_for_vertex ( const Tuple t) const

Get the one ring of elements around a vertex.

Referenced by polyfem::mesh::PhysicsRemesher< WMTKMesh >::collapse_edges(), and polyfem::mesh::WildRemesher< WMTKMesh >::smooth_vertices().

Here is the caller graph for this function:

◆ init()

template<class WMTKMesh >
void polyfem::mesh::WildRemesher< WMTKMesh >::init ( const Eigen::MatrixXd &  rest_positions,
const Eigen::MatrixXd &  positions,
const Eigen::MatrixXi &  elements,
const Eigen::MatrixXd &  projection_quantities,
const BoundaryMap< int > &  boundary_to_id,
const std::vector< int > &  body_ids,
const EdgeMap< double > &  elastic_energy,
const EdgeMap< double > &  contact_energy 
)
overridevirtual

Initialize the mesh.

Parameters
rest_positionsRest positions of the mesh (|V| × 2)
positionsCurrent positions of the mesh (|V| × 2)
elementsElements of the mesh (|T| × 3)
projection_quantitiesQuantities to be projected to the new mesh (2 rows per vertex and 1 column per quantity)
edge_to_boundary_idMap from edge to boundary id (of size |E|)
body_idsBody ids of the mesh (of size |T|)

Reimplemented from polyfem::mesh::Remesher.

Definition at line 92 of file WildRemesher.cpp.

References polyfem::mesh::Remesher::init().

Here is the call graph for this function:

◆ init_attributes_and_connectivity()

template<class WMTKMesh >
void polyfem::mesh::WildRemesher< WMTKMesh >::init_attributes_and_connectivity ( const size_t  num_vertices,
const Eigen::MatrixXi &  elements 
)
overrideprotectedvirtual

Create an internal mesh representation and associate attributes.

Implements polyfem::mesh::Remesher.

◆ invariants()

template<class WMTKMesh >
bool polyfem::mesh::WildRemesher< WMTKMesh >::invariants ( const std::vector< Tuple > &  new_tris)
overrideprotected

Check if invariants are satisfied.

Definition at line 370 of file WildRemesher.cpp.

References polyfem::log_and_throw_error(), and POLYFEM_REMESHER_SCOPED_TIMER.

Here is the call graph for this function:

◆ is_body_boundary_edge()

template<class WMTKMesh >
bool polyfem::mesh::WildRemesher< WMTKMesh >::is_body_boundary_edge ( const Tuple e) const

Is the given edge tuple on the boundary of a body?

◆ is_body_boundary_vertex()

template<class WMTKMesh >
bool polyfem::mesh::WildRemesher< WMTKMesh >::is_body_boundary_vertex ( const Tuple v) const

Is the given vertex tuple on the boundary of a body?

◆ is_boundary_edge()

template<class WMTKMesh >
bool polyfem::mesh::WildRemesher< WMTKMesh >::is_boundary_edge ( const Tuple e) const

Is the given edge tuple on the boundary of the mesh?

Referenced by polyfem::mesh::TetOperationCache::collapse_edge(), polyfem::mesh::TriOperationCache::collapse_edge(), polyfem::mesh::TetOperationCache::split_edge(), polyfem::mesh::TriOperationCache::split_edge(), and polyfem::mesh::TriOperationCache::swap_edge().

Here is the caller graph for this function:

◆ is_boundary_facet()

template<class WMTKMesh >
bool polyfem::mesh::WildRemesher< WMTKMesh >::is_boundary_facet ( const Tuple t) const

Is the given tuple on the boundary of the mesh?

◆ is_boundary_op()

template<class WMTKMesh >
bool polyfem::mesh::WildRemesher< WMTKMesh >::is_boundary_op ( ) const

Is the currently cached operation a boundary operation?

◆ is_boundary_vertex()

template<class WMTKMesh >
bool polyfem::mesh::WildRemesher< WMTKMesh >::is_boundary_vertex ( const Tuple v) const

Is the given vertex tuple on the boundary of the mesh?

Referenced by polyfem::mesh::compute_valence_energy().

Here is the caller graph for this function:

◆ is_inverted()

template<class WMTKMesh >
bool polyfem::mesh::WildRemesher< WMTKMesh >::is_inverted ( const Tuple loc) const
protected

Check if a triangle's rest and deformed shapes are inverted.

◆ is_rest_inverted()

template<class WMTKMesh >
bool polyfem::mesh::WildRemesher< WMTKMesh >::is_rest_inverted ( const Tuple loc) const
protected

Check if a triangle's rest shape is inverted.

◆ map_edge_collapse_boundary_attributes()

template<class WMTKMesh >
void polyfem::mesh::WildRemesher< WMTKMesh >::map_edge_collapse_boundary_attributes ( const Tuple t)
protected

◆ map_edge_collapse_edge_attributes()

template<class WMTKMesh >
void polyfem::mesh::WildRemesher< WMTKMesh >::map_edge_collapse_edge_attributes ( const Tuple t)
protected

◆ map_edge_collapse_vertex_attributes()

template<class WMTKMesh >
void polyfem::mesh::WildRemesher< WMTKMesh >::map_edge_collapse_vertex_attributes ( const Tuple t)
protected

◆ map_edge_split_boundary_attributes()

template<class WMTKMesh >
void polyfem::mesh::WildRemesher< WMTKMesh >::map_edge_split_boundary_attributes ( const Tuple t)
protected

◆ map_edge_split_edge_attributes()

template<class WMTKMesh >
void polyfem::mesh::WildRemesher< WMTKMesh >::map_edge_split_edge_attributes ( const Tuple t)
protected

◆ map_edge_split_element_attributes()

template<class WMTKMesh >
void polyfem::mesh::WildRemesher< WMTKMesh >::map_edge_split_element_attributes ( const Tuple t)
protected

◆ map_edge_swap_edge_attributes()

template<class WMTKMesh >
void polyfem::mesh::WildRemesher< WMTKMesh >::map_edge_swap_edge_attributes ( const Tuple t)
protected

◆ map_edge_swap_element_attributes()

template<class WMTKMesh >
void polyfem::mesh::WildRemesher< WMTKMesh >::map_edge_swap_element_attributes ( const Tuple t)
protected

◆ n_quantities()

template<class WMTKMesh >
int polyfem::mesh::WildRemesher< WMTKMesh >::n_quantities ( ) const
inlineoverridevirtual

Number of projection quantities (not including the position)

Implements polyfem::mesh::Remesher.

Definition at line 178 of file WildRemesher.hpp.

References polyfem::mesh::WildRemesher< WMTKMesh >::m_n_quantities.

◆ opposite_vertex_on_face()

template<class WMTKMesh >
Tuple polyfem::mesh::WildRemesher< WMTKMesh >::opposite_vertex_on_face ( const Tuple e) const
inline

Get the opposite vertex on a face.

Parameters
eedge tuple
Returns
vertex tuple

Definition at line 281 of file WildRemesher.hpp.

◆ orient_preserve_element_reorder()

template<class WMTKMesh >
std::array< size_t, VERTICES_PER_ELEMENT > polyfem::mesh::WildRemesher< WMTKMesh >::orient_preserve_element_reorder ( const std::array< size_t, VERTICES_PER_ELEMENT > &  conn,
const size_t  v0 
) const

Reorder the element vertices so that the first vertex is v0.

Parameters
connThe element vertices in oriented order
v0The vertex to be the first vertex
Returns
The element vertices reordered with the same orientation

◆ positions()

template<class WMTKMesh >
Eigen::MatrixXd polyfem::mesh::WildRemesher< WMTKMesh >::positions ( ) const
overridevirtual

Exports displacements of the stored mesh.

Implements polyfem::mesh::Remesher.

◆ projection_quantities()

template<class WMTKMesh >
Eigen::MatrixXd polyfem::mesh::WildRemesher< WMTKMesh >::projection_quantities ( ) const
overridevirtual

Exports projected quantities of the stored mesh.

Implements polyfem::mesh::Remesher.

Definition at line 181 of file WildRemesher.cpp.

◆ renew_neighbor_tuples()

template<class WMTKMesh >
virtual Operations polyfem::mesh::WildRemesher< WMTKMesh >::renew_neighbor_tuples ( const std::string &  op,
const std::vector< Tuple > &  tris 
) const
inlineprotectedvirtual

Reimplemented in polyfem::mesh::PhysicsRemesher< WMTKMesh >, polyfem::mesh::PhysicsRemesher< wmtk::TetMesh >, and polyfem::mesh::PhysicsRemesher< wmtk::TriMesh >.

Definition at line 293 of file WildRemesher.hpp.

Referenced by polyfem::mesh::WildRemesher< WMTKMesh >::execute().

Here is the caller graph for this function:

◆ rest_edge_center()

template<class WMTKMesh >
WildRemesher< WMTKMesh >::VectorNd polyfem::mesh::WildRemesher< WMTKMesh >::rest_edge_center ( const Tuple e) const

Compute the center of the edge.

Definition at line 408 of file WildRemesher.cpp.

◆ rest_edge_length()

template<class WMTKMesh >
double polyfem::mesh::WildRemesher< WMTKMesh >::rest_edge_length ( const Tuple e) const

Compute the length of an edge.

Definition at line 391 of file WildRemesher.cpp.

Referenced by polyfem::mesh::PhysicsRemesher< WMTKMesh >::collapse_edges(), and polyfem::mesh::SizingFieldRemesher< WMTKMesh >::collapse_edges().

Here is the caller graph for this function:

◆ rest_positions()

template<class WMTKMesh >
Eigen::MatrixXd polyfem::mesh::WildRemesher< WMTKMesh >::rest_positions ( ) const
overridevirtual

Exports rest positions of the stored mesh.

Implements polyfem::mesh::Remesher.

◆ set_body_ids()

template<class WMTKMesh >
void polyfem::mesh::WildRemesher< WMTKMesh >::set_body_ids ( const std::vector< int > &  body_ids)
overridevirtual

Set the body IDs of all elements.

Implements polyfem::mesh::Remesher.

Definition at line 330 of file WildRemesher.cpp.

◆ set_boundary_ids()

template<class WMTKMesh >
void polyfem::mesh::WildRemesher< WMTKMesh >::set_boundary_ids ( const BoundaryMap< int > &  boundary_to_id)
overridevirtual

Set the boundary IDs of all edges.

Implements polyfem::mesh::Remesher.

Definition at line 341 of file WildRemesher.cpp.

◆ set_fixed()

template<class WMTKMesh >
void polyfem::mesh::WildRemesher< WMTKMesh >::set_fixed ( const std::vector< bool > &  fixed)
overridevirtual

Set if a vertex is fixed.

Implements polyfem::mesh::Remesher.

Definition at line 321 of file WildRemesher.cpp.

◆ set_positions()

template<class WMTKMesh >
void polyfem::mesh::WildRemesher< WMTKMesh >::set_positions ( const Eigen::MatrixXd &  positions)
overridevirtual

Set deformed positions of the stored mesh.

Implements polyfem::mesh::Remesher.

◆ set_projection_quantities()

template<class WMTKMesh >
void polyfem::mesh::WildRemesher< WMTKMesh >::set_projection_quantities ( const Eigen::MatrixXd &  projection_quantities)
overridevirtual

Set projected quantities of the stored mesh.

Implements polyfem::mesh::Remesher.

Definition at line 306 of file WildRemesher.cpp.

◆ set_rest_positions()

template<class WMTKMesh >
void polyfem::mesh::WildRemesher< WMTKMesh >::set_rest_positions ( const Eigen::MatrixXd &  positions)
overridevirtual

Set rest positions of the stored mesh.

Implements polyfem::mesh::Remesher.

◆ smooth_after()

template<class WMTKMesh >
bool polyfem::mesh::WildRemesher< WMTKMesh >::smooth_after ( const Tuple t)
overrideprotectedvirtual

Reimplemented in polyfem::mesh::PhysicsRemesher< WMTKMesh >, polyfem::mesh::PhysicsRemesher< wmtk::TetMesh >, and polyfem::mesh::PhysicsRemesher< wmtk::TriMesh >.

Definition at line 192 of file Smooth.cpp.

References polyfem::mesh::get_quality(), and polyfem::mesh::project_local_quantities().

Here is the call graph for this function:

◆ smooth_before()

template<class WMTKMesh >
bool polyfem::mesh::WildRemesher< WMTKMesh >::smooth_before ( const Tuple t)
overrideprotectedvirtual

◆ smooth_vertices()

template<class WMTKMesh >
void polyfem::mesh::WildRemesher< WMTKMesh >::smooth_vertices ( )
virtual

Definition at line 296 of file Smooth.cpp.

References polyfem::mesh::WildRemesher< WMTKMesh >::get_one_ring_elements_for_vertex(), and polyfem::mesh::get_quality().

Here is the call graph for this function:

◆ split_edge_after()

◆ split_edge_before()

template<class WMTKMesh >
bool polyfem::mesh::WildRemesher< WMTKMesh >::split_edge_before ( const Tuple t)
overrideprotectedvirtual

◆ split_edges()

◆ swap_edge_after()

template<class WMTKMesh >
virtual bool polyfem::mesh::WildRemesher< WMTKMesh >::swap_edge_after ( const Tuple t)
overrideprotectedvirtual

◆ swap_edge_before()

template<class WMTKMesh >
bool polyfem::mesh::WildRemesher< WMTKMesh >::swap_edge_before ( const Tuple t)
overrideprotectedvirtual

Reimplemented in polyfem::mesh::PhysicsTriRemesher.

Definition at line 17 of file Swap.cpp.

References polyfem::utils::triangle_area_2D().

Referenced by polyfem::mesh::PhysicsTriRemesher::swap_edge_before().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ swap_edges()

template<class WMTKMesh >
virtual void polyfem::mesh::WildRemesher< WMTKMesh >::swap_edges ( )
inlinevirtual

Reimplemented in polyfem::mesh::PhysicsTriRemesher.

Definition at line 121 of file WildRemesher.hpp.

References polyfem::log_and_throw_error().

Here is the call graph for this function:

◆ tuple_from_element()

template<class WMTKMesh >
Tuple polyfem::mesh::WildRemesher< WMTKMesh >::tuple_from_element ( size_t  elem_id) const

Get a tuple of an element.

◆ tuple_from_facet()

template<class WMTKMesh >
Tuple polyfem::mesh::WildRemesher< WMTKMesh >::tuple_from_facet ( size_t  elem_id,
int  local_facet_id 
) const

Get a tuple of an element with a local facet.

◆ write_edge_ranks_mesh()

template<class WMTKMesh >
void polyfem::mesh::WildRemesher< WMTKMesh >::write_edge_ranks_mesh ( const EdgeMap< typename EdgeAttributes::EnergyRank > &  elastic_ranks,
const EdgeMap< typename EdgeAttributes::EnergyRank > &  contact_ranks 
) const

Definition at line 503 of file WildRemesher.cpp.

Member Data Documentation

◆ boundary_attrs

template<class WMTKMesh >
wmtk::AttributeCollection<BoundaryAttributes> polyfem::mesh::WildRemesher< WMTKMesh >::boundary_attrs

Definition at line 409 of file WildRemesher.hpp.

◆ DIM

template<class WMTKMesh >
constexpr int polyfem::mesh::WildRemesher< WMTKMesh >::DIM
staticconstexpr
Initial value:
= [] {
if constexpr (std::is_same_v<wmtk::TriMesh, WMTKMesh>)
return 2;
else
return 3;
}()

Definition at line 34 of file WildRemesher.hpp.

Referenced by polyfem::mesh::WildRemesher< WMTKMesh >::dim().

◆ edge_attrs

template<class WMTKMesh >
wmtk::AttributeCollection<EdgeAttributes> polyfem::mesh::WildRemesher< WMTKMesh >::edge_attrs
private

Definition at line 424 of file WildRemesher.hpp.

◆ EDGES_PER_ELEMENT

template<class WMTKMesh >
constexpr int polyfem::mesh::WildRemesher< WMTKMesh >::EDGES_PER_ELEMENT
staticconstexpr
Initial value:
= [] {
if constexpr (std::is_same_v<wmtk::TriMesh, WMTKMesh>)
return 3;
else
return 6;
}()

Definition at line 48 of file WildRemesher.hpp.

◆ element_attrs

◆ EXECUTION_POLICY

template<class WMTKMesh >
constexpr wmtk::ExecutionPolicy polyfem::mesh::WildRemesher< WMTKMesh >::EXECUTION_POLICY = wmtk::ExecutionPolicy::kSeq
staticconstexpr

Current execuation policy (sequencial or parallel)

Definition at line 67 of file WildRemesher.hpp.

◆ executor

template<class WMTKMesh >
wmtk::ExecutePass<WildRemesher, EXECUTION_POLICY> polyfem::mesh::WildRemesher< WMTKMesh >::executor
protected

Definition at line 413 of file WildRemesher.hpp.

◆ FACETS_PER_ELEMENT

template<class WMTKMesh >
constexpr int polyfem::mesh::WildRemesher< WMTKMesh >::FACETS_PER_ELEMENT
staticconstexpr
Initial value:
= [] {
if constexpr (std::is_same_v<wmtk::TriMesh, WMTKMesh>)
return 3;
else
return 4;
}()

Definition at line 55 of file WildRemesher.hpp.

◆ m_n_quantities

template<class WMTKMesh >
int polyfem::mesh::WildRemesher< WMTKMesh >::m_n_quantities
protected

◆ op_cache

template<class WMTKMesh >
std::conditional<std::is_same<WMTKMesh,wmtk::TriMesh>::value,std::shared_ptr<TriOperationCache>,std::shared_ptr<TetOperationCache>>::type polyfem::mesh::WildRemesher< WMTKMesh >::op_cache
protected

◆ total_volume

template<class WMTKMesh >
double polyfem::mesh::WildRemesher< WMTKMesh >::total_volume
protected

Definition at line 415 of file WildRemesher.hpp.

◆ vertex_attrs

◆ VERTICES_PER_ELEMENT

template<class WMTKMesh >
constexpr int polyfem::mesh::WildRemesher< WMTKMesh >::VERTICES_PER_ELEMENT
staticconstexpr
Initial value:
= [] {
if constexpr (std::is_same_v<wmtk::TriMesh, WMTKMesh>)
return 3;
else
return 4;
}()

Definition at line 41 of file WildRemesher.hpp.


The documentation for this class was generated from the following files: