54 follower_face(
int id_, Eigen::Vector2d p1_, Eigen::Vector2d p2_, Eigen::Vector2d p3_)
164 edges.setConstant(3 * (
dim - 1), 1, -1);
165 faces.setConstant(4 * (
dim - 2), 1, -1);
166 children.setConstant(std::round(pow(2,
dim)), 1, -1);
203 void refine(
const int n_refinement,
const double t)
override;
215 for (
const auto &face :
faces)
225 for (
const auto &edge :
edges)
252 int face_edge(
const int f_id,
const int le_id)
const;
285 void set_body_ids(
const std::vector<int> &body_ids)
override;
304 std::vector<uint32_t>
vertex_neighs(
const int v_gid)
const override;
305 std::vector<uint32_t>
edge_neighs(
const int e_gid)
const override;
394 std::unique_ptr<Mesh>
copy()
const override;
401 return (
long)((long)984120265 * a[0] + (
long)125965121 * a[1]);
409 return (
long)((long)984120265 * a[0] + (
long)125965121 * a[1] + (long)495698413 * a[2]);
426 int map_id(
const std::vector<int> &map,
const int id)
const
430 assert(
id >= 0 &&
id <
int(map.size()));
451 int find_face(
const int v1,
const int v2,
const int v3)
const {
return find_face(Eigen::Vector3i(v1, v2, v3)); };
454 int get_face(
const int v1,
const int v2,
const int v3) {
return get_face(Eigen::Vector3i(v1, v2, v3)); };
456 void traverse_edge(Eigen::Vector2i v,
double p1,
double p2,
int depth, std::vector<follower_edge> &list)
const;
459 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;
464 int add_element(Eigen::Vector4i v,
int parent = -1);
486 std::unordered_map<Eigen::Vector2i, int, ArrayHasher2D>
midpointMap;
487 std::unordered_map<Eigen::Vector2i, int, ArrayHasher2D>
edgeMap;
488 std::unordered_map<Eigen::Vector3i, int, ArrayHasher3D>
faceMap;
3D mesh interface: the elements are the cells (tetrahedra, hexahedra, prisms, pyramids or general pol...
Format-independent input used to construct a runtime Mesh.
Abstract mesh class to capture 2d/3d conforming and non-conforming meshes.
bool has_boundary_ids() const
checks if surface selections are available
virtual int get_default_boundary_id(const int primitive) const
Get the default boundary selection of an element (face in 3d, edge in 2d)
Non-conforming 3D tetrahedral mesh with hanging nodes, for adaptive h-refinement: refine_element() sp...
int all_to_valid_vertex(const int id) const
void remove_elements(const std::vector< bool > &keep) override
Remove all top-dimensional elements whose mask entry is false.
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
void update_labels_after_refinement()
After a refinement: rebuild the body/boundary id arrays from the per-entity labels (inherited by the ...
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
void stale_index_error() const
Throws: the id maps are stale (prepare_mesh() was not called after editing the mesh).
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
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
bool index_prepared
Whether the valid <-> all id maps match the current topology.
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
bool build_topology(const MeshData &data) override
Construct only the dimension-specific topology.
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
void compute_elements_tag() override
compute element types, see ElementType
NCMesh3D & operator=(NCMesh3D &&)=default
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 map_id(const std::vector< int > &map, const int id) const
int cell_face_orientation(const int, const int) const override
int all_to_valid_face(const int id) const
int n_face_cells(const int f_id) const
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
Set of ids stored as a sorted vector: iterates in increasing order like std::set<int>,...
void insert(const int id)
const_iterator cbegin() const
size_t erase(const int id)
Removes id; returns the number of removed ids (0 or 1).
Eigen::Matrix< T, Eigen::Dynamic, 1, Eigen::ColMajor, MaxSize, 1 > InlineVector
Small vector stored inline (no heap allocation), with the VectorXi / VectorXd API; used for the per-e...
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)
InlineVector< int, 3 > vertices
std::vector< int > global_ids
std::vector< int > followers
InlineVector< int, 6 > edges
InlineVector< int, 4 > geom_vertices
ncElem(const int dim_, const Eigen::VectorXi &vertices_, const int level_, const int parent_)
InlineVector< int, 4 > vertices
bool is_not_valid() const
InlineVector< int, 8 > children
InlineVector< int, 4 > faces
void remove_element(const int e)
ncVert(const Eigen::VectorXd &pos_)
InlineVector< double, 3 > pos
void add_element(const int e)