Commit 6ba5d6a5 authored by Alexis Girault's avatar Alexis Girault
Browse files

ENH: change default init in volumetricMesh reader

A surfaceMesh will not be automatically extracted when
reading a volumetricMesh due to the long time necessary
for that process, which will be improved later on.
(vtkDatasetSurfaceFilter is 100x faster)

The user will have to call computeAttachedSurfaceMesh to
extract the surface mesh from its volumetricMesh if he
needs it.
parent 936a35c9
......@@ -21,10 +21,17 @@
#include "imstkVolumetricMesh.h"
#include "g3log/g3log.hpp"
namespace imstk {
std::shared_ptr<SurfaceMesh>
VolumetricMesh::getAttachedSurfaceMesh()
{
if(m_attachedSurfaceMesh == nullptr)
{
LOG(WARNING) << "VolumetricMesh::getAttachedSurfaceMesh warning: attachedSurfaceMesh not set.\n"
<< "Extract a surface mesh to attach using computeAttachedSurfaceMesh().";
}
return m_attachedSurfaceMesh;
}
......
......@@ -165,7 +165,7 @@ VTKMeshReader::convertVtkUnstructuredGridToVolumetricMesh(vtkUnstructuredGrid* v
VTKMeshReader::copyCells<4>(vtkMesh->GetCells(), cells);
auto mesh = std::make_shared<TetrahedralMesh>();
mesh->initialize(vertices, cells, true);
mesh->initialize(vertices, cells, false);
return mesh;
}
else if( cellType == VTK_HEXAHEDRON )
......@@ -175,7 +175,7 @@ VTKMeshReader::convertVtkUnstructuredGridToVolumetricMesh(vtkUnstructuredGrid* v
VTKMeshReader::copyCells<8>(vtkMesh->GetCells(), cells);
auto mesh = std::make_shared<HexahedralMesh>();
mesh->initialize(vertices, cells, true);
mesh->initialize(vertices, cells, false);
return mesh;
}
else
......
......@@ -74,6 +74,7 @@ void testReadMesh()
auto mesh = imstk::MeshReader::read("/home/virtualfls/Projects/IMSTK/resources/AVM/nidus-model/nidus10KTet.vtk");
auto volumeMesh = std::dynamic_pointer_cast<imstk::VolumetricMesh>(mesh);
volumeMesh->computeAttachedSurfaceMesh();
auto surfaceMesh = volumeMesh->getAttachedSurfaceMesh();
// Create object and add to scene
......
Supports Markdown
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