Version: 6.3.1
Data Structures | Defines | Typedefs | Functions | Variables

src/SMESH_I/SMESH_Mesh_i.cxx File Reference

#include "SMESH_Mesh_i.hxx"
#include "SMESH_Filter_i.hxx"
#include "SMESH_Gen_i.hxx"
#include "SMESH_Group_i.hxx"
#include "SMESH_MEDMesh_i.hxx"
#include "SMESH_MeshEditor_i.hxx"
#include "SMESH_PythonDump.hxx"
#include "SMESH_subMesh_i.hxx"
#include "DriverMED_R_SMESHDS_Mesh.h"
#include "DriverMED_W_SMESHDS_Mesh.h"
#include "SMDS_VolumeTool.hxx"
#include "SMDS_ElemIterator.hxx"
#include "SMESHDS_Command.hxx"
#include "SMESHDS_CommandType.hxx"
#include "SMESHDS_GroupOnGeom.hxx"
#include "SMESH_Group.hxx"
#include "SMESH_MeshEditor.hxx"
#include "SMESH_MesherHelper.hxx"
#include "SMDS_EdgePosition.hxx"
#include "SMDS_FacePosition.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>
Include dependency graph for SMESH_Mesh_i.cxx:

Go to the source code of this file.

Data Structures

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;
 importMEDFile
#define CASE2STRING(enum)   case SMESH::enum: return "SMESH."#enum;
 ElementTypeString.

Typedefs

typedef list< SMESH_DimHyp * > TDimHypList

Functions

static SMESH::DriverMED_ReadStatus ConvertDriverMEDReadStatus (int theStatus)
TCollection_AsciiString ElementTypeString (SMESH::ElementType theElemType)
static SALOMEDS::Color getUniqueColor (const std::list< SALOMEDS::Color > &theReservedColors)
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 CASE2STRING (   enum)    case SMESH::enum: return "SMESH."#enum;

ElementTypeString.

Definition at line 733 of file SMESH_Mesh_i.cxx.

Referenced by ElementTypeString().

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

importMEDFile

Imports mesh data from MED file

Definition at line 413 of file SMESH_Mesh_i.cxx.

Referenced by SMESH_Mesh_i.ConvertHypothesisStatus().

#define WITHGENERICOBJ

Definition at line 93 of file SMESH_Mesh_i.cxx.


Typedef Documentation

typedef list<SMESH_DimHyp*> TDimHypList

Definition at line 3847 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 3849 of file SMESH_Mesh_i.cxx.

References SMESH_DimHyp._hypothesises.

Referenced by SMESH_Mesh_i.GetMeshOrder().

{
  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]
TCollection_AsciiString ElementTypeString ( SMESH::ElementType  theElemType)

Definition at line 734 of file SMESH_Mesh_i.cxx.

References SMESH.ALL, CASE2STRING, EDGE, SMESH.ELEM0D, FACE, SMESH.NODE, and VOLUME.

Referenced by SMESH_Mesh_i.CreateGroup(), and SMESH_Mesh_i.CreateGroupFromGEOM().

{
  switch (theElemType) {
    CASE2STRING( ALL );
    CASE2STRING( NODE );
    CASE2STRING( EDGE );
    CASE2STRING( FACE );
    CASE2STRING( VOLUME );
    CASE2STRING( ELEM0D );
  default:;
  }
  return "";
}
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 4025 of file SMESH_Mesh_i.cxx.

Referenced by SMESH_Mesh_i.SetMeshOrder().

{
  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 3869 of file SMESH_Mesh_i.cxx.

References SMESH_DimHyp._subMesh, and SMESH_DimHyp.IsConcurrent().

Referenced by SMESH_Mesh_i.GetMeshOrder().

{
  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() );
  }
}
static SALOMEDS::Color getUniqueColor ( const std::list< SALOMEDS::Color > &  theReservedColors) [static]

Definition at line 2320 of file SMESH_Mesh_i.cxx.

References SMESH_AdvancedEditor.tol.

Referenced by SMESH_Mesh_i.SetAutoColor(), and SMESHGUI_GroupDlg.setDefaultGroupColor().

{
  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 3912 of file SMESH_Mesh_i.cxx.

Referenced by SMESH_Mesh_i.GetMeshOrder().

{
  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 3719 of file SMESH_Mesh_i.cxx.

Referenced by SMESH_Mesh_i.GetMeshOrder(), SMESH_DimHyp.IsConcurrent(), and SMESH_DimHyp.SetShape().

{
  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;
}
static void unionLists ( TListOfInt theListOfId,
TListOfListOfInt theListOfListOfId,
const int  theIndx 
) [static]

Definition at line 3886 of file SMESH_Mesh_i.cxx.

Referenced by SMESH_Mesh_i.GetMeshOrder().

{
  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 83 of file SMESH_Mesh_i.cxx.

Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS