32 follower_face(
int id_, Eigen::Vector2d p1_, Eigen::Vector2d p2_, Eigen::Vector2d p3_)
144 edges.setConstant(3 * (
dim - 1), 1, -1);
145 faces.setConstant(4 * (
dim - 2), 1, -1);
146 children.setConstant(std::round(pow(2,
dim)), 1, -1);
184 void refine(
const int n_refinement,
const double t)
override;
192 for (
const auto &face :
faces)
200 for (
const auto &edge :
edges)
224 int face_edge(
const int f_id,
const int le_id)
const;
234 bool save(
const std::string &path)
const override
263 void set_body_ids(
const std::vector<int> &body_ids)
override;
278 std::vector<uint32_t>
vertex_neighs(
const int v_gid)
const override;
279 std::vector<uint32_t>
edge_neighs(
const int e_gid)
const override;
361 std::unique_ptr<Mesh>
copy()
const override;
368 return (
long)((long)984120265 * a[0] + (
long)125965121 * a[1]);
376 return (
long)((long)984120265 * a[0] + (
long)125965121 * a[1] + (long)495698413 * a[2]);
381 bool load(
const std::string &path)
override;
382 bool load(
const GEO::Mesh &M)
override;
449 int find_face(
const int v1,
const int v2,
const int v3)
const {
return find_face(Eigen::Vector3i(v1, v2, v3)); };
452 int get_face(
const int v1,
const int v2,
const int v3) {
return get_face(Eigen::Vector3i(v1, v2, v3)); };
454 void traverse_edge(Eigen::Vector2i v,
double p1,
double p2,
int depth, std::vector<follower_edge> &list)
const;
457 void traverse_face(
int v1,
int v2,
int v3, Eigen::Vector2d p1, Eigen::Vector2d p2, Eigen::Vector2d p3,
int depth, std::vector<follower_face> &face_list, std::vector<int> &edge_list)
const;
462 int add_element(Eigen::Vector4i v,
int parent = -1);
474 std::unordered_map<Eigen::Vector2i, int, ArrayHasher2D>
midpointMap;
475 std::unordered_map<Eigen::Vector2i, int, ArrayHasher2D>
edgeMap;
476 std::unordered_map<Eigen::Vector3i, int, ArrayHasher3D>
faceMap;
Abstract mesh class to capture 2d/3d conforming and non-conforming meshes.
int all_to_valid_vertex(const int id) const
int find_vertex(Eigen::Vector2i v) const
bool is_boundary_element(const int element_global_id) const override
is cell boundary
void compute_body_ids(const std::function< int(const size_t, const std::vector< int > &, const RowVectorNd &)> &marker) override
computes boundary selections based on a function
std::vector< int > all_to_valid_elemMap
int leader_face_of_vertex(const int v_id) const
int find_edge(const int v1, const int v2) const
int cell_ref_level(const int c_id) const
int n_faces() const override
number of faces
int n_cell_vertices(const int c_id) const override
number of vertices of a cell
NCMesh3D & operator=(const NCMesh3D &)=default
int valid_to_all_edge(const int id) const
Navigation3D::Index next_around_edge(Navigation3D::Index idx) const override
int face_edge(const int f_id, const int le_id) const
int n_cell_faces(const int c_id) const override
void traverse_edge(Eigen::Vector2i v, double p1, double p2, int depth, std::vector< follower_edge > &list) const
int n_edge_cells(const int e_id) const
int get_boundary_id(const int primitive) const override
Get the boundary selection of an element (face in 3d, edge in 2d)
std::unordered_map< Eigen::Vector2i, int, ArrayHasher2D > midpointMap
int n_cells() const override
number of cells
void build_element_vertex_adjacency()
void prepare_mesh() override
method used to finalize the mesh.
int n_follower_faces(const int e_id) const
bool save(const std::string &path) const override
std::vector< ncBoundary > edges
int valid_to_all_face(const int id) const
void bounding_box(RowVectorNd &min, RowVectorNd &max) const override
computes the bbox of the mesh
void append(const Mesh &mesh) override
appends a new mesh to the end of this
std::vector< int > refineHistory
double edge_length(const int gid) const override
edge length
int n_edges() const override
number of edges
void compute_boundary_ids(const std::function< int(const size_t, const std::vector< int > &, const RowVectorNd &, bool)> &marker) override
computes boundary selections based on a function
int n_follower_edges(const int e_id) const
int get_edge(Eigen::Vector2i v)
void set_point(const int global_index, const RowVectorNd &p) override
Set the point.
int add_element(Eigen::Vector4i v, int parent=-1)
int get_face(Eigen::Vector3i v)
void attach_higher_order_nodes(const Eigen::MatrixXd &V, const std::vector< std::vector< int > > &nodes) override
attach high order nodes
int n_face_vertices(const int f_id) const override
number of vertices of a face
int leader_edge_of_vertex(const int v_id) const
RowVectorNd cell_barycenter(const int c) const override
cell barycenter
std::vector< uint32_t > edge_neighs(const int e_gid) const override
int all_to_valid_elem(const int id) const
int n_vertices() const override
number of vertices
int find_face(const int v1, const int v2, const int v3) const
std::vector< ncVert > vertices
Navigation3D::Index get_index_from_element_edge(int hi, int v0, int v1) const override
std::unordered_map< Eigen::Vector2i, int, ArrayHasher2D > edgeMap
void traverse_face(int v1, int v2, int v3, Eigen::Vector2d p1, Eigen::Vector2d p2, Eigen::Vector2d p3, int depth, std::vector< follower_face > &face_list, std::vector< int > &edge_list) const
int find_vertex(const int v1, const int v2) const
virtual ~NCMesh3D()=default
void refine(const int n_refinement, const double t) override
refine the mesh
void normalize() override
normalize the mesh
std::vector< int > all_to_valid_vertexMap
int all_to_valid_edge(const int id) const
void get_face_elements_neighs(const int f_id, std::vector< int > &ids) const
std::unique_ptr< Mesh > copy() const override
Create a copy of the mesh.
int valid_to_all_elem(const int id) const
void refine_element(int id_full)
Navigation3D::Index switch_vertex(Navigation3D::Index idx) const override
int leader_face_of_edge(const int e_id) const
RowVectorNd kernel(const int cell_id) const override
bool is_boundary_vertex(const int vertex_global_id) const override
is vertex boundary
int cell_face(const int c_id, const int lf_id) const override
bool build_from_matrices(const Eigen::MatrixXd &V, const Eigen::MatrixXi &F) override
build a mesh from matrices
void compute_elements_tag() override
compute element types, see ElementType
NCMesh3D & operator=(NCMesh3D &&)=default
RowVectorNd point(const int global_index) const override
point coordinates
std::vector< int > all_to_valid_edgeMap
int find_edge(Eigen::Vector2i v) const
Navigation3D::Index get_index_from_element(int hi, int lf, int lv) const override
int get_face(const int v1, const int v2, const int v3)
bool is_boundary_face(const int face_global_id) const override
is face boundary
int cell_vertex(const int f_id, const int lv_id) const override
id of the vertex of a cell
std::vector< int > all_to_valid_faceMap
void coarsen_element(int id_full)
int leader_edge_of_edge(const int e_id) const
Navigation3D::Index next_around_face(Navigation3D::Index idx) const override
std::vector< int > valid_to_all_elemMap
std::vector< int > valid_to_all_edgeMap
void build_face_follower_chain()
RowVectorNd face_barycenter(const int f) const override
face barycenter
void build_edge_follower_chain()
int n_cell_edges(const int c_id) const override
int get_body_id(const int primitive) const override
Get the volume selection of an element (cell in 3d, face in 2d)
bool is_boundary_edge(const int edge_global_id) const override
is edge boundary
Navigation3D::Index switch_element(Navigation3D::Index idx) const override
void get_vertex_elements_neighs(const int v_id, std::vector< int > &ids) const override
NCMesh3D(const NCMesh3D &)=default
std::vector< ncElem > elements
std::unordered_map< Eigen::Vector3i, int, ArrayHasher3D > faceMap
RowVectorNd edge_barycenter(const int e) const override
edge barycenter
std::vector< int > valid_to_all_faceMap
std::vector< uint32_t > vertex_neighs(const int v_gid) const override
std::vector< int > valid_to_all_vertexMap
std::array< int, 4 > get_ordered_vertices_from_tet(const int element_index) const override
void update_elements_tag() override
Update elements types.
int get_edge(const int v1, const int v2)
int valid_to_all_vertex(const int id) const
int edge_vertex(const int e_id, const int lv_id) const override
id of the edge vertex
void refine_elements(const std::vector< int > &ids)
void build_index_mapping()
int get_vertex(Eigen::Vector2i v)
int find_face(Eigen::Vector3i v) const
void get_edge_elements_neighs(const int e_id, std::vector< int > &ids) const override
int cell_edge(const int c_id, const int le_id) const override
Navigation3D::Index switch_face(Navigation3D::Index idx) const override
int leader_face_of_face(const int f_id) const
Eigen::SparseMatrix< bool, Eigen::RowMajor > elementAdj
bool is_conforming() const override
if the mesh is conforming
int face_vertex(const int f_id, const int lv_id) const override
id of the face vertex
int all_to_valid_face(const int id) const
int n_face_cells(const int f_id) const
bool load(const std::string &path) override
loads a mesh from the path
Navigation3D::Index get_index_from_element_face(int hi, int v0, int v1, int v2) const override
void set_body_ids(const std::vector< int > &body_ids) override
Set the volume sections.
void set_boundary_ids(const std::vector< int > &boundary_ids) override
Set the boundary selection from a vector.
NCMesh3D(NCMesh3D &&)=default
std::vector< ncBoundary > faces
Navigation3D::Index switch_edge(Navigation3D::Index idx) const override
Eigen::Matrix< double, 1, Eigen::Dynamic, Eigen::RowMajor, 1, 3 > RowVectorNd
long operator()(const Eigen::Vector2i &a) const
long operator()(const Eigen::Vector3i &a) const
follower_edge(int id_, double p1_, double p2_)
follower_face(int id_, Eigen::Vector2d p1_, Eigen::Vector2d p2_, Eigen::Vector2d p3_)
int find_opposite_element(int e) const
void add_element(const int e)
void remove_element(const int e)
ncBoundary(const Eigen::VectorXi vert)
std::set< int > elem_list
std::vector< int > global_ids
std::vector< int > followers
Eigen::VectorXi geom_vertices
bool is_not_valid() const
ncElem(const int dim_, const Eigen::VectorXi vertices_, const int level_, const int parent_)
void remove_element(const int e)
void add_element(const int e)
std::set< int > elem_list
ncVert(const Eigen::VectorXd pos_)