Back to index

salome-smesh  6.5.0
Classes | Public Member Functions | Private Attributes
SMESH_MeshPartDS Class Reference

Class providing SMESHDS_Mesh API to SMESH_IDSource. More...

Collaboration diagram for SMESH_MeshPartDS:
Collaboration graph
[legend]

List of all members.

Classes

struct  TMeshInfo
 Class used to access to protected data of SMDS_MeshInfo. More...

Public Member Functions

 SMESH_MeshPartDS (SMESH::SMESH_IDSource_ptr meshPart)
virtual SMDS_NodeIteratorPtr nodesIterator (bool idInceasingOrder=false) const
virtual SMDS_0DElementIteratorPtr elements0dIterator (bool idInceasingOrder=false) const
virtual SMDS_EdgeIteratorPtr edgesIterator (bool idInceasingOrder=false) const
virtual SMDS_FaceIteratorPtr facesIterator (bool idInceasingOrder=false) const
virtual SMDS_VolumeIteratorPtr volumesIterator (bool idInceasingOrder=false) const
virtual SMDS_ElemIteratorPtr elementsIterator (SMDSAbs_ElementType type=SMDSAbs_All) const

Private Attributes

TIDSortedElemSet _elements [SMDSAbs_NbElementTypes]
SMESHDS_Mesh * _meshDS

Detailed Description

Class providing SMESHDS_Mesh API to SMESH_IDSource.

It is used to export a part of mesh as a whole mesh.

Definition at line 2846 of file SMESH_Mesh_i.cxx.


Constructor & Destructor Documentation

SMESH_MeshPartDS::SMESH_MeshPartDS ( SMESH::SMESH_IDSource_ptr  meshPart)

Definition at line 4772 of file SMESH_Mesh_i.cxx.

                                                                  :
  SMESHDS_Mesh( /*meshID=*/-1, /*isEmbeddedMode=*/true)
{
  SMESH::SMESH_Mesh_var mesh = meshPart->GetMesh();
  SMESH_Mesh_i*       mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh );

  _meshDS = mesh_i->GetImpl().GetMeshDS();

  SetPersistentId( _meshDS->GetPersistentId() );

  if ( mesh_i == SMESH::DownCast<SMESH_Mesh_i*>( meshPart ))
  {
    // <meshPart> is the whole mesh
    myInfo = _meshDS->GetMeshInfo(); // copy mesh info;
    // copy groups
    set<SMESHDS_GroupBase*>& myGroupSet = const_cast<set<SMESHDS_GroupBase*>&>( GetGroups() );
    myGroupSet = _meshDS->GetGroups();
  }
  else
  {
    TMeshInfo tmpInfo;
    SMESH::long_array_var           anIDs = meshPart->GetIDs();
    SMESH::array_of_ElementType_var types = meshPart->GetTypes();
    if ( types->length() == 1 && types[0] == SMESH::NODE ) // group of nodes
    {
      for (int i=0; i < anIDs->length(); i++)
        if ( const SMDS_MeshNode * n = _meshDS->FindNode(anIDs[i]))
          if ( _elements[ SMDSAbs_Node ].insert( n ).second )
            tmpInfo.Add( n );
    }
    else
    {
      for (int i=0; i < anIDs->length(); i++)
        if ( const SMDS_MeshElement * e = _meshDS->FindElement(anIDs[i]))
          if ( _elements[ e->GetType() ].insert( e ).second )
          {
            tmpInfo.Add( e );
            SMDS_ElemIteratorPtr nIt = e->nodesIterator();
            while ( nIt->more() )
            {
              const SMDS_MeshNode * n = (const SMDS_MeshNode*) nIt->next();
              if ( _elements[ SMDSAbs_Node ].insert( n ).second )
                tmpInfo.Add( n );
            }
          }
    }
    myInfo = tmpInfo;

    _meshDS = 0; // to enforce iteration on _elements and _nodes
  }
}

Here is the call graph for this function:


Member Function Documentation

virtual SMDS_EdgeIteratorPtr SMESH_MeshPartDS::edgesIterator ( bool  idInceasingOrder = false) const [virtual]
virtual SMDS_0DElementIteratorPtr SMESH_MeshPartDS::elements0dIterator ( bool  idInceasingOrder = false) const [virtual]

Definition at line 4824 of file SMESH_Mesh_i.cxx.

{
  typedef SMDS_SetIterator<const SMDS_MeshElement*, TIDSortedElemSet::const_iterator > TIter;
  if ( type == SMDSAbs_All && !_meshDS )
  {
    typedef vector< SMDS_ElemIteratorPtr > TIterVec;
    TIterVec iterVec;
    for ( int i = 0; i < SMDSAbs_NbElementTypes; ++i )
      if ( !_elements[i].empty() && i != SMDSAbs_Node )
        iterVec.push_back
          ( SMDS_ElemIteratorPtr( new TIter( _elements[i].begin(), _elements[i].end() )));

    typedef SMDS_IteratorOnIterators<const SMDS_MeshElement*, TIterVec > TIterOnIters;
    return SMDS_ElemIteratorPtr( new TIterOnIters( iterVec ));
  }
  return _meshDS ? _meshDS->elementsIterator(type) : SMDS_ElemIteratorPtr
      ( new TIter( _elements[type].begin(), _elements[type].end() ));
}
virtual SMDS_FaceIteratorPtr SMESH_MeshPartDS::facesIterator ( bool  idInceasingOrder = false) const [virtual]
virtual SMDS_NodeIteratorPtr SMESH_MeshPartDS::nodesIterator ( bool  idInceasingOrder = false) const [virtual]
virtual SMDS_VolumeIteratorPtr SMESH_MeshPartDS::volumesIterator ( bool  idInceasingOrder = false) const [virtual]

Member Data Documentation

Definition at line 2860 of file SMESH_Mesh_i.cxx.

SMESHDS_Mesh* SMESH_MeshPartDS::_meshDS [private]

Definition at line 2861 of file SMESH_Mesh_i.cxx.


The documentation for this class was generated from the following file: