Back to index

salome-med  6.5.0
MEDMEM_Support.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 /*
00024   File Support.hxx
00025 */
00026 
00027 #ifndef SUPPORT_HXX
00028 #define SUPPORT_HXX
00029 
00030 #include <MEDMEM.hxx>
00031 
00032 #include <list>
00033 #include <vector>
00034 #include <string>
00035 #include <list>
00036 
00037 #include "MEDMEM_Utilities.hxx"
00038 #include "MEDMEM_STRING.hxx"
00039 #include "MEDMEM_Exception.hxx"
00040 #include "MEDMEM_define.hxx"
00041 #include "MEDMEM_SkyLineArray.hxx"
00042 #include "MEDMEM_RCBase.hxx"
00043 
00044 
00045 namespace MEDMEM {
00046 
00047   class GMESH;
00048   class MESH;
00049 
00058 class MEDMEM_EXPORT SUPPORT : public RCBASE
00059 {
00060 protected:
00066   std::string                   _name;
00067 
00074   mutable std::string                   _meshName;
00075 
00081   std::string                   _description;
00082 
00088   mutable const GMESH *            _mesh;
00089 
00096   MED_EN::medEntityMesh            _entity ;
00097 
00103   int                      _numberOfGeometricType;
00104 
00110   PointerOf<MED_EN::medGeometryElement>     _geometricType;
00111 
00118   bool                     _isOnAllElts;
00119 
00126   PointerOf<int>                    _numberOfElements;
00127 
00133   int                      _totalNumberOfElements;
00134 
00135   // the two following arrays are defined only if _isOnAllElts is false :
00136 
00144   mutable MEDSKYLINEARRAY * _number;
00145 
00153   mutable MEDSKYLINEARRAY * _number_fromfile;
00154 
00166   std::vector< std::string > _profilNames;
00167 public:
00168   SUPPORT();
00169   //SUPPORT(GMESH* Mesh, std::string Name="", MED_EN::medEntityMesh Entity=MED_EN::MED_CELL);
00170   SUPPORT(const SUPPORT & m);
00171 public:
00172   friend MEDMEM_EXPORT ostream & operator<<(ostream &os,const SUPPORT &my);
00173 
00174   SUPPORT& operator=(const SUPPORT &support);
00175   bool operator == (const SUPPORT &support) const;
00176   bool deepCompare(const SUPPORT &support) const;
00177   void update();
00178 
00179   inline void setName(const std::string& Name);
00180   inline void setDescription(const std::string& Description);
00181   void        setMesh(const GMESH *Mesh) const;
00182   void        setMeshName(const string & meshName);
00183   inline void setAll(bool All);
00184   void        setEntity(MED_EN::medEntityMesh Entity);
00185   void        setNumberOfGeometricType(int NumberOfGeometricType);
00186   void        setGeometricType(const MED_EN::medGeometryElement *GeometricType);
00187   void        setNumberOfElements(const int *NumberOfElements);
00188   void        setNumber(MEDSKYLINEARRAY * Number);
00189   void        setNumber(const int * index, const int* value, bool shallowCopy=false);
00190 
00191   inline const std::string&    getName() const;
00192   inline const std::string&    getDescription() const;
00193   virtual inline const GMESH * getMesh() const;
00194   std::string                  getMeshName() const;
00195   inline MED_EN::medEntityMesh getEntity() const;
00196 
00197   inline bool   isOnAllElements() const;
00198   inline int    getNumberOfTypes() const;
00199   inline const MED_EN::medGeometryElement* getTypes() const ;
00200   int           getNumberOfElements(MED_EN::medGeometryElement GeometricType) const throw (MEDEXCEPTION);
00201   const int *   getNumberOfElements() const throw (MEDEXCEPTION);
00202   virtual MEDSKYLINEARRAY *   getnumber() const throw (MEDEXCEPTION);
00203   virtual MEDSKYLINEARRAY *   getnumberFromFile() const throw (MEDEXCEPTION);
00204   virtual const int *         getNumber(MED_EN::medGeometryElement GeometricType) const throw (MEDEXCEPTION);
00205   virtual const int *         getNumberFromFile(MED_EN::medGeometryElement GeometricType) const throw (MEDEXCEPTION);
00206   virtual        const int *  getNumberIndex() const throw (MEDEXCEPTION);
00207   virtual int getValIndFromGlobalNumber(const int number) const throw (MEDEXCEPTION);
00208 
00209   void blending(const SUPPORT * mySupport) throw (MEDEXCEPTION) ;
00210 
00211   // Les numéros d'entités dans les profils doivent être croissant
00212   // pour respecter la norme MED
00213   void setpartial(const std::string& Description, int NumberOfGeometricType,
00214                   int TotalNumberOfEntity, const MED_EN::medGeometryElement *GeometricType,
00215                   const int *NumberOfEntity, const int *NumberValue);
00216 
00217   void setpartial(MEDSKYLINEARRAY * number, bool shallowCopy=false) throw (MEDEXCEPTION);
00218 
00219 
00220   void setpartial_fromfile(MEDSKYLINEARRAY * number, bool shallowCopy=false) throw (MEDEXCEPTION);
00221   
00222   // Si les noms de profils ne sont pas positionnés, les profils ne seront
00223   // pas écrits par MEDFICHIER.
00224   void   setProfilNames(const std::vector<std::string>& profilNames) throw (MEDEXCEPTION);
00225   //string getProfilName(const MED_EN::medGeometryElement GeometricType) const throw (MEDEXCEPTION);
00226   std::vector<std::string> getProfilNames() const throw (MEDEXCEPTION);
00227 
00228   void getBoundaryElements() throw (MEDEXCEPTION);
00229   void changeElementsNbs(MED_EN::medEntityMesh entity, const int *renumberingFromOldToNew);
00230   void intersecting(const SUPPORT * mySupport) throw (MEDEXCEPTION) ;
00231   bool belongsTo(const SUPPORT& other, bool deepCompare=false) const;
00232   SUPPORT *getComplement() const;
00233   SUPPORT *substract(const SUPPORT& other) const throw (MEDEXCEPTION) ;
00234   SUPPORT *getBoundaryElements(MED_EN::medEntityMesh Entity) const throw (MEDEXCEPTION);
00235   SUPPORT* buildSupportOnNode() const throw (MEDEXCEPTION);
00236   void fillFromNodeList(const std::list<int>& listOfNode) throw (MEDEXCEPTION);
00237   void fillFromElementList(const std::list<int>& listOfElt) throw (MEDEXCEPTION);
00238   void clearDataOnNumbers();
00239   MESH* makeMesh() const;
00240  protected:
00241   virtual ~SUPPORT();
00242  protected:
00243   static std::list<int> *sub(int start,int end,const int *idsToSuppress,int lgthIdsToSuppress);
00244   static std::list<int> *sub(const int *ids,int lgthIds,const int *idsToSuppress,int lgthIdsToSuppress);
00245 };
00246 
00247 // _____________________
00248 // Methodes Inline
00249 // _____________________
00250 
00252 //--------------------------------------
00253 inline void SUPPORT::setName(const std::string& Name)
00254 //--------------------------------------
00255 {
00256   _name=Name;
00257 }
00258 
00260 //--------------------------------------------------
00261 inline void SUPPORT::setDescription(const std::string& Description)
00262 //--------------------------------------------------
00263 {
00264   _description=Description;
00265 }
00266 
00281 //------------------------------------------
00282 inline void SUPPORT::setAll(bool All)
00283 //------------------------------------------
00284 {
00285   _isOnAllElts=All;
00286 }
00290 //------------------------------------
00291 inline const std::string& SUPPORT::getName() const
00292 //------------------------------------
00293 {
00294   return _name;
00295 }
00296 
00298 //--------------------------------------------
00299 inline const std::string& SUPPORT::getDescription() const
00300 //--------------------------------------------
00301 {
00302   return _description;
00303 }
00304 
00306 //------------------------------------
00307 inline const GMESH * SUPPORT::getMesh() const
00308 //------------------------------------
00309 {
00310   return _mesh;
00311 }
00312 
00318 //------------------------------------------
00319 inline bool SUPPORT::isOnAllElements() const
00320 //------------------------------------------
00321 {
00322   return _isOnAllElts;
00323 }
00324 
00329 //------------------------------------------
00330 inline int SUPPORT::getNumberOfTypes() const
00331 //------------------------------------------
00332 {
00333   //    if ((_isOnAllElts)&(_entity != MED_NODE))
00334   //      return _mesh->getNumberOfTypes(_entity) ;
00335   //    else
00336   return _numberOfGeometricType ;
00337 }
00338 
00344 //---------------------------------------------
00345 inline MED_EN::medEntityMesh SUPPORT::getEntity() const
00346 //---------------------------------------------
00347 {
00348   return _entity;
00349 }
00350 
00355 //---------------------------------------------------
00356 inline const MED_EN::medGeometryElement * SUPPORT::getTypes() const
00357 //---------------------------------------------------
00358 {
00359   return _geometricType;
00360 }
00361 
00362 }//End namespace MEDMEM
00363 
00364 
00365 #endif /* SUPPORT_HXX */