1 // Copyright (C) 2007-2013 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.
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 __MEDFILEFIELD_HXX__
22 #define __MEDFILEFIELD_HXX__
24 #include "MEDLoaderDefines.hxx"
26 #include "MEDFileUtilities.hxx"
28 #include "MEDCouplingAutoRefCountObjectPtr.hxx"
29 #include "MEDCouplingRefCountObject.hxx"
30 #include "MEDCouplingMemArray.hxx"
32 #include "NormalizedUnstructuredMesh.hxx"
33 #include "InterpKernelException.hxx"
44 class MEDFileFieldGlobs;
45 class MEDCouplingMesh;
46 class MEDCouplingFieldDouble;
49 class MEDFileFieldLoc : public RefCountObject
52 void MEDLOADER_EXPORT simpleRepr(std::ostream& oss) const;
53 const MEDLOADER_EXPORT std::string& getName() const { return _name; }
54 void MEDLOADER_EXPORT setName(const char *name);
55 static MEDFileFieldLoc *New(med_idt fid, const char *locName);
56 static MEDFileFieldLoc *New(med_idt fid, int id);
57 static MEDFileFieldLoc *New(const char *locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w);
58 std::size_t getHeapMemorySize() const;
59 MEDFileFieldLoc *deepCpy() const;
60 int MEDLOADER_EXPORT getNbOfGaussPtPerCell() const { return _nb_gauss_pt; }
61 void MEDLOADER_EXPORT writeLL(med_idt fid) const;
62 std::string MEDLOADER_EXPORT repr() const;
63 bool MEDLOADER_EXPORT isName(const char *name) const { return _name==name; }
64 int MEDLOADER_EXPORT getDimension() const { return _dim; }
65 int MEDLOADER_EXPORT getNumberOfGaussPoints() const { return _nb_gauss_pt; }
66 int MEDLOADER_EXPORT getNumberOfPointsInCells() const { return _nb_node_per_cell; }
67 const MEDLOADER_EXPORT std::vector<double>& getRefCoords() const { return _ref_coo; }
68 const MEDLOADER_EXPORT std::vector<double>& getGaussCoords() const { return _gs_coo; }
69 const MEDLOADER_EXPORT std::vector<double>& getGaussWeights() const { return _w; }
70 bool MEDLOADER_EXPORT isEqual(const MEDFileFieldLoc& other, double eps) const;
72 MEDFileFieldLoc(med_idt fid, const char *locName);
73 MEDFileFieldLoc(med_idt fid, int id);
74 MEDFileFieldLoc(const char *locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w);
78 int _nb_node_per_cell;
80 INTERP_KERNEL::NormalizedCellType _geo_type;
81 std::vector<double> _ref_coo;
82 std::vector<double> _gs_coo;
83 std::vector<double> _w;
87 class MEDFileAnyTypeField1TSWithoutSDA;
88 class MEDFileFieldPerMeshPerType;
89 class MEDFileField1TSWithoutSDA;
90 class MEDFileFieldNameScope;
91 class MEDFileFieldGlobsReal;
92 class MEDFileFieldPerMesh;
94 class MEDFileFieldPerMeshPerTypePerDisc : public RefCountObject, public MEDFileWritable
97 static MEDFileFieldPerMeshPerTypePerDisc *NewOnRead(MEDFileFieldPerMeshPerType *fath, TypeOfField type, int profileIt) throw(INTERP_KERNEL::Exception);
98 static MEDFileFieldPerMeshPerTypePerDisc *New(MEDFileFieldPerMeshPerType *fath, TypeOfField type, int locId);
99 static MEDFileFieldPerMeshPerTypePerDisc *New(const MEDFileFieldPerMeshPerTypePerDisc& other);
100 std::size_t getHeapMemorySize() const;
101 MEDFileFieldPerMeshPerTypePerDisc *deepCpy(MEDFileFieldPerMeshPerType *father) const throw(INTERP_KERNEL::Exception);
102 void assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldDouble *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception);
103 void assignFieldProfile(int& start, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, DataArrayInt *locIds, int nbOfEltsInWholeMesh, const MEDCouplingFieldDouble *field, const DataArray *arrr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception);
104 void assignNodeFieldNoProfile(int& start, const MEDCouplingFieldDouble *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
105 void getCoarseData(TypeOfField& type, std::pair<int,int>& dad, std::string& pfl, std::string& loc) const throw(INTERP_KERNEL::Exception);
106 void writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception);
107 const MEDFileFieldPerMeshPerType *getFather() const;
108 void prepareLoading(med_idt fid, int profileIt, int& start, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception);
109 void finishLoading(med_idt fid, int profileIt, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception);
110 void setNewStart(int newValueOfStart) throw(INTERP_KERNEL::Exception);
111 int getIteration() const;
112 int getOrder() const;
113 double getTime() const;
114 std::string getMeshName() const;
115 TypeOfField getType() const;
116 void simpleRepr(int bkOffset, std::ostream& oss, int id) const;
117 void fillTypesOfFieldAvailable(std::set<TypeOfField>& types) const throw(INTERP_KERNEL::Exception);
118 void setType(TypeOfField newType);
119 INTERP_KERNEL::NormalizedCellType getGeoType() const;
120 int getNumberOfComponents() const;
121 int getNumberOfTuples() const;
122 int getStart() const { return _start; }
123 DataArray *getArray();
124 const DataArray *getArray() const;
125 const DataArrayDouble *getArrayDouble() const;
126 DataArrayDouble *getArrayDouble();
127 const std::vector<std::string>& getInfo() const;
128 std::string getProfile() const;
129 void setProfile(const char *newPflName);
130 std::string getLocalization() const;
131 void setLocalization(const char *newLocName);
132 int getLocId() const { return _loc_id; }
133 void setLocId(int newId) const { _loc_id=newId; }
134 void setFather(MEDFileFieldPerMeshPerType *newFather) { _father=newFather; }
135 void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
136 void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
137 void getFieldAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<int,int> >& dads, std::vector<const DataArrayInt *>& pfls, std::vector<int>& locs,
138 std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const;
139 void fillValues(int discId, int& startEntryId, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
140 int fillEltIdsFromCode(int offset, const std::vector<int>& codeOfMesh, const MEDFileFieldGlobsReal& glob, int *ptToFill) const throw(INTERP_KERNEL::Exception);
141 int fillTupleIds(int *ptToFill) const throw(INTERP_KERNEL::Exception);
142 static int ConvertType(TypeOfField type, int locId) throw(INTERP_KERNEL::Exception);
143 static std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> > SplitPerDiscretization(const std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>& entries);
144 static bool RenumberChunks(int offset, const std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc,
145 const DataArrayInt *explicitIdsInMesh, const std::vector<int>& newCode,
146 MEDFileFieldGlobsReal& glob, DataArrayDouble *arr, std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> >& result);
147 static MEDFileFieldPerMeshPerTypePerDisc *NewObjectOnSameDiscThanPool(TypeOfField typeF, INTERP_KERNEL::NormalizedCellType geoType, DataArrayInt *idsOfMeshElt,
148 bool isPfl, int nbi, int offset, std::list< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc,
149 MEDFileFieldGlobsReal& glob, bool ¬InExisting) throw(INTERP_KERNEL::Exception);
151 MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerType *fath, TypeOfField type, int profileIt) throw(INTERP_KERNEL::Exception);
152 MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerType *fath, TypeOfField type, int profileIt, const std::string& dummy);
153 MEDFileFieldPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc& other);
154 MEDFileFieldPerMeshPerTypePerDisc();
157 MEDFileFieldPerMeshPerType *_father;
160 //! _nval is different than end-start in case of ON_GAUSS_PT and ON_GAUSS_NE ! (_nval=(_end-_start)/nbi)
162 std::string _profile;
163 std::string _localization;
164 //! only on assignement -3 : ON_NODES, -2 : ON_CELLS, -1 : ON_GAUSS_NE, 0..* : ON_GAUSS_PT
167 mutable int _tmp_work1;
170 class MEDFileFieldPerMeshPerType : public RefCountObject, public MEDFileWritable
173 static MEDFileFieldPerMeshPerType *New(MEDFileFieldPerMesh *fath, INTERP_KERNEL::NormalizedCellType geoType) throw(INTERP_KERNEL::Exception);
174 static MEDFileFieldPerMeshPerType *NewOnRead(med_idt fid, MEDFileFieldPerMesh *fath, TypeOfField type, INTERP_KERNEL::NormalizedCellType geoType, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception);
175 std::size_t getHeapMemorySize() const;
176 MEDFileFieldPerMeshPerType *deepCpy(MEDFileFieldPerMesh *father) const throw(INTERP_KERNEL::Exception);
177 void assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception);
178 void assignFieldProfile(int& start, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, DataArrayInt *locIds, int nbOfEltsInWholeMesh, const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception);
179 void assignNodeFieldNoProfile(int& start, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
180 void assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception);
181 const MEDFileFieldPerMesh *getFather() const;
182 void prepareLoading(med_idt fid, int &start, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception);
183 void finishLoading(med_idt fid, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception);
184 void writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception);
185 void getDimension(int& dim) const;
186 void fillTypesOfFieldAvailable(std::set<TypeOfField>& types) const throw(INTERP_KERNEL::Exception);
187 void fillFieldSplitedByType(std::vector< std::pair<int,int> >& dads, std::vector<TypeOfField>& types, std::vector<std::string>& pfls, std::vector<std::string>& locs) const throw(INTERP_KERNEL::Exception);
188 int getIteration() const;
189 int getOrder() const;
190 double getTime() const;
191 std::string getMeshName() const;
192 void simpleRepr(int bkOffset, std::ostream& oss, int id) const;
193 void getSizes(int& globalSz, int& nbOfEntries) const;
194 INTERP_KERNEL::NormalizedCellType getGeoType() const;
195 int getNumberOfComponents() const;
196 DataArray *getArray();
197 const DataArray *getArray() const;
198 const DataArrayDouble *getArrayDouble() const;
199 DataArrayDouble *getArrayDouble();
200 const std::vector<std::string>& getInfo() const;
201 std::vector<std::string> getPflsReallyUsed() const;
202 std::vector<std::string> getLocsReallyUsed() const;
203 std::vector<std::string> getPflsReallyUsedMulti() const;
204 std::vector<std::string> getLocsReallyUsedMulti() const;
205 void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
206 void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
207 MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenLocId(int locId) throw(INTERP_KERNEL::Exception);
208 const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenLocId(int locId) const throw(INTERP_KERNEL::Exception);
209 void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<int,int> >& dads, std::vector<const DataArrayInt *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const;
210 void fillValues(int& startEntryId, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
211 void setLeaves(const std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerTypePerDisc > >& leaves) throw(INTERP_KERNEL::Exception);
212 static med_entity_type ConvertIntoMEDFileType(TypeOfField ikType, INTERP_KERNEL::NormalizedCellType ikGeoType, med_geometry_type& medfGeoType);
214 std::vector<int> addNewEntryIfNecessary(const MEDCouplingFieldDouble *field, int offset, int nbOfCells) throw(INTERP_KERNEL::Exception);
215 std::vector<int> addNewEntryIfNecessaryGauss(const MEDCouplingFieldDouble *field, int offset, int nbOfCells) throw(INTERP_KERNEL::Exception);
216 std::vector<int> addNewEntryIfNecessary(const MEDCouplingFieldDouble *field, const DataArrayInt *subCells) throw(INTERP_KERNEL::Exception);
217 std::vector<int> addNewEntryIfNecessaryGauss(const MEDCouplingFieldDouble *field, const DataArrayInt *subCells) throw(INTERP_KERNEL::Exception);
218 MEDFileFieldPerMeshPerType(med_idt fid, MEDFileFieldPerMesh *fath, TypeOfField type, INTERP_KERNEL::NormalizedCellType geoType, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception);
219 MEDFileFieldPerMeshPerType(MEDFileFieldPerMesh *fath, INTERP_KERNEL::NormalizedCellType geoType) throw(INTERP_KERNEL::Exception);
221 MEDFileFieldPerMesh *_father;
222 std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> > _field_pm_pt_pd;
223 INTERP_KERNEL::NormalizedCellType _geo_type;
226 class MEDFileFieldPerMesh : public RefCountObject, public MEDFileWritable
229 static MEDFileFieldPerMesh *New(MEDFileAnyTypeField1TSWithoutSDA *fath, const MEDCouplingMesh *mesh);
230 static MEDFileFieldPerMesh *NewOnRead(med_idt fid, MEDFileAnyTypeField1TSWithoutSDA *fath, int meshCsit, int meshIteration, int meshOrder, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception);
231 std::size_t getHeapMemorySize() const;
232 MEDFileFieldPerMesh *deepCpy(MEDFileAnyTypeField1TSWithoutSDA *father) const throw(INTERP_KERNEL::Exception);
233 void simpleRepr(int bkOffset,std::ostream& oss, int id) const;
234 void copyTinyInfoFrom(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
235 void assignFieldProfile(int& start, const DataArrayInt *multiTypePfl, const std::vector<int>& code, const std::vector<int>& code2, const std::vector<DataArrayInt *>& idsInPflPerType, const std::vector<DataArrayInt *>& idsPerType, const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception);
236 void assignFieldNoProfileNoRenum(int& start, const std::vector<int>& code, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception);
237 void assignNodeFieldNoProfile(int& start, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
238 void assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception);
239 void prepareLoading(med_idt fid, int &start, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception);
240 void finishLoading(med_idt fid, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception);
241 void writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception);
242 void fillTypesOfFieldAvailable(std::set<TypeOfField>& types) const throw(INTERP_KERNEL::Exception);
243 std::vector< std::vector< std::pair<int,int> > > getFieldSplitedByType(std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const throw(INTERP_KERNEL::Exception);
244 void getDimension(int& dim) const;
245 double getTime() const;
246 int getIteration() const;
247 int getOrder() const;
248 int getMeshIteration() const { return _mesh_iteration; }
249 int getMeshOrder() const { return _mesh_order; }
250 std::string getMeshName() const { return _mesh_name; }
251 int getNumberOfComponents() const;
252 DataArray *getArray();
253 const DataArray *getArray() const;
254 DataArrayDouble *getArrayDouble();
255 const DataArrayDouble *getArrayDouble() const;
256 const std::vector<std::string>& getInfo() const;
257 std::vector<std::string> getPflsReallyUsed() const;
258 std::vector<std::string> getLocsReallyUsed() const;
259 std::vector<std::string> getPflsReallyUsedMulti() const;
260 std::vector<std::string> getLocsReallyUsedMulti() const;
261 bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab) throw(INTERP_KERNEL::Exception);
262 bool renumberEntitiesLyingOnMesh(const char *meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
263 void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
264 void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
265 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, bool& isPfl, MEDCouplingAutoRefCountObjectPtr<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception);
266 DataArray *getFieldOnMeshAtLevelWithPfl(TypeOfField type, const MEDCouplingMesh *mesh, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception);
267 void getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const throw(INTERP_KERNEL::Exception);
268 MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, int locId) throw(INTERP_KERNEL::Exception);
269 const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, int locId) const throw(INTERP_KERNEL::Exception);
271 int addNewEntryIfNecessary(INTERP_KERNEL::NormalizedCellType type);
272 MEDCouplingFieldDouble *finishField(TypeOfField type, const MEDFileFieldGlobsReal *glob,
273 const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs, const MEDCouplingMesh *mesh, bool& isPfl, MEDCouplingAutoRefCountObjectPtr<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception);
274 MEDCouplingFieldDouble *finishField2(TypeOfField type, const MEDFileFieldGlobsReal *glob,
275 const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs,
276 const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes,
277 const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MEDCouplingAutoRefCountObjectPtr<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception);
278 MEDCouplingFieldDouble *finishFieldNode2(const MEDFileFieldGlobsReal *glob,
279 const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs,
280 const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MEDCouplingAutoRefCountObjectPtr<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception);
281 DataArray *finishField4(const std::vector< std::pair<int,int> >& dads, const DataArrayInt *pflIn, int nbOfElems, DataArrayInt *&pflOut) const throw(INTERP_KERNEL::Exception);
282 void assignNewLeaves(const std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerTypePerDisc > >& leaves) throw(INTERP_KERNEL::Exception);
283 static void SortArraysPerType(const MEDFileFieldGlobsReal *glob, TypeOfField type,
284 const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes, const std::vector< std::pair<int,int> >& dads, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& locs,
285 std::vector<int>& code, std::vector<DataArrayInt *>& notNullPfls);
286 static int ComputeNbOfElems(const MEDFileFieldGlobsReal *glob, TypeOfField type, const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes, const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs) throw(INTERP_KERNEL::Exception);
287 MEDFileFieldPerMesh(med_idt fid, MEDFileAnyTypeField1TSWithoutSDA *fath, int meshCsit, int meshIteration, int meshOrder, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception);
288 MEDFileFieldPerMesh(MEDFileAnyTypeField1TSWithoutSDA *fath, const MEDCouplingMesh *mesh);
290 std::string _mesh_name;
294 MEDFileAnyTypeField1TSWithoutSDA *_father;
295 std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > > _field_pm_pt;
298 class MEDFileFieldGlobsReal;
300 class MEDFileFieldGlobs : public RefCountObject
303 static MEDFileFieldGlobs *New(const char *fname);
304 static MEDFileFieldGlobs *New();
305 std::size_t getHeapMemorySize() const;
306 MEDFileFieldGlobs *deepCpy() const throw(INTERP_KERNEL::Exception);
307 MEDFileFieldGlobs *shallowCpyPart(const std::vector<std::string>& pfls, const std::vector<std::string>& locs) const throw(INTERP_KERNEL::Exception);
308 MEDFileFieldGlobs *deepCpyPart(const std::vector<std::string>& pfls, const std::vector<std::string>& locs) const throw(INTERP_KERNEL::Exception);
309 void simpleRepr(std::ostream& oss) const;
310 void appendGlobs(const MEDFileFieldGlobs& other, double eps) throw(INTERP_KERNEL::Exception);
311 void checkGlobsPflsPartCoherency(const std::vector<std::string>& pflsUsed) const throw(INTERP_KERNEL::Exception);
312 void checkGlobsLocsPartCoherency(const std::vector<std::string>& locsUsed) const throw(INTERP_KERNEL::Exception);
313 void loadProfileInFile(med_idt fid, int id, const char *pflName) throw(INTERP_KERNEL::Exception);
314 void loadProfileInFile(med_idt fid, int id);
315 void loadGlobals(med_idt fid, const MEDFileFieldGlobsReal& real) throw(INTERP_KERNEL::Exception);
316 void loadAllGlobals(med_idt fid) throw(INTERP_KERNEL::Exception);
317 void writeGlobals(med_idt fid, const MEDFileWritable& opt) const throw(INTERP_KERNEL::Exception);
318 std::vector<std::string> getPfls() const;
319 std::vector<std::string> getLocs() const;
320 bool existsPfl(const char *pflName) const;
321 bool existsLoc(const char *locName) const;
322 std::string createNewNameOfPfl() const throw(INTERP_KERNEL::Exception);
323 std::string createNewNameOfLoc() const throw(INTERP_KERNEL::Exception);
324 std::vector< std::vector<int> > whichAreEqualProfiles() const;
325 std::vector< std::vector<int> > whichAreEqualLocs(double eps) const;
326 void setFileName(const char *fileName);
327 void changePflsNamesInStruct(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
328 void changeLocsNamesInStruct(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
329 int getNbOfGaussPtPerCell(int locId) const throw(INTERP_KERNEL::Exception);
330 int getLocalizationId(const char *loc) const throw(INTERP_KERNEL::Exception);
331 const char *getFileName() const { return _file_name.c_str(); }
332 std::string getFileName2() const { return _file_name; }
333 const MEDFileFieldLoc& getLocalizationFromId(int locId) const throw(INTERP_KERNEL::Exception);
334 const MEDFileFieldLoc& getLocalization(const char *locName) const throw(INTERP_KERNEL::Exception);
335 const DataArrayInt *getProfileFromId(int pflId) const throw(INTERP_KERNEL::Exception);
336 const DataArrayInt *getProfile(const char *pflName) const throw(INTERP_KERNEL::Exception);
337 MEDFileFieldLoc& getLocalizationFromId(int locId) throw(INTERP_KERNEL::Exception);
338 MEDFileFieldLoc& getLocalization(const char *locName) throw(INTERP_KERNEL::Exception);
339 DataArrayInt *getProfile(const char *pflName) throw(INTERP_KERNEL::Exception);
340 DataArrayInt *getProfileFromId(int pflId) throw(INTERP_KERNEL::Exception);
341 void killProfileIds(const std::vector<int>& pflIds) throw(INTERP_KERNEL::Exception);
342 void killLocalizationIds(const std::vector<int>& locIds) throw(INTERP_KERNEL::Exception);
344 void appendProfile(DataArrayInt *pfl) throw(INTERP_KERNEL::Exception);
345 void appendLoc(const char *locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
347 static std::string CreateNewNameNotIn(const char *prefix, const std::vector<std::string>& namesToAvoid) throw(INTERP_KERNEL::Exception);
349 MEDFileFieldGlobs(const char *fname);
351 ~MEDFileFieldGlobs();
353 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > _pfls;
354 std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldLoc> > _locs;
355 std::string _file_name;
358 /// @endcond INTERNAL
360 class MEDLOADER_EXPORT MEDFileFieldGlobsReal
363 MEDFileFieldGlobsReal(const char *fname);
364 MEDFileFieldGlobsReal();
365 std::size_t getHeapMemorySize() const;
366 void simpleReprGlobs(std::ostream& oss) const;
368 void shallowCpyGlobs(const MEDFileFieldGlobsReal& other);
369 void deepCpyGlobs(const MEDFileFieldGlobsReal& other);
370 void shallowCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
371 void deepCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
372 void appendGlobs(const MEDFileFieldGlobsReal& other, double eps) throw(INTERP_KERNEL::Exception);
373 void checkGlobsCoherency() const throw(INTERP_KERNEL::Exception);
374 void checkGlobsPflsPartCoherency() const throw(INTERP_KERNEL::Exception);
375 void checkGlobsLocsPartCoherency() const throw(INTERP_KERNEL::Exception);
376 virtual std::vector<std::string> getPflsReallyUsed() const = 0;
377 virtual std::vector<std::string> getLocsReallyUsed() const = 0;
378 virtual std::vector<std::string> getPflsReallyUsedMulti() const = 0;
379 virtual std::vector<std::string> getLocsReallyUsedMulti() const = 0;
380 virtual void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception) = 0;
381 virtual void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception) = 0;
382 virtual ~MEDFileFieldGlobsReal();
384 void loadProfileInFile(med_idt fid, int id, const char *pflName) throw(INTERP_KERNEL::Exception);
385 void loadProfileInFile(med_idt fid, int id);
386 void loadGlobals(med_idt fid) throw(INTERP_KERNEL::Exception);
387 void loadAllGlobals(med_idt fid) throw(INTERP_KERNEL::Exception);
388 void writeGlobals(med_idt fid, const MEDFileWritable& opt) const throw(INTERP_KERNEL::Exception);
389 std::vector<std::string> getPfls() const;
390 std::vector<std::string> getLocs() const;
391 bool existsPfl(const char *pflName) const;
392 bool existsLoc(const char *locName) const;
393 std::string createNewNameOfPfl() const throw(INTERP_KERNEL::Exception);
394 std::string createNewNameOfLoc() const throw(INTERP_KERNEL::Exception);
395 std::vector< std::vector<int> > whichAreEqualProfiles() const;
396 std::vector< std::vector<int> > whichAreEqualLocs(double eps) const;
397 void setFileName(const char *fileName);
398 void changePflsNamesInStruct(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
399 void changeLocsNamesInStruct(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
400 void changePflsNames(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
401 void changeLocsNames(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
402 void changePflName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
403 void changeLocName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
404 std::vector< std::pair<std::vector<std::string>, std::string > > zipPflsNames() throw(INTERP_KERNEL::Exception);
405 std::vector< std::pair<std::vector<std::string>, std::string > > zipLocsNames(double eps) throw(INTERP_KERNEL::Exception);
406 int getNbOfGaussPtPerCell(int locId) const throw(INTERP_KERNEL::Exception);
407 int getLocalizationId(const char *loc) const throw(INTERP_KERNEL::Exception);
408 const char *getFileName() const;
409 std::string getFileName2() const;
410 const MEDFileFieldLoc& getLocalizationFromId(int locId) const throw(INTERP_KERNEL::Exception);
411 const MEDFileFieldLoc& getLocalization(const char *locName) const throw(INTERP_KERNEL::Exception);
412 MEDFileFieldLoc& getLocalizationFromId(int locId) throw(INTERP_KERNEL::Exception);
413 MEDFileFieldLoc& getLocalization(const char *locName) throw(INTERP_KERNEL::Exception);
414 const DataArrayInt *getProfile(const char *pflName) const throw(INTERP_KERNEL::Exception);
415 const DataArrayInt *getProfileFromId(int pflId) const throw(INTERP_KERNEL::Exception);
416 DataArrayInt *getProfile(const char *pflName) throw(INTERP_KERNEL::Exception);
417 DataArrayInt *getProfileFromId(int pflId) throw(INTERP_KERNEL::Exception);
418 void killProfileIds(const std::vector<int>& pflIds) throw(INTERP_KERNEL::Exception);
419 void killLocalizationIds(const std::vector<int>& locIds) throw(INTERP_KERNEL::Exception);
421 void appendProfile(DataArrayInt *pfl) throw(INTERP_KERNEL::Exception);
422 void appendLoc(const char *locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
424 MEDFileFieldGlobs *contentNotNull() throw(INTERP_KERNEL::Exception);
425 const MEDFileFieldGlobs *contentNotNull() const throw(INTERP_KERNEL::Exception);
427 MEDCouplingAutoRefCountObjectPtr< MEDFileFieldGlobs > _globals;
430 class MEDLOADER_EXPORT MEDFileFieldNameScope
433 MEDFileFieldNameScope();
434 MEDFileFieldNameScope(const char *fieldName);
435 std::string getName() const throw(INTERP_KERNEL::Exception);
436 void setName(const char *fieldName) throw(INTERP_KERNEL::Exception);
437 std::string getDtUnit() const throw(INTERP_KERNEL::Exception);
438 void setDtUnit(const char *dtUnit) throw(INTERP_KERNEL::Exception);
439 void copyNameScope(const MEDFileFieldNameScope& other);
442 std::string _dt_unit;
446 * SDA is for Shared Data Arrays such as profiles.
448 class MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA : public RefCountObject, public MEDFileFieldNameScope
451 MEDFileAnyTypeField1TSWithoutSDA();
452 MEDFileAnyTypeField1TSWithoutSDA(const char *fieldName, int csit, int iteration, int order);
453 int getIteration() const { return _iteration; }
454 int getOrder() const { return _order; }
455 double getTime(int& iteration, int& order) const { iteration=_iteration; order=_order; return _dt; }
456 void setTime(int iteration, int order, double val) { _dt=val; _iteration=iteration; _order=order; }
457 int getDimension() const;
458 std::string getMeshName() const throw(INTERP_KERNEL::Exception);
459 void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
460 bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab) throw(INTERP_KERNEL::Exception);
461 int getMeshIteration() const throw(INTERP_KERNEL::Exception);
462 int getMeshOrder() const throw(INTERP_KERNEL::Exception);
463 bool isDealingTS(int iteration, int order) const;
464 std::pair<int,int> getDtIt() const;
465 void fillIteration(std::pair<int,int>& p) const;
466 void fillTypesOfFieldAvailable(std::vector<TypeOfField>& types) const throw(INTERP_KERNEL::Exception);
467 std::vector<TypeOfField> getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception);
469 std::vector<std::string> getPflsReallyUsed2() const;
470 std::vector<std::string> getLocsReallyUsed2() const;
471 std::vector<std::string> getPflsReallyUsedMulti2() const;
472 std::vector<std::string> getLocsReallyUsedMulti2() const;
473 void changePflsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
474 void changeLocsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
476 int getNonEmptyLevels(const char *mname, std::vector<int>& levs) const throw(INTERP_KERNEL::Exception);
477 std::vector< std::vector<std::pair<int,int> > > getFieldSplitedByType(const char *mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const throw(INTERP_KERNEL::Exception);
479 MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId) throw(INTERP_KERNEL::Exception);
480 const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const throw(INTERP_KERNEL::Exception);
482 int getNumberOfComponents() const;
483 const std::vector<std::string>& getInfo() const;
484 std::vector<std::string>& getInfo();
485 void setInfo(const std::vector<std::string>& infos) throw(INTERP_KERNEL::Exception);
486 std::size_t getHeapMemorySize() const;
487 int copyTinyInfoFrom(const MEDCouplingFieldDouble *field, const DataArray *arr) throw(INTERP_KERNEL::Exception);
488 void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception);
489 void setFieldProfile(const MEDCouplingFieldDouble *field, const DataArray *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception);
490 virtual void simpleRepr(int bkOffset, std::ostream& oss, int f1tsId) const;
491 virtual MEDFileAnyTypeField1TSWithoutSDA *deepCpy() const throw(INTERP_KERNEL::Exception) = 0;
492 virtual MEDFileAnyTypeField1TSWithoutSDA *shallowCpy() const throw(INTERP_KERNEL::Exception) = 0;
493 virtual std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> > splitComponents() const throw(INTERP_KERNEL::Exception);
494 virtual const char *getTypeStr() const throw(INTERP_KERNEL::Exception) = 0;
495 virtual DataArray *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception) = 0;
496 virtual DataArray *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const throw(INTERP_KERNEL::Exception) = 0;
497 virtual void setArray(DataArray *arr) throw(INTERP_KERNEL::Exception) = 0;
498 virtual DataArray *createNewEmptyDataArrayInstance() const = 0;
499 virtual DataArray *getOrCreateAndGetArray() = 0;
500 virtual const DataArray *getOrCreateAndGetArray() const = 0;
502 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, const char *mName, int renumPol, const MEDFileFieldGlobsReal *glob, MEDCouplingAutoRefCountObjectPtr<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception);
503 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDFileMesh *mesh, MEDCouplingAutoRefCountObjectPtr<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception);
504 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, const char *mName, int renumPol, const MEDFileFieldGlobsReal *glob, MEDCouplingAutoRefCountObjectPtr<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception);
505 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, const DataArrayInt *cellRenum, const DataArrayInt *nodeRenum, MEDCouplingAutoRefCountObjectPtr<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception);
506 DataArray *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception);
508 bool renumberEntitiesLyingOnMesh(const char *meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
510 virtual void finishLoading(med_idt fid, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception);
511 void writeLL(med_idt fid, const MEDFileWritable& opts, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception);
513 int getMeshIdFromMeshName(const char *mName) const throw(INTERP_KERNEL::Exception);
514 int addNewEntryIfNecessary(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
516 std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > > _field_per_mesh;
521 //! only useable on reading
526 * SDA is for Shared Data Arrays such as profiles.
528 class MEDLOADER_EXPORT MEDFileField1TSWithoutSDA : public MEDFileAnyTypeField1TSWithoutSDA
531 const char *getTypeStr() const throw(INTERP_KERNEL::Exception);
532 DataArray *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception);
533 DataArray *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const throw(INTERP_KERNEL::Exception);
534 DataArrayDouble *getUndergroundDataArrayDouble() const throw(INTERP_KERNEL::Exception);
535 DataArrayDouble *getUndergroundDataArrayDoubleExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const throw(INTERP_KERNEL::Exception);
536 std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(const char *mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const throw(INTERP_KERNEL::Exception);
537 static void CheckMeshDimRel(int meshDimRelToMax) throw(INTERP_KERNEL::Exception);
538 static std::vector<int> CheckSBTMesh(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
539 static MEDFileField1TSWithoutSDA *New(const char *fieldName, int csit, int iteration, int order, const std::vector<std::string>& infos);
541 MEDFileField1TSWithoutSDA();
542 MEDFileField1TSWithoutSDA(const char *fieldName, int csit, int iteration, int order, const std::vector<std::string>& infos);
543 MEDFileAnyTypeField1TSWithoutSDA *shallowCpy() const throw(INTERP_KERNEL::Exception);
544 MEDFileAnyTypeField1TSWithoutSDA *deepCpy() const throw(INTERP_KERNEL::Exception);
545 void setArray(DataArray *arr) throw(INTERP_KERNEL::Exception);
546 DataArray *createNewEmptyDataArrayInstance() const;
547 DataArray *getOrCreateAndGetArray();
548 const DataArray *getOrCreateAndGetArray() const;
549 DataArrayDouble *getOrCreateAndGetArrayDouble();
550 const DataArrayDouble *getOrCreateAndGetArrayDouble() const;
552 MEDCouplingAutoRefCountObjectPtr< DataArrayDouble > _arr;
554 static const char TYPE_STR[];
558 * SDA is for Shared Data Arrays such as profiles.
560 class MEDLOADER_EXPORT MEDFileIntField1TSWithoutSDA : public MEDFileAnyTypeField1TSWithoutSDA
563 MEDFileIntField1TSWithoutSDA();
564 static MEDFileIntField1TSWithoutSDA *New(const char *fieldName, int csit, int iteration, int order, const std::vector<std::string>& infos);
565 MEDFileAnyTypeField1TSWithoutSDA *deepCpy() const throw(INTERP_KERNEL::Exception);
566 MEDFileAnyTypeField1TSWithoutSDA *shallowCpy() const throw(INTERP_KERNEL::Exception);
567 const char *getTypeStr() const throw(INTERP_KERNEL::Exception);
568 DataArray *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception);
569 DataArray *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const throw(INTERP_KERNEL::Exception);
570 void setArray(DataArray *arr) throw(INTERP_KERNEL::Exception);
571 DataArray *createNewEmptyDataArrayInstance() const;
572 DataArray *getOrCreateAndGetArray();
573 const DataArray *getOrCreateAndGetArray() const;
574 DataArrayInt *getOrCreateAndGetArrayInt();
575 const DataArrayInt *getOrCreateAndGetArrayInt() const;
576 DataArrayInt *getUndergroundDataArrayInt() const throw(INTERP_KERNEL::Exception);
577 DataArrayInt *getUndergroundDataArrayIntExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const throw(INTERP_KERNEL::Exception);
579 MEDFileIntField1TSWithoutSDA(const char *fieldName, int csit, int iteration, int order, const std::vector<std::string>& infos);
581 MEDCouplingAutoRefCountObjectPtr< DataArrayInt > _arr;
583 static const char TYPE_STR[];
589 class MEDLOADER_EXPORT MEDFileAnyTypeField1TS : public RefCountObject, public MEDFileWritable, public MEDFileFieldGlobsReal
592 MEDFileAnyTypeField1TS();
593 MEDFileAnyTypeField1TS(const char *fileName) throw(INTERP_KERNEL::Exception);
594 MEDFileAnyTypeField1TS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
595 MEDFileAnyTypeField1TS(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
596 MEDFileAnyTypeField1TS(const MEDFileAnyTypeField1TSWithoutSDA& other, bool shallowCopyOfContent);
597 static MEDFileAnyTypeField1TS *BuildNewInstanceFromContent(MEDFileAnyTypeField1TSWithoutSDA *c, const char *fileName) throw(INTERP_KERNEL::Exception);
598 static MEDFileAnyTypeField1TSWithoutSDA *BuildContentFrom(med_idt fid, const char *fileName) throw(INTERP_KERNEL::Exception);
599 static MEDFileAnyTypeField1TSWithoutSDA *BuildContentFrom(med_idt fid, const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
600 static MEDFileAnyTypeField1TSWithoutSDA *BuildContentFrom(med_idt fid, const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
601 void writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception);
602 // direct forwarding to MEDFileAnyTypeField1TSWithoutSDA instance _content
604 static MEDFileAnyTypeField1TS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
605 static MEDFileAnyTypeField1TS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
606 static MEDFileAnyTypeField1TS *New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
607 int getDimension() const;
608 int getIteration() const;
609 int getOrder() const;
610 double getTime(int& iteration, int& order) const;
611 void setTime(int iteration, int order, double val);
612 std::string getName() const;
613 void setName(const char *name);
614 std::string simpleRepr() const;
615 void simpleRepr(int bkOffset, std::ostream& oss, int f1tsId) const;
616 std::string getDtUnit() const throw(INTERP_KERNEL::Exception);
617 void setDtUnit(const char *dtUnit) throw(INTERP_KERNEL::Exception);
618 std::string getMeshName() const throw(INTERP_KERNEL::Exception);
619 void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
620 bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab) throw(INTERP_KERNEL::Exception);
621 int getMeshIteration() const throw(INTERP_KERNEL::Exception);
622 int getMeshOrder() const throw(INTERP_KERNEL::Exception);
623 int getNumberOfComponents() const;
624 bool isDealingTS(int iteration, int order) const;
625 std::pair<int,int> getDtIt() const;
626 void fillIteration(std::pair<int,int>& p) const;
627 void fillTypesOfFieldAvailable(std::vector<TypeOfField>& types) const throw(INTERP_KERNEL::Exception);
628 void setInfo(const std::vector<std::string>& infos) throw(INTERP_KERNEL::Exception);
629 const std::vector<std::string>& getInfo() const;
630 std::vector<std::string>& getInfo();
631 std::vector<TypeOfField> getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception);
632 std::vector< std::vector<std::pair<int,int> > > getFieldSplitedByType(const char *mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF,
633 std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const throw(INTERP_KERNEL::Exception);
634 MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId) throw(INTERP_KERNEL::Exception);
635 const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const throw(INTERP_KERNEL::Exception);
636 int getNonEmptyLevels(const char *mname, std::vector<int>& levs) const throw(INTERP_KERNEL::Exception);
638 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
639 std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > splitComponents() const throw(INTERP_KERNEL::Exception);
640 MEDFileAnyTypeField1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
641 int copyTinyInfoFrom(const MEDCouplingFieldDouble *field, const DataArray *arr) throw(INTERP_KERNEL::Exception);
642 virtual MEDFileAnyTypeField1TS *shallowCpy() const throw(INTERP_KERNEL::Exception) = 0;
644 //! underground method see MEDFileField1TSWithoutSDA::setProfileNameOnLeaf
645 void setProfileNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
646 //! underground method see MEDFileField1TSWithoutSDA::setLocNameOnLeaf
647 void setLocNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
648 std::size_t getHeapMemorySize() const;
649 std::vector<std::string> getPflsReallyUsed() const;
650 std::vector<std::string> getLocsReallyUsed() const;
651 std::vector<std::string> getPflsReallyUsedMulti() const;
652 std::vector<std::string> getLocsReallyUsedMulti() const;
653 void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
654 void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
656 static int LocateField2(med_idt fid, const char *fileName, int fieldIdCFormat, bool checkFieldId, std::string& fieldName, med_field_type& typcha, std::vector<std::string>& infos, std::string& dtunitOut) throw(INTERP_KERNEL::Exception);
657 static int LocateField(med_idt fid, const char *fileName, const char *fieldName, int& posCFormat, med_field_type& typcha, std::vector<std::string>& infos, std::string& dtunitOut) throw(INTERP_KERNEL::Exception);
659 virtual med_field_type getMEDFileFieldType() const = 0;
660 MEDFileAnyTypeField1TSWithoutSDA *contentNotNullBase() throw(INTERP_KERNEL::Exception);
661 const MEDFileAnyTypeField1TSWithoutSDA *contentNotNullBase() const throw(INTERP_KERNEL::Exception);
663 MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> _content;
669 class MEDLOADER_EXPORT MEDFileField1TS : public MEDFileAnyTypeField1TS
672 static MEDFileField1TS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
673 static MEDFileField1TS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
674 static MEDFileField1TS *New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
675 static MEDFileField1TS *New(const MEDFileField1TSWithoutSDA& other, bool shallowCopyOfContent);
676 static MEDFileField1TS *New();
677 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
678 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception);
679 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
680 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
681 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
682 DataArrayDouble *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const throw(INTERP_KERNEL::Exception);
684 void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
685 void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
686 // direct forwarding to MEDFileField1TSWithoutSDA instance _content
688 MEDFileAnyTypeField1TS *shallowCpy() const throw(INTERP_KERNEL::Exception);
689 DataArrayDouble *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception);
690 DataArrayDouble *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const throw(INTERP_KERNEL::Exception);
692 std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(const char *mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF,
693 std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const throw(INTERP_KERNEL::Exception);
695 static void SetDataArrayDoubleInField(MEDCouplingFieldDouble *f, MEDCouplingAutoRefCountObjectPtr<DataArray>& arr) throw(INTERP_KERNEL::Exception);
696 static DataArrayDouble *ReturnSafelyDataArrayDouble(MEDCouplingAutoRefCountObjectPtr<DataArray>& arr) throw(INTERP_KERNEL::Exception);
698 med_field_type getMEDFileFieldType() const { return MED_FLOAT64; }
699 const MEDFileField1TSWithoutSDA *contentNotNull() const throw(INTERP_KERNEL::Exception);
700 MEDFileField1TSWithoutSDA *contentNotNull() throw(INTERP_KERNEL::Exception);
702 MEDFileField1TS(const char *fileName) throw(INTERP_KERNEL::Exception);
703 MEDFileField1TS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
704 MEDFileField1TS(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
705 MEDFileField1TS(const MEDFileField1TSWithoutSDA& other, bool shallowCopyOfContent);
709 class MEDLOADER_EXPORT MEDFileIntField1TS : public MEDFileAnyTypeField1TS
712 static MEDFileIntField1TS *New();
713 static MEDFileIntField1TS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
714 static MEDFileIntField1TS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
715 static MEDFileIntField1TS *New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
716 static MEDFileIntField1TS *New(const MEDFileIntField1TSWithoutSDA& other, bool shallowCopyOfContent);
717 MEDFileAnyTypeField1TS *shallowCpy() const throw(INTERP_KERNEL::Exception);
719 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, DataArrayInt* &arrOut, int renumPol=0) const throw(INTERP_KERNEL::Exception);
720 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, DataArrayInt* &arrOut, int renumPol=0) const throw(INTERP_KERNEL::Exception);
721 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt* &arrOut, int renumPol=0) const throw(INTERP_KERNEL::Exception);
722 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, DataArrayInt* &arrOut, int renumPol=0) const throw(INTERP_KERNEL::Exception);
723 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, DataArrayInt* &arrOut, int renumPol=0) const throw(INTERP_KERNEL::Exception);
724 DataArrayInt *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const throw(INTERP_KERNEL::Exception);
726 void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) throw(INTERP_KERNEL::Exception);
727 void setFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
728 DataArrayInt *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception);
730 static DataArrayInt *ReturnSafelyDataArrayInt(MEDCouplingAutoRefCountObjectPtr<DataArray>& arr) throw(INTERP_KERNEL::Exception);
732 med_field_type getMEDFileFieldType() const { return MED_INT32; }
733 const MEDFileIntField1TSWithoutSDA *contentNotNull() const throw(INTERP_KERNEL::Exception);
734 MEDFileIntField1TSWithoutSDA *contentNotNull() throw(INTERP_KERNEL::Exception);
736 MEDFileIntField1TS();
737 MEDFileIntField1TS(const char *fileName) throw(INTERP_KERNEL::Exception);
738 MEDFileIntField1TS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
739 MEDFileIntField1TS(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
740 MEDFileIntField1TS(const MEDFileIntField1TSWithoutSDA& other, bool shallowCopyOfContent);
743 class MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA : public RefCountObject, public MEDFileFieldNameScope
746 MEDFileAnyTypeFieldMultiTSWithoutSDA();
747 MEDFileAnyTypeFieldMultiTSWithoutSDA(const char *fieldName);
748 MEDFileAnyTypeFieldMultiTSWithoutSDA(med_idt fid, int fieldId) throw(INTERP_KERNEL::Exception);
749 MEDFileAnyTypeFieldMultiTSWithoutSDA(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit) throw(INTERP_KERNEL::Exception);
751 std::size_t getHeapMemorySize() const;
752 virtual MEDFileAnyTypeFieldMultiTSWithoutSDA *deepCpy() const throw(INTERP_KERNEL::Exception);
753 virtual std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> > splitComponents() const throw(INTERP_KERNEL::Exception);
754 virtual const char *getTypeStr() const throw(INTERP_KERNEL::Exception) = 0;
755 virtual MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const throw(INTERP_KERNEL::Exception) = 0;
756 virtual MEDFileAnyTypeFieldMultiTSWithoutSDA *createNew() const throw(INTERP_KERNEL::Exception) = 0;
757 virtual MEDFileAnyTypeField1TSWithoutSDA *createNew1TSWithoutSDAEmptyInstance() const throw(INTERP_KERNEL::Exception) = 0;
758 virtual void checkCoherencyOfType(const MEDFileAnyTypeField1TSWithoutSDA *f1ts) const throw(INTERP_KERNEL::Exception) = 0;
759 const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
760 void setInfo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
761 int getTimeStepPos(int iteration, int order) const throw(INTERP_KERNEL::Exception);
762 const MEDFileAnyTypeField1TSWithoutSDA& getTimeStepEntry(int iteration, int order) const throw(INTERP_KERNEL::Exception);
763 MEDFileAnyTypeField1TSWithoutSDA& getTimeStepEntry(int iteration, int order) throw(INTERP_KERNEL::Exception);
764 std::string getMeshName() const throw(INTERP_KERNEL::Exception);
765 void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
766 bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab) throw(INTERP_KERNEL::Exception);
767 int getNumberOfTS() const;
768 void eraseEmptyTS() throw(INTERP_KERNEL::Exception);
769 void eraseTimeStepIds(const int *startIds, const int *endIds) throw(INTERP_KERNEL::Exception);
770 void eraseTimeStepIds2(int bg, int end, int step) throw(INTERP_KERNEL::Exception);
771 MEDFileAnyTypeFieldMultiTSWithoutSDA *buildFromTimeStepIds(const int *startIds, const int *endIds) const throw(INTERP_KERNEL::Exception);
772 MEDFileAnyTypeFieldMultiTSWithoutSDA *buildFromTimeStepIds2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
773 MEDFileAnyTypeFieldMultiTSWithoutSDA *partOfThisLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const throw(INTERP_KERNEL::Exception);
774 MEDFileAnyTypeFieldMultiTSWithoutSDA *partOfThisNotLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const throw(INTERP_KERNEL::Exception);
775 int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
776 int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
777 std::vector< std::pair<int,int> > getIterations() const;
778 std::vector< std::pair<int,int> > getTimeSteps(std::vector<double>& ret1) const throw(INTERP_KERNEL::Exception);
779 void pushBackTimeStep(MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA>& tse) throw(INTERP_KERNEL::Exception);
780 void synchronizeNameScope() throw(INTERP_KERNEL::Exception);
781 void simpleRepr(int bkOffset, std::ostream& oss, int fmtsId) const;
782 int getNonEmptyLevels(int iteration, int order, const char *mname, std::vector<int>& levs) const throw(INTERP_KERNEL::Exception);
783 void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
784 void appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
785 std::vector< std::vector< std::pair<int,int> > > getFieldSplitedByType(int iteration, int order, const char *mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const throw(INTERP_KERNEL::Exception);
786 std::vector< std::vector<TypeOfField> > getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception);
787 DataArray *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception);
788 DataArray *getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const throw(INTERP_KERNEL::Exception);
789 bool renumberEntitiesLyingOnMesh(const char *meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
790 void finishLoading(med_idt fid, int nbPdt, med_field_type fieldTyp) throw(INTERP_KERNEL::Exception);
791 void writeLL(med_idt fid, const MEDFileWritable& opts) const throw(INTERP_KERNEL::Exception);
793 const MEDFileAnyTypeField1TSWithoutSDA *getTimeStepAtPos2(int pos) const throw(INTERP_KERNEL::Exception);
794 MEDFileAnyTypeField1TSWithoutSDA *getTimeStepAtPos2(int pos) throw(INTERP_KERNEL::Exception);
795 std::vector<std::string> getPflsReallyUsed2() const;
796 std::vector<std::string> getLocsReallyUsed2() const;
797 std::vector<std::string> getPflsReallyUsedMulti2() const;
798 std::vector<std::string> getLocsReallyUsedMulti2() const;
799 void changePflsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
800 void changeLocsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
802 virtual med_field_type getMEDFileFieldType() const = 0;
803 void copyTinyInfoFrom(const MEDCouplingFieldDouble *field, const DataArray *arr) throw(INTERP_KERNEL::Exception);
804 void checkCoherencyOfTinyInfo(const MEDCouplingFieldDouble *field, const DataArray *arr) const throw(INTERP_KERNEL::Exception);
805 void checkThatComponentsMatch(const std::vector<std::string>& compos) const throw(INTERP_KERNEL::Exception);
806 void checkThatNbOfCompoOfTSMatchThis() const throw(INTERP_KERNEL::Exception);
808 std::vector<std::string> _infos;
809 std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> > _time_steps;
812 class MEDLOADER_EXPORT MEDFileFieldMultiTSWithoutSDA : public MEDFileAnyTypeFieldMultiTSWithoutSDA
815 static MEDFileFieldMultiTSWithoutSDA *New(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit) throw(INTERP_KERNEL::Exception);
816 MEDFileFieldMultiTSWithoutSDA(med_idt fid, int fieldId) throw(INTERP_KERNEL::Exception);
817 const char *getTypeStr() const throw(INTERP_KERNEL::Exception);
818 MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const throw(INTERP_KERNEL::Exception);
819 MEDFileAnyTypeFieldMultiTSWithoutSDA *createNew() const throw(INTERP_KERNEL::Exception);
820 std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(int iteration, int order, const char *mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const throw(INTERP_KERNEL::Exception);
822 MEDFileFieldMultiTSWithoutSDA(const char *fieldName);
823 MEDFileFieldMultiTSWithoutSDA(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit) throw(INTERP_KERNEL::Exception);
824 med_field_type getMEDFileFieldType() const { return MED_FLOAT64; }
825 MEDFileAnyTypeField1TSWithoutSDA *createNew1TSWithoutSDAEmptyInstance() const throw(INTERP_KERNEL::Exception);
826 void checkCoherencyOfType(const MEDFileAnyTypeField1TSWithoutSDA *f1ts) const throw(INTERP_KERNEL::Exception);
828 MEDFileFieldMultiTSWithoutSDA();
831 class MEDLOADER_EXPORT MEDFileIntFieldMultiTSWithoutSDA : public MEDFileAnyTypeFieldMultiTSWithoutSDA
834 static MEDFileIntFieldMultiTSWithoutSDA *New(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit) throw(INTERP_KERNEL::Exception);
835 MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, int fieldId) throw(INTERP_KERNEL::Exception);
836 const char *getTypeStr() const throw(INTERP_KERNEL::Exception);
837 MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const throw(INTERP_KERNEL::Exception);
838 MEDFileAnyTypeFieldMultiTSWithoutSDA *createNew() const throw(INTERP_KERNEL::Exception);
840 MEDFileIntFieldMultiTSWithoutSDA(const char *fieldName);
841 MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit) throw(INTERP_KERNEL::Exception);
842 med_field_type getMEDFileFieldType() const { return MED_INT32; }
843 MEDFileAnyTypeField1TSWithoutSDA *createNew1TSWithoutSDAEmptyInstance() const throw(INTERP_KERNEL::Exception);
844 void checkCoherencyOfType(const MEDFileAnyTypeField1TSWithoutSDA *f1ts) const throw(INTERP_KERNEL::Exception);
846 MEDFileIntFieldMultiTSWithoutSDA();
849 class MEDFileAnyTypeFieldMultiTSIterator;
854 class MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS : public RefCountObject, public MEDFileWritable, public MEDFileFieldGlobsReal
857 MEDFileAnyTypeFieldMultiTS();
858 MEDFileAnyTypeFieldMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception);
859 MEDFileAnyTypeFieldMultiTS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
860 MEDFileAnyTypeFieldMultiTS(const MEDFileAnyTypeFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent);
861 static MEDFileAnyTypeFieldMultiTS *BuildNewInstanceFromContent(MEDFileAnyTypeFieldMultiTSWithoutSDA *c, const char *fileName) throw(INTERP_KERNEL::Exception);
862 static MEDFileAnyTypeFieldMultiTSWithoutSDA *BuildContentFrom(med_idt fid, const char *fileName) throw(INTERP_KERNEL::Exception);
863 static MEDFileAnyTypeFieldMultiTSWithoutSDA *BuildContentFrom(med_idt fid, const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
865 static MEDFileAnyTypeFieldMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
866 static MEDFileAnyTypeFieldMultiTS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
867 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
868 void writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception);
869 std::size_t getHeapMemorySize() const;
870 virtual MEDFileAnyTypeFieldMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
871 std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > splitComponents() const throw(INTERP_KERNEL::Exception);
872 virtual MEDFileAnyTypeFieldMultiTS *shallowCpy() const throw(INTERP_KERNEL::Exception) = 0;
873 virtual void checkCoherencyOfType(const MEDFileAnyTypeField1TS *f1ts) const throw(INTERP_KERNEL::Exception) = 0;
875 virtual MEDFileAnyTypeField1TS *getTimeStepAtPos(int pos) const throw(INTERP_KERNEL::Exception) = 0;
876 MEDFileAnyTypeField1TS *getTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
877 MEDFileAnyTypeField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
878 public:// direct forwarding to MEDFileField1TSWithoutSDA instance _content
879 std::string getName() const;
880 void setName(const char *name);
881 std::string getDtUnit() const throw(INTERP_KERNEL::Exception);
882 void setDtUnit(const char *dtUnit) throw(INTERP_KERNEL::Exception);
883 std::string getMeshName() const throw(INTERP_KERNEL::Exception);
884 void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
885 std::string simpleRepr() const;
886 void simpleRepr(int bkOffset, std::ostream& oss, int fmtsId) const;
887 int getNumberOfTS() const;
888 void eraseEmptyTS() throw(INTERP_KERNEL::Exception);
889 void eraseTimeStepIds(const int *startIds, const int *endIds) throw(INTERP_KERNEL::Exception);
890 void eraseTimeStepIds2(int bg, int end, int step) throw(INTERP_KERNEL::Exception);
891 MEDFileAnyTypeFieldMultiTS *buildSubPart(const int *startIds, const int *endIds) const throw(INTERP_KERNEL::Exception);
892 MEDFileAnyTypeFieldMultiTS *buildSubPartSlice(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
893 std::vector< std::pair<int,int> > getTimeSteps(std::vector<double>& ret1) const throw(INTERP_KERNEL::Exception);
894 std::vector< std::pair<int,int> > getIterations() const;
895 void pushBackTimeSteps(const std::vector<MEDFileAnyTypeField1TS *>& f1ts) throw(INTERP_KERNEL::Exception);
896 void pushBackTimeStep(MEDFileAnyTypeField1TS *f1ts) throw(INTERP_KERNEL::Exception);
897 void synchronizeNameScope() throw(INTERP_KERNEL::Exception);
898 int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
899 int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
900 MEDFileAnyTypeFieldMultiTSIterator *iterator() throw(INTERP_KERNEL::Exception);
901 bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab) throw(INTERP_KERNEL::Exception);
902 const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
903 void setInfo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
904 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
905 int getNonEmptyLevels(int iteration, int order, const char *mname, std::vector<int>& levs) const throw(INTERP_KERNEL::Exception);
906 std::vector< std::vector<TypeOfField> > getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception);
907 std::vector< std::vector< std::pair<int,int> > > getFieldSplitedByType(int iteration, int order, const char *mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const throw(INTERP_KERNEL::Exception);
908 MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> getContent();
910 std::vector<std::string> getPflsReallyUsed() const;
911 std::vector<std::string> getLocsReallyUsed() const;
912 std::vector<std::string> getPflsReallyUsedMulti() const;
913 std::vector<std::string> getLocsReallyUsedMulti() const;
914 void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
915 void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
917 MEDFileAnyTypeFieldMultiTSWithoutSDA *contentNotNullBase() throw(INTERP_KERNEL::Exception);
918 const MEDFileAnyTypeFieldMultiTSWithoutSDA *contentNotNullBase() const throw(INTERP_KERNEL::Exception);
920 MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> _content;
926 class MEDLOADER_EXPORT MEDFileFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
929 static MEDFileFieldMultiTS *New();
930 static MEDFileFieldMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
931 static MEDFileFieldMultiTS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
932 static MEDFileFieldMultiTS *New(const MEDFileFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent);
933 MEDFileAnyTypeFieldMultiTS *shallowCpy() const throw(INTERP_KERNEL::Exception);
934 void checkCoherencyOfType(const MEDFileAnyTypeField1TS *f1ts) const throw(INTERP_KERNEL::Exception);
936 MEDFileAnyTypeField1TS *getTimeStepAtPos(int pos) const throw(INTERP_KERNEL::Exception);
937 MEDFileAnyTypeField1TS *getTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
938 MEDFileAnyTypeField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
940 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
941 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception);
942 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
943 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
944 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
945 DataArrayDouble *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const throw(INTERP_KERNEL::Exception);
947 void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
948 void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
949 std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(int iteration, int order, const char *mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const throw(INTERP_KERNEL::Exception);
950 DataArrayDouble *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception);
951 DataArrayDouble *getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const throw(INTERP_KERNEL::Exception);
953 const MEDFileFieldMultiTSWithoutSDA *contentNotNull() const throw(INTERP_KERNEL::Exception);
954 MEDFileFieldMultiTSWithoutSDA *contentNotNull() throw(INTERP_KERNEL::Exception);
956 MEDFileFieldMultiTS();
957 MEDFileFieldMultiTS(const MEDFileFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent);
958 MEDFileFieldMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception);
959 MEDFileFieldMultiTS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
965 class MEDLOADER_EXPORT MEDFileIntFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
968 static MEDFileIntFieldMultiTS *New();
969 static MEDFileIntFieldMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
970 static MEDFileIntFieldMultiTS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
971 static MEDFileIntFieldMultiTS *New(const MEDFileIntFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent);
972 MEDFileAnyTypeFieldMultiTS *shallowCpy() const throw(INTERP_KERNEL::Exception);
973 void checkCoherencyOfType(const MEDFileAnyTypeField1TS *f1ts) const throw(INTERP_KERNEL::Exception);
974 MEDFileAnyTypeField1TS *getTimeStepAtPos(int pos) const throw(INTERP_KERNEL::Exception);
976 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, DataArrayInt* &arrOut, int renumPol=0) const throw(INTERP_KERNEL::Exception);
977 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, DataArrayInt* &arrOut, int renumPol=0) const throw(INTERP_KERNEL::Exception);
978 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt* &arrOut, int renumPol=0) const throw(INTERP_KERNEL::Exception);
979 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, DataArrayInt* &arrOut, int renumPol=0) const throw(INTERP_KERNEL::Exception);
980 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const char *mname, int meshDimRelToMax, DataArrayInt* &arrOut, int renumPol=0) const throw(INTERP_KERNEL::Exception);
981 DataArrayInt *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const throw(INTERP_KERNEL::Exception);
983 void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) throw(INTERP_KERNEL::Exception);
984 void appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
986 DataArrayInt *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception);
988 const MEDFileIntFieldMultiTSWithoutSDA *contentNotNull() const throw(INTERP_KERNEL::Exception);
989 MEDFileIntFieldMultiTSWithoutSDA *contentNotNull() throw(INTERP_KERNEL::Exception);
991 MEDFileIntFieldMultiTS();
992 MEDFileIntFieldMultiTS(const MEDFileIntFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent);
993 MEDFileIntFieldMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception);
994 MEDFileIntFieldMultiTS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
997 class MEDCOUPLING_EXPORT MEDFileAnyTypeFieldMultiTSIterator
1000 MEDFileAnyTypeFieldMultiTSIterator(MEDFileAnyTypeFieldMultiTS *fmts);
1001 ~MEDFileAnyTypeFieldMultiTSIterator();
1002 MEDFileAnyTypeField1TS *nextt() throw(INTERP_KERNEL::Exception);
1004 MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTS> _fmts;
1009 class MEDFileFieldsIterator;
1014 class MEDLOADER_EXPORT MEDFileFields : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
1017 static MEDFileFields *New();
1018 static MEDFileFields *New(const char *fileName) throw(INTERP_KERNEL::Exception);
1019 std::size_t getHeapMemorySize() const;
1020 MEDFileFields *deepCpy() const throw(INTERP_KERNEL::Exception);
1021 MEDFileFields *shallowCpy() const throw(INTERP_KERNEL::Exception);
1022 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
1023 void writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception);
1024 int getNumberOfFields() const;
1025 std::vector< std::pair<int,int> > getCommonIterations(bool& areThereSomeForgottenTS) const throw(INTERP_KERNEL::Exception);
1026 std::vector<std::string> getFieldsNames() const throw(INTERP_KERNEL::Exception);
1027 std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
1028 std::string simpleRepr() const;
1029 void simpleRepr(int bkOffset, std::ostream& oss) const;
1031 void resize(int newSize) throw(INTERP_KERNEL::Exception);
1032 void pushField(MEDFileAnyTypeFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
1033 void pushFields(const std::vector<MEDFileAnyTypeFieldMultiTS *>& fields) throw(INTERP_KERNEL::Exception);
1034 void setFieldAtPos(int i, MEDFileAnyTypeFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
1035 int getPosFromFieldName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
1036 MEDFileAnyTypeFieldMultiTS *getFieldAtPos(int i) const throw(INTERP_KERNEL::Exception);
1037 MEDFileAnyTypeFieldMultiTS *getFieldWithName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
1038 MEDFileFields *buildSubPart(const int *startIds, const int *endIds) const throw(INTERP_KERNEL::Exception);
1039 MEDFileFields *partOfThisLyingOnSpecifiedMeshName(const char *meshName) const throw(INTERP_KERNEL::Exception);
1040 MEDFileFields *partOfThisLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const throw(INTERP_KERNEL::Exception);
1041 MEDFileFields *partOfThisNotLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const throw(INTERP_KERNEL::Exception);
1042 MEDFileFieldsIterator *iterator() throw(INTERP_KERNEL::Exception);
1043 void destroyFieldAtPos(int i) throw(INTERP_KERNEL::Exception);
1044 void destroyFieldsAtPos(const int *startIds, const int *endIds) throw(INTERP_KERNEL::Exception);
1045 void destroyFieldsAtPos2(int bg, int end, int step) throw(INTERP_KERNEL::Exception);
1046 bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab) throw(INTERP_KERNEL::Exception);
1047 bool renumberEntitiesLyingOnMesh(const char *meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N) throw(INTERP_KERNEL::Exception);
1049 std::vector<std::string> getPflsReallyUsed() const;
1050 std::vector<std::string> getLocsReallyUsed() const;
1051 std::vector<std::string> getPflsReallyUsedMulti() const;
1052 std::vector<std::string> getLocsReallyUsedMulti() const;
1053 void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
1054 void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
1057 MEDFileFields(const char *fileName) throw(INTERP_KERNEL::Exception);
1059 std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> > _fields;
1062 class MEDCOUPLING_EXPORT MEDFileFieldsIterator
1065 MEDFileFieldsIterator(MEDFileFields *fs);
1066 ~MEDFileFieldsIterator();
1067 MEDFileAnyTypeFieldMultiTS *nextt();
1069 MEDCouplingAutoRefCountObjectPtr<MEDFileFields> _fs;