1 // Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : SMESHDS_Group.cxx
26 #include "SMESHDS_Group.hxx"
27 #include "SMESHDS_Mesh.hxx"
29 //=============================================================================
33 //=============================================================================
35 SMESHDS_Group::SMESHDS_Group (const int theID,
36 const SMESHDS_Mesh* theMesh,
37 const SMDSAbs_ElementType theType)
38 : SMESHDS_GroupBase(theID,theMesh,theType),
39 myGroup(theMesh,theType)
43 //=======================================================================
46 //=======================================================================
48 int SMESHDS_Group::Extent() const
50 return myGroup.Extent();
53 //=======================================================================
56 //=======================================================================
58 bool SMESHDS_Group::IsEmpty()
60 return myGroup.IsEmpty();
63 //=============================================================================
67 //=============================================================================
69 bool SMESHDS_Group::Contains (const int theID)
71 const SMDS_MeshElement* aElem = findInMesh (theID);
73 return myGroup.Contains(aElem);
77 //=======================================================================
80 //=======================================================================
82 bool SMESHDS_Group::Contains (const SMDS_MeshElement* elem)
85 return myGroup.Contains(elem);
89 //=============================================================================
93 //=============================================================================
95 bool SMESHDS_Group::Add (const int theID)
97 return Add( findInMesh( theID ));
100 //=============================================================================
104 //=============================================================================
106 bool SMESHDS_Group::Add (const SMDS_MeshElement* aElem )
111 added = myGroup.Add (aElem);
118 //=============================================================================
122 //=============================================================================
124 bool SMESHDS_Group::Remove (const int theID)
126 bool removed = false;
127 if ( const SMDS_MeshElement* aElem = findInMesh( theID ))
129 removed = myGroup.Remove (aElem);
137 //======================================================================
140 //=======================================================================
142 void SMESHDS_Group::Clear()
148 //=======================================================================
149 //function : GetElements
151 //=======================================================================
153 SMDS_ElemIteratorPtr SMESHDS_Group::GetElements() const
155 return myGroup.GetElements();
158 //================================================================================
160 * \brief Return a value allowing to find out if a group has changed or not
162 //================================================================================
164 int SMESHDS_Group::GetTic() const
166 return myGroup.Tic();
169 //=======================================================================
172 //=======================================================================
174 void SMESHDS_Group::SetType(SMDSAbs_ElementType theType)
176 if ( myGroup.IsEmpty() || GetType() == SMDSAbs_All )
178 SMESHDS_GroupBase::SetType( theType );
179 myGroup.SetType ( theType );
183 SMESHDS_GroupBase::SetType( myGroup.GetType() );