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