Hello there,
I am not sure if this is the place to ask questions about Open Volume Mesh. But i couldn't find any other mailing list. Hence i am posting here.
I am trying to create a mesh of type OpenVolumeMesh::GeometricTetrahedralMeshV3d HalfFaceMesh;
To this, i am adding tetrahedrons as follows
OpenVolumeMesh::CellPropertyT< unsigned int > TetSphereAssociativeProperty = HalfFaceMesh.request_cell_property< unsigned int >("TET_SPHERE_ASSOCIATION_ID");
int num_vol_elements = nglib::Ng_GetNE(CurrentMesh);
unsigned int tetra_cnt = 1;
for(unsigned int tetra = 0; tetra < num_vol_elements; ++tetra)
{
int CoordinateArray[4];
nglib::Ng_GetVolumeElement(CurrentMesh, tetra + 1, CoordinateArray);
long v1 = CoordinateArray[0];
long v2 = CoordinateArray[1];
long v3 = CoordinateArray[2];
long v4 = CoordinateArray[3];
VertexHandle _v1 = HalfFaceMesh.add_vertex(meshPointToVector3D(v1));
VertexHandle _v2 = HalfFaceMesh.add_vertex(meshPointToVector3D(v2));
VertexHandle _v3 = HalfFaceMesh.add_vertex(meshPointToVector3D(v3));
VertexHandle _v4 = HalfFaceMesh.add_vertex(meshPointToVector3D(v4));
CellHandle current_cell = HalfFaceMesh.add_cell(_v1, _v2, _v3, _v4);
TetSphereAssociativeProperty[current_cell] = tetra_cnt;
++tetra_cnt;
}
The issue is when i try to get neighbors of a particular tetrahedron, i run into issues.
I have tried CellCellIterator and it gives me nothing. So i wrote the code to do it in the most naive way possible also (i know its quadratic).
std::set< CellHandle > getUniqueNeighbouringTetsForGivenTets(CellHandle input_tetrahedron)
{
std::set< CellHandle > matching_cells;
std::set< FaceHandle > matching_faces = getFacesForGivenCell(input_tetrahedron);
HalfFaceMesh.enable_bottom_up_incidences(true);
for(auto mf_iter = matching_faces.begin(); mf_iter != matching_faces.end(); ++mf_iter)
{
for(CellIterator c_it = HalfFaceMesh.cells_begin(); c_it != HalfFaceMesh.cells_end(); ++c_it)
{
if(*c_it != input_tetrahedron)
{
std::set< FaceHandle > intermediate_matching_faces = getFacesForGivenCell(*c_it);
for(auto mff_iter = intermediate_matching_faces.begin(); mff_iter != intermediate_matching_faces.end(); ++mff_iter)
{
if(*mff_iter == *mf_iter)
{
matching_cells.emplace(*c_it);
}
}
}
}
}
return matching_cells;
}
I still do not get any neighbours at all. It almost seems like the neighbors are not associated automatically and basically one of the half faces of every face is just some garbage with an id -1.
Should i manually establish the half face connectivity between adjacent cells while building a mesh in open volume mesh ?
This was not the case in OpenMesh where we simply add polygons and edges are automatically split into half edges.
I am stuck and any help would be appreciated. Thanks in advance.
Kind regards,
S Vijai Kumar
Sent with [ProtonMail](https://protonmail.com) Secure Email.