Salome HOME
MED file mesh loading on demand.
[modules/med.git] / src / MEDLoader / MEDFileMeshElt.hxx
1 // Copyright (C) 2007-2013  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // Author : Anthony Geay (CEA/DEN)
20
21 #ifndef __MEDFILEMESHELT_HXX__
22 #define __MEDFILEMESHELT_HXX__
23
24 #include "MEDCouplingMemArray.hxx"
25 #include "MEDCouplingAutoRefCountObjectPtr.hxx"
26
27 #include "NormalizedUnstructuredMesh.hxx"
28
29 #include "med.h"
30
31 namespace ParaMEDMEM
32 {
33   class MEDCouplingUMesh;
34   class MEDFileMeshReadSelector;
35
36   class MEDFileUMeshPerType : public RefCountObject
37   {
38   public:
39     static MEDFileUMeshPerType *New(med_idt fid, const char *mName, int dt, int it, int mdim, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType geoElt2, MEDFileMeshReadSelector *mrs);
40     static bool isExisting(med_idt fid, const char *mName, int dt, int it, med_geometry_type geoElt, med_entity_type& whichEntity);
41     std::size_t getHeapMemorySize() const { return 0; }
42     int getDim() const;
43     const DataArrayInt *getNodal() const { return _conn; }
44     const DataArrayInt *getNodalIndex() const { return _conn_index; }
45     const DataArrayInt *getFam() const { return _fam; }
46     const DataArrayInt *getNum() const { return _num; }
47     const DataArrayAsciiChar *getNames() const { return _names; }
48     static void write(med_idt fid, const char *mname, int mdim, const MEDCouplingUMesh *m, const DataArrayInt *fam, const DataArrayInt *num, const DataArrayAsciiChar *names);
49   private:
50     MEDFileUMeshPerType(med_idt fid, const char *mName, int dt, int it, int mdim, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type,
51                         med_entity_type entity, MEDFileMeshReadSelector *mrs);
52     void loadFromStaticType(med_idt fid, const char *mName, int dt, int it, int mdim, int curNbOfElem, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type,
53                             med_entity_type entity, MEDFileMeshReadSelector *mrs);
54     void loadPolyg(med_idt fid, const char *mName, int dt, int it, int mdim, int arraySize, med_geometry_type geoElt,
55                    med_entity_type entity, MEDFileMeshReadSelector *mrs);
56     void loadPolyh(med_idt fid, const char *mName, int dt, int it, int mdim, int connFaceLgth, med_geometry_type geoElt,
57                    med_entity_type entity, MEDFileMeshReadSelector *mrs);
58     void loadCommonPart(med_idt fid, const char *mName, int dt, int it, int mdim, int curNbOfElem, med_geometry_type geoElt, med_entity_type entity, MEDFileMeshReadSelector *mrs);
59   private:
60     MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _conn;
61     MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _conn_index;
62     MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _num;
63     MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _fam;
64     MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> _names;
65     INTERP_KERNEL::NormalizedCellType _type;
66     med_entity_type _entity;
67   };
68 }
69
70 #endif