Salome HOME
sources v1.2
[modules/smesh.git] / src / SMDS / SMDS_MeshGroup.hxx
1 //  SMESH SMDS : implementaion of Salome mesh data structure
2 //
3 //  Copyright (C) 2003  OPEN CASCADE
4 // 
5 //  This library is free software; you can redistribute it and/or 
6 //  modify it under the terms of the GNU Lesser General Public 
7 //  License as published by the Free Software Foundation; either 
8 //  version 2.1 of the License. 
9 // 
10 //  This library is distributed in the hope that it will be useful, 
11 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
12 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
13 //  Lesser General Public License for more details. 
14 // 
15 //  You should have received a copy of the GNU Lesser General Public 
16 //  License along with this library; if not, write to the Free Software 
17 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
18 // 
19 //  See http://www.opencascade.org or email : webmaster@opencascade.org 
20 //
21 //
22 //
23 //  File   : SMDS_MeshGroup.hxx
24 //  Module : SMESH
25
26 #ifndef _SMDS_MeshGroup_HeaderFile
27 #define _SMDS_MeshGroup_HeaderFile
28
29 #ifndef _Standard_HeaderFile
30 #include <Standard.hxx>
31 #endif
32 #ifndef _Handle_SMDS_MeshGroup_HeaderFile
33 #include "Handle_SMDS_MeshGroup.hxx"
34 #endif
35
36 #ifndef _Handle_SMDS_Mesh_HeaderFile
37 #include "Handle_SMDS_Mesh.hxx"
38 #endif
39 #ifndef _SMDSAbs_ElementType_HeaderFile
40 #include "SMDSAbs_ElementType.hxx"
41 #endif
42 #ifndef _SMDS_MapOfMeshElement_HeaderFile
43 #include "SMDS_MapOfMeshElement.hxx"
44 #endif
45 #ifndef _Handle_SMDS_MeshGroup_HeaderFile
46 #include "Handle_SMDS_MeshGroup.hxx"
47 #endif
48 #ifndef _SMDS_ListOfMeshGroup_HeaderFile
49 #include "SMDS_ListOfMeshGroup.hxx"
50 #endif
51 #ifndef _SMDS_MeshObject_HeaderFile
52 #include "SMDS_MeshObject.hxx"
53 #endif
54 #ifndef _Standard_Boolean_HeaderFile
55 #include <Standard_Boolean.hxx>
56 #endif
57 #ifndef _Handle_SMDS_MeshElement_HeaderFile
58 #include "Handle_SMDS_MeshElement.hxx"
59 #endif
60 #ifndef _Standard_Integer_HeaderFile
61 #include <Standard_Integer.hxx>
62 #endif
63 class SMDS_Mesh;
64 class Standard_NoSuchObject;
65 class Standard_TypeMismatch;
66 class SMDS_MeshElement;
67 class SMDS_MapOfMeshElement;
68
69
70 class SMDS_MeshGroup : public SMDS_MeshObject {
71
72 public:
73
74     inline void* operator new(size_t,void* anAddress) 
75       {
76         return anAddress;
77       }
78     inline void* operator new(size_t size) 
79       { 
80         return Standard::Allocate(size); 
81       }
82     inline void  operator delete(void *anAddress) 
83       { 
84         if (anAddress) Standard::Free((Standard_Address&)anAddress); 
85       }
86 //    inline void  operator delete(void *anAddress, size_t size) 
87 //      { 
88 //        if (anAddress) Standard::Free((Standard_Address&)anAddress,size); 
89 //      }
90  // Methods PUBLIC
91  // 
92 Standard_EXPORT SMDS_MeshGroup(const Handle(SMDS_Mesh)& aMesh);
93 Standard_EXPORT   Handle_SMDS_MeshGroup AddSubGroup() ;
94 Standard_EXPORT virtual  Standard_Boolean RemoveSubGroup(const Handle(SMDS_MeshGroup)& aGroup) ;
95 Standard_EXPORT virtual  Standard_Boolean RemoveFromParent() ;
96 Standard_EXPORT   void Clear() ;
97 Standard_EXPORT   void Add(const Handle(SMDS_MeshElement)& ME) ;
98 Standard_EXPORT   void Remove(const Handle(SMDS_MeshElement)& ME) ;
99 Standard_EXPORT   Standard_Boolean IsEmpty() const;
100 Standard_EXPORT   Standard_Integer Extent() const;
101 Standard_EXPORT   SMDSAbs_ElementType Type() const;
102 Standard_EXPORT   Standard_Boolean Contains(const Handle(SMDS_MeshElement)& ME) const;
103 Standard_EXPORT inline  const SMDS_MapOfMeshElement& Elements() const;
104 Standard_EXPORT ~SMDS_MeshGroup();
105
106
107
108
109  // Type management
110  //
111  Standard_EXPORT friend Handle_Standard_Type& SMDS_MeshGroup_Type_();
112  Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
113  Standard_EXPORT Standard_Boolean              IsKind(const Handle(Standard_Type)&) const;
114
115 protected:
116
117  // Methods PROTECTED
118  // 
119
120
121  // Fields PROTECTED
122  //
123
124
125 private: 
126
127  // Methods PRIVATE
128  // 
129 Standard_EXPORT SMDS_MeshGroup(const Handle(SMDS_MeshGroup)& parent);
130
131
132  // Fields PRIVATE
133  //
134 Handle_SMDS_Mesh myMesh;
135 SMDSAbs_ElementType myType;
136 SMDS_MapOfMeshElement myElements;
137 Handle_SMDS_MeshGroup myParent;
138 SMDS_ListOfMeshGroup myChildren;
139
140
141 };
142
143
144 #include "SMDS_MeshGroup.lxx"
145
146
147
148 // other inline functions and methods (like "C++: function call" methods)
149 //
150
151
152 #endif