18#ifndef GEOM_TRIANGLE_MESH_H
19#define GEOM_TRIANGLE_MESH_H
44 static_assert((
dim == 2 ||
dim == 3),
"TriangleMesh: `dim` must be 2 or 3.");
128 {
return edges_.col(
idx); };
146 {
return elem_edges_; };
155 {
return elem_edges_.col(
idx); };
165 {
return elem_edges_(
edge,
elem); };
173 {
return elem_edge_polarities_; };
182 {
return elem_edge_polarities_.col(
idx); };
192 {
return elem_edge_polarities_(
edge,
elem); };
200 {
return boundary_elems_; };
208 {
return junction_elems_; };
216 {
return internal_elems_; };
224 {
return boundary_edges_; };
232 {
return junction_edges_; };
240 {
return internal_edges_; };
248 {
return edges_.cols(); };
294 base::elems_ = base::elems_.colwise().reverse().eval();
313 bool decoupled_edges_ =
false;
const EigRowVec< Index > & elem_tags() const
Returns the element tags.
const EigMatNX< Index, verts_per_elem > & elems() const
Returns the vertex indices of each element.
const EigMatNX< Float, dim > & verts() const
Returns the coordinates of the mesh vertices.
Class defining a mesh with triangle elements.
Triangle< dim > elem_primitive(Index elem) const
Returns a Triangle primitive object representing a specific element of the mesh.
Index elem_edges(uint8_t edge, Index elem) const
Returns the index of a specific edge of a specific element.
const EigRowVec< Index > & boundary_elems() const
Returns the indices of boundary elements in the mesh.
EigColVecN< Float, 3 > elem_edge_polarities(Index idx) const
Returns the polarities of the edges of a specific element.
const EigMatNX< Index, 3 > & elem_edges() const
Returns the edge indices of each element in the mesh.
void generate_edges()
Generates edges for the mesh based on element vertices.
const EigRowVec< Index > & junction_edges() const
Returns the indices of junction edges in the mesh.
const EigRowVec< Index > & internal_elems() const
Returns the indices of internal elements in the mesh.
void partition_by_elems(MeshBase< dim, 3 > &partition, ConstEigRef< EigRowVec< Index > > elem_inds) const
Returns a sub-mesh that contains only specified elements of this mesh.
TriangleMesh(ConstEigRef< EigMatNX< Float, dim > > verts, ConstEigRef< EigMatNX< Index, 3 > > elems, const bool decoupled_edges=false)
Constructs a TriangleMesh with given vertex and element data.
Index num_edges() const
Returns the number of edges in the mesh.
const EigMatNX< Float, 3 > & elem_edge_polarities() const
Returns the polarities of the edges of each element.
const EigRowVec< Index > & boundary_edges() const
Returns the indices of boundary edges in the mesh.
const EigMatNX< Index, 2 > & edges() const
Returns index pairs of vertices of each edge in the mesh.
void partition_by_bbox(MeshBase< dim, 3 > &partition, ConstEigRef< EigMatMN< Float, dim, 2 > > bbox, const bool strict=true) const
Returns a sub-mesh that contains only elements of this mesh that lie within a given bounding box.
TriangleMesh()
Constructs an empty TriangleMesh.
EigColVecN< Index, 3 > elem_edges(Index idx) const
Returns the edge indices of a specific element.
virtual void reverse_orientation()
Reverses the orientation of each element.
TriangleMesh(ConstEigRef< EigMatNX< Float, dim > > verts, ConstEigRef< EigMatNX< Index, 3 > > elems, ConstEigRef< EigRowVec< Index > > elem_tags, const bool decoupled_edges=false)
Constructs a TriangleMesh with given vertex and element data, and element tags.
Float elem_edge_polarities(uint8_t edge, Index elem) const
Returns the polarity of a specific edge of a specific element.
void set_data(ConstEigRef< EigMatNX< Float, dim > > verts, ConstEigRef< EigMatNX< Index, 3 > > elems, ConstEigRef< EigRowVec< Index > > elem_tags, const bool decoupled_edges=false)
Sets the mesh data.
const EigRowVec< Index > & junction_elems() const
Returns the indices of junction elements in the mesh.
EigColVecN< Index, 2 > edges(Index idx) const
Returns the vertex indices of a specific edge.
Index edges(uint8_t vert, Index edge) const
Returns the index of a specific vertex of a specific edge.
const EigRowVec< Index > & internal_edges() const
Returns the indices of internal edges in the mesh.
const Eigen::Ref< const EigObj > ConstEigRef
Read-only reference to an Eigen object.
Eigen::Matrix< T, 1, Eigen::Dynamic > EigRowVec
Dynamic-size row vector containing type T.
double Float
Floating point number.
Eigen::Matrix< T, N, 1 > EigColVecN
Fixed-size column vector of size N containing type T.
std::size_t Index
Unsigned integer type for indices and container sizes.
Primary namespace for the OpenBEM library.