1 // Copyright (C) 2007-2017 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 (EDF R&D)
21 #ifndef __MEDFILESTRUCTUREELEMENT_HXX__
22 #define __MEDFILESTRUCTUREELEMENT_HXX__
24 #include "MEDLoaderDefines.hxx"
25 #include "MEDFileUtilities.txx"
26 #include "MEDFileMesh.hxx"
28 #include "MEDCouplingRefCountObject.hxx"
32 class MEDFileStructureElement;
33 class MEDFileMeshSupports;
39 std::string getModelName() const;
40 std::string getName() const;
42 MEDFileSEHolder(MEDFileStructureElement *father):_father(father) { }
43 void setName(const std::string& name);
44 std::size_t getHeapMemorySizeLoc() const;
46 MEDFileStructureElement *_father;
50 class MEDFileSEConstAtt : public RefCountObject, public MEDFileWritableStandAlone, public MEDFileSEHolder
53 static MEDFileSEConstAtt *New(med_idt fid, MEDFileStructureElement *father, int idCstAtt, const MEDFileUMesh *mesh);
55 std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
56 std::size_t getHeapMemorySizeWithoutChildren() const;
57 void writeLL(med_idt fid) const;
58 void setProfile(const std::string& name);
59 std::string getProfile() const;
61 MEDFileSEConstAtt(med_idt fid, MEDFileStructureElement *father, int idCstAtt, const MEDFileUMesh *mesh);
65 MCAuto<DataArray> _val;
68 class MEDFileSEVarAtt : public RefCountObject, public MEDFileWritableStandAlone, public MEDFileSEHolder
71 static MEDFileSEVarAtt *New(med_idt fid, MEDFileStructureElement *father, int idVarAtt);
73 std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
74 std::size_t getHeapMemorySizeWithoutChildren() const;
75 void writeLL(med_idt fid) const;
76 int getNbOfComponents() const { return _nb_compo; }
77 MCAuto<DataArray> getGenerator() const { return _gen; }
79 MEDFileSEVarAtt(med_idt fid, MEDFileStructureElement *father, int idVarAtt);
82 MCAuto<DataArray> _gen;
85 class MEDFileStructureElement : public RefCountObject, public MEDFileWritableStandAlone
88 MEDLOADER_EXPORT static MEDFileStructureElement *New(med_idt fid, int idSE, const MEDFileMeshSupports *ms);
89 MEDLOADER_EXPORT std::string getName() const;
90 MEDLOADER_EXPORT int getDynGT() const;
91 MEDLOADER_EXPORT TypeOfField getEntity() const;
92 MEDLOADER_EXPORT std::string getMeshName() const;
93 MEDLOADER_EXPORT std::vector<std::string> getVarAtts() const;
94 MEDLOADER_EXPORT const MEDFileSEVarAtt *getVarAtt(const std::string& varName) const;
96 std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
97 std::size_t getHeapMemorySizeWithoutChildren() const;
98 void writeLL(med_idt fid) const;
100 static MCAuto<DataArray> BuildFrom(med_attribute_type mat);
101 static int EffectiveNbCompo(med_attribute_type mat, int nbCompo);
103 MEDFileStructureElement(med_idt fid, int idSE, const MEDFileMeshSupports *ms);
107 std::string _sup_mesh_name;
108 INTERP_KERNEL::NormalizedCellType _geo_type;
111 std::vector< MCAuto<MEDFileSEConstAtt> > _cst_att;
112 std::vector< MCAuto<MEDFileSEVarAtt> > _var_att;
115 class MEDFileStructureElements : public RefCountObject, public MEDFileWritableStandAlone
118 MEDLOADER_EXPORT static MEDFileStructureElements *New(const std::string& fileName, const MEDFileMeshSupports *ms);
119 MEDLOADER_EXPORT static MEDFileStructureElements *New(med_idt fid, const MEDFileMeshSupports *ms);
120 MEDLOADER_EXPORT static MEDFileStructureElements *New();
121 MEDLOADER_EXPORT int getNumberOf() const;
122 MEDLOADER_EXPORT std::vector<int> getDynGTAvail() const;
123 MEDLOADER_EXPORT const MEDFileStructureElement *getWithGT(int idGT) const;
124 MEDLOADER_EXPORT int getNumberOfNodesPerSE(const std::string& seName) const;
125 MEDLOADER_EXPORT const MEDFileStructureElement *getSEWithName(const std::string& seName) const;
126 MEDLOADER_EXPORT std::vector<std::string> getVarAttsOf(const std::string& seName) const;
127 MEDLOADER_EXPORT const MEDFileSEVarAtt *getVarAttOf(const std::string &seName, const std::string& varName) const;
128 MEDLOADER_EXPORT const MEDFileUMesh *getSupMeshWithName(const std::string& name) const;
130 std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
131 std::size_t getHeapMemorySizeWithoutChildren() const;
132 void writeLL(med_idt fid) const;
134 MEDFileStructureElements(med_idt fid, const MEDFileMeshSupports *ms);
135 MEDFileStructureElements();
136 ~MEDFileStructureElements();
138 std::vector< MCAuto<MEDFileStructureElement> > _elems;
139 MCConstAuto<MEDFileMeshSupports> _sup;