1 // Copyright (C) 2007-2013 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.
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
37 #include "MEDMEM_Utilities.hxx"
38 #include "MEDMEM_STRING.hxx"
39 #include "MEDMEM_Exception.hxx"
40 #include "MEDMEM_define.hxx"
41 #include "MEDMEM_SkyLineArray.hxx"
42 #include "MEDMEM_RCBase.hxx"
52 This class describe a support of elements on an entity of the mesh.
54 It contains the list of meshes elements for an entity (MED_NODE,
55 MED_CELL, MED_FACE or MED_EDGE).
58 class MEDMEM_EXPORT SUPPORT : public RCBASE
70 Name of the associated mesh if the _mesh pointer
74 mutable std::string _meshName;
78 Description of the support (optional).
81 std::string _description;
85 Reference to the mesh on which the support is defined.
88 mutable const GMESH * _mesh;
92 Type of entity on which the support is defined
93 (only one for each support).
96 MED_EN::medEntityMesh _entity ;
100 Number of geometric type defined in the support.
103 int _numberOfGeometricType;
107 Array of all geometric type defined in the support.
110 PointerOf<MED_EN::medGeometryElement> _geometricType;
114 If true, we consider all entities of type _entity
115 defined in the associated mesh
122 Index array of size _numberOfGeometricType wich contains
123 for each geometric type, the number of elements of this type.
126 PointerOf<int> _numberOfElements;
130 Sum of each _numberOfElements component.
133 int _totalNumberOfElements;
135 // the two following arrays are defined only if _isOnAllElts is false :
139 Array of size _index[_numberOfType]-1 wich contain number of
140 entities of each geometric type. We use global numbering.\n
141 Defined only if _isOnAllElts is false.
144 mutable MEDSKYLINEARRAY * _number;
148 Array of size _index[_numberOfType]-1 wich contain number of
149 entities of each geometric type. We use file numbering.\n
150 Defined only if _isOnAllElts is false.
153 mutable MEDSKYLINEARRAY * _number_fromfile;
157 Array of size <_numberOfGeometricType> wich contain the profil name of
158 entities of each geometric type.\n
159 Defined only if _isOnAllElts is false.
160 If it exist an entities list on a geometric type in _number but there is no profil name associated
161 ( MED_NOPFL ) the MED driver will consider and verify this entities list as being all the
162 entities available on the associated mesh for this geometric type.
166 std::vector< std::string > _profilNames;
169 //SUPPORT(GMESH* Mesh, std::string Name="", MED_EN::medEntityMesh Entity=MED_EN::MED_CELL);
170 SUPPORT(const SUPPORT & m);
172 friend MEDMEM_EXPORT ostream & operator<<(ostream &os,const SUPPORT &my);
174 SUPPORT& operator=(const SUPPORT &support);
175 bool operator == (const SUPPORT &support) const;
176 bool deepCompare(const SUPPORT &support) const;
179 inline void setName(const std::string& Name);
180 inline void setDescription(const std::string& Description);
181 void setMesh(const GMESH *Mesh) const;
182 void setMeshName(const string & meshName);
183 inline void setAll(bool All);
184 void setEntity(MED_EN::medEntityMesh Entity);
185 void setNumberOfGeometricType(int NumberOfGeometricType);
186 void setGeometricType(const MED_EN::medGeometryElement *GeometricType);
187 void setNumberOfElements(const int *NumberOfElements);
188 void setNumber(MEDSKYLINEARRAY * Number);
189 void setNumber(const int * index, const int* value, bool shallowCopy=false);
191 inline const std::string& getName() const;
192 inline const std::string& getDescription() const;
193 virtual inline const GMESH * getMesh() const;
194 std::string getMeshName() const;
195 inline MED_EN::medEntityMesh getEntity() const;
197 inline bool isOnAllElements() const;
198 inline int getNumberOfTypes() const;
199 inline const MED_EN::medGeometryElement* getTypes() const ;
200 int getNumberOfElements(MED_EN::medGeometryElement GeometricType) const throw (MEDEXCEPTION);
201 const int * getNumberOfElements() const throw (MEDEXCEPTION);
202 virtual MEDSKYLINEARRAY * getnumber() const throw (MEDEXCEPTION);
203 virtual MEDSKYLINEARRAY * getnumberFromFile() const throw (MEDEXCEPTION);
204 virtual const int * getNumber(MED_EN::medGeometryElement GeometricType) const throw (MEDEXCEPTION);
205 virtual const int * getNumberFromFile(MED_EN::medGeometryElement GeometricType) const throw (MEDEXCEPTION);
206 virtual const int * getNumberIndex() const throw (MEDEXCEPTION);
207 virtual int getValIndFromGlobalNumber(const int number) const throw (MEDEXCEPTION);
209 void blending(const SUPPORT * mySupport) throw (MEDEXCEPTION) ;
211 // Les numéros d'entités dans les profils doivent être croissant
212 // pour respecter la norme MED
213 void setpartial(const std::string& Description, int NumberOfGeometricType,
214 int TotalNumberOfEntity, const MED_EN::medGeometryElement *GeometricType,
215 const int *NumberOfEntity, const int *NumberValue);
217 void setpartial(MEDSKYLINEARRAY * number, bool shallowCopy=false) throw (MEDEXCEPTION);
220 void setpartial_fromfile(MEDSKYLINEARRAY * number, bool shallowCopy=false) throw (MEDEXCEPTION);
222 // Si les noms de profils ne sont pas positionnés, les profils ne seront
223 // pas écrits par MEDFICHIER.
224 void setProfilNames(const std::vector<std::string>& profilNames) throw (MEDEXCEPTION);
225 //string getProfilName(const MED_EN::medGeometryElement GeometricType) const throw (MEDEXCEPTION);
226 std::vector<std::string> getProfilNames() const throw (MEDEXCEPTION);
228 void getBoundaryElements() throw (MEDEXCEPTION);
229 void changeElementsNbs(MED_EN::medEntityMesh entity, const int *renumberingFromOldToNew);
230 void intersecting(const SUPPORT * mySupport) throw (MEDEXCEPTION) ;
231 bool belongsTo(const SUPPORT& other, bool deepCompare=false) const;
232 SUPPORT *getComplement() const;
233 SUPPORT *substract(const SUPPORT& other) const throw (MEDEXCEPTION) ;
234 SUPPORT *getBoundaryElements(MED_EN::medEntityMesh Entity) const throw (MEDEXCEPTION);
235 SUPPORT* buildSupportOnNode() const throw (MEDEXCEPTION);
236 void fillFromNodeList(const std::list<int>& listOfNode) throw (MEDEXCEPTION);
237 void fillFromElementList(const std::list<int>& listOfElt) throw (MEDEXCEPTION);
238 void clearDataOnNumbers();
239 MESH* makeMesh() const;
243 static std::list<int> *sub(int start,int end,const int *idsToSuppress,int lgthIdsToSuppress);
244 static std::list<int> *sub(const int *ids,int lgthIds,const int *idsToSuppress,int lgthIdsToSuppress);
247 // _____________________
249 // _____________________
251 /*! set the attribute _name to Name */
252 //--------------------------------------
253 inline void SUPPORT::setName(const std::string& Name)
254 //--------------------------------------
259 /*! set the attribute _description to Description */
260 //--------------------------------------------------
261 inline void SUPPORT::setDescription(const std::string& Description)
262 //--------------------------------------------------
264 _description=Description;
268 \addtogroup SUPPORT_creation
273 /*! Creates a support on all elements of the type specified in the constructor.
275 Even if _isonAllElts is true, geometric types defining the FIELD's SUPPORT
276 must be read from the SUPPORT not from the associated GMESH (the geometric
277 types defining the FIELD's SUPPORT may be a subset of the geometric types
278 defined in the GMESH even if for each SUPPORT geometric type all MESH entities
281 //------------------------------------------
282 inline void SUPPORT::setAll(bool All)
283 //------------------------------------------
287 /*! \if MEDMEM_ug @} \endif */
289 /*! returns the name of the support. */
290 //------------------------------------
291 inline const std::string& SUPPORT::getName() const
292 //------------------------------------
297 /*! returns the description of the support. */
298 //--------------------------------------------
299 inline const std::string& SUPPORT::getDescription() const
300 //--------------------------------------------
305 /*! returns a reference to the mesh */
306 //------------------------------------
307 inline const GMESH * SUPPORT::getMesh() const
308 //------------------------------------
314 Returns true if all elements of this entity are
315 concerned, false otherwise.
316 If true, you must use mesh reference (getMesh) to get more information.
318 //------------------------------------------
319 inline bool SUPPORT::isOnAllElements() const
320 //------------------------------------------
326 Returns number of geometric Types
327 defines in the support
329 //------------------------------------------
330 inline int SUPPORT::getNumberOfTypes() const
331 //------------------------------------------
333 // if ((_isOnAllElts)&(_entity != MED_NODE))
334 // return _mesh->getNumberOfTypes(_entity) ;
336 return _numberOfGeometricType ;
340 Returns the %medEntityMesh's type used by the support.
341 Note : A support deals only with one entity's type
342 (for example : MED_FACE or MED_NODE)
344 //---------------------------------------------
345 inline MED_EN::medEntityMesh SUPPORT::getEntity() const
346 //---------------------------------------------
352 If isOnAllElements is false, returns an array of %medGeometryElement
353 types used by the support.
355 //---------------------------------------------------
356 inline const MED_EN::medGeometryElement * SUPPORT::getTypes() const
357 //---------------------------------------------------
359 return _geometricType;
362 }//End namespace MEDMEM
365 #endif /* SUPPORT_HXX */