1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D
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, or (at your option) any later version.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (CEA/DEN)
21 #ifndef __MEDFILEMESHELT_HXX__
22 #define __MEDFILEMESHELT_HXX__
24 #include "MEDCouplingMemArray.hxx"
25 #include "MEDCoupling1GTUMesh.hxx"
26 #include "MEDCouplingPartDefinition.hxx"
29 #include "NormalizedUnstructuredMesh.hxx"
35 class MEDCouplingUMesh;
36 class MEDFileMeshReadSelector;
38 class MEDFileUMeshPerTypeCommon : public RefCountObject
41 static MEDFileUMeshPerTypeCommon *New();
42 void loadCommonPart(med_idt fid, const char *mName, int dt, int it, int curNbOfElem, med_geometry_type geoElt,
43 med_entity_type entity, MEDFileMeshReadSelector *mrs);
44 std::size_t getHeapMemorySizeWithoutChildren() const;
45 std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
46 const DataArrayInt *getFam() const { return _fam; }
47 const DataArrayInt *getNum() const { return _num; }
48 const DataArrayAsciiChar *getNames() const { return _names; }
50 MCAuto<DataArrayInt> _num;
51 MCAuto<DataArrayInt> _fam;
52 MCAuto<DataArrayAsciiChar> _names;
55 class MEDFileUMeshPerType : public MEDFileUMeshPerTypeCommon
58 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);
59 static MEDFileUMeshPerType *NewPart(med_idt fid, const char *mName, int dt, int it, int mdim, INTERP_KERNEL::NormalizedCellType geoElt2, int strt, int stp, int step, MEDFileMeshReadSelector *mrs);
60 static bool isExisting(med_idt fid, const char *mName, int dt, int it, med_geometry_type geoElt, med_entity_type& whichEntity);
61 std::size_t getHeapMemorySizeWithoutChildren() const;
62 std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
64 MEDCoupling1GTUMesh *getMesh() const { return const_cast<MEDCoupling1GTUMesh *>((const MEDCoupling1GTUMesh *)_m); }
65 const PartDefinition *getPartDef() const { return _pd; }
66 static void Write(med_idt fid, const std::string& mname, int mdim, const MEDCoupling1GTUMesh *m, const DataArrayInt *fam, const DataArrayInt *num, const DataArrayAsciiChar *names);
68 MEDFileUMeshPerType();
69 MEDFileUMeshPerType(med_idt fid, const char *mName, int dt, int it, int mdim, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type,
70 med_entity_type entity, MEDFileMeshReadSelector *mrs);
71 void loadPart(med_idt fid, const char *mName, int dt, int it, int mdim, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type,
72 med_entity_type entity, int strt, int end, int step, MEDFileMeshReadSelector *mrs);
73 void loadFromStaticType(med_idt fid, const char *mName, int dt, int it, int mdim, int curNbOfElem, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type,
74 med_entity_type entity, MEDFileMeshReadSelector *mrs);
75 void loadPartStaticType(med_idt fid, const char *mName, int dt, int it, int mdim, int curNbOfElem, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type,
76 med_entity_type entity, int strt, int end, int step, MEDFileMeshReadSelector *mrs);
77 void loadPolyg(med_idt fid, const char *mName, int dt, int it, int mdim, int arraySize, med_geometry_type geoElt,
78 med_entity_type entity, MEDFileMeshReadSelector *mrs);
79 void loadPolyh(med_idt fid, const char *mName, int dt, int it, int mdim, int connFaceLgth, med_geometry_type geoElt,
80 med_entity_type entity, MEDFileMeshReadSelector *mrs);
81 void loadPartOfCellCommonPart(med_idt fid, const char *mName, int strt, int stp, int step, int dt, int it, int mdim, int curNbOfElem, med_geometry_type geoElt, med_entity_type entity, MEDFileMeshReadSelector *mrs);
83 MCAuto<MEDCoupling1GTUMesh> _m;
84 MCAuto<PartDefinition> _pd;