30 follower_face(
int id_, Eigen::Vector2d p1_, Eigen::Vector2d p2_, Eigen::Vector2d p3_)
126 edges.setConstant(3 * (
dim - 1), 1, -1);
127 faces.setConstant(4 * (
dim - 2), 1, -1);
128 children.setConstant(std::round(pow(2,
dim)), 1, -1);
172 for (
const auto &edge :
edges)
222 void refine(
const int n_refinement,
const double t)
override;
224 bool save(
const std::string &path)
const override
234 std::pair<RowVectorNd, int>
face_node(
const Navigation::Index &index,
const int n_new_nodes,
const int i,
const int j)
const override;
259 void set_body_ids(
const std::vector<int> &body_ids)
override;
302 std::unique_ptr<Mesh>
copy()
const override;
309 return (
long)((long)984120265 * a[0] + (
long)125965121 * a[1]);
314 bool load(
const std::string &path)
override;
315 bool load(
const GEO::Mesh &mesh)
override;
371 void traverse_edge(Eigen::Vector2i v,
double p1,
double p2,
int depth, std::vector<follower_edge> &list)
const;
381 int add_element(Eigen::Vector3i v,
int parent = -1);
392 std::unordered_map<Eigen::Vector2i, int, ArrayHasher2D>
midpointMap;
393 std::unordered_map<Eigen::Vector2i, int, ArrayHasher2D>
edgeMap;
Abstract mesh class to capture 2d/3d conforming and non-conforming meshes.
int all_to_valid_elem(const int id) const
int find_edge(Eigen::Vector2i v) const
bool is_boundary_element(const int element_global_id) const override
is cell boundary
void traverse_edge(Eigen::Vector2i v, double p1, double p2, int depth, std::vector< follower_edge > &list) const
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
Navigation::Index switch_face(Navigation::Index idx) const override
bool save(const std::string &path) const override
std::vector< int > valid_to_all_edgeMap
int n_face_neighbors(const int e_id) const
NCMesh2D(NCMesh2D &&)=default
RowVectorNd point(const int global_index) const override
point coordinates
Navigation::Index switch_vertex(Navigation::Index idx) const override
int leader_edge_of_vertex(const int v_id) const
std::unique_ptr< Mesh > copy() const override
Create a copy of the mesh.
void attach_higher_order_nodes(const Eigen::MatrixXd &V, const std::vector< std::vector< int > > &nodes) override
attach high order nodes
int face_edge(const int f_id, const int le_id) const
void refine_elements(const std::vector< int > &ids)
void prepare_mesh() override
method used to finalize the mesh.
std::vector< ncVert > vertices
void build_edge_follower_chain()
std::vector< int > all_to_valid_elemMap
bool is_conforming() const override
if the mesh is conforming
static double element_weight_to_edge_weight(const int l, const Eigen::Vector2d &pos)
int n_follower_edges(const int e_id) const
void refine_element(int id_full)
void set_boundary_ids(const std::vector< int > &boundary_ids) override
Set the boundary selection from a vector.
int n_faces() const override
number of faces
void set_point(const int global_index, const RowVectorNd &p) override
Set the point.
int all_to_valid_vertex(const int id) const
std::vector< ncElem > elements
int find_vertex(const int v1, const int v2) const
void set_body_ids(const std::vector< int > &body_ids) override
Set the volume sections.
Navigation::Index switch_edge(Navigation::Index idx) const override
int get_edge(Eigen::Vector2i v)
int add_element(Eigen::Vector3i v, int parent=-1)
void coarsen_element(int id_full)
int get_vertex(Eigen::Vector2i v)
Navigation::Index get_index_from_face(int f, int lv=0) const override
double edge_length(const int gid) const override
edge length
int get_boundary_id(const int primitive) const override
Get the boundary selection of an element (face in 3d, edge in 2d)
int valid_to_all_edge(const int id) const
int n_vertices() const override
number of vertices
bool is_boundary_edge(const int edge_global_id) const override
is edge boundary
int get_body_id(const int primitive) const override
Get the volume selection of an element (cell in 3d, face in 2d)
void refine(const int n_refinement, const double t) override
refine the mesh
std::pair< RowVectorNd, int > face_node(const Navigation::Index &index, const int n_new_nodes, const int i, const int j) const override
void normalize() override
normalize the mesh
std::vector< int > refineHistory
int valid_to_all_elem(const int id) const
std::vector< int > valid_to_all_elemMap
int edge_vertex(const int e_id, const int lv_id) const override
id of the edge vertex
int leader_edge_of_edge(const int e_id) const
std::vector< int > all_to_valid_edgeMap
std::vector< int > all_to_valid_vertexMap
std::unordered_map< Eigen::Vector2i, int, ArrayHasher2D > midpointMap
std::vector< ncBoundary > edges
bool build_from_matrices(const Eigen::MatrixXd &V, const Eigen::MatrixXi &F) override
build a mesh from matrices
int find_edge(const int v1, const int v2) const
void compute_elements_tag() override
compute element types, see ElementType
int face_vertex(const int f_id, const int lv_id) const override
id of the face vertex
RowVectorNd edge_barycenter(const int index) const override
edge barycenter
int all_to_valid_edge(const int id) const
std::unordered_map< Eigen::Vector2i, int, ArrayHasher2D > edgeMap
int find_vertex(Eigen::Vector2i v) const
void bounding_box(RowVectorNd &min, RowVectorNd &max) const override
computes the bbox of the mesh
int cell_vertex(const int f_id, const int lv_id) const override
id of the vertex of a cell
int face_ref_level(const int f_id) const
int n_face_vertices(const int f_id) const override
number of vertices of a face
int valid_to_all_vertex(const int id) const
virtual ~NCMesh2D()=default
void build_element_vertex_adjacency()
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_edges() const override
number of edges
NCMesh2D & operator=(const NCMesh2D &)=default
int get_edge(const int v1, const int v2)
NCMesh2D & operator=(NCMesh2D &&)=default
int face_neighbor(const int e_id) const
bool is_boundary_vertex(const int vertex_global_id) const override
is vertex boundary
Eigen::SparseMatrix< bool, Eigen::RowMajor > elementAdj
NCMesh2D(const NCMesh2D &)=default
std::vector< int > valid_to_all_vertexMap
bool load(const std::string &path) override
loads a mesh from the path
std::pair< RowVectorNd, int > edge_node(const Navigation::Index &index, const int n_new_nodes, const int i) const override
void update_elements_tag() override
Update elements types.
void build_index_mapping()
void append(const Mesh &mesh) override
appends a new mesh to the end of this
Eigen::Matrix< double, 1, Eigen::Dynamic, Eigen::RowMajor, 1, 3 > RowVectorNd
long operator()(const Eigen::Vector2i &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 remove_element(const int e)
std::vector< int > global_ids
std::set< int > elem_list
ncBoundary(const Eigen::VectorXi vert)
void add_element(const int e)
std::vector< int > followers
ncElem(const int dim_, const Eigen::VectorXi vertices_, const int level_, const int parent_)
bool is_not_valid() const
Eigen::VectorXi geom_vertices
ncVert(const Eigen::VectorXd pos_)