Version: 6.3.1
Public Member Functions | Private Types | Private Member Functions | Private Attributes

SMDS_MeshGroup Class Reference

#include <SMDS_MeshGroup.hxx>

Inheritance diagram for SMDS_MeshGroup:
Inheritance graph
[legend]

Public Member Functions

 SMDS_MeshGroup (const SMDS_Mesh *theMesh, const SMDSAbs_ElementType theType=SMDSAbs_All)
const SMDS_MeshGroupAddSubGroup (const SMDSAbs_ElementType theType=SMDSAbs_All)
virtual bool RemoveSubGroup (const SMDS_MeshGroup *theGroup)
virtual bool RemoveFromParent ()
const SMDS_MeshGetMesh () const
void SetType (const SMDSAbs_ElementType theType)
void Clear ()
void Add (const SMDS_MeshElement *theElem)
bool Remove (const SMDS_MeshElement *theElem)
bool IsEmpty () const
int Extent () const
int SubGroupsNb () const
SMDSAbs_ElementType GetType () const
bool Contains (const SMDS_MeshElement *theElem) const
void InitIterator () const
bool More () const
const SMDS_MeshElementNext () const
void InitSubGroupsIterator () const
bool MoreSubGroups () const
const SMDS_MeshGroupNextSubGroup () const

Private Types

typedef std::set< const
SMDS_MeshElement * >
::const_iterator 
TIterator
typedef std::list< const
SMDS_MeshGroup * >
::const_iterator 
TGroupIterator

Private Member Functions

 SMDS_MeshGroup (SMDS_MeshGroup *theParent, const SMDSAbs_ElementType theType=SMDSAbs_All)

Private Attributes

const SMDS_MeshmyMesh
SMDSAbs_ElementType myType
std::set< const
SMDS_MeshElement * > 
myElements
SMDS_MeshGroupmyParent
std::list< const SMDS_MeshGroup * > myChildren
TIterator myIterator
TGroupIterator myGroupIterator

Detailed Description

Definition at line 35 of file SMDS_MeshGroup.hxx.


Member Typedef Documentation

typedef std::list<const SMDS_MeshGroup *>::const_iterator SMDS_MeshGroup.TGroupIterator [private]

Definition at line 81 of file SMDS_MeshGroup.hxx.

typedef std::set<const SMDS_MeshElement *>::const_iterator SMDS_MeshGroup.TIterator [private]

Definition at line 80 of file SMDS_MeshGroup.hxx.


Constructor & Destructor Documentation

SMDS_MeshGroup::SMDS_MeshGroup ( const SMDS_Mesh theMesh,
const SMDSAbs_ElementType  theType = SMDSAbs_All 
)

Definition at line 42 of file SMDS_MeshGroup.cxx.

        :myMesh(theMesh),myType(theType), myParent(NULL)
{
}
SMDS_MeshGroup::SMDS_MeshGroup ( SMDS_MeshGroup theParent,
const SMDSAbs_ElementType  theType = SMDSAbs_All 
) [private]

Definition at line 53 of file SMDS_MeshGroup.cxx.

        :myMesh(theParent->myMesh),myType(theType), myParent(theParent)
{
}

Member Function Documentation

void SMDS_MeshGroup::Add ( const SMDS_MeshElement theElem)

Definition at line 124 of file SMDS_MeshGroup.cxx.

References SMDS_MeshElement.GetType(), MESSAGE, myElements, and myType.

Referenced by SMESHDS_Group.Add(), SMESH_MeshEditor.AddToSameGroups(), SMESH_Gen_i.CopyMesh(), SMESH_MeshEditor.generateGroups(), DriverMED_R_SMESHDS_Mesh.GetGroup(), StdMeshers_Import_1D.importMesh(), DriverUNV_R_SMDS_Mesh.Perform(), SMESH_MeshEditor.ReplaceElemInGroups(), and SMESH_Mesh.UNVToMesh().

{
        // the type of the group is determined by the first element added
        if (myElements.empty()) myType = theElem->GetType();
        else if (theElem->GetType() != myType) {
          MESSAGE("SMDS_MeshGroup::Add : Type Mismatch "<<theElem->GetType()<<"!="<<myType);
          return;
        }
        
        myElements.insert(theElem);
}
const SMDS_MeshGroup * SMDS_MeshGroup::AddSubGroup ( const SMDSAbs_ElementType  theType = SMDSAbs_All)

Definition at line 65 of file SMDS_MeshGroup.cxx.

Referenced by DriverUNV_R_SMDS_Mesh.Perform().

{
        const SMDS_MeshGroup * subgroup = new SMDS_MeshGroup(this,theType);
        myChildren.insert(myChildren.end(),subgroup);
        return subgroup;
}
void SMDS_MeshGroup::Clear ( )

Definition at line 113 of file SMDS_MeshGroup.cxx.

References myElements, myType, and SMDSAbs_All.

Referenced by SMESHDS_Group.Clear().

{
        myElements.clear();
        myType = SMDSAbs_All;
}
bool SMDS_MeshGroup::Contains ( const SMDS_MeshElement theElem) const

Definition at line 158 of file SMDS_MeshGroup.cxx.

References myElements.

Referenced by SMESHDS_Group.Add(), SMESHDS_Group.Contains(), SMESH_Pattern.createElements(), and SMESHDS_Group.Remove().

{
        return myElements.find(theElem)!=myElements.end();
}
int SMDS_MeshGroup.Extent ( ) const

Definition at line 52 of file SMDS_MeshGroup.hxx.

Referenced by SMESHDS_Group.Extent().

{ return myElements.size(); }
const SMDS_Mesh* SMDS_MeshGroup.GetMesh ( ) const

Definition at line 45 of file SMDS_MeshGroup.hxx.

{ return myMesh; }
SMDSAbs_ElementType SMDS_MeshGroup.GetType ( ) const

Definition at line 56 of file SMDS_MeshGroup.hxx.

Referenced by SMESHDS_Group.SetType(), and SMESH_Mesh.UNVToMesh().

{ return myType; }
void SMDS_MeshGroup.InitIterator ( ) const

Definition at line 60 of file SMDS_MeshGroup.hxx.

Referenced by MyGroupIterator.MyGroupIterator(), and SMESH_Mesh.UNVToMesh().

        { const_cast<TIterator&>(myIterator) = myElements.begin(); }
void SMDS_MeshGroup.InitSubGroupsIterator ( ) const

Definition at line 68 of file SMDS_MeshGroup.hxx.

Referenced by SMESH_Mesh.UNVToMesh().

        { const_cast<TGroupIterator&>(myGroupIterator) = myChildren.begin(); }
bool SMDS_MeshGroup.IsEmpty ( ) const

Definition at line 51 of file SMDS_MeshGroup.hxx.

Referenced by SMESHDS_Group.Add(), SMESHDS_Group.IsEmpty(), SMESHDS_Group.SetType(), and SetType().

{ return myElements.empty(); }
bool SMDS_MeshGroup.More ( ) const

Definition at line 63 of file SMDS_MeshGroup.hxx.

Referenced by MyGroupIterator.more(), and SMESH_Mesh.UNVToMesh().

{ return myIterator != myElements.end(); }
bool SMDS_MeshGroup.MoreSubGroups ( ) const

Definition at line 71 of file SMDS_MeshGroup.hxx.

Referenced by SMESH_Mesh.UNVToMesh().

{ return myGroupIterator != myChildren.end(); }
const SMDS_MeshElement* SMDS_MeshGroup.Next ( ) const

Definition at line 65 of file SMDS_MeshGroup.hxx.

Referenced by MyGroupIterator.next(), and SMESH_Mesh.UNVToMesh().

        { return *(const_cast<TIterator&>(myIterator))++; }
const SMDS_MeshGroup* SMDS_MeshGroup.NextSubGroup ( ) const

Definition at line 73 of file SMDS_MeshGroup.hxx.

Referenced by SMESH_Mesh.UNVToMesh().

        { return *(const_cast<TGroupIterator&>(myGroupIterator))++; }
bool SMDS_MeshGroup::Remove ( const SMDS_MeshElement theElem)

Definition at line 141 of file SMDS_MeshGroup.cxx.

References myElements, myType, and SMDSAbs_All.

Referenced by SMESHDS_Group.Remove(), SMESH_MeshEditor.RemoveElemFromGroups(), SMESHDS_Mesh.RemoveFreeElement(), SMESHDS_Mesh.RemoveFreeNode(), removeFromContainers(), and SMESH_MeshEditor.ReplaceElemInGroups().

{
  std::set<const SMDS_MeshElement *>::iterator found
    = myElements.find(theElem);
  if ( found != myElements.end() ) {
    myElements.erase(found);
    if (myElements.empty()) myType = SMDSAbs_All;
    return true;
  }
  return false;
}
bool SMDS_MeshGroup::RemoveFromParent ( ) [virtual]

Definition at line 99 of file SMDS_MeshGroup.cxx.

References myParent, and RemoveSubGroup().

{
        
        if (myParent==NULL) return false;
        else
        {
                return (myParent->RemoveSubGroup(this));
        }
}
bool SMDS_MeshGroup::RemoveSubGroup ( const SMDS_MeshGroup theGroup) [virtual]

Definition at line 77 of file SMDS_MeshGroup.cxx.

References myChildren.

Referenced by RemoveFromParent().

{
        bool found = false;     
        list<const SMDS_MeshGroup*>::iterator itgroup;
        for(itgroup=myChildren.begin(); itgroup!=myChildren.end(); itgroup++)
        {
                const SMDS_MeshGroup* subgroup=*itgroup;
                if (subgroup == theGroup)
                {
                        found = true;
                        myChildren.erase(itgroup);
                }
        }

        return found;
}
void SMDS_MeshGroup::SetType ( const SMDSAbs_ElementType  theType)

Definition at line 168 of file SMDS_MeshGroup.cxx.

References IsEmpty(), and myType.

Referenced by SMESHDS_Group.SetType().

{
  if (IsEmpty())
    myType = theType;
}
int SMDS_MeshGroup.SubGroupsNb ( ) const

Definition at line 54 of file SMDS_MeshGroup.hxx.

{ return myChildren.size(); }

Field Documentation

std::list<const SMDS_MeshGroup*> SMDS_MeshGroup.myChildren [private]

Definition at line 87 of file SMDS_MeshGroup.hxx.

Referenced by RemoveSubGroup().

std::set<const SMDS_MeshElement *> SMDS_MeshGroup.myElements [private]

Definition at line 85 of file SMDS_MeshGroup.hxx.

Referenced by Add(), Clear(), Contains(), and Remove().

Definition at line 89 of file SMDS_MeshGroup.hxx.

Definition at line 88 of file SMDS_MeshGroup.hxx.

const SMDS_Mesh* SMDS_MeshGroup.myMesh [private]

Definition at line 83 of file SMDS_MeshGroup.hxx.

Definition at line 86 of file SMDS_MeshGroup.hxx.

Referenced by RemoveFromParent().

Definition at line 84 of file SMDS_MeshGroup.hxx.

Referenced by Add(), Clear(), Remove(), and SetType().

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