1 // Copyright (C) 2007-2012 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
20 #ifndef __MEDFILEFIELD_HXX__
21 #define __MEDFILEFIELD_HXX__
23 #include "MEDLoaderDefines.hxx"
25 #include "MEDFileUtilities.hxx"
27 #include "MEDCouplingAutoRefCountObjectPtr.hxx"
28 #include "MEDCouplingRefCountObject.hxx"
29 #include "MEDCouplingMemArray.hxx"
31 #include "NormalizedUnstructuredMesh.hxx"
32 #include "InterpKernelException.hxx"
42 class MEDFileFieldGlobs;
43 class MEDCouplingMesh;
44 class MEDCouplingFieldDouble;
47 class MEDFileFieldLoc : public RefCountObject
50 void MEDLOADER_EXPORT simpleRepr(std::ostream& oss) const;
51 const MEDLOADER_EXPORT std::string& getName() const { return _name; }
52 void MEDLOADER_EXPORT setName(const char *name);
53 static MEDFileFieldLoc *New(med_idt fid, const char *locName);
54 static MEDFileFieldLoc *New(med_idt fid, int id);
55 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);
56 int MEDLOADER_EXPORT getNbOfGaussPtPerCell() const { return _nb_gauss_pt; }
57 void MEDLOADER_EXPORT writeLL(med_idt fid) const;
58 std::string MEDLOADER_EXPORT repr() const;
59 bool MEDLOADER_EXPORT isName(const char *name) const { return _name==name; }
60 int MEDLOADER_EXPORT getDimension() const { return _dim; }
61 int MEDLOADER_EXPORT getNumberOfGaussPoints() const { return _nb_gauss_pt; }
62 int MEDLOADER_EXPORT getNumberOfPointsInCells() const { return _nb_node_per_cell; }
63 const MEDLOADER_EXPORT std::vector<double>& getRefCoords() const { return _ref_coo; }
64 const MEDLOADER_EXPORT std::vector<double>& getGaussCoords() const { return _gs_coo; }
65 const MEDLOADER_EXPORT std::vector<double>& getGaussWeights() const { return _w; }
66 bool MEDLOADER_EXPORT isEqual(const MEDFileFieldLoc& other, double eps) const;
68 MEDFileFieldLoc(med_idt fid, const char *locName);
69 MEDFileFieldLoc(med_idt fid, int id);
70 MEDFileFieldLoc(const char *locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w);
74 int _nb_node_per_cell;
76 INTERP_KERNEL::NormalizedCellType _geo_type;
77 std::vector<double> _ref_coo;
78 std::vector<double> _gs_coo;
79 std::vector<double> _w;
83 class MEDFileFieldPerMeshPerType;
84 class MEDFileField1TSWithoutSDA;
85 class MEDFileFieldGlobsReal;
86 class MEDFileFieldPerMesh;
88 class MEDFileFieldPerMeshPerTypePerDisc : public RefCountObject, public MEDFileWritable
91 static MEDFileFieldPerMeshPerTypePerDisc *NewOnRead(MEDFileFieldPerMeshPerType *fath, TypeOfField type, int profileIt) throw(INTERP_KERNEL::Exception);
92 static MEDFileFieldPerMeshPerTypePerDisc *New(MEDFileFieldPerMeshPerType *fath, TypeOfField type, int locId);
93 static MEDFileFieldPerMeshPerTypePerDisc *New(const MEDFileFieldPerMeshPerTypePerDisc& other);
94 void assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldDouble *field, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
95 void assignFieldProfile(int& start, const char *pflName, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, const MEDCouplingFieldDouble *field, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
96 void assignNodeFieldNoProfile(int& start, const MEDCouplingFieldDouble *field, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
97 void getCoarseData(TypeOfField& type, std::pair<int,int>& dad, std::string& pfl, std::string& loc) const throw(INTERP_KERNEL::Exception);
98 void writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception);
99 const MEDFileFieldPerMeshPerType *getFather() const;
100 void prepareLoading(med_idt fid, int profileIt, int& start) throw(INTERP_KERNEL::Exception);
101 void finishLoading(med_idt fid, int profileIt, int ft) throw(INTERP_KERNEL::Exception);
102 void setNewStart(int newValueOfStart) throw(INTERP_KERNEL::Exception);
103 int getIteration() const;
104 int getOrder() const;
105 double getTime() const;
106 std::string getName() const;
107 std::string getMeshName() const;
108 TypeOfField getType() const;
109 void simpleRepr(int bkOffset, std::ostream& oss, int id) const;
110 void fillTypesOfFieldAvailable(std::set<TypeOfField>& types) const throw(INTERP_KERNEL::Exception);
111 void setType(TypeOfField newType);
112 INTERP_KERNEL::NormalizedCellType getGeoType() const;
113 int getNumberOfComponents() const;
114 int getNumberOfTuples() const;
115 int getStart() const { return _start; }
116 DataArrayDouble *getArray();
117 const DataArrayDouble *getArray() const;
118 const std::vector<std::string>& getInfo() const;
119 std::string getProfile() const;
120 void setProfile(const char *newPflName);
121 std::string getLocalization() const;
122 void setLocalization(const char *newLocName);
123 int getLocId() const { return _loc_id; }
124 void setLocId(int newId) const { _loc_id=newId; }
125 void setFather(MEDFileFieldPerMeshPerType *newFather) { _father=newFather; }
126 void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
127 void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
128 void getFieldAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<int,int> >& dads, std::vector<const DataArrayInt *>& pfls, std::vector<int>& locs,
129 std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const;
130 void fillValues(int discId, int& startEntryId, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
131 int fillEltIdsFromCode(int offset, const std::vector<int>& codeOfMesh, const MEDFileFieldGlobsReal& glob, int *ptToFill) const throw(INTERP_KERNEL::Exception);
132 int fillTupleIds(int *ptToFill) const throw(INTERP_KERNEL::Exception);
133 static int ConvertType(TypeOfField type, int locId) throw(INTERP_KERNEL::Exception);
134 static std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> > SplitPerDiscretization(const std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>& entries);
135 static bool RenumberChunks(int offset, const std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc,
136 const DataArrayInt *explicitIdsInMesh, const std::vector<int>& newCode,
137 MEDFileFieldGlobsReal& glob, DataArrayDouble *arr, std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> >& result);
138 static MEDFileFieldPerMeshPerTypePerDisc *NewObjectOnSameDiscThanPool(TypeOfField typeF, INTERP_KERNEL::NormalizedCellType geoType, DataArrayInt *idsOfMeshElt,
139 bool isPfl, int nbi, int offset, std::list< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc,
140 MEDFileFieldGlobsReal& glob, bool ¬InExisting) throw(INTERP_KERNEL::Exception);
142 MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerType *fath, TypeOfField type, int profileIt) throw(INTERP_KERNEL::Exception);
143 MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerType *fath, TypeOfField type, int profileIt, const std::string& dummy);
144 MEDFileFieldPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc& other);
145 MEDFileFieldPerMeshPerTypePerDisc();
148 MEDFileFieldPerMeshPerType *_father;
151 //! _nval is different than end-start in case of ON_GAUSS_PT and ON_GAUSS_NE ! (_nval=(_end-_start)/nbi)
153 std::string _profile;
154 std::string _localization;
155 //! only on assignement -3 : ON_NODES, -2 : ON_CELLS, -1 : ON_GAUSS_NE, 0..* : ON_GAUSS_PT
158 mutable int _tmp_work1;
161 class MEDFileFieldPerMeshPerType : public RefCountObject, public MEDFileWritable
164 static MEDFileFieldPerMeshPerType *New(MEDFileFieldPerMesh *fath, INTERP_KERNEL::NormalizedCellType geoType) throw(INTERP_KERNEL::Exception);
165 static MEDFileFieldPerMeshPerType *NewOnRead(med_idt fid, MEDFileFieldPerMesh *fath, TypeOfField type, INTERP_KERNEL::NormalizedCellType geoType) throw(INTERP_KERNEL::Exception);
166 void assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldDouble *field, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
167 void assignFieldProfile(int& start, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, DataArrayInt *locIds, const MEDCouplingFieldDouble *field, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
168 void assignNodeFieldNoProfile(int& start, const MEDCouplingFieldDouble *field, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
169 void assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldDouble *field, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
170 const MEDFileFieldPerMesh *getFather() const;
171 void prepareLoading(med_idt fid, int &start) throw(INTERP_KERNEL::Exception);
172 void finishLoading(med_idt fid, int ft) throw(INTERP_KERNEL::Exception);
173 void writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception);
174 void getDimension(int& dim) const;
175 void fillTypesOfFieldAvailable(std::set<TypeOfField>& types) const throw(INTERP_KERNEL::Exception);
176 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);
177 int getIteration() const;
178 int getOrder() const;
179 double getTime() const;
180 std::string getName() const;
181 std::string getMeshName() const;
182 void simpleRepr(int bkOffset, std::ostream& oss, int id) const;
183 void getSizes(int& globalSz, int& nbOfEntries) const;
184 INTERP_KERNEL::NormalizedCellType getGeoType() const;
185 int getNumberOfComponents() const;
186 DataArrayDouble *getArray();
187 const DataArrayDouble *getArray() const;
188 const std::vector<std::string>& getInfo() const;
189 std::vector<std::string> getPflsReallyUsed() const;
190 std::vector<std::string> getLocsReallyUsed() const;
191 std::vector<std::string> getPflsReallyUsedMulti() const;
192 std::vector<std::string> getLocsReallyUsedMulti() const;
193 void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
194 void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
195 MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenLocId(int locId) throw(INTERP_KERNEL::Exception);
196 const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenLocId(int locId) const throw(INTERP_KERNEL::Exception);
197 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;
198 void fillValues(int& startEntryId, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
199 void setLeaves(const std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerTypePerDisc > >& leaves) throw(INTERP_KERNEL::Exception);
200 static med_entity_type ConvertIntoMEDFileType(TypeOfField ikType, INTERP_KERNEL::NormalizedCellType ikGeoType, med_geometry_type& medfGeoType);
202 std::vector<int> addNewEntryIfNecessary(const MEDCouplingFieldDouble *field, int offset, int nbOfCells) throw(INTERP_KERNEL::Exception);
203 std::vector<int> addNewEntryIfNecessaryGauss(const MEDCouplingFieldDouble *field, int offset, int nbOfCells) throw(INTERP_KERNEL::Exception);
204 std::vector<int> addNewEntryIfNecessary(const MEDCouplingFieldDouble *field, const DataArrayInt *subCells) throw(INTERP_KERNEL::Exception);
205 std::vector<int> addNewEntryIfNecessaryGauss(const MEDCouplingFieldDouble *field, const DataArrayInt *subCells) throw(INTERP_KERNEL::Exception);
206 MEDFileFieldPerMeshPerType(med_idt fid, MEDFileFieldPerMesh *fath, TypeOfField type, INTERP_KERNEL::NormalizedCellType geoType) throw(INTERP_KERNEL::Exception);
207 MEDFileFieldPerMeshPerType(MEDFileFieldPerMesh *fath, INTERP_KERNEL::NormalizedCellType geoType) throw(INTERP_KERNEL::Exception);
209 MEDFileFieldPerMesh *_father;
210 std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> > _field_pm_pt_pd;
211 INTERP_KERNEL::NormalizedCellType _geo_type;
214 class MEDFileFieldPerMesh : public RefCountObject, public MEDFileWritable
217 static MEDFileFieldPerMesh *New(MEDFileField1TSWithoutSDA *fath, const MEDCouplingMesh *mesh);
218 static MEDFileFieldPerMesh *NewOnRead(med_idt fid, MEDFileField1TSWithoutSDA *fath, int meshCsit, int meshIteration, int meshOrder) throw(INTERP_KERNEL::Exception);
219 void simpleRepr(int bkOffset,std::ostream& oss, int id) const;
220 void copyTinyInfoFrom(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
221 void assignFieldProfile(int& start, const DataArrayInt *multiTypePfl, const std::vector<int>& code, const std::vector<DataArrayInt *>& idsInPflPerType, const std::vector<DataArrayInt *>& idsPerType, const MEDCouplingFieldDouble *field, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
222 void assignFieldProfileGeneral(int& start, const DataArrayInt *multiTypePfl, const std::vector<int>& code, const std::vector<DataArrayInt *>& idsInPflPerType, const std::vector<DataArrayInt *>& idsPerType, const MEDCouplingFieldDouble *field, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
223 void assignFieldNoProfileNoRenum(int& start, const std::vector<int>& code, const MEDCouplingFieldDouble *field, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
224 void assignNodeFieldNoProfile(int& start, const MEDCouplingFieldDouble *field, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
225 void assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldDouble *field, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
226 void prepareLoading(med_idt fid, int &start) throw(INTERP_KERNEL::Exception);
227 void finishLoading(med_idt fid, int ft) throw(INTERP_KERNEL::Exception);
228 void writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception);
229 void fillTypesOfFieldAvailable(std::set<TypeOfField>& types) const throw(INTERP_KERNEL::Exception);
230 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);
231 void getDimension(int& dim) const;
232 double getTime() const;
233 int getIteration() const;
234 int getOrder() const;
235 int getMeshIteration() const { return _mesh_iteration; }
236 int getMeshOrder() const { return _mesh_order; }
237 const std::string& getDtUnit() const;
238 std::string getName() const;
239 std::string getMeshName() const { return _mesh_name; }
240 int getNumberOfComponents() const;
241 DataArrayDouble *getArray();
242 const DataArrayDouble *getArray() const;
243 const std::vector<std::string>& getInfo() const;
244 std::vector<std::string> getPflsReallyUsed() const;
245 std::vector<std::string> getLocsReallyUsed() const;
246 std::vector<std::string> getPflsReallyUsedMulti() const;
247 std::vector<std::string> getLocsReallyUsedMulti() const;
248 bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab) throw(INTERP_KERNEL::Exception);
249 bool renumberEntitiesLyingOnMesh(const char *meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
250 void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
251 void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
252 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, bool& isPfl) const throw(INTERP_KERNEL::Exception);
253 DataArrayDouble *getFieldOnMeshAtLevelWithPfl(TypeOfField type, const MEDCouplingMesh *mesh, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob) const throw(INTERP_KERNEL::Exception);
254 DataArrayDouble *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const throw(INTERP_KERNEL::Exception);
255 MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, int locId) throw(INTERP_KERNEL::Exception);
256 const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, int locId) const throw(INTERP_KERNEL::Exception);
258 int addNewEntryIfNecessary(INTERP_KERNEL::NormalizedCellType type);
259 MEDCouplingFieldDouble *finishField(TypeOfField type, const MEDFileFieldGlobsReal *glob,
260 const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs, const MEDCouplingMesh *mesh, bool& isPfl) const throw(INTERP_KERNEL::Exception);
261 MEDCouplingFieldDouble *finishField2(TypeOfField type, const MEDFileFieldGlobsReal *glob,
262 const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs,
263 const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes,
264 const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl) const throw(INTERP_KERNEL::Exception);
265 MEDCouplingFieldDouble *finishField3(const MEDFileFieldGlobsReal *glob,
266 const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs,
267 const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl) const throw(INTERP_KERNEL::Exception);
268 DataArrayDouble *finishField4(const std::vector< std::pair<int,int> >& dads, const DataArrayInt *pflIn, int nbOfElems, DataArrayInt *&pflOut) const throw(INTERP_KERNEL::Exception);
269 void assignNewLeaves(const std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerTypePerDisc > >& leaves) throw(INTERP_KERNEL::Exception);
270 static void SortArraysPerType(const MEDFileFieldGlobsReal *glob, TypeOfField type,
271 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,
272 std::vector<int>& code, std::vector<DataArrayInt *>& notNullPfls);
273 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);
274 MEDFileFieldPerMesh(med_idt fid, MEDFileField1TSWithoutSDA *fath, int meshCsit, int meshIteration, int meshOrder) throw(INTERP_KERNEL::Exception);
275 MEDFileFieldPerMesh(MEDFileField1TSWithoutSDA *fath, const MEDCouplingMesh *mesh);
277 std::string _mesh_name;
281 MEDFileField1TSWithoutSDA *_father;
282 std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > > _field_pm_pt;
285 class MEDFileFieldGlobsReal;
287 class MEDFileFieldGlobs : public RefCountObject
290 static MEDFileFieldGlobs *New(const char *fname);
291 static MEDFileFieldGlobs *New();
292 void simpleRepr(std::ostream& oss) const;
293 void appendGlobs(const MEDFileFieldGlobs& other, double eps) throw(INTERP_KERNEL::Exception);
294 void loadProfileInFile(med_idt fid, int id, const char *pflName) throw(INTERP_KERNEL::Exception);
295 void loadProfileInFile(med_idt fid, int id);
296 void loadGlobals(med_idt fid, const MEDFileFieldGlobsReal& real) throw(INTERP_KERNEL::Exception);
297 void loadAllGlobals(med_idt fid) throw(INTERP_KERNEL::Exception);
298 void writeGlobals(med_idt fid, const MEDFileWritable& opt) const throw(INTERP_KERNEL::Exception);
299 std::vector<std::string> getPfls() const;
300 std::vector<std::string> getLocs() const;
301 bool existsPfl(const char *pflName) const;
302 bool existsLoc(const char *locName) const;
303 std::string createNewNameOfPfl() const throw(INTERP_KERNEL::Exception);
304 std::string createNewNameOfLoc() const throw(INTERP_KERNEL::Exception);
305 std::vector< std::vector<int> > whichAreEqualProfiles() const;
306 std::vector< std::vector<int> > whichAreEqualLocs(double eps) const;
307 void setFileName(const char *fileName);
308 void changePflsNamesInStruct(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
309 void changeLocsNamesInStruct(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
310 int getNbOfGaussPtPerCell(int locId) const throw(INTERP_KERNEL::Exception);
311 int getLocalizationId(const char *loc) const throw(INTERP_KERNEL::Exception);
312 const char *getFileName() const { return _file_name.c_str(); }
313 std::string getFileName2() const { return _file_name; }
314 const MEDFileFieldLoc& getLocalizationFromId(int locId) const throw(INTERP_KERNEL::Exception);
315 const MEDFileFieldLoc& getLocalization(const char *locName) const throw(INTERP_KERNEL::Exception);
316 const DataArrayInt *getProfileFromId(int pflId) const throw(INTERP_KERNEL::Exception);
317 const DataArrayInt *getProfile(const char *pflName) const throw(INTERP_KERNEL::Exception);
318 MEDFileFieldLoc& getLocalizationFromId(int locId) throw(INTERP_KERNEL::Exception);
319 MEDFileFieldLoc& getLocalization(const char *locName) throw(INTERP_KERNEL::Exception);
320 DataArrayInt *getProfile(const char *pflName) throw(INTERP_KERNEL::Exception);
321 DataArrayInt *getProfileFromId(int pflId) throw(INTERP_KERNEL::Exception);
322 void killProfileIds(const std::vector<int>& pflIds) throw(INTERP_KERNEL::Exception);
323 void killLocalizationIds(const std::vector<int>& locIds) throw(INTERP_KERNEL::Exception);
325 void appendProfile(DataArrayInt *pfl) throw(INTERP_KERNEL::Exception);
326 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);
328 static std::string CreateNewNameNotIn(const char *prefix, const std::vector<std::string>& namesToAvoid) throw(INTERP_KERNEL::Exception);
330 MEDFileFieldGlobs(const char *fname);
332 ~MEDFileFieldGlobs();
334 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > _pfls;
335 std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldLoc> > _locs;
336 std::string _file_name;
339 /// @endcond INTERNAL
341 class MEDLOADER_EXPORT MEDFileFieldGlobsReal
344 MEDFileFieldGlobsReal(const char *fname);
345 MEDFileFieldGlobsReal();
346 void simpleRepr(std::ostream& oss) const;
347 void shallowCpyGlobs(const MEDFileFieldGlobsReal& other);
348 void appendGlobs(const MEDFileFieldGlobsReal& other, double eps) throw(INTERP_KERNEL::Exception);
349 virtual std::vector<std::string> getPflsReallyUsed() const = 0;
350 virtual std::vector<std::string> getLocsReallyUsed() const = 0;
351 virtual std::vector<std::string> getPflsReallyUsedMulti() const = 0;
352 virtual std::vector<std::string> getLocsReallyUsedMulti() const = 0;
353 virtual void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception) = 0;
354 virtual void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception) = 0;
355 virtual ~MEDFileFieldGlobsReal();
357 void loadProfileInFile(med_idt fid, int id, const char *pflName) throw(INTERP_KERNEL::Exception);
358 void loadProfileInFile(med_idt fid, int id);
359 void loadGlobals(med_idt fid) throw(INTERP_KERNEL::Exception);
360 void loadAllGlobals(med_idt fid) throw(INTERP_KERNEL::Exception);
361 void writeGlobals(med_idt fid, const MEDFileWritable& opt) const throw(INTERP_KERNEL::Exception);
362 std::vector<std::string> getPfls() const;
363 std::vector<std::string> getLocs() const;
364 bool existsPfl(const char *pflName) const;
365 bool existsLoc(const char *locName) const;
366 std::string createNewNameOfPfl() const throw(INTERP_KERNEL::Exception);
367 std::string createNewNameOfLoc() const throw(INTERP_KERNEL::Exception);
368 std::vector< std::vector<int> > whichAreEqualProfiles() const;
369 std::vector< std::vector<int> > whichAreEqualLocs(double eps) const;
370 void setFileName(const char *fileName);
371 void changePflsNamesInStruct(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
372 void changeLocsNamesInStruct(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
373 void changePflsNames(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
374 void changeLocsNames(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
375 void changePflName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
376 void changeLocName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
377 std::vector< std::pair<std::vector<std::string>, std::string > > zipPflsNames() throw(INTERP_KERNEL::Exception);
378 std::vector< std::pair<std::vector<std::string>, std::string > > zipLocsNames(double eps) throw(INTERP_KERNEL::Exception);
379 int getNbOfGaussPtPerCell(int locId) const throw(INTERP_KERNEL::Exception);
380 int getLocalizationId(const char *loc) const throw(INTERP_KERNEL::Exception);
381 const char *getFileName() const;
382 std::string getFileName2() const;
383 const MEDFileFieldLoc& getLocalizationFromId(int locId) const throw(INTERP_KERNEL::Exception);
384 const MEDFileFieldLoc& getLocalization(const char *locName) const throw(INTERP_KERNEL::Exception);
385 MEDFileFieldLoc& getLocalizationFromId(int locId) throw(INTERP_KERNEL::Exception);
386 MEDFileFieldLoc& getLocalization(const char *locName) throw(INTERP_KERNEL::Exception);
387 const DataArrayInt *getProfile(const char *pflName) const throw(INTERP_KERNEL::Exception);
388 const DataArrayInt *getProfileFromId(int pflId) const throw(INTERP_KERNEL::Exception);
389 DataArrayInt *getProfile(const char *pflName) throw(INTERP_KERNEL::Exception);
390 DataArrayInt *getProfileFromId(int pflId) throw(INTERP_KERNEL::Exception);
391 void killProfileIds(const std::vector<int>& pflIds) throw(INTERP_KERNEL::Exception);
392 void killLocalizationIds(const std::vector<int>& locIds) throw(INTERP_KERNEL::Exception);
394 void appendProfile(DataArrayInt *pfl) throw(INTERP_KERNEL::Exception);
395 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);
397 MEDCouplingAutoRefCountObjectPtr< MEDFileFieldGlobs > _globals;
401 * SDA is for Shared Data Arrays such as profiles.
403 class MEDLOADER_EXPORT MEDFileField1TSWithoutSDA : public RefCountObject
406 int copyTinyInfoFrom(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
407 int getDimension() const;
408 int getIteration() const { return _iteration; }
409 int getOrder() const { return _order; }
410 double getTime(int& iteration, int& order) const { iteration=_iteration; order=_order; return _dt; }
411 void setTime(int iteration, int order, double val) { _dt=val; _iteration=iteration; _order=order; }
412 std::string getName() const;
413 void setName(const char *name);
414 void simpleRepr(int bkOffset, std::ostream& oss, int f1tsId) const;
415 const std::string& getDtUnit() const { return _dt_unit; }
416 std::string getMeshName() const throw(INTERP_KERNEL::Exception);
417 void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
418 bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab) throw(INTERP_KERNEL::Exception);
419 int getMeshIteration() const throw(INTERP_KERNEL::Exception);
420 int getMeshOrder() const throw(INTERP_KERNEL::Exception);
421 int getNumberOfComponents() const;
422 bool isDealingTS(int iteration, int order) const;
423 std::pair<int,int> getDtIt() const;
424 void fillIteration(std::pair<int,int>& p) const;
425 void fillTypesOfFieldAvailable(std::vector<TypeOfField>& types) const throw(INTERP_KERNEL::Exception);
426 const std::vector<std::string>& getInfo() const;
427 std::vector<std::string>& getInfo();
429 std::vector<std::string> getPflsReallyUsed2() const;
430 std::vector<std::string> getLocsReallyUsed2() const;
431 std::vector<std::string> getPflsReallyUsedMulti2() const;
432 std::vector<std::string> getLocsReallyUsedMulti2() const;
433 void changePflsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
434 void changeLocsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
435 DataArrayDouble *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception);
436 DataArrayDouble *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const throw(INTERP_KERNEL::Exception);
437 int getNonEmptyLevels(const char *mname, std::vector<int>& levs) const throw(INTERP_KERNEL::Exception);
438 std::vector<TypeOfField> getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception);
439 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);
440 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);
441 MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId) throw(INTERP_KERNEL::Exception);
442 const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const throw(INTERP_KERNEL::Exception);
443 static void CheckMeshDimRel(int meshDimRelToMax) throw(INTERP_KERNEL::Exception);
444 static std::vector<int> CheckSBTMesh(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
445 static MEDFileField1TSWithoutSDA *New(const char *fieldName, int csit, int fieldtype, int iteration, int order, const std::vector<std::string>& infos);
447 void finishLoading(med_idt fid) throw(INTERP_KERNEL::Exception);
448 virtual void writeLL(med_idt fid, const MEDFileWritable& opts) const throw(INTERP_KERNEL::Exception);
449 void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
450 void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
451 bool renumberEntitiesLyingOnMesh(const char *meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
452 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, const char *mName, int renumPol, const MEDFileFieldGlobsReal *glob) const throw(INTERP_KERNEL::Exception);
453 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception);
454 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, const char *mName, int renumPol, const MEDFileFieldGlobsReal *glob) const throw(INTERP_KERNEL::Exception);
455 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, const DataArrayInt *cellRenum, const DataArrayInt *nodeRenum) const throw(INTERP_KERNEL::Exception);
456 DataArrayDouble *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob) const throw(INTERP_KERNEL::Exception);
458 int addNewEntryIfNecessary(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
459 int getMeshIdFromMeshName(const char *mName) const throw(INTERP_KERNEL::Exception);
461 MEDFileField1TSWithoutSDA();
462 MEDFileField1TSWithoutSDA(const char *fieldName, int csit, int fieldtype, int iteration, int order, const std::vector<std::string>& infos);
463 DataArrayDouble *getOrCreateAndGetArray();
464 const DataArrayDouble *getOrCreateAndGetArray() const;
466 std::string _dt_unit;
467 MEDCouplingAutoRefCountObjectPtr< DataArrayDouble > _arr;
468 std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > > _field_per_mesh;
473 //! only useable on reading
475 //! only useable on reading. 0 is for float, 1 for int32, 2 for int64
476 mutable int _field_type;
482 class MEDLOADER_EXPORT MEDFileField1TS : public RefCountObject, public MEDFileWritable, public MEDFileFieldGlobsReal
485 static MEDFileField1TS *New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
486 static MEDFileField1TS *New(const MEDFileField1TSWithoutSDA& other, bool deepCpy);
487 static MEDFileField1TS *New();
488 std::string simpleRepr() const;
489 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
490 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
491 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception);
492 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
493 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
494 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
495 DataArrayDouble *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const throw(INTERP_KERNEL::Exception);
497 void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
498 void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
499 // direct forwarding to MEDFileField1TSWithoutSDA instance _content
501 int copyTinyInfoFrom(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
502 int getDimension() const;
503 int getIteration() const;
504 int getOrder() const;
505 double getTime(int& iteration, int& order) const;
506 void setTime(int iteration, int order, double val);
507 std::string getName() const;
508 void setName(const char *name);
509 void simpleRepr(int bkOffset, std::ostream& oss, int f1tsId) const;
510 const std::string& getDtUnit() const;
511 std::string getMeshName() const throw(INTERP_KERNEL::Exception);
512 void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
513 bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab) throw(INTERP_KERNEL::Exception);
514 int getMeshIteration() const throw(INTERP_KERNEL::Exception);
515 int getMeshOrder() const throw(INTERP_KERNEL::Exception);
516 int getNumberOfComponents() const;
517 bool isDealingTS(int iteration, int order) const;
518 std::pair<int,int> getDtIt() const;
519 void fillIteration(std::pair<int,int>& p) const;
520 void fillTypesOfFieldAvailable(std::vector<TypeOfField>& types) const throw(INTERP_KERNEL::Exception);
521 const std::vector<std::string>& getInfo() const;
522 std::vector<std::string>& getInfo();
523 DataArrayDouble *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception);
524 DataArrayDouble *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const throw(INTERP_KERNEL::Exception);
525 MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId) throw(INTERP_KERNEL::Exception);
526 const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const throw(INTERP_KERNEL::Exception);
527 int getNonEmptyLevels(const char *mname, std::vector<int>& levs) const throw(INTERP_KERNEL::Exception);
528 std::vector<TypeOfField> getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception);
529 std::vector< std::vector<std::pair<int,int> > > getFieldSplitedByType(const char *mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF,
530 std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const throw(INTERP_KERNEL::Exception);
531 std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(const char *mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF,
532 std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const throw(INTERP_KERNEL::Exception);
534 //! underground method see MEDFileField1TSWithoutSDA::setProfileNameOnLeaf
535 void setProfileNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
536 //! underground method see MEDFileField1TSWithoutSDA::setLocNameOnLeaf
537 void setLocNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
539 void writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception);
540 std::vector<std::string> getPflsReallyUsed() const;
541 std::vector<std::string> getLocsReallyUsed() const;
542 std::vector<std::string> getPflsReallyUsedMulti() const;
543 std::vector<std::string> getLocsReallyUsedMulti() const;
544 void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
545 void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
546 MEDFileField1TS(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
547 MEDFileField1TS(const MEDFileField1TSWithoutSDA& other, bool deepCpy);
550 MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSWithoutSDA> _content;
553 class MEDLOADER_EXPORT MEDFileFieldMultiTSWithoutSDA : public RefCountObject
556 static MEDFileFieldMultiTSWithoutSDA *New(med_idt fid, const char *fieldName, int id, int ft, const std::vector<std::string>& infos, int nbOfStep) throw(INTERP_KERNEL::Exception);
557 MEDFileFieldMultiTSWithoutSDA(med_idt fid, int fieldId) throw(INTERP_KERNEL::Exception);
558 int getNumberOfTS() const;
559 void eraseEmptyTS() throw(INTERP_KERNEL::Exception);
560 void eraseTimeStepIds(const int *startIds, const int *endIds) throw(INTERP_KERNEL::Exception);
561 std::vector< std::pair<int,int> > getIterations() const;
562 int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
563 int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
564 int getNonEmptyLevels(int iteration, int order, const char *mname, std::vector<int>& levs) const throw(INTERP_KERNEL::Exception);
565 std::vector< std::vector<TypeOfField> > getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception);
566 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);
567 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);
568 virtual void writeLL(med_idt fid, const MEDFileWritable& opts) const throw(INTERP_KERNEL::Exception);
569 std::string getName() const;
570 void setName(const char *name);
571 void simpleRepr(int bkOffset, std::ostream& oss, int fmtsId) const;
572 std::vector< std::pair<int,int> > getTimeSteps(std::vector<double>& ret1) const throw(INTERP_KERNEL::Exception);
573 std::string getMeshName() const throw(INTERP_KERNEL::Exception);
574 void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
575 bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab) throw(INTERP_KERNEL::Exception);
576 const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
577 DataArrayDouble *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception);
578 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);
579 bool renumberEntitiesLyingOnMesh(const char *meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
580 void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
581 void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
583 const MEDFileField1TSWithoutSDA *getTimeStepAtPos2(int pos) const throw(INTERP_KERNEL::Exception);
584 MEDFileField1TSWithoutSDA *getTimeStepAtPos2(int pos) throw(INTERP_KERNEL::Exception);
585 const MEDFileField1TSWithoutSDA& getTimeStepEntry(int iteration, int order) const throw(INTERP_KERNEL::Exception);
586 std::vector<std::string> getPflsReallyUsed2() const;
587 std::vector<std::string> getLocsReallyUsed2() const;
588 std::vector<std::string> getPflsReallyUsedMulti2() const;
589 std::vector<std::string> getLocsReallyUsedMulti2() const;
590 void changePflsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
591 void changeLocsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
593 MEDFileField1TSWithoutSDA& getTimeStepEntry(int iteration, int order) throw(INTERP_KERNEL::Exception);
594 std::string getDtUnit() const throw(INTERP_KERNEL::Exception);
595 MEDFileFieldMultiTSWithoutSDA(const char *fieldName);
596 MEDFileFieldMultiTSWithoutSDA(med_idt fid, const char *fieldName, int id, int ft, const std::vector<std::string>& infos, int nbOfStep) throw(INTERP_KERNEL::Exception);
597 void finishLoading(med_idt fid, int nbPdt) throw(INTERP_KERNEL::Exception);
598 void copyTinyInfoFrom(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
599 void checkCoherencyOfTinyInfo(const MEDCouplingFieldDouble *field) const throw(INTERP_KERNEL::Exception);
601 MEDFileFieldMultiTSWithoutSDA();
604 std::vector<std::string> _infos;
605 //! only useable on reading. 0 is for float, 1 for int32, 2 for int64
606 mutable int _field_type;
607 std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSWithoutSDA> > _time_steps;
610 class MEDFileFieldMultiTSIterator;
615 class MEDLOADER_EXPORT MEDFileFieldMultiTS : public RefCountObject, public MEDFileWritable, public MEDFileFieldGlobsReal
618 static MEDFileFieldMultiTS *New();
619 static MEDFileFieldMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
620 static MEDFileFieldMultiTS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
621 static MEDFileFieldMultiTS *New(const MEDFileFieldMultiTSWithoutSDA& other, bool deepCpy);
623 MEDFileField1TS *getTimeStepAtPos(int pos) const throw(INTERP_KERNEL::Exception);
624 MEDFileField1TS *getTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
625 MEDFileField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
626 MEDFileFieldMultiTSIterator *iterator() throw(INTERP_KERNEL::Exception);
628 std::string simpleRepr() const;
629 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
630 void writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception);
631 MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
632 MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception);
633 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
634 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
635 MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
636 DataArrayDouble *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const throw(INTERP_KERNEL::Exception);
638 void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
639 void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
640 public:// direct forwarding to MEDFileField1TSWithoutSDA instance _content
641 int getNumberOfTS() const;
642 void eraseEmptyTS() throw(INTERP_KERNEL::Exception);
643 void eraseTimeStepIds(const int *startIds, const int *endIds) throw(INTERP_KERNEL::Exception);
644 std::vector< std::pair<int,int> > getIterations() const;
645 int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
646 int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
647 int getNonEmptyLevels(int iteration, int order, const char *mname, std::vector<int>& levs) const throw(INTERP_KERNEL::Exception);
648 std::vector< std::vector<TypeOfField> > getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception);
649 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);
650 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);
651 std::string getName() const;
652 void setName(const char *name);
653 void simpleRepr(int bkOffset, std::ostream& oss, int fmtsId) const;
654 std::vector< std::pair<int,int> > getTimeSteps(std::vector<double>& ret1) const throw(INTERP_KERNEL::Exception);
655 std::string getMeshName() const throw(INTERP_KERNEL::Exception);
656 void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
657 bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab) throw(INTERP_KERNEL::Exception);
658 const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
659 DataArrayDouble *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception);
660 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);
662 std::vector<std::string> getPflsReallyUsed() const;
663 std::vector<std::string> getLocsReallyUsed() const;
664 std::vector<std::string> getPflsReallyUsedMulti() const;
665 std::vector<std::string> getLocsReallyUsedMulti() const;
666 void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
667 void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
669 MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTSWithoutSDA> getContent();
671 MEDFileFieldMultiTS();
672 MEDFileFieldMultiTS(const MEDFileFieldMultiTSWithoutSDA& other, bool deepCpy);
673 MEDFileFieldMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception);
674 MEDFileFieldMultiTS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
676 MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTSWithoutSDA> _content;
679 class MEDCOUPLING_EXPORT MEDFileFieldMultiTSIterator
682 MEDFileFieldMultiTSIterator(MEDFileFieldMultiTS *fmts);
683 ~MEDFileFieldMultiTSIterator();
684 MEDFileField1TS *nextt();
686 MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTS> _fmts;
691 class MEDFileFieldsIterator;
696 class MEDLOADER_EXPORT MEDFileFields : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
699 static MEDFileFields *New();
700 static MEDFileFields *New(const char *fileName) throw(INTERP_KERNEL::Exception);
701 void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
702 void writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception);
703 int getNumberOfFields() const;
704 std::vector<std::string> getFieldsNames() const throw(INTERP_KERNEL::Exception);
705 std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
706 std::string simpleRepr() const;
707 void simpleRepr(int bkOffset, std::ostream& oss) const;
709 void resize(int newSize) throw(INTERP_KERNEL::Exception);
710 void pushField(MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
711 void setFieldAtPos(int i, MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
712 MEDFileFieldMultiTS *getFieldAtPos(int i) const throw(INTERP_KERNEL::Exception);
713 MEDFileFieldMultiTS *getFieldWithName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
714 MEDFileFieldsIterator *iterator() throw(INTERP_KERNEL::Exception);
715 void destroyFieldAtPos(int i) throw(INTERP_KERNEL::Exception);
716 bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab) throw(INTERP_KERNEL::Exception);
717 bool renumberEntitiesLyingOnMesh(const char *meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N) throw(INTERP_KERNEL::Exception);
719 int getPosFromFieldName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
720 std::vector<std::string> getPflsReallyUsed() const;
721 std::vector<std::string> getLocsReallyUsed() const;
722 std::vector<std::string> getPflsReallyUsedMulti() const;
723 std::vector<std::string> getLocsReallyUsedMulti() const;
724 void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
725 void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
728 MEDFileFields(const char *fileName) throw(INTERP_KERNEL::Exception);
730 std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTSWithoutSDA> > _fields;
733 class MEDCOUPLING_EXPORT MEDFileFieldsIterator
736 MEDFileFieldsIterator(MEDFileFields *fs);
737 ~MEDFileFieldsIterator();
738 MEDFileFieldMultiTS *nextt();
740 MEDCouplingAutoRefCountObjectPtr<MEDFileFields> _fs;