Commit 0148560e authored by Jan Möbius's avatar Jan Möbius
Browse files

Merge branch 'Update_OVM' into 'master'

Update ovm

See merge request !240
parents c2d46a1c ba304cba
Pipeline #4363 passed with stage
in 53 minutes and 56 seconds
......@@ -59,7 +59,7 @@ echo "CPPCHECK Summary"
echo "=============================================================================="
echo -e "${NC}"
MAX_ERROR=136
MAX_ERROR=105
if [ $COUNT -gt $MAX_ERROR ]; then
echo -e ${WARNING}
......
......@@ -177,7 +177,7 @@ unsigned int OVMPropertyVisualizer<MeshT>::getClosestHalffaceId(unsigned int _fa
template <typename MeshT>
unsigned int OVMPropertyVisualizer<MeshT>::getClosestHalfedgeId(unsigned int _face, ACG::Vec3d& _hitPoint)
{
unsigned int halfface = getClosestHalffaceId(_face, _hitPoint);
OpenVolumeMesh::HalfFaceHandle halfface = OpenVolumeMesh::HalfFaceHandle(getClosestHalffaceId(_face, _hitPoint));
OpenVolumeMesh::OpenVolumeMeshFace face = mesh->halfface(halfface);
......
......@@ -121,16 +121,16 @@ void FileOpenVolumeMeshPlugin::loadMesh(const char* _filename, MeshT& _mesh, boo
for (int f = 0; f < nf; ++f) {
int nfv;
iff >> nfv;
std::vector<OpenVolumeMesh::VertexHandle> vids;
std::vector<OpenVolumeMesh::VertexHandle> vhs;
for (int v = 0; v < nfv; ++v) {
int i;
iff >> i;
vids.push_back(i);
vhs.push_back(OpenVolumeMesh::VertexHandle(i));
}
int pos_cell, neg_cell;
iff >> pos_cell;
iff >> neg_cell;
_mesh.add_face(vids);
_mesh.add_face(vhs);
}
} else {
......@@ -144,7 +144,7 @@ void FileOpenVolumeMeshPlugin::loadMesh(const char* _filename, MeshT& _mesh, boo
for (int he = 0; he < nfhe; ++he) {
int i;
iff >> i;
hes.push_back(i);
hes.push_back(OpenVolumeMesh::HalfEdgeHandle(i));
}
_mesh.add_face(hes, _topCheck);
......@@ -168,23 +168,23 @@ void FileOpenVolumeMeshPlugin::loadMesh(const char* _filename, MeshT& _mesh, boo
int ncf;
iff >> ncf;
std::vector< int > faceids;
std::vector< OpenVolumeMesh::FaceHandle > faces;
for( int f = 0; f < ncf; ++f) {
int fidx;
iff >> fidx;
faceids.push_back(fidx);
faces.push_back(OpenVolumeMesh::FaceHandle(fidx));
}
// Get right halffaces
// First determine the barycenter of the polyhedron
ACG::Vec3d c(0.0, 0.0, 0.0);
unsigned int num_faces = faceids.size();
for(std::vector<int>::const_iterator it = faceids.begin();
it != faceids.end(); ++it) {
unsigned int num_faces = faces.size();
for(auto fh : faces)
{
std::vector<OpenVolumeMesh::HalfEdgeHandle> hes = _mesh.face(*it).halfedges();
std::vector<OpenVolumeMesh::HalfEdgeHandle> hes = _mesh.face(fh).halfedges();
unsigned int val = hes.size();
ACG::Vec3d f_mid(0.0, 0.0, 0.0);
for(std::vector<OpenVolumeMesh::HalfEdgeHandle>::const_iterator p_it = hes.begin();
......@@ -197,11 +197,11 @@ void FileOpenVolumeMeshPlugin::loadMesh(const char* _filename, MeshT& _mesh, boo
// Now determine all halffaces
// Test whether their normals point into the polyhedron
std::vector<OpenVolumeMesh::HalfFaceHandle> hfhandles;
for(std::vector<int>::const_iterator it = faceids.begin();
it != faceids.end(); ++it) {
for(auto fh : faces)
{
// Get face's mid-point
std::vector<OpenVolumeMesh::HalfEdgeHandle> hes = _mesh.face(*it).halfedges();
std::vector<OpenVolumeMesh::HalfEdgeHandle> hes = _mesh.face(fh).halfedges();
unsigned int val = hes.size();
ACG::Vec3d f_mid(0.0, 0.0, 0.0);
for(std::vector<OpenVolumeMesh::HalfEdgeHandle>::const_iterator p_it = hes.begin();
......@@ -217,8 +217,8 @@ void FileOpenVolumeMeshPlugin::loadMesh(const char* _filename, MeshT& _mesh, boo
ACG::Vec3d n = (p0 - p1) % (p2 - p1);
n.normalize();
if(((c - f_mid) | n) >= 0.0) hfhandles.push_back(_mesh.halfface_handle(*it, 0));
else hfhandles.push_back(_mesh.halfface_handle(*it, 1));
if(((c - f_mid) | n) >= 0.0) hfhandles.push_back(_mesh.halfface_handle(fh, 0));
else hfhandles.push_back(_mesh.halfface_handle(fh, 1));
}
if(hfhandles.size() > 3) {
......@@ -248,7 +248,7 @@ void FileOpenVolumeMeshPlugin::loadMesh(const char* _filename, MeshT& _mesh, boo
for (int hf = 0; hf < nhf; ++hf) {
int i;
iff >> i;
hfs.push_back(i);
hfs.push_back(OpenVolumeMesh::HalfFaceHandle(i));
}
// Implement hex mesh shit
......
......@@ -516,21 +516,21 @@ int FileVTKPlugin::addTetraCellToOpenVolumeMesh(MeshT _mesh, std::vector<quint32
std::vector< std::vector<OpenVolumeMesh::VertexHandle> > faces;
faces.push_back(std::vector<OpenVolumeMesh::VertexHandle>());
faces[0].push_back(_indices[0]);
faces[0].push_back(_indices[1]);
faces[0].push_back(_indices[2]);
faces[0].push_back(OpenVolumeMesh::VertexHandle(_indices[0]));
faces[0].push_back(OpenVolumeMesh::VertexHandle(_indices[1]));
faces[0].push_back(OpenVolumeMesh::VertexHandle(_indices[2]));
faces.push_back(std::vector<OpenVolumeMesh::VertexHandle>());
faces[1].push_back(_indices[0]);
faces[1].push_back(_indices[3]);
faces[1].push_back(_indices[1]);
faces[1].push_back(OpenVolumeMesh::VertexHandle(_indices[0]));
faces[1].push_back(OpenVolumeMesh::VertexHandle(_indices[3]));
faces[1].push_back(OpenVolumeMesh::VertexHandle(_indices[1]));
faces.push_back(std::vector<OpenVolumeMesh::VertexHandle>());
faces[2].push_back(_indices[1]);
faces[2].push_back(_indices[3]);
faces[2].push_back(_indices[2]);
faces[2].push_back(OpenVolumeMesh::VertexHandle(_indices[1]));
faces[2].push_back(OpenVolumeMesh::VertexHandle(_indices[3]));
faces[2].push_back(OpenVolumeMesh::VertexHandle(_indices[2]));
faces.push_back(std::vector<OpenVolumeMesh::VertexHandle>());
faces[3].push_back(_indices[0]);
faces[3].push_back(_indices[2]);
faces[3].push_back(_indices[3]);
faces[3].push_back(OpenVolumeMesh::VertexHandle(_indices[0]));
faces[3].push_back(OpenVolumeMesh::VertexHandle(_indices[2]));
faces[3].push_back(OpenVolumeMesh::VertexHandle(_indices[3]));
std::vector<OpenVolumeMesh::HalfFaceHandle> halffacehandles;
for (unsigned int i = 0; i < faces.size(); i++)
......@@ -556,35 +556,35 @@ int FileVTKPlugin::addHexaCellToOpenVolumeMesh(MeshT _mesh, std::vector<quint32>
std::vector< std::vector<OpenVolumeMesh::VertexHandle> > faces;
faces.push_back(std::vector<OpenVolumeMesh::VertexHandle>());
faces[0].push_back(_indices[0]);
faces[0].push_back(_indices[1]);
faces[0].push_back(_indices[2]);
faces[0].push_back(_indices[3]);
faces[0].push_back(OpenVolumeMesh::VertexHandle(_indices[0]));
faces[0].push_back(OpenVolumeMesh::VertexHandle(_indices[1]));
faces[0].push_back(OpenVolumeMesh::VertexHandle(_indices[2]));
faces[0].push_back(OpenVolumeMesh::VertexHandle(_indices[3]));
faces.push_back(std::vector<OpenVolumeMesh::VertexHandle>());
faces[1].push_back(_indices[0]);
faces[1].push_back(_indices[4]);
faces[1].push_back(_indices[5]);
faces[1].push_back(_indices[1]);
faces[1].push_back(OpenVolumeMesh::VertexHandle(_indices[0]));
faces[1].push_back(OpenVolumeMesh::VertexHandle(_indices[4]));
faces[1].push_back(OpenVolumeMesh::VertexHandle(_indices[5]));
faces[1].push_back(OpenVolumeMesh::VertexHandle(_indices[1]));
faces.push_back(std::vector<OpenVolumeMesh::VertexHandle>());
faces[2].push_back(_indices[0]);
faces[2].push_back(_indices[3]);
faces[2].push_back(_indices[7]);
faces[2].push_back(_indices[4]);
faces[2].push_back(OpenVolumeMesh::VertexHandle(_indices[0]));
faces[2].push_back(OpenVolumeMesh::VertexHandle(_indices[3]));
faces[2].push_back(OpenVolumeMesh::VertexHandle(_indices[7]));
faces[2].push_back(OpenVolumeMesh::VertexHandle(_indices[4]));
faces.push_back(std::vector<OpenVolumeMesh::VertexHandle>());
faces[3].push_back(_indices[1]);
faces[3].push_back(_indices[5]);
faces[3].push_back(_indices[6]);
faces[3].push_back(_indices[2]);
faces[3].push_back(OpenVolumeMesh::VertexHandle(_indices[1]));
faces[3].push_back(OpenVolumeMesh::VertexHandle(_indices[5]));
faces[3].push_back(OpenVolumeMesh::VertexHandle(_indices[6]));
faces[3].push_back(OpenVolumeMesh::VertexHandle(_indices[2]));
faces.push_back(std::vector<OpenVolumeMesh::VertexHandle>());
faces[4].push_back(_indices[2]);
faces[4].push_back(_indices[6]);
faces[4].push_back(_indices[7]);
faces[4].push_back(_indices[3]);
faces[4].push_back(OpenVolumeMesh::VertexHandle(_indices[2]));
faces[4].push_back(OpenVolumeMesh::VertexHandle(_indices[6]));
faces[4].push_back(OpenVolumeMesh::VertexHandle(_indices[7]));
faces[4].push_back(OpenVolumeMesh::VertexHandle(_indices[3]));
faces.push_back(std::vector<OpenVolumeMesh::VertexHandle>());
faces[5].push_back(_indices[4]);
faces[5].push_back(_indices[7]);
faces[5].push_back(_indices[6]);
faces[5].push_back(_indices[5]);
faces[5].push_back(OpenVolumeMesh::VertexHandle(_indices[4]));
faces[5].push_back(OpenVolumeMesh::VertexHandle(_indices[7]));
faces[5].push_back(OpenVolumeMesh::VertexHandle(_indices[6]));
faces[5].push_back(OpenVolumeMesh::VertexHandle(_indices[5]));
std::vector<OpenVolumeMesh::HalfFaceHandle> halffacehandles;
for (unsigned int i = 0; i < faces.size(); i++)
......@@ -609,28 +609,28 @@ int FileVTKPlugin::addWedgeCellToOpenVolumeMesh(MeshT _mesh, std::vector<quint32
std::vector< std::vector<OpenVolumeMesh::VertexHandle> > faces;
faces.push_back(std::vector<OpenVolumeMesh::VertexHandle>());
faces[0].push_back(_indices[0]);
faces[0].push_back(_indices[1]);
faces[0].push_back(_indices[4]);
faces[0].push_back(_indices[3]);
faces[0].push_back(OpenVolumeMesh::VertexHandle(_indices[0]));
faces[0].push_back(OpenVolumeMesh::VertexHandle(_indices[1]));
faces[0].push_back(OpenVolumeMesh::VertexHandle(_indices[4]));
faces[0].push_back(OpenVolumeMesh::VertexHandle(_indices[3]));
faces.push_back(std::vector<OpenVolumeMesh::VertexHandle>());
faces[1].push_back(_indices[0]);
faces[1].push_back(_indices[2]);
faces[1].push_back(_indices[1]);
faces[1].push_back(OpenVolumeMesh::VertexHandle(_indices[0]));
faces[1].push_back(OpenVolumeMesh::VertexHandle(_indices[2]));
faces[1].push_back(OpenVolumeMesh::VertexHandle(_indices[1]));
faces.push_back(std::vector<OpenVolumeMesh::VertexHandle>());
faces[2].push_back(_indices[3]);
faces[2].push_back(_indices[4]);
faces[2].push_back(_indices[5]);
faces[2].push_back(OpenVolumeMesh::VertexHandle(_indices[3]));
faces[2].push_back(OpenVolumeMesh::VertexHandle(_indices[4]));
faces[2].push_back(OpenVolumeMesh::VertexHandle(_indices[5]));
faces.push_back(std::vector<OpenVolumeMesh::VertexHandle>());
faces[3].push_back(_indices[0]);
faces[3].push_back(_indices[3]);
faces[3].push_back(_indices[5]);
faces[3].push_back(_indices[2]);
faces[3].push_back(OpenVolumeMesh::VertexHandle(_indices[0]));
faces[3].push_back(OpenVolumeMesh::VertexHandle(_indices[3]));
faces[3].push_back(OpenVolumeMesh::VertexHandle(_indices[5]));
faces[3].push_back(OpenVolumeMesh::VertexHandle(_indices[2]));
faces.push_back(std::vector<OpenVolumeMesh::VertexHandle>());
faces[4].push_back(_indices[1]);
faces[4].push_back(_indices[2]);
faces[4].push_back(_indices[5]);
faces[4].push_back(_indices[4]);
faces[4].push_back(OpenVolumeMesh::VertexHandle(_indices[1]));
faces[4].push_back(OpenVolumeMesh::VertexHandle(_indices[2]));
faces[4].push_back(OpenVolumeMesh::VertexHandle(_indices[5]));
faces[4].push_back(OpenVolumeMesh::VertexHandle(_indices[4]));
std::vector<OpenVolumeMesh::HalfFaceHandle> halffacehandles;
for (unsigned int i = 0; i < faces.size(); i++)
......@@ -655,26 +655,26 @@ int FileVTKPlugin::addPyramidCellToOpenVolumeMesh(MeshT _mesh, std::vector<quint
std::vector< std::vector<OpenVolumeMesh::VertexHandle> > faces;
faces.push_back(std::vector<OpenVolumeMesh::VertexHandle>());
faces[0].push_back(_indices[0]);
faces[0].push_back(_indices[1]);
faces[0].push_back(_indices[2]);
faces[0].push_back(_indices[3]);
faces[0].push_back(OpenVolumeMesh::VertexHandle(_indices[0]));
faces[0].push_back(OpenVolumeMesh::VertexHandle(_indices[1]));
faces[0].push_back(OpenVolumeMesh::VertexHandle(_indices[2]));
faces[0].push_back(OpenVolumeMesh::VertexHandle(_indices[3]));
faces.push_back(std::vector<OpenVolumeMesh::VertexHandle>());
faces[1].push_back(_indices[0]);
faces[1].push_back(_indices[4]);
faces[1].push_back(_indices[1]);
faces[1].push_back(OpenVolumeMesh::VertexHandle(_indices[0]));
faces[1].push_back(OpenVolumeMesh::VertexHandle(_indices[4]));
faces[1].push_back(OpenVolumeMesh::VertexHandle(_indices[1]));
faces.push_back(std::vector<OpenVolumeMesh::VertexHandle>());
faces[2].push_back(_indices[0]);
faces[2].push_back(_indices[3]);
faces[2].push_back(_indices[4]);
faces[2].push_back(OpenVolumeMesh::VertexHandle(_indices[0]));
faces[2].push_back(OpenVolumeMesh::VertexHandle(_indices[3]));
faces[2].push_back(OpenVolumeMesh::VertexHandle(_indices[4]));
faces.push_back(std::vector<OpenVolumeMesh::VertexHandle>());
faces[3].push_back(_indices[2]);
faces[3].push_back(_indices[4]);
faces[3].push_back(_indices[3]);
faces[3].push_back(OpenVolumeMesh::VertexHandle(_indices[2]));
faces[3].push_back(OpenVolumeMesh::VertexHandle(_indices[4]));
faces[3].push_back(OpenVolumeMesh::VertexHandle(_indices[3]));
faces.push_back(std::vector<OpenVolumeMesh::VertexHandle>());
faces[4].push_back(_indices[1]);
faces[4].push_back(_indices[4]);
faces[4].push_back(_indices[2]);
faces[4].push_back(OpenVolumeMesh::VertexHandle(_indices[1]));
faces[4].push_back(OpenVolumeMesh::VertexHandle(_indices[4]));
faces[4].push_back(OpenVolumeMesh::VertexHandle(_indices[2]));
std::vector<OpenVolumeMesh::HalfFaceHandle> halffacehandles;
for (unsigned int i = 0; i < faces.size(); i++)
......@@ -706,7 +706,7 @@ int FileVTKPlugin::addFaceToOpenVolumeMesh(MeshT*& _mesh, std::vector<quint32> _
halffacehandle = _mesh->halfface(face);
if (halffacehandle == -1) // face didn't exist
{
OpenVolumeMesh::FaceHandle fh = _mesh->add_face(face).idx();
OpenVolumeMesh::FaceHandle fh = _mesh->add_face(face);
halffacehandle = _mesh->halfface_handle(fh, 0);
}
return halffacehandle.idx();
......@@ -724,7 +724,7 @@ int FileVTKPlugin::addFaceToOpenVolumeMesh(MeshT*& _mesh, quint32 _index1, quint
halffacehandle = _mesh->halfface(face);
if (halffacehandle == -1) // face didn't exist
{
OpenVolumeMesh::FaceHandle fh = _mesh->add_face(face).idx();
OpenVolumeMesh::FaceHandle fh = _mesh->add_face(face);
halffacehandle = _mesh->halfface_handle(fh, 0);
}
return halffacehandle.idx();
......@@ -745,9 +745,9 @@ void FileVTKPlugin::addFaceNormalToOpenVolumeMesh(MeshT _mesh, quint32 _index, O
OpenVolumeMesh::HalfFaceHandle hfh = OpenVolumeMesh::HalfFaceHandle(_index);
OpenVolumeMesh::FaceHandle fh = _mesh->face_handle(hfh);
if (hfh == _mesh->halfface_handle(fh, 0))
faceNormals[_mesh->face_handle(_index)] = _normal;
faceNormals[fh] = _normal;
else
faceNormals[_mesh->face_handle(_index)] = -_normal;
faceNormals[fh] = -_normal;
}
......@@ -1595,7 +1595,8 @@ int FileVTKPlugin::loadObject(QString _filename) {
return -1;
}
BaseObject* baseObj = 0;
BaseObjectData* baseObj = 0;
bool is_OpenVolumeMesh = false;
if ( (forceTriangleMesh_) || (bestType == BMT_TriMesh) ){
......@@ -1660,6 +1661,7 @@ int FileVTKPlugin::loadObject(QString _filename) {
else if (bestType == BMT_PolyhedralMesh)
{
// add a Polyhedral mesh
is_OpenVolumeMesh = true;
int id = -1;
emit addEmptyObject(DATA_POLYHEDRAL_MESH, id);
......@@ -1689,6 +1691,7 @@ int FileVTKPlugin::loadObject(QString _filename) {
else if (bestType == BMT_HexahedralMesh)
{
// add a hexahedral mesh
is_OpenVolumeMesh = true;
int id = -1;
emit addEmptyObject(DATA_HEXAHEDRAL_MESH, id);
......@@ -1717,6 +1720,7 @@ int FileVTKPlugin::loadObject(QString _filename) {
else if (bestType == BMT_TetrahedralMesh)
{
// add a tetrahedral mesh
is_OpenVolumeMesh = true;
int id = -1;
emit addEmptyObject(DATA_TETRAHEDRAL_MESH, id);
......@@ -1747,6 +1751,11 @@ int FileVTKPlugin::loadObject(QString _filename) {
baseObj->setFromFileName(_filename);
baseObj->setName(baseObj->filename());
if (is_OpenVolumeMesh)
{
// Go into solid flat shaded mode
baseObj->setObjectDrawMode(ACG::SceneGraph::DrawModes::getDrawMode("Cells (flat shaded)"));
}
emit updatedObject(baseObj->id(), UPDATE_ALL);
......
OpenVolumeMesh @ a45f4a3d
Subproject commit b5039f0f28f1cea68e0eb4420ed8e37ad8ab6307
Subproject commit a45f4a3d3da9d7b5b812bb5b57555be3f8836e10
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