Back to index

salome-smesh  6.5.0
Classes | Defines | Typedefs | Functions | Variables
SMESH_Mesh_i.cxx File Reference
#include "SMESH_Mesh_i.hxx"
#include "DriverMED_R_SMESHDS_Mesh.h"
#include "DriverMED_W_SMESHDS_Mesh.h"
#include "SMDS_EdgePosition.hxx"
#include "SMDS_ElemIterator.hxx"
#include "SMDS_FacePosition.hxx"
#include "SMDS_IteratorOnIterators.hxx"
#include "SMDS_SetIterator.hxx"
#include "SMDS_VolumeTool.hxx"
#include "SMESHDS_Command.hxx"
#include "SMESHDS_CommandType.hxx"
#include "SMESHDS_GroupOnGeom.hxx"
#include "SMESH_Filter_i.hxx"
#include "SMESH_Gen_i.hxx"
#include "SMESH_Group.hxx"
#include "SMESH_Group_i.hxx"
#include "SMESH_MEDMesh_i.hxx"
#include "SMESH_MeshEditor.hxx"
#include "SMESH_MeshEditor_i.hxx"
#include "SMESH_MesherHelper.hxx"
#include "SMESH_PreMeshInfo.hxx"
#include "SMESH_PythonDump.hxx"
#include "SMESH_subMesh_i.hxx"
#include <OpUtil.hxx>
#include <SALOME_NamingService.hxx>
#include <Utils_CorbaException.hxx>
#include <Utils_ExceptHandlers.hxx>
#include <Utils_SINGLETON.hxx>
#include <utilities.h>
#include <GEOMImpl_Types.hxx>
#include <BRep_Builder.hxx>
#include <OSD_Directory.hxx>
#include <OSD_File.hxx>
#include <OSD_Path.hxx>
#include <OSD_Protection.hxx>
#include <TColStd_MapIteratorOfMapOfInteger.hxx>
#include <TColStd_MapOfInteger.hxx>
#include <TColStd_SequenceOfInteger.hxx>
#include <TCollection_AsciiString.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS_Compound.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_MapIteratorOfMapOfShape.hxx>
#include <algorithm>
#include <string>
#include <iostream>
#include <sstream>
#include <sys/stat.h>

Go to the source code of this file.

Classes

class  SMESH_MeshPartDS
 Class providing SMESHDS_Mesh API to SMESH_IDSource. More...
struct  SMESH_MeshPartDS::TMeshInfo
 Class used to access to protected data of SMDS_MeshInfo. More...
class  SMESH_DimHyp
 Internal structure used to find concurent submeshes. More...

Defines

#define WITHGENERICOBJ
#define RETURNCASE(hyp_stat)   case SMESH_Hypothesis::hyp_stat: return SMESH::hyp_stat;
#define _GET_ITER_DEFINE(iterType, methName, elem, elemType)

Typedefs

typedef list< SMESH_DimHyp * > TDimHypList

Functions

static SMESH::DriverMED_ReadStatus ConvertDriverMEDReadStatus (int theStatus)
static SALOMEDS::Color getUniqueColor (const std::list< SALOMEDS::Color > &theReservedColors)
 Returns a random unique color.
static TopAbs_ShapeEnum shapeTypeByDim (const int theDim)
 mapping of mesh dimension into shape type
static void addDimHypInstance (const int theDim, const TopoDS_Shape &theShape, const SMESH_Algo *theAlgo, const SMESH_subMesh *theSubMesh, const list< const SMESHDS_Hypothesis * > &theHypList, TDimHypList *theDimHypListArr)
static void findConcurrents (const SMESH_DimHyp *theDimHyp, const TDimHypList &theListOfDimHyp, TListOfInt &theListOfConcurr)
static void unionLists (TListOfInt &theListOfId, TListOfListOfInt &theListOfListOfId, const int theIndx)
static void removeDimHyps (TDimHypList *theArrOfList)
 free memory allocated for dimension-hypothesis objects
static void findCommonSubMesh (list< const SMESH_subMesh * > &theSubMeshList, const SMESH_subMesh *theSubMesh, set< const SMESH_subMesh * > &theCommon)
 find common submeshes with given submesh

Variables

static int MYDEBUG = 0

Define Documentation

#define _GET_ITER_DEFINE (   iterType,
  methName,
  elem,
  elemType 
)
Value:
iterType SMESH_MeshPartDS::methName( bool idInceasingOrder) const                 \
  {                                                                                 \
    typedef SMDS_SetIterator<const elem*, TIDSortedElemSet::const_iterator > TIter; \
    return _meshDS ? _meshDS->methName(idInceasingOrder) : iterType                 \
      ( new TIter( _elements[elemType].begin(), _elements[elemType].end() ));       \
  }

Definition at line 4843 of file SMESH_Mesh_i.cxx.

#define RETURNCASE (   hyp_stat)    case SMESH_Hypothesis::hyp_stat: return SMESH::hyp_stat;

Definition at line 460 of file SMESH_Mesh_i.cxx.

#define WITHGENERICOBJ

Definition at line 95 of file SMESH_Mesh_i.cxx.


Typedef Documentation

typedef list<SMESH_DimHyp*> TDimHypList

Definition at line 4465 of file SMESH_Mesh_i.cxx.


Function Documentation

static void addDimHypInstance ( const int  theDim,
const TopoDS_Shape &  theShape,
const SMESH_Algo *  theAlgo,
const SMESH_subMesh *  theSubMesh,
const list< const SMESHDS_Hypothesis * > &  theHypList,
TDimHypList theDimHypListArr 
) [static]

Definition at line 4467 of file SMESH_Mesh_i.cxx.

{
  TDimHypList& listOfdimHyp = theDimHypListArr[theDim];
  if ( listOfdimHyp.empty() || listOfdimHyp.back()->_subMesh != theSubMesh ) {
    SMESH_DimHyp* dimHyp = new SMESH_DimHyp( theSubMesh, theDim, theShape );
    listOfdimHyp.push_back( dimHyp );
  }
  
  SMESH_DimHyp* dimHyp = listOfdimHyp.back();
  dimHyp->_hypothesises.push_front(theAlgo);
  list <const SMESHDS_Hypothesis*>::const_iterator hypIt = theHypList.begin();
  for( ; hypIt != theHypList.end(); hypIt++ )
    dimHyp->_hypothesises.push_back( *hypIt );
}
static SMESH::DriverMED_ReadStatus ConvertDriverMEDReadStatus ( int  theStatus) [static]
static void findCommonSubMesh ( list< const SMESH_subMesh * > &  theSubMeshList,
const SMESH_subMesh *  theSubMesh,
set< const SMESH_subMesh * > &  theCommon 
) [static]

find common submeshes with given submesh

Parameters:
theSubMeshListlist of already collected submesh to check
theSubMeshgiven submesh to intersect with other
theCommonSubMeshescollected common submeshes

Definition at line 4643 of file SMESH_Mesh_i.cxx.

{
  if ( !theSubMesh )
    return;
  list<const SMESH_subMesh*>::const_iterator it = theSubMeshList.begin();
  for ( ; it != theSubMeshList.end(); it++ )
    theSubMesh->FindIntersection( *it, theCommon );
  theSubMeshList.push_back( theSubMesh );
  //theCommon.insert( theSubMesh );
}
static void findConcurrents ( const SMESH_DimHyp theDimHyp,
const TDimHypList theListOfDimHyp,
TListOfInt theListOfConcurr 
) [static]

Definition at line 4487 of file SMESH_Mesh_i.cxx.

{
  TDimHypList::const_reverse_iterator rIt = theListOfDimHyp.rbegin();
  for ( ; rIt != theListOfDimHyp.rend(); rIt++ ) {
    const SMESH_DimHyp* curDimHyp = *rIt;
    if ( curDimHyp == theDimHyp )
      break; // meet own dimHyp pointer in same dimension
    else if ( theDimHyp->IsConcurrent( curDimHyp ) )
      if ( find( theListOfConcurr.begin(),
                 theListOfConcurr.end(),
                 curDimHyp->_subMesh->GetId() ) == theListOfConcurr.end() )
        theListOfConcurr.push_back( curDimHyp->_subMesh->GetId() );
  }
}

Here is the call graph for this function:

static SALOMEDS::Color getUniqueColor ( const std::list< SALOMEDS::Color > &  theReservedColors) [static]

Returns a random unique color.

Definition at line 2527 of file SMESH_Mesh_i.cxx.

{
  const int MAX_ATTEMPTS = 100;
  int cnt = 0;
  double tolerance = 0.5;
  SALOMEDS::Color col;

  bool ok = false;
  while ( !ok ) {
    // generate random color
    double red    = (double)rand() / RAND_MAX;
    double green  = (double)rand() / RAND_MAX;
    double blue   = (double)rand() / RAND_MAX;
    // check existence in the list of the existing colors
    bool matched = false;
    std::list<SALOMEDS::Color>::const_iterator it;
    for ( it = theReservedColors.begin(); it != theReservedColors.end() && !matched; ++it ) {
      SALOMEDS::Color color = *it;
      double tol = fabs( color.R - red ) + fabs( color.G - green ) + fabs( color.B  - blue  );
      matched = tol < tolerance;
    }
    if ( (cnt+1) % 20 == 0 ) tolerance = tolerance/2;
    ok = ( ++cnt == MAX_ATTEMPTS ) || !matched;
    col.R = red;
    col.G = green;
    col.B = blue;
  }
  return col;
}
static void removeDimHyps ( TDimHypList theArrOfList) [static]

free memory allocated for dimension-hypothesis objects

Definition at line 4530 of file SMESH_Mesh_i.cxx.

{
  for (int i = 0; i < 4; i++ ) {
    TDimHypList& listOfdimHyp = theArrOfList[i];
    TDimHypList::const_iterator it = listOfdimHyp.begin();
    for ( ; it != listOfdimHyp.end(); it++ )
      delete (*it);
  }
}
static TopAbs_ShapeEnum shapeTypeByDim ( const int  theDim) [static]

mapping of mesh dimension into shape type

Definition at line 4336 of file SMESH_Mesh_i.cxx.

{
  TopAbs_ShapeEnum aType = TopAbs_SOLID;
  switch ( theDim ) {
  case 0: aType = TopAbs_VERTEX; break;
  case 1: aType = TopAbs_EDGE; break;
  case 2: aType = TopAbs_FACE; break;
  case 3:
  default:aType = TopAbs_SOLID; break;
  }
  return aType;
}

Here is the caller graph for this function:

static void unionLists ( TListOfInt theListOfId,
TListOfListOfInt theListOfListOfId,
const int  theIndx 
) [static]

Definition at line 4504 of file SMESH_Mesh_i.cxx.

{
  TListOfListOfInt::iterator it = theListOfListOfId.begin();
  for ( int i = 0; it != theListOfListOfId.end(); it++, i++ ) {
    if ( i < theIndx )
      continue; //skip already treated lists
    // check if other list has any same submesh object
    TListOfInt& otherListOfId = *it;
    if ( find_first_of( theListOfId.begin(), theListOfId.end(),
                        otherListOfId.begin(), otherListOfId.end() ) == theListOfId.end() )
      continue;
         
    // union two lists (from source into target)
    TListOfInt::iterator it2 = otherListOfId.begin();
    for ( ; it2 != otherListOfId.end(); it2++ ) {
      if ( find( theListOfId.begin(), theListOfId.end(), (*it2) ) == theListOfId.end() )
        theListOfId.push_back(*it2);
    }
    // clear source list
    otherListOfId.clear();
  }
}

Variable Documentation

int MYDEBUG = 0 [static]

Definition at line 85 of file SMESH_Mesh_i.cxx.