Commit df019722 authored by Sreekanth Arikatla's avatar Sreekanth Arikatla

ENH: Remove dependency between DataStructures and Geometry

The getMeshGraph function is moved from the geometry calsses to the utilities thus removing the dependency between DataStructures and Geometry
parent 39b33496
......@@ -22,6 +22,7 @@
#include "imstkGraph.h"
#include "imstkTetrahedralMesh.h"
#include "imstkMeshIO.h"
#include "imstkAPIUtilities.h"
#include <iostream>
......@@ -90,11 +91,11 @@ main(int argc, char** argv)
else
{
auto volMesh = std::dynamic_pointer_cast<TetrahedralMesh>(tetMesh);
auto colorsGVMesh = volMesh->getMeshGraph()->doColoring(method, true);
auto colorsGVMesh = apiutils::getMeshGraph(volMesh)->doColoring(method, true);
auto surfMesh = std::make_shared<SurfaceMesh>();
volMesh->extractSurfaceMesh(surfMesh, true);
auto colorsGSMesh = surfMesh->getMeshGraph()->doColoring(method, true);
auto colorsGSMesh = apiutils::getMeshGraph(surfMesh)->doColoring(method, true);
}
std::cout << "Press any key to exit!" << std::endl;
......
......@@ -5,7 +5,6 @@ include(imstkAddLibrary)
imstk_add_library( Geometry
DEPENDS
Core
Datastructures
glm
Assimp
Materials
......
......@@ -20,7 +20,7 @@
=========================================================================*/
#include "imstkPointSet.h"
#include "imstkGraph.h"
//#include "imstkGraph.h"
#include "imstkParallelUtils.h"
namespace imstk
......@@ -317,12 +317,4 @@ PointSet::getMaxNumVertices()
{
return m_maxNumVertices;
}
std::shared_ptr<Graph>
PointSet::getMeshGraph()
{
LOG(WARNING) << "The graph of a point set has no edges";
return std::make_shared<Graph>(this->getNumVertices());
}
} // imstk
......@@ -166,11 +166,6 @@ public:
///
size_t getMaxNumVertices();
///
/// \brief Returns the mesh graph
///
virtual std::shared_ptr<Graph> getMeshGraph();
protected:
friend class VTKPointSetRenderDelegate;
......
......@@ -20,7 +20,7 @@
=========================================================================*/
#include "imstkSurfaceMesh.h"
#include "imstkGraph.h"
//#include "imstkGraph.h"
namespace imstk
{
......@@ -613,18 +613,4 @@ SurfaceMesh::getMaxNumTriangles()
{
return m_maxNumTriangles;
}
std::shared_ptr<Graph>
SurfaceMesh::getMeshGraph()
{
auto gMesh = std::make_shared<Graph>(this->getNumVertices());
for (auto tri : this->getTrianglesVertices())
{
gMesh->addEdge(tri[0], tri[1]);
gMesh->addEdge(tri[0], tri[2]);
gMesh->addEdge(tri[1], tri[2]);
}
return gMesh;
}
} // imstk
......@@ -212,11 +212,6 @@ public:
///
size_t getMaxNumTriangles();
///
/// \brief Returns the mesh graph
///
std::shared_ptr<Graph> getMeshGraph() override;
protected:
friend class VTKSurfaceMeshRenderDelegate;
......
......@@ -20,7 +20,7 @@
=========================================================================*/
#include "imstkTetrahedralMesh.h"
#include "imstkGraph.h"
//#include "imstkGraph.h"
namespace imstk
{
......@@ -303,20 +303,4 @@ TetrahedralMesh::getNumTetrahedra() const
{
return m_tetrahedraVertices.size();
}
std::shared_ptr<Graph>
TetrahedralMesh::getMeshGraph()
{
auto gMesh = std::make_shared<Graph>(this->getNumVertices());
for (auto tet : this->getTetrahedraVertices())
{
gMesh->addEdge(tet[0], tet[1]);
gMesh->addEdge(tet[0], tet[2]);
gMesh->addEdge(tet[0], tet[3]);
gMesh->addEdge(tet[1], tet[2]);
gMesh->addEdge(tet[1], tet[3]);
gMesh->addEdge(tet[2], tet[3]);
}
return gMesh;
}
} // imstk
......@@ -121,11 +121,6 @@ public:
void setTetrahedraAsRemoved(const unsigned int tetId) { m_removedMeshElems[tetId] = true; }
const std::vector<bool>& getRemovedTetrahedra() const { return m_removedMeshElems; }
///
/// \brief Returns the mesh graph
///
std::shared_ptr<Graph> getMeshGraph() override;
protected:
friend class VTKTetrahedralMeshRenderDelegate;
......
......@@ -34,9 +34,13 @@
#include "imstkSphere.h"
#include "imstkCapsule.h"
#include "imstkCube.h"
#include "imstkPointSet.h"
#include "imstkSurfaceMesh.h"
#include "imstkTetrahedralMesh.h"
#include "imstkMeshIO.h"
#include "imstkGraph.h"
// logger
#include "g3log/g3log.hpp"
#include "imstkTimer.h"
......@@ -242,5 +246,43 @@ printUPS(std::shared_ptr<SceneManager> sceneManager, std::shared_ptr<UPSCounter>
LOG(INFO) << "\nPost cleanup of " << module->getName() << " module";
});
}
std::shared_ptr<Graph>
getMeshGraph(std::shared_ptr<PointSet> m)
{
LOG(WARNING) << "The graph of a point set has no edges";
return std::make_shared<Graph>(m->getNumVertices());
}
std::shared_ptr<Graph>
getMeshGraph(std::shared_ptr<SurfaceMesh> m)
{
auto gMesh = std::make_shared<Graph>(m->getNumVertices());
for (auto tri : m->getTrianglesVertices())
{
gMesh->addEdge(tri[0], tri[1]);
gMesh->addEdge(tri[0], tri[2]);
gMesh->addEdge(tri[1], tri[2]);
}
return gMesh;
}
std::shared_ptr<Graph>
getMeshGraph(std::shared_ptr<TetrahedralMesh> m)
{
auto gMesh = std::make_shared<Graph>(m->getNumVertices());
for (auto tet : m->getTetrahedraVertices())
{
gMesh->addEdge(tet[0], tet[1]);
gMesh->addEdge(tet[0], tet[2]);
gMesh->addEdge(tet[0], tet[3]);
gMesh->addEdge(tet[1], tet[2]);
gMesh->addEdge(tet[1], tet[3]);
gMesh->addEdge(tet[2], tet[3]);
}
return gMesh;
}
} //apiutils
} // imstk
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