]> SALOME platform Git repositories - tools/medcoupling.git/blob - src/MEDLoader/MEDFileStructureElement.hxx
Salome HOME
Step 5 -> struct element into deepest SD
[tools/medcoupling.git] / src / MEDLoader / MEDFileStructureElement.hxx
1 // Copyright (C) 2007-2017  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, or (at your option) any later version.
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 (EDF R&D)
20
21 #ifndef __MEDFILESTRUCTUREELEMENT_HXX__
22 #define __MEDFILESTRUCTUREELEMENT_HXX__
23
24 #include "MEDLoaderDefines.hxx"
25 #include "MEDFileUtilities.txx"
26 #include "MEDFileMesh.hxx"
27
28 #include "MEDCouplingRefCountObject.hxx"
29
30 namespace MEDCoupling
31 {
32   class MEDFileStructureElement;
33   class MEDFileMeshSupports;
34   class MEDFileUMesh;
35   
36   class MEDFileSEHolder
37   {
38   protected:
39     MEDFileSEHolder(MEDFileStructureElement *father):_father(father) { }
40     std::string getModelName() const;
41     void setName(const std::string& name);
42     std::size_t getHeapMemorySizeLoc() const;
43   private:
44     MEDFileStructureElement *_father;
45     std::string _name;
46   };
47   
48 class MEDFileSEConstAtt : public RefCountObject, public MEDFileWritableStandAlone, public MEDFileSEHolder
49   {
50   public:
51     static MEDFileSEConstAtt *New(med_idt fid, MEDFileStructureElement *father, int idCstAtt, const MEDFileUMesh *mesh);
52   public:
53     std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
54     std::size_t getHeapMemorySizeWithoutChildren() const;
55     void writeLL(med_idt fid) const;
56     void setProfile(const std::string& name);
57     std::string getProfile() const;
58   private:
59     MEDFileSEConstAtt(med_idt fid, MEDFileStructureElement *father, int idCstAtt, const MEDFileUMesh *mesh);
60   private:
61     std::string _pfl;
62     TypeOfField _tof;
63     MCAuto<DataArray> _val;
64   };
65   
66   class MEDFileSEVarAtt : public RefCountObject, public MEDFileWritableStandAlone, public MEDFileSEHolder
67   {
68   public:
69     static MEDFileSEVarAtt *New(med_idt fid, MEDFileStructureElement *father, int idVarAtt);
70   public:
71     std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
72     std::size_t getHeapMemorySizeWithoutChildren() const;
73     void writeLL(med_idt fid) const;
74   private:
75     MEDFileSEVarAtt(med_idt fid, MEDFileStructureElement *father, int idVarAtt);
76   private:
77     int _nb_compo;
78     MCAuto<DataArray> _gen;
79   };
80   
81   class MEDFileStructureElement : public RefCountObject, public MEDFileWritableStandAlone
82   {
83   public:
84     MEDLOADER_EXPORT static MEDFileStructureElement *New(med_idt fid, int idSE, const MEDFileMeshSupports *ms);
85     MEDLOADER_EXPORT std::string getName() const;
86     MEDLOADER_EXPORT int getDynGT() const;
87     MEDLOADER_EXPORT TypeOfField getEntity() const;
88   public:
89     std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
90     std::size_t getHeapMemorySizeWithoutChildren() const;
91     void writeLL(med_idt fid) const;
92   public:
93     static MCAuto<DataArray> BuildFrom(med_attribute_type mat);
94     static int EffectiveNbCompo(med_attribute_type mat, int nbCompo);
95   private:
96     MEDFileStructureElement(med_idt fid, int idSE, const MEDFileMeshSupports *ms);
97   private:
98     int _id_type;
99     std::string _name;
100     std::string _sup_mesh_name;
101     INTERP_KERNEL::NormalizedCellType _geo_type;
102     TypeOfField _tof;
103     int _dim;
104     std::vector< MCAuto<MEDFileSEConstAtt> > _cst_att;
105     std::vector< MCAuto<MEDFileSEVarAtt> > _var_att;
106   };
107   
108   class MEDFileStructureElements : public RefCountObject, public MEDFileWritableStandAlone
109   {
110   public:
111     MEDLOADER_EXPORT static MEDFileStructureElements *New(med_idt fid, const MEDFileMeshSupports *ms);
112     MEDLOADER_EXPORT static MEDFileStructureElements *New();
113     MEDLOADER_EXPORT int getNumberOf() const;
114     MEDLOADER_EXPORT std::vector<int> getDynGTAvail() const;
115     MEDLOADER_EXPORT const MEDFileStructureElement *getWithGT(int idGT) const;
116   public:
117     std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
118     std::size_t getHeapMemorySizeWithoutChildren() const;
119     void writeLL(med_idt fid) const;
120   private:
121     MEDFileStructureElements(med_idt fid, const MEDFileMeshSupports *ms);
122     MEDFileStructureElements();
123     ~MEDFileStructureElements();
124   private:
125     std::vector< MCAuto<MEDFileStructureElement> > _elems;
126   };
127 }
128
129 #endif