1 // Copyright (C) 2007-2020 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (EDF R&D)
21 #ifndef __MEDFILEFIELDINTERNAL_HXX__
22 #define __MEDFILEFIELDINTERNAL_HXX__
24 #include "MEDLoaderDefines.hxx"
25 #include "MEDFileUtilities.hxx"
26 #include "NormalizedGeometricTypes"
27 #include "InterpKernelAutoPtr.hxx"
40 virtual MEDFileGTKeeper *deepCopy() const = 0;
41 virtual INTERP_KERNEL::NormalizedCellType getGeoType() const = 0;
42 virtual std::string getRepr() const = 0;
43 virtual bool isEqual(const MEDFileGTKeeper *other) const = 0;
44 virtual ~MEDFileGTKeeper();
47 class MEDFileGTKeeperSta : public MEDFileGTKeeper
50 MEDFileGTKeeperSta(INTERP_KERNEL::NormalizedCellType gt):_geo_type(gt) { }
51 MEDFileGTKeeper *deepCopy() const;
52 INTERP_KERNEL::NormalizedCellType getGeoType() const;
53 std::string getRepr() const;
54 bool isEqual(const MEDFileGTKeeper *other) const;
56 INTERP_KERNEL::NormalizedCellType _geo_type;
60 class MEDFileStructureElement;
63 class MEDFileGTKeeperDyn : public MEDFileGTKeeper
66 MEDFileGTKeeperDyn(const MEDFileUMesh *mesh, const MEDFileUMesh *section, const MEDFileStructureElement *se);
67 MEDFileGTKeeper *deepCopy() const;
68 INTERP_KERNEL::NormalizedCellType getGeoType() const;
69 std::string getRepr() const;
70 bool isEqual(const MEDFileGTKeeper *other) const;
71 const MEDFileUMesh *getMesh() const { return _mesh; }
72 const MEDFileUMesh *getSection() const { return _section; }
73 const MEDFileStructureElement *getSE() const { return _se; }
75 MCConstAuto<MEDFileUMesh> _mesh;
76 MCConstAuto<MEDFileUMesh> _section;
77 MCConstAuto<MEDFileStructureElement> _se;
80 class MEDFileEntities;
82 class MEDFileFieldLoc : public RefCountObject
85 MEDLOADER_EXPORT void simpleRepr(std::ostream& oss) const;
86 MEDLOADER_EXPORT std::string getName() const { return _name; }
87 MEDLOADER_EXPORT void setName(const std::string& name);
88 std::string getClassName() const override { return std::string("MEDFileFieldLoc"); }
89 static MEDFileFieldLoc *New(med_idt fid, const std::string& locName);
90 static MEDFileFieldLoc *New(med_idt fid, int i, const MEDFileEntities *entities);
91 static MEDFileFieldLoc *New(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w);
92 std::size_t getHeapMemorySizeWithoutChildren() const;
93 std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
94 MEDFileFieldLoc *deepCopy() const;
95 bool isOnStructureElement() const;
96 const MEDFileGTKeeper *getUndergroundGTKeeper() const { return _gt; }
97 MEDLOADER_EXPORT int getNbOfGaussPtPerCell() const { return _nb_gauss_pt; }
98 MEDLOADER_EXPORT void writeLL(med_idt fid) const;
99 MEDLOADER_EXPORT std::string repr() const;
100 MEDLOADER_EXPORT bool isName(const std::string& name) const { return _name==name; }
101 MEDLOADER_EXPORT int getDimension() const { return _dim; }
102 MEDLOADER_EXPORT int getNumberOfGaussPoints() const { return _nb_gauss_pt; }
103 MEDLOADER_EXPORT int getNumberOfPointsInCells() const { return _nb_node_per_cell; }
104 MEDLOADER_EXPORT const std::vector<double>& getRefCoords() const { return _ref_coo; }
105 MEDLOADER_EXPORT const std::vector<double>& getGaussCoords() const { return _gs_coo; }
106 MEDLOADER_EXPORT const std::vector<double>& getGaussWeights() const { return _w; }
107 MEDLOADER_EXPORT INTERP_KERNEL::NormalizedCellType getGeoType() const { return _gt->getGeoType(); }
108 MEDLOADER_EXPORT bool isEqual(const MEDFileFieldLoc& other, double eps) const;
110 MEDFileFieldLoc(const MEDFileFieldLoc& other);
111 MEDFileFieldLoc(med_idt fid, const std::string& locName);
112 MEDFileFieldLoc(med_idt fid, int id, const MEDFileEntities *entities);
113 MEDFileFieldLoc(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w);
117 INTERP_KERNEL::AutoCppPtr<MEDFileGTKeeper> _gt;
118 int _nb_node_per_cell;
120 std::vector<double> _ref_coo;
121 std::vector<double> _gs_coo;
122 std::vector<double> _w;
126 class MEDFileFieldPerMeshPerTypeCommon;
127 class MEDFileFieldPerMeshPerType;
128 class MEDCouplingFieldTemplate;
129 class MEDFileFieldNameScope;
130 class MEDFileFieldGlobsReal;
131 class MEDCouplingMesh;
133 class MEDFileFieldPerMeshPerTypePerDisc : public RefCountObject, public MEDFileWritable
136 static MEDFileFieldPerMeshPerTypePerDisc *NewOnRead(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int profileIt, const PartDefinition *pd);
137 static MEDFileFieldPerMeshPerTypePerDisc *New(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, mcIdType locId);
138 static MEDFileFieldPerMeshPerTypePerDisc *New(const MEDFileFieldPerMeshPerTypePerDisc& other);
139 std::string getClassName() const override { return std::string("MEDFileFieldPerMeshPerTypePerDisc"); }
140 std::size_t getHeapMemorySizeWithoutChildren() const;
141 std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
142 MEDFileFieldPerMeshPerTypePerDisc *deepCopy(MEDFileFieldPerMeshPerTypeCommon *father) const;
143 void assignFieldNoProfile(mcIdType& start, mcIdType offset, mcIdType nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
144 void assignFieldProfile(bool isPflAlone, mcIdType& start, const DataArrayIdType *multiTypePfl, const DataArrayIdType *idsInPfl, DataArrayIdType *locIds, mcIdType nbOfEltsInWholeMesh, const MEDCouplingFieldTemplate *field, const DataArray *arrr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
145 void assignNodeFieldNoProfile(mcIdType& start, const MEDCouplingFieldTemplate *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob);
146 void getCoarseData(TypeOfField& type, std::pair<mcIdType,mcIdType>& dad, std::string& pfl, std::string& loc) const;
147 void writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const;
148 const MEDFileFieldPerMeshPerTypeCommon *getFather() const;
149 void loadOnlyStructureOfDataRecursively(med_idt fid, mcIdType& start, const MEDFileFieldNameScope& nasc);
150 void loadBigArray(med_idt fid, const MEDFileFieldNameScope& nasc);
151 void setNewStart(mcIdType newValueOfStart);
152 int getIteration() const;
153 int getOrder() const;
154 double getTime() const;
155 std::string getMeshName() const;
156 TypeOfField getType() const;
157 void simpleRepr(int bkOffset, std::ostream& oss, int id) const;
158 void fillTypesOfFieldAvailable(std::set<TypeOfField>& types) const;
159 void setType(TypeOfField newType);
160 INTERP_KERNEL::NormalizedCellType getGeoType() const;
161 std::size_t getNumberOfComponents() const;
162 mcIdType getNumberOfTuples() const;
163 mcIdType getStart() const { return _start; }
164 mcIdType getEnd() const { return _end; }
165 void setEnd(mcIdType endd) { _end=endd; }
166 mcIdType getNumberOfVals() const { return _nval; }
167 void incrementNbOfVals(mcIdType deltaNbVal);
168 DataArray *getOrCreateAndGetArray();
169 const DataArray *getOrCreateAndGetArray() const;
170 const std::vector<std::string>& getInfo() const;
171 std::string getProfile() const;
172 void setProfile(const std::string& newPflName);
173 std::string getLocalization() const;
174 void setLocalization(const std::string& newLocName);
175 mcIdType getLocId() const { return _loc_id; }
176 void setLocId(mcIdType newId) const { _loc_id=newId; }
177 void setFather(MEDFileFieldPerMeshPerTypeCommon *newFather) { _father=newFather; }
178 void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
179 void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
180 void getFieldAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<mcIdType,mcIdType> >& dads, std::vector<const DataArrayIdType *>& pfls, std::vector<int>& locs,
181 std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const;
182 void fillValues(int discId, mcIdType& startEntryId, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const;
183 mcIdType fillEltIdsFromCode(mcIdType offset, const std::vector<mcIdType>& codeOfMesh, const MEDFileFieldGlobsReal& glob, mcIdType *ptToFill) const;
184 mcIdType fillTupleIds(mcIdType *ptToFill) const;
185 static int ConvertType(TypeOfField type, mcIdType locId);
186 static std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> > SplitPerDiscretization(const std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>& entries);
187 static bool RenumberChunks(mcIdType offset, const std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc,
188 const DataArrayIdType *explicitIdsInMesh, const std::vector<mcIdType>& newCode,
189 MEDFileFieldGlobsReal& glob, DataArrayDouble *arr, std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >& result);
190 static MEDFileFieldPerMeshPerTypePerDisc *NewObjectOnSameDiscThanPool(TypeOfField typeF, INTERP_KERNEL::NormalizedCellType geoType, DataArrayIdType *idsOfMeshElt,
191 bool isPfl, mcIdType nbi, mcIdType offset, std::list< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc,
192 MEDFileFieldGlobsReal& glob, bool ¬InExisting);
193 static MCAuto<MEDFileFieldPerMeshPerTypePerDisc> Aggregate(mcIdType &start, const std::vector<std::pair<int,const MEDFileFieldPerMeshPerTypePerDisc *> >& pms, const std::vector< std::vector< std::pair<int,mcIdType> > >& dts, TypeOfField tof, MEDFileFieldPerMeshPerType *father, std::vector<std::pair< int, std::pair<mcIdType,mcIdType> > >& extractInfo);
194 MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type):_type(type),_father(fath),_start(-1),_end(-1),_nval(-1),_loc_id(-5),_profile_it(-1) { }
196 MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, mcIdType profileIt, const PartDefinition *pd);
197 MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, mcIdType profileIt, const std::string& dummy);
198 MEDFileFieldPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc& other);
199 MEDFileFieldPerMeshPerTypePerDisc();
201 void goReadZeValuesInFile(med_idt fid, const std::string& fieldName, int nbOfCompo, int iteration, int order, med_entity_type menti, med_geometry_type mgeoti, unsigned char *startFeedingPtr);
204 MEDFileFieldPerMeshPerTypeCommon *_father;
207 //! _nval is different than end-start in case of ON_GAUSS_PT and ON_GAUSS_NE ! (_nval=(_end-_start)/nbi)
209 std::string _profile;
210 std::string _localization;
211 //! only on assignment -3 : ON_NODES, -2 : ON_CELLS, -1 : ON_GAUSS_NE, 0..* : ON_GAUSS_PT
212 mutable mcIdType _loc_id;
213 mutable mcIdType _profile_it;
214 MCAuto<PartDefinition> _pd;
216 mutable mcIdType _tmp_work1;
219 class MEDFileFieldVisitor;
220 class MEDFileFieldPerMesh;
222 class MEDFileFieldPerMeshPerTypeCommon : public RefCountObject, public MEDFileWritable
225 std::string getClassName() const override { return std::string("MEDFileFieldPerMeshPerTypeCommon"); }
226 std::size_t getHeapMemorySizeWithoutChildren() const;
227 std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
228 void assignFieldNoProfile(mcIdType& start, mcIdType offset, mcIdType nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
229 void assignFieldProfile(bool isPflAlone, mcIdType& start, const DataArrayIdType *multiTypePfl, const DataArrayIdType *idsInPfl, DataArrayIdType *locIds, mcIdType nbOfEltsInWholeMesh, const MEDCouplingFieldTemplate *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
230 void assignNodeFieldNoProfile(mcIdType& start, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob);
231 void assignNodeFieldProfile(mcIdType& start, const DataArrayIdType *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
232 const MEDFileFieldPerMesh *getFather() const;
233 void loadOnlyStructureOfDataRecursively(med_idt fid, mcIdType &start, const MEDFileFieldNameScope& nasc);
234 void loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc);
235 void writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const;
236 bool isUniqueLevel(int& dim) const;
237 void fillTypesOfFieldAvailable(std::set<TypeOfField>& types) const;
238 void fillFieldSplitedByType(std::vector< std::pair<mcIdType,mcIdType> >& dads, std::vector<TypeOfField>& types, std::vector<std::string>& pfls, std::vector<std::string>& locs) const;
239 int getIteration() const;
240 int getOrder() const;
241 double getTime() const;
242 std::string getMeshName() const;
243 void getSizes(mcIdType& globalSz, mcIdType& nbOfEntries) const;
244 std::size_t getNumberOfComponents() const;
245 bool presenceOfMultiDiscPerGeoType() const;
246 void pushDiscretization(MEDFileFieldPerMeshPerTypePerDisc *disc);
247 DataArray *getOrCreateAndGetArray();
248 const DataArray *getOrCreateAndGetArray() const;
249 const std::vector<std::string>& getInfo() const;
250 std::vector<std::string> getPflsReallyUsed() const;
251 std::vector<std::string> getLocsReallyUsed() const;
252 std::vector<std::string> getPflsReallyUsedMulti() const;
253 std::vector<std::string> getLocsReallyUsedMulti() const;
254 void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
255 void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
256 MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenLocId(mcIdType locId);
257 const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenLocId(mcIdType locId) const;
258 int getNumberOfLoc() const { return (int)_field_pm_pt_pd.size(); }
259 int locIdOfLeaf(const MEDFileFieldPerMeshPerTypePerDisc *leaf) const;
260 void fillValues(mcIdType& startEntryId, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const;
261 void setLeaves(const std::vector< MCAuto< MEDFileFieldPerMeshPerTypePerDisc > >& leaves);
262 bool keepOnlySpatialDiscretization(TypeOfField tof, mcIdType &globalNum, std::vector< std::pair<mcIdType,mcIdType> >& its);
263 bool keepOnlyGaussDiscretization(std::size_t idOfDisc, mcIdType &globalNum, std::vector< std::pair<mcIdType,mcIdType> >& its);
264 static med_entity_type ConvertIntoMEDFileType(TypeOfField ikType, INTERP_KERNEL::NormalizedCellType ikGeoType, med_geometry_type& medfGeoType);
265 MEDFileFieldPerMeshPerTypeCommon(MEDFileFieldPerMesh *father):_father(father) { }
266 void setFather(MEDFileFieldPerMesh *father);
267 void accept(MEDFileFieldVisitor& visitor) const;
269 virtual ~MEDFileFieldPerMeshPerTypeCommon();
270 virtual void getDimension(int& dim) const = 0;
271 virtual INTERP_KERNEL::NormalizedCellType getGeoType() const = 0;
272 virtual void entriesForMEDfile(TypeOfField mct, med_geometry_type& gt, med_entity_type& ent) const = 0;
273 virtual void simpleRepr(int bkOffset, std::ostream& oss, int id) const = 0;
274 virtual std::string getGeoTypeRepr() const = 0;
275 virtual MEDFileFieldPerMeshPerTypeCommon *deepCopy(MEDFileFieldPerMesh *father) const = 0;
276 virtual void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<mcIdType,mcIdType> >& dads, std::vector<const DataArrayIdType *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const = 0;
278 void deepCopyElements();
279 std::vector<mcIdType> addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, mcIdType offset, mcIdType nbOfCells);
280 std::vector<mcIdType> addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, mcIdType offset, mcIdType nbOfCells);
281 std::vector<mcIdType> addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, const DataArrayIdType *subCells);
282 std::vector<mcIdType> addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, const DataArrayIdType *subCells);
284 MEDFileFieldPerMesh *_father;
286 std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> > _field_pm_pt_pd;
289 class MEDFileFieldPerMeshPerType : public MEDFileFieldPerMeshPerTypeCommon
292 std::string getClassName() const override { return std::string("MEDFileFieldPerMeshPerType"); }
293 static MEDFileFieldPerMeshPerType *New(MEDFileFieldPerMesh *fath, INTERP_KERNEL::NormalizedCellType geoType);
294 static MEDFileFieldPerMeshPerType *NewOnRead(med_idt fid, MEDFileFieldPerMesh *fath, TypeOfField type, INTERP_KERNEL::NormalizedCellType geoType, const MEDFileFieldNameScope& nasc, const PartDefinition *pd);
295 static MCAuto<MEDFileFieldPerMeshPerType> Aggregate(mcIdType &start, const std::vector< std::pair<int,const MEDFileFieldPerMeshPerType *> >& pms, const std::vector< std::vector< std::pair<int,mcIdType> > >& dts, INTERP_KERNEL::NormalizedCellType gt, MEDFileFieldPerMesh *father, std::vector<std::pair< int, std::pair<mcIdType,mcIdType> > >& extractInfo);
296 public:// overload of abstract methods
297 void getDimension(int& dim) const;
298 INTERP_KERNEL::NormalizedCellType getGeoType() const;
299 void entriesForMEDfile(TypeOfField mct, med_geometry_type& gt, med_entity_type& ent) const;
300 void simpleRepr(int bkOffset, std::ostream& oss, int id) const;
301 std::string getGeoTypeRepr() const;
302 MEDFileFieldPerMeshPerType *deepCopy(MEDFileFieldPerMesh *father) const;
303 void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<mcIdType,mcIdType> >& dads, std::vector<const DataArrayIdType *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const;
305 MEDFileFieldPerMeshPerType(med_idt fid, MEDFileFieldPerMesh *fath, TypeOfField type, INTERP_KERNEL::NormalizedCellType geoType, const MEDFileFieldNameScope& nasc, const PartDefinition *pd);
306 MEDFileFieldPerMeshPerType(MEDFileFieldPerMesh *father, INTERP_KERNEL::NormalizedCellType gt);
308 INTERP_KERNEL::NormalizedCellType _geo_type;
311 class MEDFileFieldPerMeshPerTypeDyn : public MEDFileFieldPerMeshPerTypeCommon
314 static MEDFileFieldPerMeshPerTypeDyn *NewOnRead(med_idt fid, MEDFileFieldPerMesh *fath, const MEDFileEntities *entities, int idGT, const MEDFileFieldNameScope& nasc);
315 std::string getClassName() const override { return std::string("MEDFileFieldPerMeshPerTypeDyn"); }
316 int getDynGT() const;
317 std::string getModelName() const;
319 void getDimension(int& dim) const;
320 INTERP_KERNEL::NormalizedCellType getGeoType() const;
321 void entriesForMEDfile(TypeOfField mct, med_geometry_type& gt, med_entity_type& ent) const;
322 void simpleRepr(int bkOffset, std::ostream& oss, int id) const;
323 std::string getGeoTypeRepr() const;
324 MEDFileFieldPerMeshPerTypeDyn *deepCopy(MEDFileFieldPerMesh *father) const;
325 void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<mcIdType,mcIdType> >& dads, std::vector<const DataArrayIdType *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const;
327 MEDFileFieldPerMeshPerTypeDyn(med_idt fid, MEDFileFieldPerMesh *fath, const MEDFileStructureElement *se, const MEDFileFieldNameScope& nasc);
329 MCConstAuto<MEDFileStructureElement> _se;
333 class MEDFileAnyTypeField1TSWithoutSDA;
334 class MEDFileField1TSWithoutSDA;
336 class MEDFileFieldPerMesh : public RefCountObject, public MEDFileWritable
339 static MEDFileFieldPerMesh *New(MEDFileAnyTypeField1TSWithoutSDA *fath, const MEDCouplingMesh *mesh);
340 static MEDFileFieldPerMesh *NewOnRead(med_idt fid, MEDFileAnyTypeField1TSWithoutSDA *fath, int meshCsit, int meshIteration, int meshOrder, const MEDFileFieldNameScope& nasc, const MEDFileMesh *mm, const MEDFileEntities *entities);
341 std::string getClassName() const override { return std::string("MEDFileFieldPerMesh"); }
342 std::size_t getHeapMemorySizeWithoutChildren() const;
343 std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
344 MEDFileFieldPerMesh *deepCopy(MEDFileAnyTypeField1TSWithoutSDA *father) const;
345 void simpleRepr(int bkOffset,std::ostream& oss, int id) const;
346 void copyTinyInfoFrom(const MEDCouplingMesh *mesh);
347 void assignFieldProfile(mcIdType& start, const DataArrayIdType *multiTypePfl, const std::vector<mcIdType>& code, const std::vector<mcIdType>& code2, const std::vector<DataArrayIdType *>& idsInPflPerType, const std::vector<DataArrayIdType *>& idsPerType, const MEDCouplingFieldTemplate *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
348 void assignFieldNoProfileNoRenum(mcIdType& start, const std::vector<mcIdType>& code, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
349 void assignNodeFieldNoProfile(mcIdType& start, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob);
350 void assignNodeFieldProfile(mcIdType& start, const DataArrayIdType *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
351 void loadOnlyStructureOfDataRecursively(med_idt fid, mcIdType &start, const MEDFileFieldNameScope& nasc);
352 void loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc);
353 void writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const;
354 void fillTypesOfFieldAvailable(std::set<TypeOfField>& types) const;
355 std::vector< std::vector< std::pair<mcIdType,mcIdType> > > 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;
356 void accept(MEDFileFieldVisitor& visitor) const;
357 void getDimension(int& dim) const;
358 bool isUniqueLevel(int& dim) const;
359 double getTime() const;
360 int getIteration() const;
361 int getOrder() const;
362 int getMeshIteration() const { return _mesh_iteration; }
363 int getMeshOrder() const { return _mesh_order; }
364 std::string getMeshName() const;
365 void setMeshName(const std::string& meshName);
366 std::size_t getNumberOfComponents() const;
367 bool presenceOfMultiDiscPerGeoType() const;
368 bool presenceOfStructureElements() const;
369 bool onlyStructureElements() const;
370 void killStructureElements();
371 void keepOnlyStructureElements();
372 void keepOnlyOnSE(const std::string& seName);
373 void getMeshSENames(std::vector< std::pair<std::string,std::string> >& ps) const;
374 DataArray *getOrCreateAndGetArray();
375 const DataArray *getOrCreateAndGetArray() const;
376 const std::vector<std::string>& getInfo() const;
377 std::vector<std::string> getPflsReallyUsed() const;
378 std::vector<std::string> getLocsReallyUsed() const;
379 std::vector<std::string> getPflsReallyUsedMulti() const;
380 std::vector<std::string> getLocsReallyUsedMulti() const;
381 void convertMedBallIntoClassic();
382 bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
383 bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<mcIdType>& oldCode, const std::vector<mcIdType>& newCode, const DataArrayIdType *renumO2N, MEDFileFieldGlobsReal& glob);
384 void keepOnlySpatialDiscretization(TypeOfField tof, mcIdType &globalNum, std::vector< std::pair<mcIdType,mcIdType> >& its);
385 void keepOnlyGaussDiscretization(std::size_t idOfDisc, mcIdType &globalNum, std::vector< std::pair<mcIdType,mcIdType> >& its);
386 void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
387 void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
388 MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, bool& isPfl, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
389 DataArray *getFieldOnMeshAtLevelWithPfl(TypeOfField type, const MEDCouplingMesh *mesh, DataArrayIdType *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const;
390 void getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const;
391 MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, mcIdType locId);
392 const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, mcIdType locId) const;
393 static MCAuto<MEDFileFieldPerMesh> Aggregate(mcIdType &start, const std::vector<const MEDFileFieldPerMesh *>& pms, const std::vector< std::vector< std::pair<int,mcIdType> > >& dts, MEDFileAnyTypeField1TSWithoutSDA *father, std::vector<std::pair< int, std::pair<mcIdType,mcIdType> > >& extractInfo);
395 int addNewEntryIfNecessary(INTERP_KERNEL::NormalizedCellType type);
396 MEDCouplingFieldDouble *finishField(TypeOfField type, const MEDFileFieldGlobsReal *glob,
397 const std::vector< std::pair<mcIdType,mcIdType> >& dads, const std::vector<int>& locs, const MEDCouplingMesh *mesh, bool& isPfl, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
398 MEDCouplingFieldDouble *finishField2(TypeOfField type, const MEDFileFieldGlobsReal *glob,
399 const std::vector< std::pair<mcIdType,mcIdType> >& dads, const std::vector<int>& locs,
400 const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes,
401 const MEDCouplingMesh *mesh, const DataArrayIdType *da, bool& isPfl, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
402 MEDCouplingFieldDouble *finishFieldNode2(const MEDFileFieldGlobsReal *glob,
403 const std::vector< std::pair<mcIdType,mcIdType> >& dads, const std::vector<int>& locs,
404 const MEDCouplingMesh *mesh, const DataArrayIdType *da, bool& isPfl, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
405 DataArray *finishField4(const std::vector< std::pair<mcIdType,mcIdType> >& dads, const DataArrayIdType *pflIn, mcIdType nbOfElems, DataArrayIdType *&pflOut) const;
406 void assignNewLeaves(const std::vector< MCAuto< MEDFileFieldPerMeshPerTypePerDisc > >& leaves);
407 static void SortArraysPerType(const MEDFileFieldGlobsReal *glob, TypeOfField type,
408 const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes, const std::vector< std::pair<mcIdType,mcIdType> >& dads, const std::vector<const DataArrayIdType *>& pfls, const std::vector<int>& locs,
409 std::vector<mcIdType>& code, std::vector<DataArrayIdType *>& notNullPfls);
410 static mcIdType ComputeNbOfElems(const MEDFileFieldGlobsReal *glob, TypeOfField type, const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes, const std::vector< std::pair<mcIdType,mcIdType> >& dads, const std::vector<int>& locs);
411 MEDFileFieldPerMesh(med_idt fid, MEDFileAnyTypeField1TSWithoutSDA *fath, int meshCsit, int meshIteration, int meshOrder, const MEDFileFieldNameScope& nasc, const MEDFileMesh *mm, const MEDFileEntities *entities);
412 MEDFileFieldPerMesh(MEDFileAnyTypeField1TSWithoutSDA *fath, const MEDCouplingMesh *mesh);
413 MEDFileFieldPerMesh(MEDFileAnyTypeField1TSWithoutSDA *fath, const std::string& meshName, int meshIt, int meshOrd):_mesh_iteration(meshIt),_mesh_order(meshOrd),_father(fath) { }
417 MEDFileAnyTypeField1TSWithoutSDA *_father;
418 std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > > _field_pm_pt;