18#ifndef GEOM_MESH_BASE_H
19#define GEOM_MESH_BASE_H
39template <u
int8_t dim, u
int8_t verts_per_elem>
43 static_assert((
dim == 1 ||
dim == 2 ||
dim == 3),
"MeshBase: `dim` must be 1, 2, or 3.");
61 {
return verts_.col(
vert); };
78 {
return elems_.col(
elem); };
100 {
return elem_tags_; };
112 {
return elem_tags_[
elem]; };
120 {
return verts_.cols(); };
128 {
return elems_.cols(); };
152 Eigen::placeholders::all, elems_.col(
ii)
165 elems_ = elems_.colwise().reverse().eval();
183template <
typename MeshType>
197 const std::string
name =
"view"
208 const std::string
name =
"view"
223 mesh_.partition_by_elems(
submesh, elem_inds_);
239 const std::string&
name()
const {
return name_; };
246 const std::string name_ =
"view";
virtual void partition_by_elems(MeshBase< dim, verts_per_elem > &partition, ConstEigRef< EigRowVec< Index > > elem_inds) const =0
Returns a sub-mesh that contains only specified elements of this mesh.
virtual void reverse_orientation()
Reverses the orientation of each element.
Index num_verts() const
Returns the number of vertices in the mesh.
Index elem_tags(Index elem) const
Returns the tag associated with a specified element.
Index num_elems() const
Returns the number of elements in the mesh.
EigColVecN< Float, dim > verts(Index vert) const
Returns the coordinates of a specific vertex.
const EigRowVec< Index > & elem_tags() const
Returns the element tags.
EigColVecN< Index, 3 > elems(Index elem) const
Returns the vertex indices of a specific element.
EigMatNX< Float, dim > elem_centroids() const
Computes and returns the centroid of each element.
Index elems(uint8_t vert, Index elem) const
Returns the index of a specific vertex of a specific element.
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 that provides a lightweight view into a MeshBase object.
MeshView(const MeshType &mesh, ConstEigRef< EigRowVec< Index > > elem_inds, const std::string name="view")
Constructs a MeshView from a mesh and specified element indices.
const EigRowVec< Index > & elem_inds() const
Returns the parent mesh's element indices associated with this view.
const std::string & name() const
Returns the name of the view.
MeshType mesh() const
Creates and returns a new mesh containing the elements of the parent mesh associated with this view.
MeshView(const MeshType &mesh, const std::string name="view")
Constructs a MeshView from a mesh, containing all its elements.
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.
Eigen::Matrix< T, N, 1 > EigColVecN
Fixed-size column vector of size N containing type T.
Eigen::Matrix< T, N, Eigen::Dynamic > EigMatNX
Fixed-height matrix with N rows containing type T.
std::size_t Index
Unsigned integer type for indices and container sizes.
Primary namespace for the OpenBEM library.