Personal tools
You are here: Home Forum How to use Salome? Is mapping between original sub-shapes and mesh available ?

Is mapping between original sub-shapes and mesh available ?

Up to How to use Salome?

Is mapping between original sub-shapes and mesh available ?

Posted by Roman Lygin at April 07. 2011

When creating a mesh for TopoDS_Shape is mapping between original sub-shapes (vertices, edges and faces) and resulting nodes and elements kept ? That is, exploring sub-shapes of the shape to get a set of 1D element or a set of 2D elements for each edge or face respectively ?

Looking at Mefisto-based meshing algorithm

bool StdMeshers_MEFISTO_2D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape)
{
  MESSAGE("StdMeshers_MEFISTO_2D::Compute");

  TopoDS_Face F = TopoDS::Face(aShape.Oriented(TopAbs_FORWARD));

it creates an impression that the original shape is explored face-by-face and fed into the algorithm. Thus leads to an assumption that mapping should be possible but I would like to double-check. If it is supported what is an API to access it ?

 

A related question is what happens to shared (partner) sub-shapes. Are results of their meshing reused ? Imagine you have a complex NURBS-based face with different locations inside a shape. Instead of re-meshing it several times when exploring, more efficient implementation would reuse a sub-mesh built for the first time and apply transformation to the nodes. Is this done this way or is a recomputation arranged ?

Many thanks for any help.

Roman

Re: Is mapping between original sub-shapes and mesh available ?

Posted by Saint Michael at April 07. 2011

it creates an impression that the original shape is explored face-by-face and fed into the algorithm. Thus leads to an assumption that mapping should be possible but I would like to double-check. If it is supported what is an API to access it ?

Look at SMESHDS_Mesh

///////////////////////////////////////////////////////////////////////////////

/// Return the sub mesh linked to the a given TopoDS_Shape or NULL if the given

/// TopoDS_Shape is unknown

///////////////////////////////////////////////////////////////////////////////

SMESHDS_SubMesh * SMESHDS_Mesh::MeshElements(const TopoDS_Shape & S) const

{

  int Index = ShapeToIndex(S);

  TShapeIndexToSubMesh::const_iterator anIter = myShapeIndexToSubMesh.find(Index);

  if (anIter != myShapeIndexToSubMesh.end())

    return anIter->second;

  else

    return NULL;

}

 

 

A related question is what happens to shared (partner) sub-shapes. Are results of their meshing reused ?

No, mesh of the partner shape is not reused.

BR SM

 

Re: Is mapping between original sub-shapes and mesh available ?

Posted by Roman Lygin at April 07. 2011

St. Michele, thanks for returning a code snippet. That does help a lot!

 

Powered by Ploneboard
Document Actions