Salome HOME
update from the MedMemory V1.0.1
[modules/med.git] / src / MEDMEM / MEDMEM_Family.hxx
1 #ifndef FAMILY_HXX
2 #define FAMILY_HXX
3
4 #include <string>
5 #include "MEDMEM_Support.hxx"
6
7 /*!
8
9   This class describe a family of elements on an entity./n
10   It inherits from support. /n
11   It contains a list of elements (by SUPPORT class inheritance)
12   and a description of some attributs./n
13
14   All families on one entity represent a mesh partition for this entity.
15
16 */
17
18 class FAMILY : virtual public SUPPORT
19 {
20 protected :
21   /*!
22     \if developper
23     Identifier of the family in the mesh
24     Note : There is precisely one for each family.
25     \endif
26   */
27   int      _identifier ;
28   /*!
29     \if developper
30     Number of attribute of the family ./n
31     Note that attributes are numbered from 1 to N.
32     \endif
33   */
34   int      _numberOfAttribute ;
35   /*!
36     \if developper
37     Array of all attributes' identifiers.
38     There is one for each attribute.
39     \endif
40   */ 
41   int *    _attributeIdentifier ;
42   /*!
43     \if developper
44     Array of all attributes' values.
45     There is one for each attribute.
46     \endif
47   */
48   int *    _attributeValue ;
49   /*!
50     \if developper
51     Array of all attributes' descriptions.
52     There is one for each attribute.
53     \endif
54   */
55   string * _attributeDescription ;
56   /*!
57     \if developper
58     Number of the group the family belongs to.
59     \endif
60   */
61   int      _numberOfGroup ;
62   /*!
63     \if developper
64     Name of the group the family belongs to.
65     \endif
66   */
67   string * _groupName ;
68
69 public:
70                         /*! Constructor. */
71   FAMILY();
72   /*!
73     \if developper
74     Constructor to use with med driver.
75     \endif
76   */
77   FAMILY( MESH* Mesh, int Identifier, string Name, 
78           int NumberOfAttribute, int *AttributeIdentifier,
79           int *AttributeValue, string AttributeDescription,
80           int NumberOfGroup,   string GroupName,
81           int * MEDArrayNodeFamily,
82           int ** MEDArrayCellFamily,
83           int ** MEDArrayFaceFamily,
84           int ** MEDArrayEdgeFamily
85           ) ;
86
87                         /*! Copy Constructor. */
88   FAMILY(const FAMILY & m);
89
90                         /*! Constructor with SUPPORT entry. */
91   FAMILY(const SUPPORT & s);
92
93                         /*! Destructor. */
94   virtual ~FAMILY();
95   FAMILY & operator=(const FAMILY &fam);
96   friend ostream & operator<<(ostream &os, FAMILY &my) ;
97
98   bool build(medEntityMesh Entity,int **FamilyNumber);
99
100   inline void setIdentifier             (int Identifier);        
101   inline void setNumberOfAttributes     (int NumberOfAttribute);
102   inline void setAttributesIdentifiers  (int * AttributeIdentifier);
103   inline void setAttributesValues       (int * AttributeValue);
104   inline void setAttributesDescriptions (string * AttributeDescription); 
105   inline void setNumberOfGroups         (int NumberOfGroups);
106   inline void setGroupsNames            (string * GroupName);
107
108   inline int      getIdentifier()              const;
109   inline int      getNumberOfAttributes()      const;
110   inline int *    getAttributesIdentifiers()   const;
111   inline int *    getAttributesValues()        const;
112   inline string * getAttributesDescriptions()  const;
113   inline int      getNumberOfGroups()          const;
114   inline string * getGroupsNames()             const;
115
116   // A FAIRE : VERIFIER LA VALIDITE DES PARAMETRES !
117   inline int      getAttributeIdentifier(int i)  const;
118   inline int      getAttributeValue(int i)       const;
119   inline string   getAttributeDescription(int i) const;
120   inline string   getGroupName(int i)            const;
121 };
122
123 // inline methods :
124
125 /*! Sets the attribute _identifier to Identifier. */
126 //----------------------------------------------
127 inline void FAMILY::setIdentifier(int Identifier)         
128 //----------------------------------------------
129
130     _identifier = Identifier; 
131 }
132
133 /*! Sets the attribute _numberOfAttribute to NumberOfAttribute. */
134 //--------------------------------------------------------------
135 inline void FAMILY::setNumberOfAttributes(int NumberOfAttribute) 
136 //--------------------------------------------------------------
137
138     _numberOfAttribute = NumberOfAttribute; 
139 }
140
141 /*! Sets the attribute _attributeIdentifier to AttributeIdentifier. */
142 //---------------------------------------------------------------------
143 inline void FAMILY::setAttributesIdentifiers(int * AttributeIdentifier) 
144 //---------------------------------------------------------------------
145
146     _attributeIdentifier = AttributeIdentifier ; 
147 }
148
149 /*! Sets the attribute _attributeValue to AttributeValue. */
150 //-----------------------------------------------------------
151 inline void FAMILY::setAttributesValues(int * AttributeValue) 
152 //-----------------------------------------------------------
153
154     _attributeValue = AttributeValue ; 
155 }
156
157 /*! Sets the attribute _attributeDescription to  AttributeDescription. */
158 //--------------------------------------------------------------------------
159 inline void FAMILY::setAttributesDescriptions(string * AttributeDescription) 
160 //--------------------------------------------------------------------------
161
162     _attributeDescription = AttributeDescription ; 
163 }
164
165 /*! Sets the attribute _numberOfGroup to NumberOfGroups. */
166 //-------------------------------------------------------
167 inline void FAMILY::setNumberOfGroups(int NumberOfGroups) 
168 //-------------------------------------------------------
169
170     _numberOfGroup = NumberOfGroups ; 
171 }
172
173 /*! Sets the attribute _groupName to GroupName. */
174 //----------------------------------------------------
175 inline void FAMILY::setGroupsNames(string * GroupName) 
176 //----------------------------------------------------
177
178     _groupName = GroupName ; 
179 }
180 /*! Returns the attribute _identifier./n
181    Note that there is one identifier precisely for each family. */
182 //--------------------------------------
183 inline int FAMILY::getIdentifier() const
184 //--------------------------------------
185
186     return _identifier ; 
187 }
188
189 /*! Returns the number of attributes of the family. */
190 //----------------------------------------------
191 inline int FAMILY::getNumberOfAttributes() const
192 //----------------------------------------------
193
194     return _numberOfAttribute ; 
195 }
196 /*! Returns a pointer to attributes identifiers .
197     (There are _numberOfAttribute attributes) */
198 //---------------------------------------------------
199 inline int * FAMILY::getAttributesIdentifiers() const
200 //---------------------------------------------------
201
202     return _attributeIdentifier ; 
203 }
204 /*! Returns identifer of the Ith attribute of the family./n
205    Note that they are numbered from 1 to N */
206 //----------------------------------------------------
207 inline int FAMILY::getAttributeIdentifier(int i) const     
208 //----------------------------------------------------
209
210     return _attributeIdentifier[i-1] ; 
211 }
212 /*! Returns a pointer to attributes values.
213     (There are _numberOfAttribute attributes)*/
214 //----------------------------------------------
215 inline int * FAMILY::getAttributesValues() const             
216 //----------------------------------------------
217
218     return _attributeValue ; 
219 }
220 /*! Returns value of the Ith attribute of the family./n
221    Note that they are numbered from 1 to N */
222 //-----------------------------------------------
223 inline int FAMILY::getAttributeValue(int i) const          
224 //-----------------------------------------------
225
226     return _attributeValue[i-1] ; 
227 }
228 //-------------------------------------------------------
229 inline string * FAMILY::getAttributesDescriptions() const    
230 //-------------------------------------------------------
231
232     return _attributeDescription ; 
233 }
234 /*! Returns description of the Ith attribute of the family/n
235    Note that they are numbered from 1 to N */
236 //--------------------------------------------------------
237 inline string FAMILY::getAttributeDescription(int i) const 
238 //--------------------------------------------------------
239
240     return _attributeDescription[i-1] ; 
241 }
242 /*! Returns the number of groups the family belongs to.*/
243 //------------------------------------------
244 inline int FAMILY::getNumberOfGroups() const                   
245 //------------------------------------------
246
247     return _numberOfGroup; 
248 }
249 /*! Returns a pointer to the names of the groups the family belongs to */
250 //--------------------------------------------
251 inline string * FAMILY::getGroupsNames() const               
252 //--------------------------------------------
253
254     return _groupName ; 
255 }
256 /*! Returns the name of the Ith group the family belongs to./n
257     Note that they are numbered from 1 to N*/
258 //---------------------------------------------
259 inline string FAMILY::getGroupName(int i) const            
260 //---------------------------------------------
261
262     return _groupName[i-1] ; 
263 }
264   
265
266 #endif /* FAMILY_HXX */