Commit c523c0d6 authored by Mike Kremer's avatar Mike Kremer

Added function to get the genus of a mesh.

git-svn-id: http://www.openvolumemesh.org/svnrepo/OpenVolumeMesh/trunk@231 66977474-1d4b-4f09-8fe9-267525286df2
parent 63b7ecaf
......@@ -226,6 +226,13 @@ public:
/// Get number of cells in mesh
virtual unsigned int n_cells() const { return cells_.size(); }
unsigned int genus() const {
return (1 - (n_vertices() -
n_edges() +
n_faces() -
n_cells())/2.0);
}
private:
// Cache total vertex number
......
......@@ -482,6 +482,13 @@ TEST_F(HexahedralMeshBase, TopologyCheckFail) {
EXPECT_EQ(HexahedralMesh::InvalidCellHandle, mesh_.add_cell(chfaces, true));
}
TEST_F(PolyhedralMeshBase, VolumeMeshGenus) {
generatePolyhedralMesh(mesh_);
EXPECT_EQ(0, mesh_.genus());
}
TEST_F(PolyhedralMeshBase, VolumeMeshConnectivity) {
generatePolyhedralMesh(mesh_);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment