Version: 6.3.1
Public Member Functions | Static Public Member Functions | Data Fields

SMESH_DimHyp Class Reference

Internal structure used to find concurent submeshes. More...

Public Member Functions

 SMESH_DimHyp (const SMESH_subMesh *theSubMesh, const int theDim, const TopoDS_Shape &theShape)
 Constructors.
void SetShape (const int theDim, const TopoDS_Shape &theShape)
 set shape
bool IsConcurrent (const SMESH_DimHyp *theOther) const
 Check if subshape hypotheses are concurrent.

Static Public Member Functions

static bool isShareSubShapes (const TopTools_MapOfShape &theToCheck, const TopTools_MapOfShape &theToFind, const TopAbs_ShapeEnum theType)
 Check sharing of sub shapes.
static bool checkAlgo (const SMESHDS_Hypothesis *theA1, const SMESHDS_Hypothesis *theA2)
 check algorithms

Data Fields

int _dim
 fileds
int _ownDim
 dimension of shape of _subMesh (>=_dim)
TopTools_MapOfShape _shapeMap
SMESH_subMesh_subMesh
list< const SMESHDS_Hypothesis * > _hypothesises
 algo is first, then its parameters

Detailed Description

Internal structure used to find concurent submeshes.

It represents a pair < submesh, concurent dimension >, where 'concurrent dimension' is dimension of shape where the submesh can concurent with another submesh. In other words, it is dimension of a hypothesis assigned to submesh.

Definition at line 3743 of file SMESH_Mesh_i.cxx.


Constructor & Destructor Documentation

SMESH_DimHyp.SMESH_DimHyp ( const SMESH_subMesh theSubMesh,
const int  theDim,
const TopoDS_Shape &  theShape 
)

Constructors.

Definition at line 3754 of file SMESH_Mesh_i.cxx.

References _subMesh, and SetShape().

  {
    _subMesh = (SMESH_subMesh*)theSubMesh;
    SetShape( theDim, theShape );
  }

Member Function Documentation

static bool SMESH_DimHyp.checkAlgo ( const SMESHDS_Hypothesis theA1,
const SMESHDS_Hypothesis theA2 
) [static]

check algorithms

Definition at line 3797 of file SMESH_Mesh_i.cxx.

References SMESHDS_Hypothesis.GetName(), SMESHDS_Hypothesis.GetType(), and SMESHDS_Hypothesis.PARAM_ALGO.

Referenced by IsConcurrent().

  {
    if ( theA1->GetType() == SMESHDS_Hypothesis::PARAM_ALGO ||
         theA2->GetType() == SMESHDS_Hypothesis::PARAM_ALGO )
      return false; // one of the hypothesis is not algorithm
    // check algorithm names (should be equal)
    return strcmp( theA1->GetName(), theA2->GetName() ) == 0;
  }
bool SMESH_DimHyp.IsConcurrent ( const SMESH_DimHyp theOther) const

Check if subshape hypotheses are concurrent.

Definition at line 3809 of file SMESH_Mesh_i.cxx.

References _dim, _hypothesises, _ownDim, _shapeMap, _subMesh, checkAlgo(), isShareSubShapes(), and shapeTypeByDim().

Referenced by findConcurrents().

  {
    if ( _subMesh == theOther->_subMesh )
      return false; // same subshape - should not be

    // if ( <own dim of either of submeshes> == <concurrent dim> &&
    //      any of the two submeshes is not on COMPOUND shape )
    //  -> no concurrency
    bool meIsCompound = (_subMesh->GetSubMeshDS() && _subMesh->GetSubMeshDS()->IsComplexSubmesh());
    bool otherIsCompound = (theOther->_subMesh->GetSubMeshDS() && theOther->_subMesh->GetSubMeshDS()->IsComplexSubmesh());
    if ( (_ownDim == _dim  || theOther->_ownDim == _dim ) && (!meIsCompound || !otherIsCompound))
      return false;

//     bool checkSubShape = ( _dim >= theOther->_dim )
//       ? isShareSubShapes( _shapeMap, theOther->_shapeMap, shapeTypeByDim(theOther->_dim) )
//       : isShareSubShapes( theOther->_shapeMap, _shapeMap, shapeTypeByDim(_dim) ) ;
    bool checkSubShape = isShareSubShapes( _shapeMap, theOther->_shapeMap, shapeTypeByDim(_dim));
    if ( !checkSubShape )
        return false;

    // check algorithms to be same
    if (!checkAlgo( _hypothesises.front(), theOther->_hypothesises.front() ))
      return true; // different algorithms
    
    // check hypothesises for concurrence (skip first as algorithm)
    int nbSame = 0;
    // pointers should be same, becase it is referenes from mesh hypothesis partition
    list <const SMESHDS_Hypothesis*>::const_iterator hypIt = _hypothesises.begin();
    list <const SMESHDS_Hypothesis*>::const_iterator otheEndIt = theOther->_hypothesises.end();
    for ( hypIt++ /*skip first as algo*/; hypIt != _hypothesises.end(); hypIt++ )
      if ( find( theOther->_hypothesises.begin(), otheEndIt, *hypIt ) != otheEndIt )
        nbSame++;
    // the submeshes are concurrent if their algorithms has different parameters
    return nbSame != theOther->_hypothesises.size() - 1;
  }
static bool SMESH_DimHyp.isShareSubShapes ( const TopTools_MapOfShape &  theToCheck,
const TopTools_MapOfShape &  theToFind,
const TopAbs_ShapeEnum  theType 
) [static]

Check sharing of sub shapes.

Definition at line 3778 of file SMESH_Mesh_i.cxx.

Referenced by IsConcurrent().

  {
    bool isShared = false;
    TopTools_MapIteratorOfMapOfShape anItr( theToCheck );
    for (; !isShared && anItr.More(); anItr.Next() ) {
      const TopoDS_Shape aSubSh = anItr.Key();
      // check for case when concurrent dimensions are same
      isShared = theToFind.Contains( aSubSh );
      // check for subshape with concurrent dimension
      TopExp_Explorer anExp( aSubSh, theType );
      for ( ; !isShared && anExp.More(); anExp.Next() )
        isShared = theToFind.Contains( anExp.Current() );
    }
    return isShared;
  }
void SMESH_DimHyp.SetShape ( const int  theDim,
const TopoDS_Shape &  theShape 
)

set shape

Definition at line 3763 of file SMESH_Mesh_i.cxx.

References _dim, _ownDim, _shapeMap, SMESH_Gen.GetShapeDim(), and shapeTypeByDim().

Referenced by SMESH_DimHyp().

  {
    _dim = theDim;
    _ownDim = (int)SMESH_Gen::GetShapeDim(theShape);
    if (_dim >= _ownDim)
      _shapeMap.Add( theShape );
    else {
      TopExp_Explorer anExp( theShape, shapeTypeByDim(theDim) );
      for( ; anExp.More(); anExp.Next() )
        _shapeMap.Add( anExp.Current() );
    }
  }

Field Documentation

fileds

a dimension the algo can build (concurrent dimension)

Definition at line 3747 of file SMESH_Mesh_i.cxx.

Referenced by IsConcurrent(), and SetShape().

algo is first, then its parameters

Definition at line 3751 of file SMESH_Mesh_i.cxx.

Referenced by addDimHypInstance(), and IsConcurrent().

dimension of shape of _subMesh (>=_dim)

Definition at line 3748 of file SMESH_Mesh_i.cxx.

Referenced by IsConcurrent(), and SetShape().

TopTools_MapOfShape SMESH_DimHyp._shapeMap

Definition at line 3749 of file SMESH_Mesh_i.cxx.

Referenced by IsConcurrent(), and SetShape().

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