PolyFEM
|
Namespaces | |
namespace | MeshProcessing3D |
namespace | Navigation |
namespace | Navigation3D |
namespace | Polygons |
Classes | |
class | CMesh2D |
class | CMesh3D |
struct | Edge |
struct | Element |
struct | Face |
class | LocalBoundary |
Boundary primitive IDs for a single element. More... | |
class | LocalMesh |
class | LocalRelaxationData |
class | Mesh |
Abstract mesh class to capture 2d/3d conforming and non-conforming meshes. More... | |
class | Mesh2D |
class | Mesh3D |
class | Mesh3DStorage |
struct | Mesh_Quality |
class | MeshNodes |
class | NCMesh2D |
class | NCMesh3D |
class | Obstacle |
class | PhysicsRemesher |
class | PhysicsTetRemesher |
class | PhysicsTriRemesher |
class | Remesher |
class | SizingFieldRemesher |
class | TetOperationCache |
class | TriOperationCache |
struct | Vertex |
class | WildRemesher |
Typedefs | |
typedef std::function< void(const Eigen::MatrixXd &, Eigen::MatrixXd &, int)> | EvalParametersFunc |
typedef std::function< std::tuple< int, int, bool >(int, int)> | GetAdjacentLocalEdge |
using | SizingFieldTriRemesher = SizingFieldRemesher< wmtk::TriMesh > |
using | SizingFieldTetRemesher = SizingFieldRemesher< wmtk::TetMesh > |
using | TriMesh = WildRemesher< wmtk::TriMesh > |
using | TetMesh = WildRemesher< wmtk::TetMesh > |
using | WildTriRemesher = WildRemesher< wmtk::TriMesh > |
using | WildTetRemesher = WildRemesher< wmtk::TetMesh > |
using | Tuple = WildTetRemesher::Tuple |
Enumerations | |
enum class | CollisionProxyTessellation { REGULAR , IRREGULAR } |
enum class | BoundaryType { TRI_LINE , QUAD_LINE , TRI , QUAD , POLYGON , POLYHEDRON , INVALID } |
enum class | ElementType { SIMPLEX = 0 , REGULAR_INTERIOR_CUBE , SIMPLE_SINGULAR_INTERIOR_CUBE , MULTI_SINGULAR_INTERIOR_CUBE , REGULAR_BOUNDARY_CUBE , SIMPLE_SINGULAR_BOUNDARY_CUBE , MULTI_SINGULAR_BOUNDARY_CUBE , INTERFACE_CUBE , INTERIOR_POLYTOPE , BOUNDARY_POLYTOPE , UNDEFINED } |
Type of Element, check [Poly-Spline Finite Element Method] for a complete description. More... | |
enum class | MeshType { TRI = 0 , QUA , H_SUR , TET , HYB , HEX } |
enum class | CollapseEdgeTo { V0 , V1 , MIDPOINT , ILLEGAL } |
Functions | |
void | build_collision_proxy (const std::vector< basis::ElementBases > &bases, const std::vector< basis::ElementBases > &geom_bases, const std::vector< LocalBoundary > &total_local_boundary, const int n_bases, const int dim, const double max_edge_length, Eigen::MatrixXd &proxy_vertices, Eigen::MatrixXi &proxy_faces, std::vector< Eigen::Triplet< double > > &displacement_map_entries, const CollisionProxyTessellation tessellation) |
void | build_collision_proxy_displacement_map (const std::vector< basis::ElementBases > &bases, const std::vector< basis::ElementBases > &geom_bases, const std::vector< mesh::LocalBoundary > &total_local_boundary, const int n_bases, const int dim, const Eigen::MatrixXd &proxy_vertices, std::vector< Eigen::Triplet< double > > &displacement_map) |
Build a collision proxy displacement map for a given mesh and proxy mesh. | |
void | load_collision_proxy (const std::string &mesh_filename, const std::string &weights_filename, const Eigen::VectorXi &in_node_to_node, const json &transformation, Eigen::MatrixXd &vertices, Eigen::VectorXi &codim_vertices, Eigen::MatrixXi &edges, Eigen::MatrixXi &faces, std::vector< Eigen::Triplet< double > > &displacement_map_entries) |
Load a collision proxy mesh and displacement map from files. | |
void | load_collision_proxy_mesh (const std::string &mesh_filename, const json &transformation, Eigen::MatrixXd &vertices, Eigen::VectorXi &codim_vertices, Eigen::MatrixXi &edges, Eigen::MatrixXi &faces) |
Load a collision proxy mesh from a file. | |
void | load_collision_proxy_displacement_map (const std::string &weights_filename, const Eigen::VectorXi &in_node_to_node, const size_t num_proxy_vertices, std::vector< Eigen::Triplet< double > > &displacement_map_entries) |
Load a collision proxy displacement map from files. | |
NLOHMANN_JSON_SERIALIZE_ENUM (CollisionProxyTessellation, {{CollisionProxyTessellation::REGULAR, "regular"}, {CollisionProxyTessellation::IRREGULAR, "irregular"}}) | |
void | build_collision_proxy (const std::vector< basis::ElementBases > &bases, const std::vector< basis::ElementBases > &geom_bases, const std::vector< mesh::LocalBoundary > &total_local_boundary, const int n_bases, const int dim, const double max_edge_length, Eigen::MatrixXd &proxy_vertices, Eigen::MatrixXi &proxy_faces, std::vector< Eigen::Triplet< double > > &displacement_map, const CollisionProxyTessellation tessellation=CollisionProxyTessellation::REGULAR) |
Build a collision proxy mesh by upsampling a given mesh. | |
void | stitch_mesh (const Eigen::MatrixXd &V, const Eigen::MatrixXi &F, Eigen::MatrixXd &V_out, Eigen::MatrixXi &F_out, const double epsilon=1e-5) |
Stitch a triangle mesh (V, F) together by removing duplicate vertices. | |
void | stitch_mesh (const Eigen::MatrixXd &V, const Eigen::MatrixXi &F, const std::vector< Eigen::Triplet< double > > &W, Eigen::MatrixXd &V_out, Eigen::MatrixXi &F_out, std::vector< Eigen::Triplet< double > > &W_out, const double epsilon=1e-5) |
Stitch a triangle mesh (V, F) together by removing duplicate vertices. | |
double | max_edge_length (const Eigen::MatrixXd &V, const Eigen::MatrixXi &F) |
Compute the maximum edge length of a triangle mesh (V, F) | |
void | regular_grid_triangle_barycentric_coordinates (const int n, Eigen::MatrixXd &V, Eigen::MatrixXi &F) |
Compute the barycentric coordinates of a regular grid of triangles. | |
void | regular_grid_tessellation (const Eigen::MatrixXd &V, const Eigen::MatrixXi &F, const double max_edge_length, Eigen::MatrixXd &V_out, Eigen::MatrixXi &F_out) |
Tessilate a triangle mesh (V, F) with regular grids of triangles of maximum edge length. | |
Eigen::MatrixXd | refine_edge (const VectorNd &a, const VectorNd &b, const double max_edge_length) |
Refine an edge (a, b) so each refined edge has length at most max_edge_length. | |
void | refine_triangle_edges (const VectorNd &a, const VectorNd &b, const VectorNd &c, const double max_edge_len, Eigen::MatrixXd &V, Eigen::MatrixXi &E) |
Refine the edges of a triangle (a, b, c) so each refined edge has length at most max_edge_length. | |
void | irregular_triangle (const Eigen::Vector3d &a, const Eigen::Vector3d &b, const Eigen::Vector3d &c, const double max_edge_length, Eigen::MatrixXd &V, Eigen::MatrixXi &F) |
Refine a triangle (a, b, c) into a well shaped triangle mesh. | |
void | irregular_triangle_barycentric_coordinates (const Eigen::Vector3d &a, const Eigen::Vector3d &b, const Eigen::Vector3d &c, const double max_edge_length, Eigen::MatrixXd &UV, Eigen::MatrixXi &F) |
Refine a triangle (a, b, c) into a well shaped triangle mesh. | |
void | irregular_tessellation (const Eigen::MatrixXd &V, const Eigen::MatrixXi &F, const double max_edge_length, Eigen::MatrixXd &V_out, Eigen::MatrixXi &F_out) |
Tessilate a triangle mesh (V, F) with well shaped triangles. | |
std::unique_ptr< Mesh > | read_fem_mesh (const Units &units, const json &j_mesh, const std::string &root_path, const bool non_conforming=false) |
read a FEM mesh from a geometry JSON | |
std::unique_ptr< Mesh > | read_fem_geometry (const Units &units, const json &geometry, const std::string &root_path, const std::vector< std::string > &names=std::vector< std::string >(), const std::vector< Eigen::MatrixXd > &vertices=std::vector< Eigen::MatrixXd >(), const std::vector< Eigen::MatrixXi > &cells=std::vector< Eigen::MatrixXi >(), const bool non_conforming=false) |
read FEM meshes from a geometry JSON array (or single) | |
void | read_obstacle_mesh (const Units &units, const json &j_mesh, const std::string &root_path, const int dim, Eigen::MatrixXd &vertices, Eigen::VectorXi &codim_vertices, Eigen::MatrixXi &codim_edges, Eigen::MatrixXi &faces) |
read a obstacle mesh from a geometry JSON | |
Obstacle | read_obstacle_geometry (const Units &units, const json &geometry, const std::vector< json > &displacements, const std::vector< json > &dirichlets, const std::string &root_path, const int dim, const std::vector< std::string > &names=std::vector< std::string >(), const std::vector< Eigen::MatrixXd > &vertices=std::vector< Eigen::MatrixXd >(), const std::vector< Eigen::MatrixXi > &cells=std::vector< Eigen::MatrixXi >(), const bool non_conforming=false) |
read a FEM mesh from a geometry JSON | |
void | construct_affine_transformation (const double unit_scale, const json &transform, const VectorNd &mesh_dimensions, MatrixNd &A, VectorNd &b) |
Construct an affine transformation \(Ax+b\). | |
std::ostream & | operator<< (std::ostream &os, const LocalBoundary &lb) |
int | find (const Eigen::VectorXi &vec, int x) |
double | line_weight (Eigen::Matrix< double, 2, 2 > &e, Eigen::VectorXd &v) |
void | clip_polygon_by_half_plane (const Eigen::MatrixXd &P, const Eigen::RowVector2d &q1, const Eigen::RowVector2d &q2, Eigen::MatrixXd &result) |
Clip a polygon by a half-plane. | |
void | compute_visibility_kernel (const Eigen::MatrixXd &IV, Eigen::MatrixXd &OV) |
Determine the kernel of the given polygon. | |
bool | is_star_shaped (const Eigen::MatrixXd &IV, Eigen::RowVector3d &bary) |
Determine whether a polygon is star-shaped or not. | |
void | offset_polygon (const Eigen::MatrixXd &IV, Eigen::MatrixXd &OV, double eps) |
Compute offset polygon. | |
int | is_inside (const Eigen::MatrixXd &IV, const Eigen::MatrixXd &Q, std::vector< bool > &inside) |
Compute whether points are inside a polygon. | |
void | sample_polygon (const Eigen::MatrixXd &IV, int num_samples, Eigen::MatrixXd &S) |
Sample points on a polygon, evenly spaced from each other. | |
void | edge_adjacency_graph (const Eigen::MatrixXi &Q, Eigen::MatrixXi &edge_index, std::vector< std::vector< int > > &adj, std::vector< std::pair< int, int > > *pairs_of_edges=nullptr, std::vector< std::pair< int, int > > *pairs_of_quads=nullptr, Eigen::MatrixXi *quad_index=nullptr) |
bool | instantiate_pattern (const Eigen::MatrixXd &IV, const Eigen::MatrixXi &IF, const Eigen::MatrixXd &PV, const Eigen::MatrixXi &PF, Eigen::MatrixXd &OV, Eigen::MatrixXi &OF, Eigen::VectorXi *SF=nullptr, EvalParametersFunc evalFunc=nullptr, GetAdjacentLocalEdge getAdjLocalEdge=nullptr) |
void | refine_quad_mesh (const Eigen::MatrixXd &IV, const Eigen::MatrixXi &IF, Eigen::MatrixXd &OV, Eigen::MatrixXi &OF) |
void | refine_polygonal_mesh (const GEO::Mesh &M_in, GEO::Mesh &M_out, Polygons::SplitFunction split_func) |
Refine a polygonal mesh. | |
void | refine_triangle_mesh (const GEO::Mesh &M_in, GEO::Mesh &M_out) |
Refine a triangle mesh. | |
void | refine_polygonal_mesh (const GEO::Mesh &M_in, GEO::Mesh &M_out, bool refine_polygons=false, double t=0.5) |
void | singular_vertices (const GEO::Mesh &M, Eigen::VectorXi &V, int regular_degree=4, bool ignore_border=true) |
void | singular_edges (const GEO::Mesh &M, const Eigen::VectorXi &V, Eigen::MatrixX2i &E) |
void | singularity_graph (const GEO::Mesh &M, Eigen::VectorXi &V, Eigen::MatrixX2i &E, int regular_degree=4, bool ignore_border=true) |
void | create_patch_around_singularities (GEO::Mesh &M, const Eigen::VectorXi &V, const Eigen::MatrixX2i &E, double t=0.5) |
GEO::vec3 | mesh_vertex (const GEO::Mesh &M, GEO::index_t v) |
Retrieve a 3D vector with the position of a given vertex. | |
GEO::vec3 | facet_barycenter (const GEO::Mesh &M, GEO::index_t f) |
GEO::index_t | mesh_create_vertex (GEO::Mesh &M, const GEO::vec3 &p) |
void | compute_element_tags (const GEO::Mesh &M, std::vector< ElementType > &element_tags) |
Compute the type of each facet in a surface mesh. | |
void | orient_normals_2d (GEO::Mesh &M) |
Orient facets of a 2D mesh so that each connected component has positive volume. | |
void | reorder_mesh (Eigen::MatrixXd &V, Eigen::MatrixXi &F, const Eigen::VectorXi &C, Eigen::VectorXi &R) |
Reorder vertices of a mesh using color tags, so that vertices are ordered by increasing colors. | |
void | signed_squared_distances (const Eigen::MatrixXd &V, const Eigen::MatrixXi &F, const Eigen::MatrixXd &P, Eigen::VectorXd &D) |
Computes the signed squared distance from a list of points to a triangle mesh. | |
void | to_geogram_mesh (const Eigen::MatrixXd &V, const Eigen::MatrixXi &F, GEO::Mesh &M) |
Converts a triangle mesh to a Geogram mesh. | |
void | from_geogram_mesh (const GEO::Mesh &M, Eigen::MatrixXd &V, Eigen::MatrixXi &F, Eigen::MatrixXi &T) |
Extract simplices from a Geogram mesh. | |
void | to_geogram_mesh (const Mesh3D &mesh, GEO::Mesh &M) |
Converts a hex mesh to a Geogram mesh. | |
double | signed_volume (const Eigen::MatrixXd &V, const Eigen::MatrixXi &F) |
Compute the signed volume of a surface mesh. | |
void | orient_closed_surface (const Eigen::MatrixXd &V, Eigen::MatrixXi &F, bool positive=true) |
Orient a triangulated surface to have positive volume. | |
void | extract_polyhedra (const Mesh3D &mesh, std::vector< std::unique_ptr< GEO::Mesh > > &polys, bool triangulated=false) |
Extract polyhedra from a 3D volumetric mesh. | |
void | tertrahedralize_star_shaped_surface (const Eigen::MatrixXd &V, const Eigen::MatrixXi &F, const Eigen::RowVector3d &kernel, Eigen::MatrixXd &OV, Eigen::MatrixXi &OF, Eigen::MatrixXi &OT) |
Tetrahedralize a star-shaped mesh, with a given point in its kernel. | |
void | sample_surface (const Eigen::MatrixXd &V, const Eigen::MatrixXi &F, int num_samples, Eigen::MatrixXd &P, Eigen::MatrixXd *N=nullptr, int num_lloyd=10, int num_newton=10) |
Samples points on a surface. | |
void | extract_parent_edges (const Eigen::MatrixXd &IV, const Eigen::MatrixXi &IE, const Eigen::MatrixXd &BV, const Eigen::MatrixXi &BE, Eigen::MatrixXi &OE) |
Extract a set of edges that are overlap with a set given set of parent edges, using vertices positions to discriminate. | |
void | extract_triangle_surface_from_tets (const Eigen::MatrixXd &vertices, const Eigen::MatrixXi &tets, Eigen::MatrixXd &surface_vertices, Eigen::MatrixXi &tris) |
Extract triangular surface from a tetmesh. | |
bool | read_surface_mesh (const std::string &mesh_path, Eigen::MatrixXd &vertices, Eigen::VectorXi &codim_vertices, Eigen::MatrixXi &codim_edges, Eigen::MatrixXi &faces) |
read a surface mesh | |
bool | is_planar (const GEO::Mesh &M, const double tol=1e-5) |
Determine if the given mesh is planar (2D or tiny z-range). | |
int | count_faces (const int dim, const Eigen::MatrixXi &cells) |
Count the number of boundary elements (triangles for tetmesh and edges for triangle mesh) | |
void | generate_edges (GEO::Mesh &M) |
assing edges to M | |
Eigen::MatrixXd | unconstrained_L2_projection (const Eigen::SparseMatrix< double > &M, const Eigen::SparseMatrix< double > &A, const Eigen::Ref< const Eigen::MatrixXd > &y) |
void | reduced_L2_projection (const Eigen::MatrixXd &M, const Eigen::MatrixXd &A, const Eigen::Ref< const Eigen::MatrixXd > &y, const std::vector< int > &boundary_nodes, Eigen::Ref< Eigen::MatrixXd > x) |
Eigen::VectorXd | constrained_L2_projection (std::shared_ptr< polysolve::nonlinear::Solver > nl_solver, const Eigen::SparseMatrix< double > &M, const Eigen::SparseMatrix< double > &A, const Eigen::VectorXd &y, const Eigen::MatrixXd &rest_positions, const Eigen::MatrixXi &elements, const int dim, const ipc::CollisionMesh &collision_mesh, const double dhat, const double barrier_stiffness, const bool use_convergent_formulation, const ipc::BroadPhaseMethod broad_phase_method, const double ccd_tolerance, const int ccd_max_iterations, const std::vector< int > &boundary_nodes, const size_t obstacle_ndof, const Eigen::VectorXd &target_x, const Eigen::VectorXd &x0) |
void | unique_facet_tuples (const wmtk::TriMesh &m, std::vector< wmtk::TriMesh::Tuple > &tuples) |
void | unique_facet_tuples (const wmtk::TetMesh &m, std::vector< wmtk::TetMesh::Tuple > &tuples) |
void | add_solver_timings (decltype(Remesher::timings) &timings, const polyfem::json &solver_info) |
template<class WMTKMesh > | |
double | get_quality (const WildRemesher< WMTKMesh > &m, const typename WMTKMesh::Tuple &t) |
template<class WMTKMesh > | |
void | project_local_quantities (WildRemesher< WMTKMesh > &m, LocalMesh< WildRemesher< WMTKMesh > > &old_local_mesh, LocalMesh< WildRemesher< WMTKMesh > > &new_local_mesh) |
double | compute_valence_energy (const WildTriRemesher &m, std::string op, const WildTriRemesher::Tuple &t) |
double | compute_area_ratio_energy (const WildTriRemesher &m, std::string op, const WildTriRemesher::Tuple &t) |
template<typename WMTKMesh > | |
Remesher::EdgeMap< typename WildRemesher< WMTKMesh >::EdgeAttributes::EnergyRank > | rank_edges (const Remesher::EdgeMap< double > &edge_energy, const json &args) |
bool | apply_slim (const Eigen::MatrixXd &V, const Eigen::MatrixXi &F, const Eigen::MatrixXd &V_new, Eigen::MatrixXd &V_smooth, const int max_iters) |
typedef std::function<void(const Eigen::MatrixXd &, Eigen::MatrixXd &, int)> polyfem::mesh::EvalParametersFunc |
Definition at line 30 of file Refinement.hpp.
typedef std::function<std::tuple<int, int, bool>(int, int)> polyfem::mesh::GetAdjacentLocalEdge |
Definition at line 31 of file Refinement.hpp.
using polyfem::mesh::SizingFieldTetRemesher = typedef SizingFieldRemesher<wmtk::TetMesh> |
Definition at line 70 of file SizingFieldRemesher.hpp.
using polyfem::mesh::SizingFieldTriRemesher = typedef SizingFieldRemesher<wmtk::TriMesh> |
Definition at line 69 of file SizingFieldRemesher.hpp.
using polyfem::mesh::TetMesh = typedef WildRemesher<wmtk::TetMesh> |
Definition at line 36 of file LocalMesh.cpp.
using polyfem::mesh::TriMesh = typedef WildRemesher<wmtk::TriMesh> |
Definition at line 35 of file LocalMesh.cpp.
Definition at line 14 of file WildTetRemesher.cpp.
using polyfem::mesh::WildTetRemesher = typedef WildRemesher<wmtk::TetMesh> |
Definition at line 428 of file WildRemesher.hpp.
using polyfem::mesh::WildTriRemesher = typedef WildRemesher<wmtk::TriMesh> |
Definition at line 427 of file WildRemesher.hpp.
|
strong |
Enumerator | |
---|---|
TRI_LINE | Boundary of a triangle in 2D. |
QUAD_LINE | Boundary of a quad in 2D. |
TRI | |
QUAD | |
POLYGON | |
POLYHEDRON | |
INVALID |
Definition at line 12 of file LocalBoundary.hpp.
|
strong |
Enumerator | |
---|---|
V0 | |
V1 | |
MIDPOINT | |
ILLEGAL |
Definition at line 14 of file WildRemesher.hpp.
|
strong |
Enumerator | |
---|---|
REGULAR | Regular tessellation of the mesh. |
IRREGULAR | Irregular tessellation of the mesh (requires POLYFEM_WITH_TRIANGLE) |
Definition at line 12 of file CollisionProxy.hpp.
|
strong |
Type of Element, check [Poly-Spline Finite Element Method] for a complete description.
NOTE: For the purpose of the tagging, elements (facets in 2D, cells in 3D) adjacent to a polytope are tagged as boundary, and vertices incident to a polytope are also considered as boundary.
|
strong |
Enumerator | |
---|---|
TRI | |
QUA | |
H_SUR | |
TET | |
HYB | |
HEX |
Definition at line 54 of file Mesh3DStorage.hpp.
void polyfem::mesh::add_solver_timings | ( | decltype(Remesher::timings) & | timings, |
const polyfem::json & | solver_info | ||
) |
Definition at line 11 of file LocalRelaxation.cpp.
References polyfem::utils::StringUtils::startswith().
bool polyfem::mesh::apply_slim | ( | const Eigen::MatrixXd & | V, |
const Eigen::MatrixXi & | F, | ||
const Eigen::MatrixXd & | V_new, | ||
Eigen::MatrixXd & | V_smooth, | ||
const int | max_iters | ||
) |
Definition at line 11 of file SlimSmooth.cpp.
References polyfem::adjoint_logger(), polyfem::F, polyfem::solver::AdjointTools::is_flipped(), polyfem::logger(), and V.
Referenced by polyfem::solver::AdjointNLProblem::after_line_search_custom_operation(), and polyfem::solver::AdjointNLProblem::is_step_valid().
void polyfem::mesh::build_collision_proxy | ( | const std::vector< basis::ElementBases > & | bases, |
const std::vector< basis::ElementBases > & | geom_bases, | ||
const std::vector< LocalBoundary > & | total_local_boundary, | ||
const int | n_bases, | ||
const int | dim, | ||
const double | max_edge_length, | ||
Eigen::MatrixXd & | proxy_vertices, | ||
Eigen::MatrixXi & | proxy_faces, | ||
std::vector< Eigen::Triplet< double > > & | displacement_map_entries, | ||
const CollisionProxyTessellation | tessellation | ||
) |
Definition at line 73 of file CollisionProxy.cpp.
References polyfem::basis::ElementBases::bases, IRREGULAR, irregular_triangle_barycentric_coordinates(), polyfem::log_and_throw_error(), max_edge_length(), REGULAR, regular_grid_triangle_barycentric_coordinates(), stitch_mesh(), TRI, and x.
Referenced by polyfem::State::build_collision_mesh().
void polyfem::mesh::build_collision_proxy | ( | const std::vector< basis::ElementBases > & | bases, |
const std::vector< basis::ElementBases > & | geom_bases, | ||
const std::vector< mesh::LocalBoundary > & | total_local_boundary, | ||
const int | n_bases, | ||
const int | dim, | ||
const double | max_edge_length, | ||
Eigen::MatrixXd & | proxy_vertices, | ||
Eigen::MatrixXi & | proxy_faces, | ||
std::vector< Eigen::Triplet< double > > & | displacement_map, | ||
const CollisionProxyTessellation | tessellation = CollisionProxyTessellation::REGULAR |
||
) |
Build a collision proxy mesh by upsampling a given mesh.
[in] | bases | Bases for elements |
[in] | geom_bases | Geometry bases for elements |
[in] | total_local_boundary | Local boundaries for elements |
[in] | n_bases | Number of bases (nodes) |
[in] | dim | Dimension of the mesh |
[in] | max_edge_length | Maximum edge length of the proxy mesh |
[out] | proxy_vertices | Output vertices of the proxy mesh |
[out] | proxy_faces | Output faces of the proxy mesh |
[out] | displacement_map | Output displacement map from proxy mesh to original mesh |
[in] | tessellation | Type of tessellation to use |
void polyfem::mesh::build_collision_proxy_displacement_map | ( | const std::vector< basis::ElementBases > & | bases, |
const std::vector< basis::ElementBases > & | geom_bases, | ||
const std::vector< mesh::LocalBoundary > & | total_local_boundary, | ||
const int | n_bases, | ||
const int | dim, | ||
const Eigen::MatrixXd & | proxy_vertices, | ||
std::vector< Eigen::Triplet< double > > & | displacement_map | ||
) |
Build a collision proxy displacement map for a given mesh and proxy mesh.
[in] | bases | Bases for elements |
[in] | geom_bases | Geometry bases for elements |
[in] | total_local_boundary | Local boundaries for elements |
[in] | n_bases | Number of bases (nodes) |
[in] | dim | Dimension of the mesh |
[in] | proxy_vertices | Vertices of the proxy mesh |
[out] | displacement_map | Output displacement map from proxy mesh to original mesh |
Definition at line 168 of file CollisionProxy.cpp.
References polyfem::log_and_throw_error().
void polyfem::mesh::clip_polygon_by_half_plane | ( | const Eigen::MatrixXd & | P, |
const Eigen::RowVector2d & | q1, | ||
const Eigen::RowVector2d & | q2, | ||
Eigen::MatrixXd & | result | ||
) |
Clip a polygon by a half-plane.
[in] | P | Input polygon |
[in] | q1 | First endpoint of the clipping line |
[in] | q2 | Second endpoint of the clipping line |
[out] | result | Clipped polygon |
Definition at line 51 of file PolygonUtils.cpp.
Referenced by compute_visibility_kernel().
double polyfem::mesh::compute_area_ratio_energy | ( | const WildTriRemesher & | m, |
std::string | op, | ||
const WildTriRemesher::Tuple & | t | ||
) |
Definition at line 207 of file Swap.cpp.
References compute_area_ratio_energy(), and polyfem::mesh::WildRemesher< WMTKMesh >::element_volume().
Referenced by compute_area_ratio_energy().
void polyfem::mesh::compute_element_tags | ( | const GEO::Mesh & | M, |
std::vector< ElementType > & | element_tags | ||
) |
Compute the type of each facet in a surface mesh.
[in] | M | Input surface mesh |
[out] | element_tags | Types of each facet element |
Definition at line 97 of file MeshUtils.cpp.
Referenced by polyfem::mesh::CMesh2D::compute_elements_tag(), and polyfem::mesh::CMesh2D::update_elements_tag().
double polyfem::mesh::compute_valence_energy | ( | const WildTriRemesher & | m, |
std::string | op, | ||
const WildTriRemesher::Tuple & | t | ||
) |
Definition at line 182 of file Swap.cpp.
References compute_valence_energy(), and polyfem::mesh::WildRemesher< WMTKMesh >::is_boundary_vertex().
Referenced by compute_valence_energy(), and polyfem::mesh::PhysicsTriRemesher::swap_edges().
void polyfem::mesh::compute_visibility_kernel | ( | const Eigen::MatrixXd & | IV, |
Eigen::MatrixXd & | OV | ||
) |
Determine the kernel of the given polygon.
[in] | IV | #IV x (2|3) vertex positions around the input polygon |
[out] | OV | #OV x (2|3) vertex positions around the output polygon |
Definition at line 121 of file PolygonUtils.cpp.
References clip_polygon_by_half_plane().
Referenced by is_star_shaped().
Eigen::VectorXd polyfem::mesh::constrained_L2_projection | ( | std::shared_ptr< polysolve::nonlinear::Solver > | nl_solver, |
const Eigen::SparseMatrix< double > & | M, | ||
const Eigen::SparseMatrix< double > & | A, | ||
const Eigen::VectorXd & | y, | ||
const Eigen::MatrixXd & | rest_positions, | ||
const Eigen::MatrixXi & | elements, | ||
const int | dim, | ||
const ipc::CollisionMesh & | collision_mesh, | ||
const double | dhat, | ||
const double | barrier_stiffness, | ||
const bool | use_convergent_formulation, | ||
const ipc::BroadPhaseMethod | broad_phase_method, | ||
const double | ccd_tolerance, | ||
const int | ccd_max_iterations, | ||
const std::vector< int > & | boundary_nodes, | ||
const size_t | obstacle_ndof, | ||
const Eigen::VectorXd & | target_x, | ||
const Eigen::VectorXd & | x0 | ||
) |
Definition at line 70 of file L2Projection.cpp.
References polyfem::solver::ALSolver::solve_al(), polyfem::utils::unflatten(), x, and y.
Referenced by polyfem::mesh::Remesher::project_quantities(), and polyfem::mesh::WildRemesher< wmtk::TetMesh >::smooth_vertices().
void polyfem::mesh::construct_affine_transformation | ( | const double | unit_scale, |
const json & | transform, | ||
const VectorNd & | mesh_dimensions, | ||
MatrixNd & | A, | ||
VectorNd & | b | ||
) |
Construct an affine transformation \(Ax+b\).
[in] | transform | JSON object with the mesh data |
[in] | mesh_dimensions | Dimensions of the mesh (i.e., width, height, depth) |
[out] | A | Multiplicative matrix component of transformation |
[out] | b | Additive translation component of transformation |
Definition at line 688 of file GeometryReader.cpp.
References polyfem::utils::deg2rad(), polyfem::log_and_throw_error(), and polyfem::utils::to_rotation_matrix().
Referenced by load_collision_proxy_mesh(), read_fem_mesh(), and read_obstacle_mesh().
int polyfem::mesh::count_faces | ( | const int | dim, |
const Eigen::MatrixXi & | cells | ||
) |
Count the number of boundary elements (triangles for tetmesh and edges for triangle mesh)
Definition at line 1194 of file MeshUtils.cpp.
void polyfem::mesh::create_patch_around_singularities | ( | GEO::Mesh & | M, |
const Eigen::VectorXi & | V, | ||
const Eigen::MatrixX2i & | E, | ||
double | t = 0.5 |
||
) |
Definition at line 84 of file Singularities.cpp.
References facet_barycenter(), mesh_create_vertex(), mesh_vertex(), and V.
void polyfem::mesh::edge_adjacency_graph | ( | const Eigen::MatrixXi & | Q, |
Eigen::MatrixXi & | edge_index, | ||
std::vector< std::vector< int > > & | adj, | ||
std::vector< std::pair< int, int > > * | pairs_of_edges = nullptr , |
||
std::vector< std::pair< int, int > > * | pairs_of_quads = nullptr , |
||
Eigen::MatrixXi * | quad_index = nullptr |
||
) |
Definition at line 16 of file Refinement.cpp.
Referenced by instantiate_pattern().
void polyfem::mesh::extract_parent_edges | ( | const Eigen::MatrixXd & | IV, |
const Eigen::MatrixXi & | IE, | ||
const Eigen::MatrixXd & | BV, | ||
const Eigen::MatrixXi & | BE, | ||
Eigen::MatrixXi & | OE | ||
) |
Extract a set of edges that are overlap with a set given set of parent edges, using vertices positions to discriminate.
[in] | IV | #IV x 3 input vertices positions |
[in] | IE | #IE x 2 input edge indices |
[in] | BV | #BV x 3 base vertices positions to test against |
[in] | BE | #BE x 2 base edge indices to test against |
[out] | OE | #OE x 2 output extracted edges |
Definition at line 946 of file MeshUtils.cpp.
Referenced by polyfem::utils::RefElementSampler::build().
void polyfem::mesh::extract_polyhedra | ( | const Mesh3D & | mesh, |
std::vector< std::unique_ptr< GEO::Mesh > > & | polys, | ||
bool | triangulated = false |
||
) |
Extract polyhedra from a 3D volumetric mesh.
[in] | mesh | Input volume mesh |
[out] | polys | Extracted polyhedral surfaces |
Definition at line 715 of file MeshUtils.cpp.
References polyfem::mesh::Mesh3D::get_index_from_element(), polyfem::mesh::Mesh::is_polytope(), polyfem::mesh::Mesh3D::kernel(), polyfem::mesh::Mesh3D::n_cell_faces(), polyfem::mesh::Mesh::n_cell_vertices(), polyfem::mesh::Mesh::n_cells(), polyfem::mesh::Mesh::n_face_vertices(), polyfem::mesh::Mesh::n_faces(), polyfem::mesh::Mesh::n_vertices(), polyfem::mesh::Mesh3D::next_around_face(), and polyfem::mesh::Mesh::point().
void polyfem::mesh::extract_triangle_surface_from_tets | ( | const Eigen::MatrixXd & | vertices, |
const Eigen::MatrixXi & | tets, | ||
Eigen::MatrixXd & | surface_vertices, | ||
Eigen::MatrixXi & | tris | ||
) |
Extract triangular surface from a tetmesh.
[in] | v,tets | tet mesh |
[out] | s_v,tris | { surface mesh } |
Definition at line 1052 of file MeshUtils.cpp.
References find_triangle_surface_from_tets().
Referenced by read_surface_mesh().
GEO::vec3 polyfem::mesh::facet_barycenter | ( | const GEO::Mesh & | M, |
GEO::index_t | f | ||
) |
Definition at line 64 of file MeshUtils.cpp.
References mesh_vertex().
Referenced by create_patch_around_singularities(), and refine_polygonal_mesh().
int polyfem::mesh::find | ( | const Eigen::VectorXi & | vec, |
int | x | ||
) |
Definition at line 289 of file NCMesh2D.cpp.
Referenced by polyfem::mesh::MeshProcessing3D::build_connectivity(), polyfem::mesh::NCMesh2D::build_element_vertex_adjacency(), polyfem::mesh::Navigation3D::get_index_from_element_face(), polyfem::mesh::CMesh3D::load(), polyfem::mesh::MeshProcessing3D::refine_catmul_clark_polar(), and polyfem::mesh::NCMesh2D::switch_edge().
void polyfem::mesh::from_geogram_mesh | ( | const GEO::Mesh & | M, |
Eigen::MatrixXd & | V, | ||
Eigen::MatrixXi & | F, | ||
Eigen::MatrixXi & | T | ||
) |
Extract simplices from a Geogram mesh.
[in] | M | Input Geogram mesh |
[out] | V | V x 3 output mesh vertices |
[out] | F | F x 3 output mesh faces |
[out] | T | #T x 4 output mesh tets |
Definition at line 639 of file MeshUtils.cpp.
References V.
void polyfem::mesh::generate_edges | ( | GEO::Mesh & | M | ) |
assing edges to M
[in/out] | M geogram mesh to appen edges to |
Definition at line 1244 of file MeshUtils.cpp.
Referenced by polyfem::mesh::Mesh::create(), and polyfem::mesh::CMesh2D::refine().
double polyfem::mesh::get_quality | ( | const WildRemesher< WMTKMesh > & | m, |
const typename WMTKMesh::Tuple & | t | ||
) |
Definition at line 17 of file Smooth.cpp.
References polyfem::mesh::WildRemesher< WMTKMesh >::element_vids(), and polyfem::mesh::WildRemesher< WMTKMesh >::vertex_attrs.
Referenced by polyfem::mesh::WildRemesher< WMTKMesh >::smooth_after(), and polyfem::mesh::WildRemesher< WMTKMesh >::smooth_vertices().
bool polyfem::mesh::instantiate_pattern | ( | const Eigen::MatrixXd & | IV, |
const Eigen::MatrixXi & | IF, | ||
const Eigen::MatrixXd & | PV, | ||
const Eigen::MatrixXi & | PF, | ||
Eigen::MatrixXd & | OV, | ||
Eigen::MatrixXi & | OF, | ||
Eigen::VectorXi * | SF = nullptr , |
||
EvalParametersFunc | evalFunc = nullptr , |
||
GetAdjacentLocalEdge | getAdjLocalEdge = nullptr |
||
) |
Definition at line 278 of file Refinement.cpp.
References adj, edge_adjacency_graph(), polyfem::F, polyfem::logger(), V, x, and y.
Referenced by refine_quad_mesh().
void polyfem::mesh::irregular_tessellation | ( | const Eigen::MatrixXd & | V, |
const Eigen::MatrixXi & | F, | ||
const double | max_edge_length, | ||
Eigen::MatrixXd & | V_out, | ||
Eigen::MatrixXi & | F_out | ||
) |
Tessilate a triangle mesh (V, F) with well shaped triangles.
V | vertices |
F | triangular faces |
max_edge_length | maximum edge length |
V_out | tessilated vertices |
F_out | tessilated faces |
Definition at line 288 of file UpsampleMesh.cpp.
References polyfem::F, irregular_triangle(), max_edge_length(), stitch_mesh(), and V.
void polyfem::mesh::irregular_triangle | ( | const Eigen::Vector3d & | a, |
const Eigen::Vector3d & | b, | ||
const Eigen::Vector3d & | c, | ||
const double | max_edge_length, | ||
Eigen::MatrixXd & | V, | ||
Eigen::MatrixXi & | F | ||
) |
Refine a triangle (a, b, c) into a well shaped triangle mesh.
a | first vertex of the triangle |
b | second vertex of the triangle |
c | third vertex of the triangle |
max_edge_len | maximum edge length of the refined triangle mesh |
V | vertices of the refined triangle |
F | faces of the refined triangle |
Definition at line 217 of file UpsampleMesh.cpp.
References polyfem::assembler::cross(), polyfem::F, polyfem::log_and_throw_error(), max_edge_length(), refine_triangle_edges(), polyfem::utils::triangle_area(), V, and z.
Referenced by irregular_tessellation(), and irregular_triangle_barycentric_coordinates().
void polyfem::mesh::irregular_triangle_barycentric_coordinates | ( | const Eigen::Vector3d & | a, |
const Eigen::Vector3d & | b, | ||
const Eigen::Vector3d & | c, | ||
const double | max_edge_length, | ||
Eigen::MatrixXd & | UV, | ||
Eigen::MatrixXi & | F | ||
) |
Refine a triangle (a, b, c) into a well shaped triangle mesh.
a | first vertex of the triangle |
b | second vertex of the triangle |
c | third vertex of the triangle |
max_edge_len | maximum edge length of the refined triangle mesh |
UV | barycentric coordinates of the refined triangle |
F | faces of the refined triangle |
Definition at line 266 of file UpsampleMesh.cpp.
References polyfem::F, irregular_triangle(), max_edge_length(), and V.
Referenced by build_collision_proxy().
int polyfem::mesh::is_inside | ( | const Eigen::MatrixXd & | IV, |
const Eigen::MatrixXd & | Q, | ||
std::vector< bool > & | inside | ||
) |
Compute whether points are inside a polygon.
[in] | IV | #IV x 2 of vertex positions for the input polygon |
[in] | Q | #Q x 2 of query point positions |
[out] | inside | Whether the i-th query point is inside or not |
Definition at line 243 of file PolygonUtils.cpp.
bool polyfem::mesh::is_planar | ( | const GEO::Mesh & | M, |
const double | tol = 1e-5 |
||
) |
Determine if the given mesh is planar (2D or tiny z-range).
Definition at line 31 of file MeshUtils.cpp.
Referenced by polyfem::mesh::Mesh::create(), and read_surface_mesh().
bool polyfem::mesh::is_star_shaped | ( | const Eigen::MatrixXd & | IV, |
Eigen::RowVector3d & | bary | ||
) |
Determine whether a polygon is star-shaped or not.
[in] | IV | #IV x (2|3) of vertex positions around the polygon |
[out] | bary | The barycenter of the kernel |
Definition at line 151 of file PolygonUtils.cpp.
References compute_visibility_kernel().
Referenced by polyfem::mesh::Polygons::catmul_clark_split(), and polyfem::mesh::Polygons::polar_split().
double polyfem::mesh::line_weight | ( | Eigen::Matrix< double, 2, 2 > & | e, |
Eigen::VectorXd & | v | ||
) |
Definition at line 364 of file NCMesh2D.cpp.
Referenced by polyfem::mesh::NCMesh2D::build_element_vertex_adjacency().
void polyfem::mesh::load_collision_proxy | ( | const std::string & | mesh_filename, |
const std::string & | weights_filename, | ||
const Eigen::VectorXi & | in_node_to_node, | ||
const json & | transformation, | ||
Eigen::MatrixXd & | vertices, | ||
Eigen::VectorXi & | codim_vertices, | ||
Eigen::MatrixXi & | edges, | ||
Eigen::MatrixXi & | faces, | ||
std::vector< Eigen::Triplet< double > > & | displacement_map_entries | ||
) |
Load a collision proxy mesh and displacement map from files.
[in] | mesh_filename | Mesh filename |
[in] | weights_filename | Weights filename |
[in] | in_node_to_node | Map from input node IDs to node IDs |
[in] | transformation | Transformation to apply to the mesh |
[out] | vertices | Output vertices of the proxy mesh |
[out] | codim_vertices | Output codimension vertices of the proxy mesh |
[out] | edges | Output edges of the proxy mesh |
[out] | faces | Output faces of the proxy mesh |
[out] | displacement_map_entries | Output displacement map entries |
Definition at line 315 of file CollisionProxy.cpp.
References faces, load_collision_proxy(), load_collision_proxy_displacement_map(), and load_collision_proxy_mesh().
Referenced by polyfem::State::build_collision_mesh(), and load_collision_proxy().
void polyfem::mesh::load_collision_proxy_displacement_map | ( | const std::string & | weights_filename, |
const Eigen::VectorXi & | in_node_to_node, | ||
const size_t | num_proxy_vertices, | ||
std::vector< Eigen::Triplet< double > > & | displacement_map_entries | ||
) |
Load a collision proxy displacement map from files.
[in] | weights_filename | Weights filename |
[in] | in_node_to_node | Map from input node IDs to node IDs |
[out] | displacement_map_entries | Output displacement map entries |
Definition at line 368 of file CollisionProxy.cpp.
References load_collision_proxy_displacement_map().
Referenced by load_collision_proxy(), and load_collision_proxy_displacement_map().
void polyfem::mesh::load_collision_proxy_mesh | ( | const std::string & | mesh_filename, |
const json & | transformation, | ||
Eigen::MatrixXd & | vertices, | ||
Eigen::VectorXi & | codim_vertices, | ||
Eigen::MatrixXi & | edges, | ||
Eigen::MatrixXi & | faces | ||
) |
Load a collision proxy mesh from a file.
[in] | mesh_filename | Mesh filename |
[in] | transformation | Transformation to apply to the mesh |
[out] | vertices | Output vertices of the proxy mesh |
[out] | codim_vertices | Output codimension vertices of the proxy mesh |
[out] | edges | Output edges of the proxy mesh |
[out] | faces | Output faces of the proxy mesh |
Definition at line 330 of file CollisionProxy.cpp.
References construct_affine_transformation(), faces, load_collision_proxy_mesh(), and read_surface_mesh().
Referenced by load_collision_proxy(), and load_collision_proxy_mesh().
double polyfem::mesh::max_edge_length | ( | const Eigen::MatrixXd & | V, |
const Eigen::MatrixXi & | F | ||
) |
Compute the maximum edge length of a triangle mesh (V, F)
V | vertices |
F | triangular faces |
Definition at line 87 of file UpsampleMesh.cpp.
References polyfem::F, max_edge_length(), and V.
Referenced by build_collision_proxy(), polyfem::mesh::WildRemesher< WMTKMesh >::collapse_edge_before(), irregular_tessellation(), irregular_triangle(), irregular_triangle_barycentric_coordinates(), max_edge_length(), refine_edge(), and regular_grid_tessellation().
GEO::index_t polyfem::mesh::mesh_create_vertex | ( | GEO::Mesh & | M, |
const GEO::vec3 & | p | ||
) |
Definition at line 77 of file MeshUtils.cpp.
Referenced by create_patch_around_singularities(), refine_polygonal_mesh(), and refine_triangle_mesh().
GEO::vec3 polyfem::mesh::mesh_vertex | ( | const GEO::Mesh & | M, |
GEO::index_t | v | ||
) |
Retrieve a 3D vector with the position of a given vertex.
Contrary to geogram's version, this function works with both single and double precision meshes, as well as 2D meshes too.
[in] | M | Input mesh |
[in] | v | Vertex index whose position to retrieve |
Definition at line 44 of file MeshUtils.cpp.
Referenced by create_patch_around_singularities(), facet_barycenter(), refine_polygonal_mesh(), and refine_triangle_mesh().
polyfem::mesh::NLOHMANN_JSON_SERIALIZE_ENUM | ( | CollisionProxyTessellation | , |
{{CollisionProxyTessellation::REGULAR, "regular"}, {CollisionProxyTessellation::IRREGULAR, "irregular"}} | |||
) |
void polyfem::mesh::offset_polygon | ( | const Eigen::MatrixXd & | IV, |
Eigen::MatrixXd & | OV, | ||
double | eps | ||
) |
Compute offset polygon.
[in] | IV | #IV x 2 of vertex positions for the input polygon |
[out] | OV | #OV x 2 of vertex positions for the offset polygon |
[in] | eps | Offset distance |
Definition at line 179 of file PolygonUtils.cpp.
std::ostream & polyfem::mesh::operator<< | ( | std::ostream & | os, |
const LocalBoundary & | lb | ||
) |
os | Output stream |
lb | LocalBoundary to print |
Definition at line 49 of file LocalBoundary.cpp.
void polyfem::mesh::orient_closed_surface | ( | const Eigen::MatrixXd & | V, |
Eigen::MatrixXi & | F, | ||
bool | positive = true |
||
) |
Orient a triangulated surface to have positive volume.
[in] | V | V x 3 input mesh vertices |
[in] | F | F x 3 input mesh facets |
[in] | positive | Orient for positive volume, or negative volume |
Definition at line 702 of file MeshUtils.cpp.
References signed_volume(), and V.
Referenced by polyfem::basis::PolygonalBasis3d::build_bases().
void polyfem::mesh::orient_normals_2d | ( | GEO::Mesh & | M | ) |
Orient facets of a 2D mesh so that each connected component has positive volume.
[in,out] | M | Surface mesh to reorient |
Definition at line 304 of file MeshUtils.cpp.
Referenced by polyfem::mesh::CMesh2D::build_from_matrices(), polyfem::mesh::NCMesh2D::build_from_matrices(), polyfem::mesh::CMesh2D::load(), and polyfem::mesh::NCMesh2D::load().
void polyfem::mesh::project_local_quantities | ( | WildRemesher< WMTKMesh > & | m, |
LocalMesh< WildRemesher< WMTKMesh > > & | old_local_mesh, | ||
LocalMesh< WildRemesher< WMTKMesh > > & | new_local_mesh | ||
) |
Definition at line 45 of file Smooth.cpp.
References POLYFEM_REMESHER_SCOPED_TIMER.
Referenced by polyfem::mesh::WildRemesher< WMTKMesh >::smooth_after().
Remesher::EdgeMap< typename WildRemesher< WMTKMesh >::EdgeAttributes::EnergyRank > polyfem::mesh::rank_edges | ( | const Remesher::EdgeMap< double > & | edge_energy, |
const json & | args | ||
) |
Definition at line 47 of file WildRemesher.cpp.
std::unique_ptr< Mesh > polyfem::mesh::read_fem_geometry | ( | const Units & | units, |
const json & | geometry, | ||
const std::string & | root_path, | ||
const std::vector< std::string > & | names = std::vector< std::string >() , |
||
const std::vector< Eigen::MatrixXd > & | vertices = std::vector< Eigen::MatrixXd >() , |
||
const std::vector< Eigen::MatrixXi > & | cells = std::vector< Eigen::MatrixXi >() , |
||
const bool | non_conforming = false |
||
) |
read FEM meshes from a geometry JSON array (or single)
[in] | geometry | geometry JSON object(s) |
[in] | root_path | root path of JSON |
Definition at line 230 of file GeometryReader.cpp.
References polyfem::utils::json_as_array(), polyfem::log_and_throw_error(), and read_fem_mesh().
Referenced by polyfem::State::load_mesh().
std::unique_ptr< Mesh > polyfem::mesh::read_fem_mesh | ( | const Units & | units, |
const json & | j_mesh, | ||
const std::string & | root_path, | ||
const bool | non_conforming = false |
||
) |
read a FEM mesh from a geometry JSON
[in] | j_mesh | geometry JSON |
[in] | root_path | root path of JSON |
[in] | non_conforming | if true, the mesh will be non-conforming |
Definition at line 25 of file GeometryReader.cpp.
References polyfem::utils::Selection::build_selections(), construct_affine_transformation(), polyfem::Units::convert(), polyfem::mesh::Mesh::create(), polyfem::utils::is_param_valid(), polyfem::Units::length(), polyfem::log_and_throw_error(), polyfem::logger(), and polyfem::utils::resolve_path().
Referenced by read_fem_geometry().
Obstacle polyfem::mesh::read_obstacle_geometry | ( | const Units & | units, |
const json & | geometry, | ||
const std::vector< json > & | displacements, | ||
const std::vector< json > & | dirichlets, | ||
const std::string & | root_path, | ||
const int | dim, | ||
const std::vector< std::string > & | names = std::vector< std::string >() , |
||
const std::vector< Eigen::MatrixXd > & | vertices = std::vector< Eigen::MatrixXd >() , |
||
const std::vector< Eigen::MatrixXi > & | cells = std::vector< Eigen::MatrixXi >() , |
||
const bool | non_conforming = false |
||
) |
read a FEM mesh from a geometry JSON
[in] | geometry | geometry JSON object(s) |
[in] | displacements | displacements JSON object(s) |
[in] | dirichlets | dirichlet bc JSON object(s) |
[in] | root_path | root path of JSON |
Definition at line 438 of file GeometryReader.cpp.
References polyfem::mesh::Obstacle::append_mesh(), polyfem::mesh::Obstacle::append_mesh_sequence(), polyfem::mesh::Obstacle::append_plane(), faces, polyfem::utils::is_param_valid(), polyfem::utils::json_as_array(), polyfem::log_and_throw_error(), read_obstacle_mesh(), polyfem::utils::resolve_path(), and polyfem::mesh::Obstacle::set_units().
Referenced by polyfem::State::load_mesh(), and polyfem::State::load_mesh().
void polyfem::mesh::read_obstacle_mesh | ( | const Units & | units, |
const json & | j_mesh, | ||
const std::string & | root_path, | ||
const int | dim, | ||
Eigen::MatrixXd & | vertices, | ||
Eigen::VectorXi & | codim_vertices, | ||
Eigen::MatrixXi & | codim_edges, | ||
Eigen::MatrixXi & | faces | ||
) |
read a obstacle mesh from a geometry JSON
[in] | j_mesh | geometry JSON |
[in] | root_path | root path of JSON |
[out] | vertices | V x 3/2 output vertices positions |
[out] | codim_vertices | indicies in vertices for the codimensional vertices |
[out] | codim_edges | indicies in vertices for the codimensional edges |
[out] | faces | indicies in vertices for the surface faces |
Definition at line 327 of file GeometryReader.cpp.
References construct_affine_transformation(), polyfem::Units::convert(), faces, polyfem::utils::is_param_valid(), polyfem::Units::length(), polyfem::log_and_throw_error(), read_surface_mesh(), and polyfem::utils::resolve_path().
Referenced by read_obstacle_geometry().
bool polyfem::mesh::read_surface_mesh | ( | const std::string & | mesh_path, |
Eigen::MatrixXd & | vertices, | ||
Eigen::VectorXi & | codim_vertices, | ||
Eigen::MatrixXi & | codim_edges, | ||
Eigen::MatrixXi & | faces | ||
) |
read a surface mesh
[in] | mesh_path | path to mesh file |
[out] | vertices | V x 3/2 output vertices positions |
[out] | codim_vertices | indicies in vertices for the codimensional vertices |
[out] | codim_edges | indicies in vertices for the codimensional edges |
[out] | faces | indicies in vertices for the surface faces |
Definition at line 1091 of file MeshUtils.cpp.
References polyfem::utils::StringUtils::endswith(), extract_triangle_surface_from_tets(), faces, find_codim_vertices(), is_planar(), polyfem::io::MshReader::load(), polyfem::logger(), and polyfem::io::OBJReader::read().
Referenced by load_collision_proxy_mesh(), and read_obstacle_mesh().
void polyfem::mesh::reduced_L2_projection | ( | const Eigen::MatrixXd & | M, |
const Eigen::MatrixXd & | A, | ||
const Eigen::Ref< const Eigen::MatrixXd > & | y, | ||
const std::vector< int > & | boundary_nodes, | ||
Eigen::Ref< Eigen::MatrixXd > | x | ||
) |
Definition at line 47 of file L2Projection.cpp.
Eigen::MatrixXd polyfem::mesh::refine_edge | ( | const VectorNd & | a, |
const VectorNd & | b, | ||
const double | max_edge_length | ||
) |
Refine an edge (a, b) so each refined edge has length at most max_edge_length.
a | first vertex of the edge |
b | second vertex of the edge |
max_edge_length | maximum edge length |
Definition at line 183 of file UpsampleMesh.cpp.
References max_edge_length(), and V.
Referenced by refine_triangle_edges().
|
inline |
Definition at line 137 of file Refinement.hpp.
References polyfem::mesh::Polygons::no_split_func(), polyfem::mesh::Polygons::polar_split_func(), and refine_polygonal_mesh().
void polyfem::mesh::refine_polygonal_mesh | ( | const GEO::Mesh & | M_in, |
GEO::Mesh & | M_out, | ||
Polygons::SplitFunction | split_func | ||
) |
Refine a polygonal mesh.
Quads and triangles are split into quads. If refine_polygons
is set to true
, then polygonal facets are also split into a layer of padding quads, and a new polygon is created around the barycenter
[in] | M_in | Surface mesh to subdivide |
[out] | M_out | Refined mesh |
[in] | split_func | Functional used to split the new polygon interiors (boundary has already been split) |
Definition at line 620 of file Refinement.cpp.
References polyfem::mesh::Navigation::Index::edge, polyfem::F, facet_barycenter(), polyfem::mesh::Navigation::get_index_from_face(), mesh_create_vertex(), mesh_vertex(), polyfem::mesh::Navigation::next_around_face(), polyfem::mesh::Navigation::switch_edge(), polyfem::mesh::Navigation::switch_vertex(), V, and polyfem::mesh::Navigation::Index::vertex.
Referenced by polyfem::mesh::CMesh2D::refine(), and refine_polygonal_mesh().
void polyfem::mesh::refine_quad_mesh | ( | const Eigen::MatrixXd & | IV, |
const Eigen::MatrixXi & | IF, | ||
Eigen::MatrixXd & | OV, | ||
Eigen::MatrixXi & | OF | ||
) |
Definition at line 507 of file Refinement.cpp.
References instantiate_pattern().
void polyfem::mesh::refine_triangle_edges | ( | const VectorNd & | a, |
const VectorNd & | b, | ||
const VectorNd & | c, | ||
const double | max_edge_len, | ||
Eigen::MatrixXd & | V, | ||
Eigen::MatrixXi & | E | ||
) |
Refine the edges of a triangle (a, b, c) so each refined edge has length at most max_edge_length.
a | first vertex of the triangle |
b | second vertex of the triangle |
c | third vertex of the triangle |
max_edge_len | maximum edge length |
V | vertices of the refined edges |
E | refined edges |
Definition at line 194 of file UpsampleMesh.cpp.
References refine_edge(), and V.
Referenced by irregular_triangle().
void polyfem::mesh::refine_triangle_mesh | ( | const GEO::Mesh & | M_in, |
GEO::Mesh & | M_out | ||
) |
Refine a triangle mesh.
Each input triangle is split into 4 new triangles
[in] | M_in | Input surface mesh |
[out] | M_out | Output surface mesh |
Definition at line 736 of file Refinement.cpp.
References polyfem::mesh::Navigation::Index::edge, polyfem::mesh::Navigation::get_index_from_face(), mesh_create_vertex(), mesh_vertex(), polyfem::mesh::Navigation::next_around_face(), polyfem::mesh::Navigation::switch_edge(), polyfem::mesh::Navigation::switch_vertex(), and polyfem::mesh::Navigation::Index::vertex.
Referenced by polyfem::mesh::CMesh2D::refine().
void polyfem::mesh::regular_grid_tessellation | ( | const Eigen::MatrixXd & | V, |
const Eigen::MatrixXi & | F, | ||
const double | max_edge_length, | ||
Eigen::MatrixXd & | V_out, | ||
Eigen::MatrixXi & | F_out | ||
) |
Tessilate a triangle mesh (V, F) with regular grids of triangles of maximum edge length.
V | vertices |
F | triangular faces |
max_edge_length | maximum edge length |
V_out | tessilated vertices |
F_out | tessilated faces |
Definition at line 148 of file UpsampleMesh.cpp.
References polyfem::F, max_edge_length(), regular_grid_triangle_barycentric_coordinates(), stitch_mesh(), and V.
void polyfem::mesh::regular_grid_triangle_barycentric_coordinates | ( | const int | n, |
Eigen::MatrixXd & | V, | ||
Eigen::MatrixXi & | F | ||
) |
Compute the barycentric coordinates of a regular grid of triangles.
[in] | n | Number of triangles along each edge |
[out] | V | Vertices of the regular grid |
[out] | F | Faces of the regular grid |
Definition at line 104 of file UpsampleMesh.cpp.
References polyfem::F, and V.
Referenced by build_collision_proxy(), and regular_grid_tessellation().
void polyfem::mesh::reorder_mesh | ( | Eigen::MatrixXd & | V, |
Eigen::MatrixXi & | F, | ||
const Eigen::VectorXi & | C, | ||
Eigen::VectorXi & | R | ||
) |
Reorder vertices of a mesh using color tags, so that vertices are ordered by increasing colors.
[in,out] | V | V x d input mesh vertices |
[in,out] | F | F x k input mesh faces |
[in] | C | V per vertex color tag |
[out] | R | max(C)+1 vector of starting indices for each colors (last value is the total number of vertices) |
Definition at line 325 of file MeshUtils.cpp.
References V.
void polyfem::mesh::sample_polygon | ( | const Eigen::MatrixXd & | IV, |
int | num_samples, | ||
Eigen::MatrixXd & | S | ||
) |
Sample points on a polygon, evenly spaced from each other.
[in] | IV | #IV x 2 vertex positions for the input polygon |
[in] | num_samples | Desired number of samples |
[out] | S | #S x 2 output sample positions |
Definition at line 265 of file PolygonUtils.cpp.
Referenced by polyfem::basis::PolygonalBasis2d::build_bases().
void polyfem::mesh::sample_surface | ( | const Eigen::MatrixXd & | V, |
const Eigen::MatrixXi & | F, | ||
int | num_samples, | ||
Eigen::MatrixXd & | P, | ||
Eigen::MatrixXd * | N = nullptr , |
||
int | num_lloyd = 10 , |
||
int | num_newton = 10 |
||
) |
Samples points on a surface.
[in] | V | V x 3 input mesh vertices |
[in] | F | F x 3 input mesh facets |
[in] | num_samples | Number of desired samples |
[out] | P | num_samples x 3 sample points positions |
[out] | N | num_samples x 3 of normals estimated from the original surface (optional argument) |
[in] | num_lloyd | Number of Lloyd iterations |
[in] | num_newton | Number of Newton iterations |
Definition at line 884 of file MeshUtils.cpp.
References to_geogram_mesh(), and V.
void polyfem::mesh::signed_squared_distances | ( | const Eigen::MatrixXd & | V, |
const Eigen::MatrixXi & | F, | ||
const Eigen::MatrixXd & | P, | ||
Eigen::VectorXd & | D | ||
) |
Computes the signed squared distance from a list of points to a triangle mesh.
This function build a AABB tree of the input mesh, computes the distance for each query point to the closest triangle, and then determines the sign by casting a vertical ray from the query point and counting the number of intersections with the input mesh
[in] | V | V x 3 input mesh vertices |
[in] | F | F x 3 input mesh faces |
[in] | P | #P x 3 query points |
D | #P x 1 computed signed distances, negative inside, positive outside |
Definition at line 669 of file MeshUtils.cpp.
References to_geogram_mesh(), and V.
double polyfem::mesh::signed_volume | ( | const Eigen::MatrixXd & | V, |
const Eigen::MatrixXi & | F | ||
) |
Compute the signed volume of a surface mesh.
Definition at line 681 of file MeshUtils.cpp.
References V.
Referenced by orient_closed_surface(), and polyfem::mesh::MeshProcessing3D::refine_red_refinement_tet().
void polyfem::mesh::singular_edges | ( | const GEO::Mesh & | M, |
const Eigen::VectorXi & | V, | ||
Eigen::MatrixX2i & | E | ||
) |
Definition at line 48 of file Singularities.cpp.
References V.
Referenced by singularity_graph().
void polyfem::mesh::singular_vertices | ( | const GEO::Mesh & | M, |
Eigen::VectorXi & | V, | ||
int | regular_degree = 4 , |
||
bool | ignore_border = true |
||
) |
Definition at line 8 of file Singularities.cpp.
References V.
Referenced by singularity_graph().
void polyfem::mesh::singularity_graph | ( | const GEO::Mesh & | M, |
Eigen::VectorXi & | V, | ||
Eigen::MatrixX2i & | E, | ||
int | regular_degree = 4 , |
||
bool | ignore_border = true |
||
) |
Definition at line 75 of file Singularities.cpp.
References singular_edges(), singular_vertices(), and V.
void polyfem::mesh::stitch_mesh | ( | const Eigen::MatrixXd & | V, |
const Eigen::MatrixXi & | F, | ||
const std::vector< Eigen::Triplet< double > > & | W, | ||
Eigen::MatrixXd & | V_out, | ||
Eigen::MatrixXi & | F_out, | ||
std::vector< Eigen::Triplet< double > > & | W_out, | ||
const double | epsilon = 1e-5 |
||
) |
Stitch a triangle mesh (V, F) together by removing duplicate vertices.
Also removes weights in W that correspond to duplicate vertices.
[in] | V | Input vertices |
[in] | F | Input faces |
[in] | W | Input weights |
[out] | V_out | Output vertices (duplicate vertices removed) |
[out] | F_out | Output faces (updated to use V_out) |
[out] | W_out | Output weights (updated to use V_out) |
[in] | epsilon | Tolerance for duplicate vertices |
indices: #V_out by 1 list of indices so V_out = V(indices,:) inverse: V by 1 list of indices so V = V_out(inverse,:)
Definition at line 46 of file UpsampleMesh.cpp.
References polyfem::F, polyfem::utils::inverse(), and V.
void polyfem::mesh::stitch_mesh | ( | const Eigen::MatrixXd & | V, |
const Eigen::MatrixXi & | F, | ||
Eigen::MatrixXd & | V_out, | ||
Eigen::MatrixXi & | F_out, | ||
const double | epsilon = 1e-5 |
||
) |
Stitch a triangle mesh (V, F) together by removing duplicate vertices.
[in] | V | Input vertices |
[in] | F | Input faces |
[out] | V_out | Output vertices (duplicate vertices removed) |
[out] | F_out | Output faces (updated to use V_out) |
[in] | epsilon | Tolerance for duplicate vertices |
Definition at line 35 of file UpsampleMesh.cpp.
References polyfem::F, stitch_mesh(), and V.
Referenced by build_collision_proxy(), irregular_tessellation(), regular_grid_tessellation(), and stitch_mesh().
void polyfem::mesh::tertrahedralize_star_shaped_surface | ( | const Eigen::MatrixXd & | V, |
const Eigen::MatrixXi & | F, | ||
const Eigen::RowVector3d & | kernel, | ||
Eigen::MatrixXd & | OV, | ||
Eigen::MatrixXi & | OF, | ||
Eigen::MatrixXi & | OT | ||
) |
Tetrahedralize a star-shaped mesh, with a given point in its kernel.
[in] | V | V x 3 input mesh vertices |
[in] | F | F x 3 input mesh triangles |
[in] | kernel | A point in the kernel |
[out] | OV | #OV x 3 output mesh vertices |
[out] | OF | #OF x 3 output mesh surface triangles |
[out] | OT | #OT x 4 output mesh tetrahedra |
Definition at line 869 of file MeshUtils.cpp.
References V.
Referenced by polyfem::quadrature::PolyhedronQuadrature::get_quadrature(), and polyfem::utils::RefElementSampler::sample_polyhedron().
void polyfem::mesh::to_geogram_mesh | ( | const Eigen::MatrixXd & | V, |
const Eigen::MatrixXi & | F, | ||
GEO::Mesh & | M | ||
) |
Converts a triangle mesh to a Geogram mesh.
Definition at line 575 of file MeshUtils.cpp.
References V.
Referenced by polyfem::mesh::CMesh2D::build_from_matrices(), polyfem::mesh::NCMesh2D::build_from_matrices(), sample_surface(), polyfem::mesh::CMesh3D::save(), and signed_squared_distances().
void polyfem::mesh::to_geogram_mesh | ( | const Mesh3D & | mesh, |
GEO::Mesh & | M | ||
) |
Converts a hex mesh to a Geogram mesh.
[in] | mesh | Input mesh |
[out] | M | Output Geogram mesh |
Definition at line 811 of file MeshUtils.cpp.
References polyfem::mesh::Mesh::face_vertex(), polyfem::mesh::Mesh3D::get_ordered_vertices_from_hex(), polyfem::mesh::Mesh::is_boundary_face(), polyfem::mesh::Mesh::is_cube(), polyfem::mesh::Mesh::n_cells(), polyfem::mesh::Mesh::n_face_vertices(), polyfem::mesh::Mesh::n_faces(), polyfem::mesh::Mesh::n_vertices(), and polyfem::mesh::Mesh::point().
Eigen::MatrixXd polyfem::mesh::unconstrained_L2_projection | ( | const Eigen::SparseMatrix< double > & | M, |
const Eigen::SparseMatrix< double > & | A, | ||
const Eigen::Ref< const Eigen::MatrixXd > & | y | ||
) |
Definition at line 17 of file L2Projection.cpp.
References polyfem::logger(), x, and y.
Referenced by polyfem::mesh::Remesher::project_quantities().
void polyfem::mesh::unique_facet_tuples | ( | const wmtk::TetMesh & | m, |
std::vector< wmtk::TetMesh::Tuple > & | tuples | ||
) |
Definition at line 43 of file LocalMesh.cpp.
void polyfem::mesh::unique_facet_tuples | ( | const wmtk::TriMesh & | m, |
std::vector< wmtk::TriMesh::Tuple > & | tuples | ||
) |
Definition at line 38 of file LocalMesh.cpp.
Referenced by polyfem::mesh::LocalMesh< M >::LocalMesh().