Commit 76bef1e7 authored by Ben Boeckel's avatar Ben Boeckel

Merge topic 'generate-representations-without-modifying-db-release' into release

* generate-representations-without-modifying-db-release:
  smtk::mesh: Do not create new meshes when generating a mesh rep.
  SurfaceExtractContours: set minimum Line Thickness to 1.

Merge-request: !838
parents 5d188f2a 8000835e
......@@ -209,8 +209,13 @@ void vtkMeshMultiBlockSource::GenerateRepresentationForSingleMesh(const smtk::me
{
if (!meshes.is_empty())
{
//we want all 0d, 1d, 2d, and shells of 3d elments
smtk::mesh::MeshSet shell = meshes.subset(smtk::mesh::Dims3).extractShell();
//we want all 0d, 1d, 2d, and shells of 3d elments.
//To preserve the state of the mesh database, we track
//whether or not a new meshset was created to represent
//the 3d shell; if it was created, we delete it when we
//are finished with it.
bool shellCreated;
smtk::mesh::MeshSet shell = meshes.subset(smtk::mesh::Dims3).extractShell(shellCreated);
smtk::mesh::MeshSet twoD = meshes.subset(smtk::mesh::Dims2);
smtk::mesh::MeshSet oneD = meshes.subset(smtk::mesh::Dims1);
smtk::mesh::MeshSet zeroD = meshes.subset(smtk::mesh::Dims0);
......@@ -230,6 +235,11 @@ void vtkMeshMultiBlockSource::GenerateRepresentationForSingleMesh(const smtk::me
pointCoords->ShallowCopy(pd->GetPoints()->GetData());
pointCoords->SetName("PointCoordinates");
pd->GetPointData()->AddArray(pointCoords.GetPointer());
if (shellCreated)
{
meshes.collection()->removeMeshes(shell);
}
}
}
......
......@@ -369,6 +369,13 @@ smtk::mesh::MeshSet MeshSet::subset(std::size_t ith) const
smtk::mesh::MeshSet MeshSet::extractShell() const
{
bool created;
return this->extractShell(created);
}
smtk::mesh::MeshSet MeshSet::extractShell(bool& created) const
{
created = false;
const smtk::mesh::InterfacePtr& iface = this->m_parent->interface();
smtk::mesh::HandleRange entities;
......@@ -378,8 +385,8 @@ smtk::mesh::MeshSet MeshSet::extractShell() const
{
smtk::mesh::Handle meshSetHandle;
//create a mesh for these cells since they don't have a meshset currently
const bool meshCreated = iface->createMesh(cells, meshSetHandle);
if (meshCreated)
created = iface->createMesh(cells, meshSetHandle);
if (created)
{
entities.insert(meshSetHandle);
}
......@@ -389,6 +396,13 @@ smtk::mesh::MeshSet MeshSet::extractShell() const
smtk::mesh::MeshSet MeshSet::extractAdjacenciesOfDimension(int dimension) const
{
bool created;
return this->extractAdjacenciesOfDimension(dimension, created);
}
smtk::mesh::MeshSet MeshSet::extractAdjacenciesOfDimension(int dimension, bool& created) const
{
created = false;
const smtk::mesh::InterfacePtr& iface = this->m_parent->interface();
smtk::mesh::HandleRange entities;
......@@ -399,8 +413,8 @@ smtk::mesh::MeshSet MeshSet::extractAdjacenciesOfDimension(int dimension) const
{
smtk::mesh::Handle meshSetHandle;
//create a mesh for these cells since they don't have a meshset currently
const bool meshCreated = iface->createMesh(cells, meshSetHandle);
if (meshCreated)
created = iface->createMesh(cells, meshSetHandle);
if (created)
{
entities.insert(meshSetHandle);
}
......
......@@ -139,11 +139,18 @@ public:
//Extract the shell ( exterior (D-1)-dimensional elements ) of this set of
//meshes. This operation might create new cells if no shell already exists
//for the given meshset. The resulting meshset will be added to the
//database so that the shell is saved.
//for the given meshset. If not already present, the resulting meshset will
//be added to the database so that the shell is saved.
//Will return an empty set when no shell can be found
smtk::mesh::MeshSet extractShell() const;
//Extract the shell ( exterior (D-1)-dimensional elements ) of this set of
//meshes. This operation might create new cells if no shell already exists
//for the given meshset. The input field <created> is set to reflect
//whether or not the resulting meshset is added to the database.
//Will return an empty set when no shell can be found
smtk::mesh::MeshSet extractShell(bool& created) const;
//Extract the adjacency cells of this set of meshes for a given dimension.
//This operation might create new cells if they do not already exist
//for the given meshset. The resulting meshset will be added to the
......@@ -151,6 +158,13 @@ public:
//Will return an empty set when no adjacencies can be found
smtk::mesh::MeshSet extractAdjacenciesOfDimension(int dimension) const;
//Extract the adjacency cells of this set of meshes for a given dimension.
//This operation might create new cells if they do not already exist
//for the given meshset. he input field <created> is set to reflect
//whether or not the resulting meshset is added to the database.
//Will return an empty set when no adjacencies can be found
smtk::mesh::MeshSet extractAdjacenciesOfDimension(int dimension, bool& created) const;
//Merge all duplicate points contained within this meshset.
//Will return true when any points have been merged
//Will cause any existing PointConnectivity and PointSet's to become
......
......@@ -60,7 +60,8 @@ PySharedPtrClass< smtk::mesh::MeshSet > pybind11_init_smtk_mesh_MeshSet(py::modu
.def("pointFields", &smtk::mesh::MeshSet::pointFields)
.def("dirichlets", &smtk::mesh::MeshSet::dirichlets)
.def("domains", &smtk::mesh::MeshSet::domains)
.def("extractShell", &smtk::mesh::MeshSet::extractShell)
.def("extractShell", (smtk::mesh::MeshSet (smtk::mesh::MeshSet::*)() const) &smtk::mesh::MeshSet::extractShell)
.def("extractAdjacenciesOfDimension", (smtk::mesh::MeshSet (smtk::mesh::MeshSet::*)(int) const) &smtk::mesh::MeshSet::extractAdjacenciesOfDimension)
.def("is_empty", &smtk::mesh::MeshSet::is_empty)
.def("mergeCoincidentContactPoints", &smtk::mesh::MeshSet::mergeCoincidentContactPoints, py::arg("tolerance") = 9.9999999999999995E-7)
.def("modelEntities", &smtk::mesh::MeshSet::modelEntities, py::arg("arg0"))
......
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