Back to index

salome-smesh  6.5.0
Functions
SMESHDS_Mesh.cxx File Reference
#include "SMESHDS_Mesh.hxx"
#include "SMESHDS_Group.hxx"
#include "SMDS_VertexPosition.hxx"
#include "SMDS_EdgePosition.hxx"
#include "SMDS_FacePosition.hxx"
#include "SMDS_SpacePosition.hxx"
#include "SMDS_Downward.hxx"
#include "SMESHDS_GroupOnGeom.hxx"
#include <Standard_ErrorHandler.hxx>
#include <Standard_OutOfRange.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS_Iterator.hxx>
#include "utilities.h"

Go to the source code of this file.

Functions

static void removeFromContainers (map< int, SMESHDS_SubMesh * > &theSubMeshes, set< SMESHDS_GroupBase * > &theGroups, list< const SMDS_MeshElement * > &theElems, const bool isNode)

Function Documentation

static void removeFromContainers ( map< int, SMESHDS_SubMesh * > &  theSubMeshes,
set< SMESHDS_GroupBase * > &  theGroups,
list< const SMDS_MeshElement * > &  theElems,
const bool  isNode 
) [static]

Definition at line 763 of file SMESHDS_Mesh.cxx.

{
  if ( theElems.empty() )
    return;

  // Rm from group
  // Element can belong to several groups
  if ( !theGroups.empty() )
  {
    set<SMESHDS_GroupBase*>::iterator GrIt = theGroups.begin();
    for ( ; GrIt != theGroups.end(); GrIt++ )
    {
      SMESHDS_Group* group = dynamic_cast<SMESHDS_Group*>( *GrIt );
      if ( !group || group->IsEmpty() ) continue;

      list<const SMDS_MeshElement *>::iterator elIt = theElems.begin();
      for ( ; elIt != theElems.end(); elIt++ )
      {
        group->SMDSGroup().Remove( *elIt );
        if ( group->IsEmpty() ) break;
      }
    }
  }

  const bool deleted=true;

  // Rm from sub-meshes
  // Element should belong to only one sub-mesh
  if ( !theSubMeshes.empty() )
  {
    SMESHDS_Mesh* mesh = theSubMeshes.begin()->second->getParent();
    list<const SMDS_MeshElement *>::iterator elIt = theElems.begin();
    if ( isNode ) {
      for ( ; elIt != theElems.end(); ++elIt )
        if ( SMESHDS_SubMesh* sm = mesh->MeshElements( (*elIt)->getshapeId() ))
          sm->RemoveNode( static_cast<const SMDS_MeshNode*> (*elIt), deleted );
    }
    else {
      for ( ; elIt != theElems.end(); ++elIt )
        if ( SMESHDS_SubMesh* sm = mesh->MeshElements( (*elIt)->getshapeId() ))
          sm->RemoveElement( *elIt, deleted );
    }
  }
}