Version: 6.3.1
Public Types | Public Member Functions | Static Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes

VISCOUS._MeshOfSolid Struct Reference

SMESH_ProxyMesh computed by _ViscousBuilder for a SOLID. More...

Inheritance diagram for VISCOUS._MeshOfSolid:
Inheritance graph
[legend]

Public Types

typedef boost::shared_ptr
< SMESH_ProxyMesh
Ptr
typedef std::map< const
SMDS_MeshNode *, const
SMDS_MeshNode *, TIDCompare
TN2NMap

Public Member Functions

 _MeshOfSolid (SMESH_Mesh *mesh)
SMESH_ProxyMesh::SubMeshgetFaceSubM (const TopoDS_Face &F, bool create=false)
void setNode2Node (const SMDS_MeshNode *srcNode, const SMDS_MeshNode *proxyNode, const SMESH_ProxyMesh::SubMesh *subMesh)
 Set node-node correspondence.
const SMESHDS_SubMeshGetSubMesh (const TopoDS_Shape &face) const
 Returns the submesh of a shape; it can be a proxy sub-mesh.
const SubMeshGetProxySubMesh (const TopoDS_Shape &face) const
 Returns the proxy sub-mesh of a shape; it can be NULL.
const SMDS_MeshNodeGetProxyNode (const SMDS_MeshNode *node) const
 Returns the proxy node of a node; the input node is returned if no proxy exists.
SMDS_ElemIteratorPtr GetFaces () const
 Returns iterator on all faces of the mesh taking into account substitutions To be used in case of mesh without shape.
SMDS_ElemIteratorPtr GetFaces (const TopoDS_Shape &face) const
 Returns iterator on all faces on the shape taking into account substitutions.
int NbFaces () const
 Return total nb of faces taking into account substitutions.
bool IsTemporary (const SMDS_MeshElement *elem) const
 Return true if the element is a temporary one.
const SMESH_MeshGetMesh () const
SMESHDS_MeshGetMeshDS () const
 Returns mesh DS.
bool IsDeletable () const

Static Public Member Functions

static
SMESH_subMeshEventListenerData
MakeData (SMESH_subMesh *dependentSM, const int type=0)
 Create a default listener data.

Data Fields

bool _n2nMapComputed
bool myIsDeletable
 if true, it will be deleted by SMESH_subMesh
int myType
 to recognize data type
std::list< SMESH_subMesh * > mySubMeshes
 generally: submeshes depending

Protected Member Functions

void setMesh (const SMESH_Mesh &mesh)
int shapeIndex (const TopoDS_Shape &shape) const
 Returns index of a shape.
SubMeshfindProxySubMesh (int shapeIndex=0) const
 Returns a proxy sub-mesh.
SubMeshgetProxySubMesh (int shapeIndex)
 Returns a proxy sub-mesh; it is created if not yet exists.
SubMeshgetProxySubMesh (const TopoDS_Shape &shape=TopoDS_Shape())
 Returns a proxy sub-mesh; it is created if not yet exists.
bool takeProxySubMesh (const TopoDS_Shape &shape, SMESH_ProxyMesh *proxyMesh)
 Move proxy sub-mesh from other proxy mesh to this, returns true if sub-mesh found.
void takeTmpElemsInMesh (SMESH_ProxyMesh *proxyMesh)
 Move tmp elements residing the _mesh from other proxy mesh to this.
void removeTmpElement (const SMDS_MeshElement *face)
 Removes tmp faces from the _mesh.
void storeTmpElement (const SMDS_MeshElement *face)
 Stores tmp element residing the _mesh.

Protected Attributes

std::vector< SMDSAbs_EntityType_allowedTypes

Detailed Description

SMESH_ProxyMesh computed by _ViscousBuilder for a SOLID.

It is stored in a SMESH_subMesh of the SOLID as SMESH_subMeshEventListenerData

Definition at line 92 of file StdMeshers_ViscousLayers.cxx.


Member Typedef Documentation

typedef boost::shared_ptr<SMESH_ProxyMesh> SMESH_ProxyMesh.Ptr [inherited]

Definition at line 49 of file SMESH_ProxyMesh.hxx.

typedef std::map<const SMDS_MeshNode*, const SMDS_MeshNode*, TIDCompare > SMESH_ProxyMesh.TN2NMap [inherited]

Definition at line 51 of file SMESH_ProxyMesh.hxx.


Constructor & Destructor Documentation

VISCOUS._MeshOfSolid._MeshOfSolid ( SMESH_Mesh mesh)

Definition at line 97 of file StdMeshers_ViscousLayers.cxx.

References SMESH_ProxyMesh.setMesh().

      :SMESH_subMeshEventListenerData( /*isDeletable=*/true),_n2nMapComputed(false)
    {
      SMESH_ProxyMesh::setMesh( *mesh );
    }

Member Function Documentation

SMESH_ProxyMesh::SubMesh * SMESH_ProxyMesh::findProxySubMesh ( int  shapeIndex = 0) const [protected, inherited]

Returns a proxy sub-mesh.

Definition at line 353 of file SMESH_ProxyMesh.cxx.

References SMESH_ProxyMesh._subMeshes.

Referenced by StdMeshers_QuadToTriaAdaptor.Compute2ndPart(), SMESH_ProxyMesh.GetProxyNode(), and SMESH_ProxyMesh.takeProxySubMesh().

{
  return shapeIndex < int(_subMeshes.size()) ? _subMeshes[shapeIndex] : 0;
}
SMDS_ElemIteratorPtr SMESH_ProxyMesh::GetFaces ( ) const [inherited]

Returns iterator on all faces of the mesh taking into account substitutions To be used in case of mesh without shape.

Definition at line 249 of file SMESH_ProxyMesh.cxx.

References SMESH_ProxyMesh._allowedTypes, SMESH_ProxyMesh._mesh, SMESH_ProxyMesh._subContainer, SMESH_ProxyMesh._subMeshes, SMESHDS_SubMesh.AddSubMesh(), SMDS_Mesh.elementsIterator(), SMESH_ProxyMesh.GetMeshDS(), SMESH_Mesh.HasShapeToMesh(), SMESH_Mesh.NbFaces(), SMESH_ProxyMesh.NbFaces(), SMESHDS_SubMesh.NbSubMeshes(), SMESHDS_SubMesh.RemoveAllSubmeshes(), and SMDSAbs_Face.

Referenced by StdMeshers_QuadToTriaAdaptor.Compute(), VISCOUS._ViscousBuilder.inflate(), and VISCOUS._ViscousBuilder.smoothAndCheck().

{
  if ( _mesh->HasShapeToMesh() )
    return SMDS_ElemIteratorPtr();

  _subContainer.RemoveAllSubmeshes();
  for ( unsigned i = 0; i < _subMeshes.size(); ++i )
    if ( _subMeshes[i] )
      _subContainer.AddSubMesh( _subMeshes[i] );

  if ( _subContainer.NbSubMeshes() == 0 ) // no elements substituted
    return GetMeshDS()->elementsIterator(SMDSAbs_Face);

  // if _allowedTypes is empty, only elements from _subMeshes are returned,...
  SMDS_ElemIteratorPtr proxyIter = _subContainer.SMESHDS_SubMesh::GetElements();
  if ( _allowedTypes.empty() || NbFaces() == _mesh->NbFaces() )
    return proxyIter;

  // ... else elements filtered using allowedTypes are additionally returned
  SMDS_ElemIteratorPtr facesIter = GetMeshDS()->elementsIterator(SMDSAbs_Face);
  SMDS_ElemIteratorPtr filterIter( new TFilteringIterator( _allowedTypes, facesIter ));
  vector< SMDS_ElemIteratorPtr > iters(2);
  iters[0] = proxyIter;
  iters[1] = filterIter;
    
  typedef vector< SMDS_ElemIteratorPtr > TElemIterVector;
  typedef SMDS_IteratorOnIterators<const SMDS_MeshElement *, TElemIterVector> TItersIter;
  return SMDS_ElemIteratorPtr( new TItersIter( iters ));
}
SMDS_ElemIteratorPtr SMESH_ProxyMesh::GetFaces ( const TopoDS_Shape &  face) const [inherited]

Returns iterator on all faces on the shape taking into account substitutions.

Definition at line 226 of file SMESH_ProxyMesh.cxx.

References SMESH_ProxyMesh._mesh, SMESH_ProxyMesh._subContainer, SMESHDS_SubMesh.AddSubMesh(), SMESH_ProxyMesh.GetSubMesh(), SMESH_Mesh.HasShapeToMesh(), and SMESHDS_SubMesh.RemoveAllSubmeshes().

{
  if ( !_mesh->HasShapeToMesh() )
    return SMDS_ElemIteratorPtr();

  _subContainer.RemoveAllSubmeshes();

  TopTools_IndexedMapOfShape FF;
  TopExp::MapShapes( shape, TopAbs_FACE, FF );
  for ( int i = 1; i <= FF.Extent(); ++i )
    if ( const SMESHDS_SubMesh* sm = GetSubMesh( FF(i)))
      _subContainer.AddSubMesh( sm );

  return _subContainer.SMESHDS_SubMesh::GetElements();
}
SMESH_ProxyMesh::SubMesh* VISCOUS._MeshOfSolid.getFaceSubM ( const TopoDS_Face &  F,
bool  create = false 
)
const SMESH_Mesh* SMESH_ProxyMesh.GetMesh ( ) const [inherited]

Definition at line 116 of file SMESH_ProxyMesh.hxx.

References SMESH_ProxyMesh._mesh.

{ return _mesh; }
SMESHDS_Mesh * SMESH_ProxyMesh::GetMeshDS ( ) const [inherited]
const SMDS_MeshNode * SMESH_ProxyMesh::GetProxyNode ( const SMDS_MeshNode node) const [inherited]

Returns the proxy node of a node; the input node is returned if no proxy exists.

Definition at line 161 of file SMESH_ProxyMesh.cxx.

References SMESH_ProxyMesh._mesh, SMESH_ProxyMesh.findProxySubMesh(), SMESH_Mesh.GetAncestors(), SMESH_ProxyMesh.GetMeshDS(), SMDS_MeshNode.GetPosition(), SMDS_MeshElement.getshapeId(), SMESH_MesherHelper.GetSubShapeByNode(), SMDS_Position.GetTypeOfPosition(), ex29_refine.node(), SMESH_fixation.shape, SMESH_ProxyMesh.shapeIndex(), and SMDS_TOP_FACE.

Referenced by SMESH_MesherHelper.LoadNodeColumns().

{
  const SMDS_MeshNode* proxy = node;
  if ( node->GetPosition()->GetTypeOfPosition() == SMDS_TOP_FACE )
  {
    if ( const SubMesh* proxySM = findProxySubMesh( node->getshapeId() ))
      proxy = proxySM->GetProxyNode( node );
  }
  else
  {
    TopoDS_Shape shape = SMESH_MesherHelper::GetSubShapeByNode( node, GetMeshDS());
    TopTools_ListIteratorOfListOfShape ancIt;
    if ( !shape.IsNull() ) ancIt.Initialize( _mesh->GetAncestors( shape ));
    for ( ; ancIt.More() && proxy == node; ancIt.Next() )
      if ( const SubMesh* proxySM = findProxySubMesh( shapeIndex(ancIt.Value())))
        proxy = proxySM->GetProxyNode( node );
  }
  return proxy;
}
SMESH_ProxyMesh::SubMesh * SMESH_ProxyMesh::getProxySubMesh ( const TopoDS_Shape &  shape = TopoDS_Shape()) [protected, inherited]

Returns a proxy sub-mesh; it is created if not yet exists.

Definition at line 342 of file SMESH_ProxyMesh.cxx.

References SMESH_ProxyMesh.getProxySubMesh(), and SMESH_ProxyMesh.shapeIndex().

{
  return getProxySubMesh( shapeIndex( shape ));
}
const SMESH_ProxyMesh::SubMesh * SMESH_ProxyMesh::GetProxySubMesh ( const TopoDS_Shape &  face) const [inherited]

Returns the proxy sub-mesh of a shape; it can be NULL.

Definition at line 149 of file SMESH_ProxyMesh.cxx.

References SMESH_ProxyMesh._subMeshes, and SMESH_ProxyMesh.shapeIndex().

Referenced by VISCOUS._ViscousBuilder.MakeN2NMap().

{
  int i = shapeIndex(shape);
  return i < _subMeshes.size() ? _subMeshes[i] : 0;
}
SMESH_ProxyMesh::SubMesh * SMESH_ProxyMesh::getProxySubMesh ( int  shapeIndex) [protected, inherited]

Returns a proxy sub-mesh; it is created if not yet exists.

Definition at line 327 of file SMESH_ProxyMesh.cxx.

References SMESH_ProxyMesh._subMeshes.

Referenced by StdMeshers_QuadToTriaAdaptor.Compute(), VISCOUS._MeshOfSolid.getFaceSubM(), and SMESH_ProxyMesh.getProxySubMesh().

{
  if ( int(_subMeshes.size()) <= index )
    _subMeshes.resize( index+1, 0 );
  if ( !_subMeshes[index] )
    _subMeshes[index] = new SubMesh( index );
  return _subMeshes[index];
}
const SMESHDS_SubMesh * SMESH_ProxyMesh::GetSubMesh ( const TopoDS_Shape &  face) const [inherited]

Returns the submesh of a shape; it can be a proxy sub-mesh.

Definition at line 129 of file SMESH_ProxyMesh.cxx.

References SMESH_ProxyMesh._subMeshes, SMESH_ProxyMesh.GetMeshDS(), SMESHDS_Mesh.MeshElements(), and SMESH_ProxyMesh.shapeIndex().

Referenced by StdMeshers_QuadToTriaAdaptor.Compute(), SMESH_ProxyMesh.GetFaces(), SMESH_MesherHelper.LoadNodeColumns(), and SMESH_ProxyMesh.NbFaces().

{
  const SMESHDS_SubMesh* sm = 0;

  int i = shapeIndex(shape);
  if ( i < _subMeshes.size() )
    sm = _subMeshes[i];
  if ( !sm )
    sm = GetMeshDS()->MeshElements( i );

  return sm;
}
bool SMESH_subMeshEventListenerData.IsDeletable ( ) const [inherited]
bool SMESH_ProxyMesh::IsTemporary ( const SMDS_MeshElement elem) const [inherited]

Return true if the element is a temporary one.

Definition at line 465 of file SMESH_ProxyMesh.cxx.

References SMESH_ProxyMesh._elemsInMesh, and SMDS_MeshElement.GetID().

Referenced by SMESH_MesherHelper.LoadNodeColumns().

{
  return ( elem->GetID() < 1 ) || _elemsInMesh.count( elem );
}
static SMESH_subMeshEventListenerData* SMESH_subMeshEventListenerData.MakeData ( SMESH_subMesh dependentSM,
const int  type = 0 
) [static, inherited]

Create a default listener data.

Parameters:
dependentSM- subMesh to store
type- data type
Return values:
SMESH_subMeshEventListenerData*- a new listener data

See SMESH_subMeshEventListener.ProcessEvent() to know how the default listener uses it (implementation is in SMESH_subMesh.cxx)

Definition at line 98 of file SMESH_subMeshEventListener.hxx.

References SMESH_subMeshEventListenerData.mySubMeshes, SMESH_subMeshEventListenerData.myType, and SMESH_subMeshEventListenerData.SMESH_subMeshEventListenerData().

Referenced by StdMeshers_Penta_3D.MakeMeshOnFxy1(), StdMeshers_ProjectionUtils.SetEventListener(), and VISCOUS._SrinkShapeListener.ToClearSubMeshWithSolid().

  {
    SMESH_subMeshEventListenerData* data = new SMESH_subMeshEventListenerData(true);
    data->mySubMeshes.push_back( dependentSM );
    data->myType = type;
    return data;
  }
int SMESH_ProxyMesh::NbFaces ( ) const [inherited]

Return total nb of faces taking into account substitutions.

Definition at line 285 of file SMESH_ProxyMesh.cxx.

References SMESH_ProxyMesh._allowedTypes, SMESH_ProxyMesh._mesh, SMESH_ProxyMesh._subMeshes, SMESH_ProxyMesh.GetMeshDS(), SMDS_Mesh.GetMeshInfo(), SMESH_Mesh.GetShapeToMesh(), SMESH_ProxyMesh.GetSubMesh(), SMESH_Mesh.HasShapeToMesh(), SMDS_MeshInfo.NbEntities(), SMDS_Mesh.NbFaces(), SMDSEntity_Quad_Quadrangle, and SMDSEntity_Triangle.

Referenced by SMESH_ProxyMesh.GetFaces().

{
  int nb = 0;
  if ( _mesh->HasShapeToMesh() )
  {
    TopTools_IndexedMapOfShape FF;
    TopExp::MapShapes( _mesh->GetShapeToMesh(), TopAbs_FACE, FF );
    for ( int i = 1; i <= FF.Extent(); ++i )
      if ( const SMESHDS_SubMesh* sm = GetSubMesh( FF(i)))
        nb += sm->NbElements();
  }
  else
  {
    if ( _subMeshes.empty() )
      return GetMeshDS()->NbFaces();

    for ( unsigned i = 0; i < _subMeshes.size(); ++i )
      if ( _subMeshes[i] )
        nb += _subMeshes[i]->NbElements();

    // if _allowedTypes is empty, only elements from _subMeshes are returned,
    // else elements filtered using allowedTypes are additionally returned
    if ( !_allowedTypes.empty() )
    {
      for ( int t = SMDSEntity_Triangle; t <= SMDSEntity_Quad_Quadrangle; ++t )
      {
        bool allowed =
          ( find( _allowedTypes.begin(), _allowedTypes.end(), t ) != _allowedTypes.end() );
        if ( allowed )
          nb += GetMeshDS()->GetMeshInfo().NbEntities( SMDSAbs_EntityType( t ));
      }
    }
  }
  return nb;
}
void SMESH_ProxyMesh::removeTmpElement ( const SMDS_MeshElement face) [protected, inherited]

Removes tmp faces from the _mesh.

Definition at line 415 of file SMESH_ProxyMesh.cxx.

References SMESH_ProxyMesh._elemsInMesh, PAL_MESH_043_3D.face, SMDS_MeshElement.GetID(), SMESH_ProxyMesh.GetMeshDS(), and SMESHDS_Mesh.RemoveFreeElement().

Referenced by StdMeshers_QuadToTriaAdaptor.Compute().

{
  if ( face && face->GetID() > 0 )
  {
    set< const SMDS_MeshElement* >::iterator i =  _elemsInMesh.find( face );
    if ( i != _elemsInMesh.end() )
    {
      GetMeshDS()->RemoveFreeElement( face, 0 );
      _elemsInMesh.erase( i );
    }
  }
  else
  {
    delete face;
  }
}
void SMESH_ProxyMesh.setMesh ( const SMESH_Mesh mesh) [protected, inherited]
void VISCOUS._MeshOfSolid.setNode2Node ( const SMDS_MeshNode srcNode,
const SMDS_MeshNode proxyNode,
const SMESH_ProxyMesh::SubMesh subMesh 
)

Set node-node correspondence.

Reimplemented from SMESH_ProxyMesh.

Definition at line 109 of file StdMeshers_ViscousLayers.cxx.

References SMESH_ProxyMesh.setNode2Node().

Referenced by VISCOUS._ViscousBuilder.MakeN2NMap().

    {
      SMESH_ProxyMesh::setNode2Node( srcNode,proxyNode,subMesh);
    }
int SMESH_ProxyMesh::shapeIndex ( const TopoDS_Shape &  shape) const [protected, inherited]
void SMESH_ProxyMesh::storeTmpElement ( const SMDS_MeshElement face) [protected, inherited]

Stores tmp element residing the _mesh.

Definition at line 438 of file SMESH_ProxyMesh.cxx.

References SMESH_ProxyMesh._elemsInMesh.

Referenced by StdMeshers_QuadToTriaAdaptor.Compute().

{
  _elemsInMesh.insert( face );
}
bool SMESH_ProxyMesh::takeProxySubMesh ( const TopoDS_Shape &  shape,
SMESH_ProxyMesh proxyMesh 
) [protected, inherited]

Move proxy sub-mesh from other proxy mesh to this, returns true if sub-mesh found.

Definition at line 375 of file SMESH_ProxyMesh.cxx.

References SMESH_ProxyMesh._mesh, SMESH_ProxyMesh._subMeshes, SMESH_ProxyMesh.findProxySubMesh(), and SMESH_ProxyMesh.shapeIndex().

Referenced by StdMeshers_QuadToTriaAdaptor.Compute().

{
  if ( proxyMesh && proxyMesh->_mesh == _mesh )
  {
    int iS = shapeIndex( shape );
    if ( SubMesh* sm = proxyMesh->findProxySubMesh( iS ))
    {
      if ( iS >= int(_subMeshes.size()) )
        _subMeshes.resize( iS + 1, 0 );
      _subMeshes[iS] = sm;
      proxyMesh->_subMeshes[iS] = 0;
      return true;
    }
  }
  return false;
}
void SMESH_ProxyMesh::takeTmpElemsInMesh ( SMESH_ProxyMesh proxyMesh) [protected, inherited]

Move tmp elements residing the _mesh from other proxy mesh to this.

Definition at line 399 of file SMESH_ProxyMesh.cxx.

References SMESH_ProxyMesh._elemsInMesh.

Referenced by StdMeshers_QuadToTriaAdaptor.Compute().

{
  if ( proxyMesh )
  {
    _elemsInMesh.insert( proxyMesh->_elemsInMesh.begin(),
                         proxyMesh->_elemsInMesh.end());
    proxyMesh->_elemsInMesh.clear();
  }
}

Field Documentation

std::vector< SMDSAbs_EntityType> SMESH_ProxyMesh._allowedTypes [protected, inherited]

Definition at line 95 of file StdMeshers_ViscousLayers.cxx.

Referenced by VISCOUS._ViscousBuilder.MakeN2NMap().

if true, it will be deleted by SMESH_subMesh

Definition at line 80 of file SMESH_subMeshEventListener.hxx.

Referenced by SMESH_subMeshEventListenerData.IsDeletable().

to recognize data type

Definition at line 81 of file SMESH_subMeshEventListener.hxx.

Referenced by SMESH_subMeshEventListenerData.MakeData().

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