Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef FAMILY_HXX
00024 #define FAMILY_HXX
00025
00026 #include <string>
00027 #include "MEDMEM_Support.hxx"
00028
00039 namespace MEDMEM {
00040 class FAMILY;
00041 MEDMEM_EXPORT std::ostream & operator<<(std::ostream &os, FAMILY &my);
00042 MEDMEM_EXPORT std::ostream & operator<<(std::ostream &os, const FAMILY &my) ;
00043
00044 class MEDMEM_EXPORT FAMILY : virtual public SUPPORT
00045 {
00046 protected :
00053 int _identifier ;
00060 int _numberOfAttribute ;
00067 PointerOf<int> _attributeIdentifier ;
00074 PointerOf<int> _attributeValue ;
00081
00082 std::vector<std::string> _attributeDescription ;
00088 int _numberOfGroup ;
00094
00095 std::vector<std::string> _groupName ;
00096 protected:
00098 virtual ~FAMILY();
00099 public:
00101 FAMILY();
00107 FAMILY( GMESH* Mesh, int Identifier, string Name,
00108 int NumberOfAttribute, int *AttributeIdentifier,
00109 int *AttributeValue, string AttributeDescription,
00110 int NumberOfGroup, string GroupName,
00111 int * MEDArrayNodeFamily,
00112 int ** MEDArrayCellFamily,
00113 int ** MEDArrayFaceFamily,
00114 int ** MEDArrayEdgeFamily
00115 ) ;
00116
00118 FAMILY(const FAMILY & m);
00119
00121 FAMILY(const SUPPORT & s);
00122
00123
00124 FAMILY & operator=(const FAMILY &fam);
00125 friend std::ostream & operator<<(std::ostream &os, FAMILY &my) ;
00126
00127 friend std::ostream & operator<<(std::ostream &os, const FAMILY &my) ;
00128
00129 bool build(MED_EN::medEntityMesh Entity,int **FamilyNumber);
00130
00131
00132
00133
00134 inline void setIdentifier (int Identifier);
00135 inline void setNumberOfAttributes (int NumberOfAttribute);
00136 inline void setAttributesIdentifiers (int * AttributeIdentifier);
00137 inline void setAttributesValues (int * AttributeValue);
00138 inline void setAttributesDescriptions (std::string * AttributeDescription);
00139 inline void setNumberOfGroups (int NumberOfGroups);
00140 inline void setGroupsNames (std::string * GroupName, bool giveOwnership=false);
00141
00142 inline int getIdentifier() const;
00143 inline int getNumberOfAttributes() const;
00144 inline const int * getAttributesIdentifiers() const;
00145 inline const int * getAttributesValues() const;
00146 inline const std::string* getAttributesDescriptions() const;
00147 inline int getNumberOfGroups() const;
00148 inline const std::string* getGroupsNames() const;
00149
00150
00151 inline int getAttributeIdentifier(int i) const;
00152 inline int getAttributeValue(int i) const;
00153 inline std::string getAttributeDescription(int i) const;
00154 inline std::string getGroupName(int i) const;
00155 };
00156
00157
00159
00160 inline void FAMILY::setIdentifier(int Identifier)
00161
00162 {
00163 _identifier = Identifier;
00164 }
00165
00167
00168 inline void FAMILY::setNumberOfAttributes(int NumberOfAttribute)
00169
00170 {
00171 _numberOfAttribute = NumberOfAttribute;
00172 }
00173
00175
00176 inline void FAMILY::setAttributesIdentifiers(int * AttributeIdentifier)
00177
00178 {
00179
00180 _attributeIdentifier.setShallowAndOwnership(AttributeIdentifier) ;
00181 }
00182
00184
00185 inline void FAMILY::setAttributesValues(int * AttributeValue)
00186
00187 {
00188
00189 _attributeValue.setShallowAndOwnership(AttributeValue) ;
00190 }
00191
00193
00194 inline void FAMILY::setAttributesDescriptions(std::string * AttributeDescription)
00195
00196 {
00197
00198
00199 int nbAttr = getNumberOfAttributes();
00200
00201
00202
00203
00204
00205 _attributeDescription.resize(nbAttr);
00206 for(int i=0; i<nbAttr; i++) {
00207 _attributeDescription[i] = AttributeDescription[i];
00208 }
00209 }
00210
00212
00213 inline void FAMILY::setNumberOfGroups(int NumberOfGroups)
00214
00215 {
00216 _numberOfGroup = NumberOfGroups ;
00217 }
00218
00220
00221 inline void FAMILY::setGroupsNames(std::string * GroupName, bool giveOwnership)
00222
00223 {
00224
00225
00226
00227
00228
00229
00230
00231 int nbGr = getNumberOfGroups();
00232
00233
00234
00235
00236
00237 if (giveOwnership) {
00238
00239 _groupName.resize(nbGr);
00240 for(int i=0; i<nbGr; i++) {
00241 _groupName[i] = GroupName[i];
00242 }
00243 delete [] GroupName;
00244 }
00245 else {
00246
00247
00248 _groupName.resize(nbGr);
00249 for(int i=0; i<nbGr; i++) {
00250 _groupName[i] = GroupName[i];
00251 }
00252 }
00253 }
00256
00257 inline int FAMILY::getIdentifier() const
00258
00259 {
00260 return _identifier ;
00261 }
00262
00264
00265 inline int FAMILY::getNumberOfAttributes() const
00266
00267 {
00268 return _numberOfAttribute ;
00269 }
00272
00273 inline const int * FAMILY::getAttributesIdentifiers() const
00274
00275 {
00276 return _attributeIdentifier ;
00277 }
00280
00281 inline int FAMILY::getAttributeIdentifier(int i) const
00282
00283 {
00284 return _attributeIdentifier[i-1] ;
00285 }
00288
00289 inline const int * FAMILY::getAttributesValues() const
00290
00291 {
00292 return _attributeValue ;
00293 }
00296
00297 inline int FAMILY::getAttributeValue(int i) const
00298
00299 {
00300 return _attributeValue[i-1] ;
00301 }
00302
00303 inline const std::string * FAMILY::getAttributesDescriptions() const
00304
00305 {
00306 return &(_attributeDescription[0]);
00307 }
00310
00311 inline std::string FAMILY::getAttributeDescription(int i) const
00312
00313 {
00314 return _attributeDescription[i-1] ;
00315 }
00317
00318 inline int FAMILY::getNumberOfGroups() const
00319
00320 {
00321 return _numberOfGroup;
00322 }
00324
00325 inline const std::string * FAMILY::getGroupsNames() const
00326
00327 {
00328 return &(_groupName[0]);
00329 }
00332
00333 inline std::string FAMILY::getGroupName(int i) const
00334
00335 {
00336 return _groupName[i-1] ;
00337 }
00338
00339 }
00340 #endif