X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDLoader%2FMEDFileField.hxx;h=4513b45ef7eafdcfededc420c2cbbe2cdedcf10d;hb=7126a380f58b740a46752e59318913032e951e35;hp=f12ef235db916282bba63d4b6e92e02892ff9627;hpb=79386ac5c73f8365c428b8ef595c4ef004959667;p=tools%2Fmedcoupling.git diff --git a/src/MEDLoader/MEDFileField.hxx b/src/MEDLoader/MEDFileField.hxx index f12ef235d..4513b45ef 100644 --- a/src/MEDLoader/MEDFileField.hxx +++ b/src/MEDLoader/MEDFileField.hxx @@ -24,10 +24,14 @@ #include "MEDLoaderDefines.hxx" #include "MEDFileFieldOverView.hxx" -#include "MEDFileUtilities.hxx" +#include "MEDFileUtilities.txx" +#include "MEDFileEntities.hxx" #include "MCAuto.hxx" +#include "MEDLoaderTraits.hxx" +#include "MEDCouplingTraits.hxx" #include "MEDCouplingRefCountObject.hxx" +#include "MEDCouplingFieldInt.hxx" #include "MEDCouplingMemArray.hxx" #include "NormalizedUnstructuredMesh.hxx" @@ -47,6 +51,43 @@ namespace MEDCoupling class MEDCouplingFieldDouble; class MEDFileMesh; + class MEDFileGTKeeper + { + public: + virtual MEDFileGTKeeper *deepCopy() const = 0; + virtual INTERP_KERNEL::NormalizedCellType getGeoType() const = 0; + virtual std::string getRepr() const = 0; + virtual bool isEqual(const MEDFileGTKeeper *other) const = 0; + virtual ~MEDFileGTKeeper(); + }; + + class MEDFileGTKeeperSta : public MEDFileGTKeeper + { + public: + MEDFileGTKeeperSta(INTERP_KERNEL::NormalizedCellType gt):_geo_type(gt) { } + MEDFileGTKeeper *deepCopy() const; + INTERP_KERNEL::NormalizedCellType getGeoType() const; + std::string getRepr() const; + bool isEqual(const MEDFileGTKeeper *other) const; + private: + INTERP_KERNEL::NormalizedCellType _geo_type; + }; + + + class MEDFileGTKeeperDyn : public MEDFileGTKeeper + { + public: + MEDFileGTKeeperDyn(const MEDFileUMesh *mesh, const MEDFileUMesh *section, const MEDFileStructureElement *se); + MEDFileGTKeeper *deepCopy() const; + INTERP_KERNEL::NormalizedCellType getGeoType() const; + std::string getRepr() const; + bool isEqual(const MEDFileGTKeeper *other) const; + private: + MCConstAuto _mesh; + MCConstAuto _section; + MCConstAuto _se; + }; + class MEDFileFieldLoc : public RefCountObject { public: @@ -54,7 +95,7 @@ namespace MEDCoupling MEDLOADER_EXPORT std::string getName() const { return _name; } MEDLOADER_EXPORT void setName(const std::string& name); static MEDFileFieldLoc *New(med_idt fid, const std::string& locName); - static MEDFileFieldLoc *New(med_idt fid, int id); + static MEDFileFieldLoc *New(med_idt fid, int i, const MEDFileEntities *entities); static MEDFileFieldLoc *New(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& w); std::size_t getHeapMemorySizeWithoutChildren() const; std::vector getDirectChildrenWithNull() const; @@ -69,18 +110,19 @@ namespace MEDCoupling MEDLOADER_EXPORT const std::vector& getRefCoords() const { return _ref_coo; } MEDLOADER_EXPORT const std::vector& getGaussCoords() const { return _gs_coo; } MEDLOADER_EXPORT const std::vector& getGaussWeights() const { return _w; } - MEDLOADER_EXPORT INTERP_KERNEL::NormalizedCellType getGeoType() const { return _geo_type; } + MEDLOADER_EXPORT INTERP_KERNEL::NormalizedCellType getGeoType() const { return _gt->getGeoType(); } MEDLOADER_EXPORT bool isEqual(const MEDFileFieldLoc& other, double eps) const; private: + MEDFileFieldLoc(const MEDFileFieldLoc& other); MEDFileFieldLoc(med_idt fid, const std::string& locName); - MEDFileFieldLoc(med_idt fid, int id); + MEDFileFieldLoc(med_idt fid, int id, const MEDFileEntities *entities); MEDFileFieldLoc(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& w); private: int _dim; int _nb_gauss_pt; + INTERP_KERNEL::AutoCppPtr _gt; int _nb_node_per_cell; std::string _name; - INTERP_KERNEL::NormalizedCellType _geo_type; std::vector _ref_coo; std::vector _gs_coo; std::vector _w; @@ -88,6 +130,7 @@ namespace MEDCoupling /// @cond INTERNAL class MEDFileAnyTypeField1TSWithoutSDA; + class MEDFileFieldPerMeshPerTypeCommon; class MEDFileFieldPerMeshPerType; class MEDFileField1TSWithoutSDA; class MEDFileFieldNameScope; @@ -98,18 +141,18 @@ namespace MEDCoupling class MEDFileFieldPerMeshPerTypePerDisc : public RefCountObject, public MEDFileWritable { public: - static MEDFileFieldPerMeshPerTypePerDisc *NewOnRead(MEDFileFieldPerMeshPerType *fath, TypeOfField type, int profileIt, const PartDefinition *pd); - static MEDFileFieldPerMeshPerTypePerDisc *New(MEDFileFieldPerMeshPerType *fath, TypeOfField type, int locId); + static MEDFileFieldPerMeshPerTypePerDisc *NewOnRead(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int profileIt, const PartDefinition *pd); + static MEDFileFieldPerMeshPerTypePerDisc *New(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int locId); static MEDFileFieldPerMeshPerTypePerDisc *New(const MEDFileFieldPerMeshPerTypePerDisc& other); std::size_t getHeapMemorySizeWithoutChildren() const; std::vector getDirectChildrenWithNull() const; - MEDFileFieldPerMeshPerTypePerDisc *deepCopy(MEDFileFieldPerMeshPerType *father) const; + MEDFileFieldPerMeshPerTypePerDisc *deepCopy(MEDFileFieldPerMeshPerTypeCommon *father) const; void assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldDouble *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); void assignFieldProfile(bool isPflAlone, int& start, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, DataArrayInt *locIds, int nbOfEltsInWholeMesh, const MEDCouplingFieldDouble *field, const DataArray *arrr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); void assignNodeFieldNoProfile(int& start, const MEDCouplingFieldDouble *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob); void getCoarseData(TypeOfField& type, std::pair& dad, std::string& pfl, std::string& loc) const; void writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const; - const MEDFileFieldPerMeshPerType *getFather() const; + const MEDFileFieldPerMeshPerTypeCommon *getFather() const; void loadOnlyStructureOfDataRecursively(med_idt fid, int& start, const MEDFileFieldNameScope& nasc); void loadBigArray(med_idt fid, const MEDFileFieldNameScope& nasc); void setNewStart(int newValueOfStart); @@ -126,6 +169,8 @@ namespace MEDCoupling int getNumberOfTuples() const; int getStart() const { return _start; } int getEnd() const { return _end; } + void setEnd(int endd) { _end=endd; } + int getNumberOfVals() const { return _nval; } DataArray *getOrCreateAndGetArray(); const DataArray *getOrCreateAndGetArray() const; const std::vector& getInfo() const; @@ -135,7 +180,7 @@ namespace MEDCoupling void setLocalization(const std::string& newLocName); int getLocId() const { return _loc_id; } void setLocId(int newId) const { _loc_id=newId; } - void setFather(MEDFileFieldPerMeshPerType *newFather) { _father=newFather; } + void setFather(MEDFileFieldPerMeshPerTypeCommon *newFather) { _father=newFather; } void changePflsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif); void changeLocsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif); void getFieldAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair >& dads, std::vector& pfls, std::vector& locs, @@ -151,16 +196,18 @@ namespace MEDCoupling static MEDFileFieldPerMeshPerTypePerDisc *NewObjectOnSameDiscThanPool(TypeOfField typeF, INTERP_KERNEL::NormalizedCellType geoType, DataArrayInt *idsOfMeshElt, bool isPfl, int nbi, int offset, std::list< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc, MEDFileFieldGlobsReal& glob, bool ¬InExisting); + static MCAuto Aggregate(int &start, const std::vector >& pms, const std::vector< std::vector< std::pair > >& dts, TypeOfField tof, MEDFileFieldPerMeshPerType *father, std::vector > >& extractInfo); + MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type):_type(type),_father(fath),_start(-1),_end(-1),_nval(-1),_loc_id(-5),_profile_it(-1) { } private: - MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerType *fath, TypeOfField type, int profileIt, const PartDefinition *pd); - MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerType *fath, TypeOfField type, int profileIt, const std::string& dummy); + MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int profileIt, const PartDefinition *pd); + MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int profileIt, const std::string& dummy); MEDFileFieldPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc& other); MEDFileFieldPerMeshPerTypePerDisc(); private: 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); private: TypeOfField _type; - MEDFileFieldPerMeshPerType *_father; + MEDFileFieldPerMeshPerTypeCommon *_father; int _start; int _end; //! _nval is different than end-start in case of ON_GAUSS_PT and ON_GAUSS_NE ! (_nval=(_end-_start)/nbi) @@ -175,14 +222,11 @@ namespace MEDCoupling mutable int _tmp_work1; }; - class MEDFileFieldPerMeshPerType : public RefCountObject, public MEDFileWritable + class MEDFileFieldPerMeshPerTypeCommon : public RefCountObject, public MEDFileWritable { public: - static MEDFileFieldPerMeshPerType *New(MEDFileFieldPerMesh *fath, INTERP_KERNEL::NormalizedCellType geoType); - static MEDFileFieldPerMeshPerType *NewOnRead(med_idt fid, MEDFileFieldPerMesh *fath, TypeOfField type, INTERP_KERNEL::NormalizedCellType geoType, const MEDFileFieldNameScope& nasc, const PartDefinition *pd); std::size_t getHeapMemorySizeWithoutChildren() const; std::vector getDirectChildrenWithNull() const; - MEDFileFieldPerMeshPerType *deepCopy(MEDFileFieldPerMesh *father) const; void assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); void assignFieldProfile(bool isPflAlone, int& start, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, DataArrayInt *locIds, int nbOfEltsInWholeMesh, const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); void assignNodeFieldNoProfile(int& start, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob); @@ -191,18 +235,17 @@ namespace MEDCoupling void loadOnlyStructureOfDataRecursively(med_idt fid, int &start, const MEDFileFieldNameScope& nasc); void loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc); void writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const; - void getDimension(int& dim) const; + bool isUniqueLevel(int& dim) const; void fillTypesOfFieldAvailable(std::set& types) const; void fillFieldSplitedByType(std::vector< std::pair >& dads, std::vector& types, std::vector& pfls, std::vector& locs) const; int getIteration() const; int getOrder() const; double getTime() const; std::string getMeshName() const; - void simpleRepr(int bkOffset, std::ostream& oss, int id) const; void getSizes(int& globalSz, int& nbOfEntries) const; - INTERP_KERNEL::NormalizedCellType getGeoType() const; int getNumberOfComponents() const; bool presenceOfMultiDiscPerGeoType() const; + void pushDiscretization(MEDFileFieldPerMeshPerTypePerDisc *disc); DataArray *getOrCreateAndGetArray(); const DataArray *getOrCreateAndGetArray() const; const std::vector& getInfo() const; @@ -214,32 +257,83 @@ namespace MEDCoupling void changeLocsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif); MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenLocId(int locId); const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenLocId(int locId) const; - void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair >& dads, std::vector& pfls, std::vector& locs, std::vector& geoTypes) const; + int getNumberOfLoc() const { return _field_pm_pt_pd.size(); } void fillValues(int& startEntryId, std::vector< std::pair,std::pair > >& entries) const; void setLeaves(const std::vector< MCAuto< MEDFileFieldPerMeshPerTypePerDisc > >& leaves); bool keepOnlySpatialDiscretization(TypeOfField tof, int &globalNum, std::vector< std::pair >& its); bool keepOnlyGaussDiscretization(std::size_t idOfDisc, int &globalNum, std::vector< std::pair >& its); static med_entity_type ConvertIntoMEDFileType(TypeOfField ikType, INTERP_KERNEL::NormalizedCellType ikGeoType, med_geometry_type& medfGeoType); - private: + MEDFileFieldPerMeshPerTypeCommon(MEDFileFieldPerMesh *father):_father(father) { } + void setFather(MEDFileFieldPerMesh *father); + public: + virtual ~MEDFileFieldPerMeshPerTypeCommon(); + virtual void getDimension(int& dim) const = 0; + virtual INTERP_KERNEL::NormalizedCellType getGeoType() const = 0; + virtual void entriesForMEDfile(TypeOfField mct, med_geometry_type& gt, med_entity_type& ent) const = 0; + virtual void simpleRepr(int bkOffset, std::ostream& oss, int id) const = 0; + virtual std::string getGeoTypeRepr() const = 0; + virtual MEDFileFieldPerMeshPerTypeCommon *deepCopy(MEDFileFieldPerMesh *father) const = 0; + virtual void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair >& dads, std::vector& pfls, std::vector& locs, std::vector& geoTypes) const = 0; + protected: + void deepCopyElements(); std::vector addNewEntryIfNecessary(const MEDCouplingFieldDouble *field, int offset, int nbOfCells); std::vector addNewEntryIfNecessaryGauss(const MEDCouplingFieldDouble *field, int offset, int nbOfCells); std::vector addNewEntryIfNecessary(const MEDCouplingFieldDouble *field, const DataArrayInt *subCells); std::vector addNewEntryIfNecessaryGauss(const MEDCouplingFieldDouble *field, const DataArrayInt *subCells); - MEDFileFieldPerMeshPerType(med_idt fid, MEDFileFieldPerMesh *fath, TypeOfField type, INTERP_KERNEL::NormalizedCellType geoType, const MEDFileFieldNameScope& nasc, const PartDefinition *pd); - MEDFileFieldPerMeshPerType(MEDFileFieldPerMesh *fath, INTERP_KERNEL::NormalizedCellType geoType); private: MEDFileFieldPerMesh *_father; + protected: std::vector< MCAuto > _field_pm_pt_pd; + }; + + class MEDFileFieldPerMeshPerType : public MEDFileFieldPerMeshPerTypeCommon + { + public: + static MEDFileFieldPerMeshPerType *New(MEDFileFieldPerMesh *fath, INTERP_KERNEL::NormalizedCellType geoType); + static MEDFileFieldPerMeshPerType *NewOnRead(med_idt fid, MEDFileFieldPerMesh *fath, TypeOfField type, INTERP_KERNEL::NormalizedCellType geoType, const MEDFileFieldNameScope& nasc, const PartDefinition *pd); + static MCAuto Aggregate(int &start, const std::vector< std::pair >& pms, const std::vector< std::vector< std::pair > >& dts, INTERP_KERNEL::NormalizedCellType gt, MEDFileFieldPerMesh *father, std::vector > >& extractInfo); + public:// overload of abstract methods + void getDimension(int& dim) const; + INTERP_KERNEL::NormalizedCellType getGeoType() const; + void entriesForMEDfile(TypeOfField mct, med_geometry_type& gt, med_entity_type& ent) const; + void simpleRepr(int bkOffset, std::ostream& oss, int id) const; + std::string getGeoTypeRepr() const; + MEDFileFieldPerMeshPerType *deepCopy(MEDFileFieldPerMesh *father) const; + void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair >& dads, std::vector& pfls, std::vector& locs, std::vector& geoTypes) const; + private: + MEDFileFieldPerMeshPerType(med_idt fid, MEDFileFieldPerMesh *fath, TypeOfField type, INTERP_KERNEL::NormalizedCellType geoType, const MEDFileFieldNameScope& nasc, const PartDefinition *pd); + MEDFileFieldPerMeshPerType(MEDFileFieldPerMesh *father, INTERP_KERNEL::NormalizedCellType gt); + private: INTERP_KERNEL::NormalizedCellType _geo_type; }; + class MEDFileFieldPerMeshPerTypeDyn : public MEDFileFieldPerMeshPerTypeCommon + { + public: + static MEDFileFieldPerMeshPerTypeDyn *NewOnRead(med_idt fid, MEDFileFieldPerMesh *fath, const MEDFileEntities *entities, int idGT, const MEDFileFieldNameScope& nasc); + int getDynGT() const; + std::string getModelName() const; + public: + void getDimension(int& dim) const; + INTERP_KERNEL::NormalizedCellType getGeoType() const; + void entriesForMEDfile(TypeOfField mct, med_geometry_type& gt, med_entity_type& ent) const; + void simpleRepr(int bkOffset, std::ostream& oss, int id) const; + std::string getGeoTypeRepr() const; + MEDFileFieldPerMeshPerTypeDyn *deepCopy(MEDFileFieldPerMesh *father) const; + void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair >& dads, std::vector& pfls, std::vector& locs, std::vector& geoTypes) const; + private: + MEDFileFieldPerMeshPerTypeDyn(med_idt fid, MEDFileFieldPerMesh *fath, const MEDFileStructureElement *se, const MEDFileFieldNameScope& nasc); + private: + MCConstAuto _se; + }; + class MEDFileMesh; class MEDFileFieldPerMesh : public RefCountObject, public MEDFileWritable { public: static MEDFileFieldPerMesh *New(MEDFileAnyTypeField1TSWithoutSDA *fath, const MEDCouplingMesh *mesh); - static MEDFileFieldPerMesh *NewOnRead(med_idt fid, MEDFileAnyTypeField1TSWithoutSDA *fath, int meshCsit, int meshIteration, int meshOrder, const MEDFileFieldNameScope& nasc, const MEDFileMesh *mm, const std::vector< std::pair > *entities); + static MEDFileFieldPerMesh *NewOnRead(med_idt fid, MEDFileAnyTypeField1TSWithoutSDA *fath, int meshCsit, int meshIteration, int meshOrder, const MEDFileFieldNameScope& nasc, const MEDFileMesh *mm, const MEDFileEntities *entities); std::size_t getHeapMemorySizeWithoutChildren() const; std::vector getDirectChildrenWithNull() const; MEDFileFieldPerMesh *deepCopy(MEDFileAnyTypeField1TSWithoutSDA *father) const; @@ -255,6 +349,7 @@ namespace MEDCoupling void fillTypesOfFieldAvailable(std::set& types) const; std::vector< std::vector< std::pair > > getFieldSplitedByType(std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const; void getDimension(int& dim) const; + bool isUniqueLevel(int& dim) const; double getTime() const; int getIteration() const; int getOrder() const; @@ -263,6 +358,12 @@ namespace MEDCoupling std::string getMeshName() const { return _mesh_name; } int getNumberOfComponents() const; bool presenceOfMultiDiscPerGeoType() const; + bool presenceOfStructureElements() const; + bool onlyStructureElements() const; + void killStructureElements(); + void keepOnlyStructureElements(); + void keepOnlyOnSE(const std::string& seName); + void getMeshSENames(std::vector< std::pair >& ps) const; DataArray *getOrCreateAndGetArray(); const DataArray *getOrCreateAndGetArray() const; const std::vector& getInfo() const; @@ -270,6 +371,7 @@ namespace MEDCoupling std::vector getLocsReallyUsed() const; std::vector getPflsReallyUsedMulti() const; std::vector getLocsReallyUsedMulti() const; + void convertMedBallIntoClassic(); bool changeMeshNames(const std::vector< std::pair >& modifTab); bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob); void keepOnlySpatialDiscretization(TypeOfField tof, int &globalNum, std::vector< std::pair >& its); @@ -281,6 +383,7 @@ namespace MEDCoupling void getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const; MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, int locId); const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, int locId) const; + static MCAuto Aggregate(int &start, const std::vector& pms, const std::vector< std::vector< std::pair > >& dts, MEDFileAnyTypeField1TSWithoutSDA *father, std::vector > >& extractInfo); private: int addNewEntryIfNecessary(INTERP_KERNEL::NormalizedCellType type); MEDCouplingFieldDouble *finishField(TypeOfField type, const MEDFileFieldGlobsReal *glob, @@ -298,14 +401,15 @@ namespace MEDCoupling const std::vector& geoTypes, const std::vector< std::pair >& dads, const std::vector& pfls, const std::vector& locs, std::vector& code, std::vector& notNullPfls); static int ComputeNbOfElems(const MEDFileFieldGlobsReal *glob, TypeOfField type, const std::vector& geoTypes, const std::vector< std::pair >& dads, const std::vector& locs); - MEDFileFieldPerMesh(med_idt fid, MEDFileAnyTypeField1TSWithoutSDA *fath, int meshCsit, int meshIteration, int meshOrder, const MEDFileFieldNameScope& nasc, const MEDFileMesh *mm, const std::vector< std::pair > *entities); + MEDFileFieldPerMesh(med_idt fid, MEDFileAnyTypeField1TSWithoutSDA *fath, int meshCsit, int meshIteration, int meshOrder, const MEDFileFieldNameScope& nasc, const MEDFileMesh *mm, const MEDFileEntities *entities); MEDFileFieldPerMesh(MEDFileAnyTypeField1TSWithoutSDA *fath, const MEDCouplingMesh *mesh); + MEDFileFieldPerMesh(MEDFileAnyTypeField1TSWithoutSDA *fath, const std::string& meshName, int meshIt, int meshOrd):_father(fath),_mesh_name(meshName),_mesh_iteration(meshIt),_mesh_order(meshOrd) { } private: std::string _mesh_name; int _mesh_iteration; int _mesh_order; MEDFileAnyTypeField1TSWithoutSDA *_father; - std::vector< MCAuto< MEDFileFieldPerMeshPerType > > _field_pm_pt; + std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > > _field_pm_pt; }; class MEDFileFieldGlobsReal; @@ -313,7 +417,7 @@ namespace MEDCoupling class MEDFileFieldGlobs : public RefCountObject { public: - static MEDFileFieldGlobs *New(const std::string& fname); + static MEDFileFieldGlobs *New(med_idt fid); static MEDFileFieldGlobs *New(); std::size_t getHeapMemorySizeWithoutChildren() const; std::vector getDirectChildrenWithNull() const; @@ -327,7 +431,7 @@ namespace MEDCoupling void loadProfileInFile(med_idt fid, int id, const std::string& pflName); void loadProfileInFile(med_idt fid, int id); void loadGlobals(med_idt fid, const MEDFileFieldGlobsReal& real); - void loadAllGlobals(med_idt fid); + void loadAllGlobals(med_idt fid, const MEDFileEntities *entities); void writeGlobals(med_idt fid, const MEDFileWritable& opt) const; std::vector getPfls() const; std::vector getLocs() const; @@ -337,7 +441,7 @@ namespace MEDCoupling std::string createNewNameOfLoc() const; std::vector< std::vector > whichAreEqualProfiles() const; std::vector< std::vector > whichAreEqualLocs(double eps) const; - void setFileName(const std::string& fileName); + void setFileName(const std::string& fileName) { _file_name=fileName; } void changePflsNamesInStruct(const std::vector< std::pair, std::string > >& mapOfModif); void changeLocsNamesInStruct(const std::vector< std::pair, std::string > >& mapOfModif); int getNbOfGaussPtPerCell(int locId) const; @@ -359,7 +463,7 @@ namespace MEDCoupling // static std::string CreateNewNameNotIn(const std::string& prefix, const std::vector& namesToAvoid); protected: - MEDFileFieldGlobs(const std::string& fname); + MEDFileFieldGlobs(med_idt fid); MEDFileFieldGlobs(); ~MEDFileFieldGlobs(); protected: @@ -373,7 +477,7 @@ namespace MEDCoupling class MEDFileFieldGlobsReal { public: - MEDLOADER_EXPORT MEDFileFieldGlobsReal(const std::string& fname); + MEDLOADER_EXPORT MEDFileFieldGlobsReal(med_idt fid); MEDLOADER_EXPORT MEDFileFieldGlobsReal(); MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; @@ -398,7 +502,7 @@ namespace MEDCoupling MEDLOADER_EXPORT void loadProfileInFile(med_idt fid, int id, const std::string& pflName); MEDLOADER_EXPORT void loadProfileInFile(med_idt fid, int id); MEDLOADER_EXPORT void loadGlobals(med_idt fid); - MEDLOADER_EXPORT void loadAllGlobals(med_idt fid); + MEDLOADER_EXPORT void loadAllGlobals(med_idt fid, const MEDFileEntities *entities=0); MEDLOADER_EXPORT void writeGlobals(med_idt fid, const MEDFileWritable& opt) const; MEDLOADER_EXPORT std::vector getPfls() const; MEDLOADER_EXPORT std::vector getLocs() const; @@ -489,6 +593,8 @@ namespace MEDCoupling MEDLOADER_EXPORT void changeLocsRefsNamesGen2(const std::vector< std::pair, std::string > >& mapOfModif); // MEDLOADER_EXPORT int getNonEmptyLevels(const std::string& mname, std::vector& levs) const; + MEDLOADER_EXPORT void convertMedBallIntoClassic(); + MEDLOADER_EXPORT void makeReduction(INTERP_KERNEL::NormalizedCellType ct, TypeOfField tof, const DataArrayInt *pfl); MEDLOADER_EXPORT std::vector< std::vector > > getFieldSplitedByType(const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const; // MEDLOADER_EXPORT MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId); @@ -499,6 +605,12 @@ namespace MEDCoupling MEDLOADER_EXPORT const std::vector& getInfo() const; MEDLOADER_EXPORT std::vector& getInfo(); MEDLOADER_EXPORT bool presenceOfMultiDiscPerGeoType() const; + MEDLOADER_EXPORT bool presenceOfStructureElements() const; + MEDLOADER_EXPORT bool onlyStructureElements() const; + MEDLOADER_EXPORT void killStructureElements(); + MEDLOADER_EXPORT void keepOnlyStructureElements(); + MEDLOADER_EXPORT void keepOnlyOnSE(const std::string& seName); + MEDLOADER_EXPORT void getMeshSENames(std::vector< std::pair >& ps) const; MEDLOADER_EXPORT void setInfo(const std::vector& infos); MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; @@ -517,6 +629,7 @@ namespace MEDCoupling MEDLOADER_EXPORT virtual DataArray *getOrCreateAndGetArray() = 0; MEDLOADER_EXPORT virtual const DataArray *getOrCreateAndGetArray() const = 0; public: + MEDLOADER_EXPORT MEDCouplingFieldDouble *fieldOnMesh(const MEDFileFieldGlobsReal *glob, const MEDFileMesh *mesh, MCAuto& arrOut, const MEDFileFieldNameScope& nasc) const; MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, const std::string& mName, int renumPol, const MEDFileFieldGlobsReal *glob, MCAuto &arrOut, const MEDFileFieldNameScope& nasc) const; MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDFileMesh *mesh, MCAuto &arrOut, const MEDFileFieldNameScope& nasc) const; MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, const std::string& mName, int renumPol, const MEDFileFieldGlobsReal *glob, MCAuto &arrOut, const MEDFileFieldNameScope& nasc) const; @@ -531,10 +644,10 @@ namespace MEDCoupling public: MEDLOADER_EXPORT void allocNotFromFile(int newNbOfTuples); MEDLOADER_EXPORT bool allocIfNecessaryTheArrayToReceiveDataFromFile(); - MEDLOADER_EXPORT void loadOnlyStructureOfDataRecursively(med_idt fid, const MEDFileFieldNameScope& nasc, const MEDFileMeshes *ms, const std::vector< std::pair > *entities); + MEDLOADER_EXPORT void loadOnlyStructureOfDataRecursively(med_idt fid, const MEDFileFieldNameScope& nasc, const MEDFileMeshes *ms, const MEDFileEntities *entities); MEDLOADER_EXPORT void loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc); MEDLOADER_EXPORT void loadBigArraysRecursivelyIfNecessary(med_idt fid, const MEDFileFieldNameScope& nasc); - MEDLOADER_EXPORT void loadStructureAndBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc, const MEDFileMeshes *ms, const std::vector< std::pair > *entities); + MEDLOADER_EXPORT void loadStructureAndBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc, const MEDFileMeshes *ms, const MEDFileEntities *entities); MEDLOADER_EXPORT void unloadArrays(); MEDLOADER_EXPORT void writeLL(med_idt fid, const MEDFileWritable& opts, const MEDFileFieldNameScope& nasc) const; protected: @@ -558,16 +671,34 @@ namespace MEDCoupling class MEDFileIntField1TSWithoutSDA; + template + class MEDFileField1TSTemplateWithoutSDA : public MEDFileAnyTypeField1TSWithoutSDA + { + protected: + MEDFileField1TSTemplateWithoutSDA(const std::string& fieldName, int csit, int iteration, int order):MEDFileAnyTypeField1TSWithoutSDA(fieldName,csit,iteration,order) { } + MEDFileField1TSTemplateWithoutSDA():MEDFileAnyTypeField1TSWithoutSDA() { } + public: + MEDLOADER_EXPORT void setArray(DataArray *arr); + MEDLOADER_EXPORT DataArray *createNewEmptyDataArrayInstance() const; + MEDLOADER_EXPORT typename Traits::ArrayType *getOrCreateAndGetArrayTemplate(); + MEDLOADER_EXPORT typename Traits::ArrayType const *getOrCreateAndGetArrayTemplate() const; + MEDLOADER_EXPORT typename Traits::ArrayType *getUndergroundDataArrayTemplate() const; + MEDLOADER_EXPORT DataArray *getOrCreateAndGetArray(); + MEDLOADER_EXPORT const DataArray *getOrCreateAndGetArray() const; + MEDLOADER_EXPORT DataArray *getUndergroundDataArray() const; + MEDLOADER_EXPORT void aggregate(const typename std::vector< typename MLFieldTraits::F1TSWSDAType const * >& f1tss, const std::vector< std::vector< std::pair > >& dts); + protected: + MCAuto< typename Traits::ArrayType > _arr; + }; + /*! * SDA is for Shared Data Arrays such as profiles. */ - class MEDFileField1TSWithoutSDA : public MEDFileAnyTypeField1TSWithoutSDA + class MEDFileField1TSWithoutSDA : public MEDFileField1TSTemplateWithoutSDA { public: MEDLOADER_EXPORT const char *getTypeStr() const; - MEDLOADER_EXPORT DataArray *getUndergroundDataArray() const; MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const; - MEDLOADER_EXPORT DataArrayDouble *getUndergroundDataArrayDouble() const; MEDLOADER_EXPORT DataArrayDouble *getUndergroundDataArrayDoubleExt(std::vector< std::pair,std::pair > >& entries) const; MEDLOADER_EXPORT std::vector< std::vector > getFieldSplitedByType2(const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const; MEDLOADER_EXPORT static void CheckMeshDimRel(int meshDimRelToMax); @@ -576,17 +707,9 @@ namespace MEDCoupling public: MEDLOADER_EXPORT MEDFileField1TSWithoutSDA(); MEDLOADER_EXPORT MEDFileField1TSWithoutSDA(const std::string& fieldName, int csit, int iteration, int order, const std::vector& infos); - MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA *shallowCpy() const; - MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA *deepCopy() const; - MEDLOADER_EXPORT void setArray(DataArray *arr); - MEDLOADER_EXPORT DataArray *createNewEmptyDataArrayInstance() const; - MEDLOADER_EXPORT DataArray *getOrCreateAndGetArray(); - MEDLOADER_EXPORT const DataArray *getOrCreateAndGetArray() const; - MEDLOADER_EXPORT DataArrayDouble *getOrCreateAndGetArrayDouble(); - MEDLOADER_EXPORT const DataArrayDouble *getOrCreateAndGetArrayDouble() const; + MEDLOADER_EXPORT MEDFileField1TSWithoutSDA *shallowCpy() const; + MEDLOADER_EXPORT MEDFileField1TSWithoutSDA *deepCopy() const; MEDLOADER_EXPORT MEDFileIntField1TSWithoutSDA *convertToInt() const; - protected: - MCAuto< DataArrayDouble > _arr; public: static const char TYPE_STR[]; }; @@ -594,29 +717,19 @@ namespace MEDCoupling /*! * SDA is for Shared Data Arrays such as profiles. */ - class MEDFileIntField1TSWithoutSDA : public MEDFileAnyTypeField1TSWithoutSDA + class MEDFileIntField1TSWithoutSDA : public MEDFileField1TSTemplateWithoutSDA { public: MEDLOADER_EXPORT MEDFileIntField1TSWithoutSDA(); MEDLOADER_EXPORT static MEDFileIntField1TSWithoutSDA *New(const std::string& fieldName, int csit, int iteration, int order, const std::vector& infos); - MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA *deepCopy() const; - MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA *shallowCpy() const; + MEDLOADER_EXPORT MEDFileIntField1TSWithoutSDA *deepCopy() const; + MEDLOADER_EXPORT MEDFileIntField1TSWithoutSDA *shallowCpy() const; MEDLOADER_EXPORT const char *getTypeStr() const; - MEDLOADER_EXPORT DataArray *getUndergroundDataArray() const; MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const; - MEDLOADER_EXPORT void setArray(DataArray *arr); - MEDLOADER_EXPORT DataArray *createNewEmptyDataArrayInstance() const; - MEDLOADER_EXPORT DataArray *getOrCreateAndGetArray(); - MEDLOADER_EXPORT const DataArray *getOrCreateAndGetArray() const; - MEDLOADER_EXPORT DataArrayInt *getOrCreateAndGetArrayInt(); - MEDLOADER_EXPORT const DataArrayInt *getOrCreateAndGetArrayInt() const; - MEDLOADER_EXPORT DataArrayInt *getUndergroundDataArrayInt() const; MEDLOADER_EXPORT DataArrayInt *getUndergroundDataArrayIntExt(std::vector< std::pair,std::pair > >& entries) const; MEDLOADER_EXPORT MEDFileField1TSWithoutSDA *convertToDouble() const; protected: MEDFileIntField1TSWithoutSDA(const std::string& fieldName, int csit, int iteration, int order, const std::vector& infos); - protected: - MCAuto< DataArrayInt > _arr; public: MEDLOADER_EXPORT static const char TYPE_STR[]; }; @@ -624,24 +737,28 @@ namespace MEDCoupling /*! * User class. */ - class MEDFileAnyTypeField1TS : public RefCountObject, public MEDFileWritable, public MEDFileFieldGlobsReal + class MEDFileAnyTypeField1TS : public RefCountObject, public MEDFileWritableStandAlone, public MEDFileFieldGlobsReal { protected: MEDLOADER_EXPORT MEDFileAnyTypeField1TS(); - MEDLOADER_EXPORT MEDFileAnyTypeField1TS(const std::string& fileName, bool loadAll, const MEDFileMeshes *ms); - MEDLOADER_EXPORT MEDFileAnyTypeField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms); - MEDLOADER_EXPORT MEDFileAnyTypeField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileMeshes *ms); + MEDLOADER_EXPORT MEDFileAnyTypeField1TS(med_idt fid, bool loadAll, const MEDFileMeshes *ms); + MEDLOADER_EXPORT MEDFileAnyTypeField1TS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms); + MEDLOADER_EXPORT MEDFileAnyTypeField1TS(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileMeshes *ms); MEDLOADER_EXPORT MEDFileAnyTypeField1TS(const MEDFileAnyTypeField1TSWithoutSDA& other, bool shallowCopyOfContent); - MEDLOADER_EXPORT static MEDFileAnyTypeField1TS *BuildNewInstanceFromContent(MEDFileAnyTypeField1TSWithoutSDA *c, const std::string& fileName); - MEDLOADER_EXPORT static MEDFileAnyTypeField1TSWithoutSDA *BuildContentFrom(med_idt fid, const std::string& fileName, bool loadAll, const MEDFileMeshes *ms); - MEDLOADER_EXPORT static MEDFileAnyTypeField1TSWithoutSDA *BuildContentFrom(med_idt fid, const std::string& fileName, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms); - MEDLOADER_EXPORT static MEDFileAnyTypeField1TSWithoutSDA *BuildContentFrom(med_idt fid, const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileMeshes *ms); + MEDLOADER_EXPORT static MEDFileAnyTypeField1TS *BuildNewInstanceFromContent(MEDFileAnyTypeField1TSWithoutSDA *c); + MEDLOADER_EXPORT static MEDFileAnyTypeField1TS *BuildNewInstanceFromContent(MEDFileAnyTypeField1TSWithoutSDA *c, med_idt fid); + MEDLOADER_EXPORT static MEDFileAnyTypeField1TSWithoutSDA *BuildContentFrom(med_idt fid, bool loadAll, const MEDFileMeshes *ms); + MEDLOADER_EXPORT static MEDFileAnyTypeField1TSWithoutSDA *BuildContentFrom(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms); + MEDLOADER_EXPORT static MEDFileAnyTypeField1TSWithoutSDA *BuildContentFrom(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileMeshes *ms); MEDLOADER_EXPORT void writeLL(med_idt fid) const; // direct forwarding to MEDFileAnyTypeField1TSWithoutSDA instance _content public: MEDLOADER_EXPORT static MEDFileAnyTypeField1TS *New(const std::string& fileName, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileAnyTypeField1TS *New(med_idt fid, bool loadAll=true); MEDLOADER_EXPORT static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileAnyTypeField1TS *New(med_idt fid, const std::string& fieldName, bool loadAll=true); MEDLOADER_EXPORT static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileAnyTypeField1TS *New(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll=true); MEDLOADER_EXPORT int getDimension() const; MEDLOADER_EXPORT int getIteration() const; MEDLOADER_EXPORT int getOrder() const; @@ -673,8 +790,9 @@ namespace MEDCoupling MEDLOADER_EXPORT MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId); MEDLOADER_EXPORT const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const; MEDLOADER_EXPORT int getNonEmptyLevels(const std::string& mname, std::vector& levs) const; + MEDLOADER_EXPORT void convertMedBallIntoClassic(); + MEDLOADER_EXPORT void makeReduction(INTERP_KERNEL::NormalizedCellType ct, TypeOfField tof, const DataArrayInt *pfl); public: - MEDLOADER_EXPORT void write(const std::string& fileName, int mode) const; MEDLOADER_EXPORT void loadArrays(); MEDLOADER_EXPORT void loadArraysIfNecessary(); MEDLOADER_EXPORT void unloadArrays(); @@ -699,8 +817,8 @@ namespace MEDCoupling MEDLOADER_EXPORT void changePflsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif); MEDLOADER_EXPORT void changeLocsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif); public: - MEDLOADER_EXPORT static int LocateField2(med_idt fid, const std::string& fileName, int fieldIdCFormat, bool checkFieldId, std::string& fieldName, med_field_type& typcha, std::vector& infos, std::string& dtunitOut); - MEDLOADER_EXPORT static int LocateField(med_idt fid, const std::string& fileName, const std::string& fieldName, int& posCFormat, med_field_type& typcha, std::vector& infos, std::string& dtunitOut); + MEDLOADER_EXPORT static int LocateField2(med_idt fid, int fieldIdCFormat, bool checkFieldId, std::string& fieldName, med_field_type& typcha, std::vector& infos, std::string& dtunitOut); + MEDLOADER_EXPORT static int LocateField(med_idt fid, const std::string& fieldName, int& posCFormat, med_field_type& typcha, std::vector& infos, std::string& dtunitOut); public: MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TS *extractPart(const std::map >& extractDef, MEDFileMesh *mm) const = 0; public: @@ -720,12 +838,17 @@ namespace MEDCoupling { public: MEDLOADER_EXPORT static MEDFileField1TS *New(const std::string& fileName, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileField1TS *New(med_idt fid, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileField1TS *New(DataArrayByte *db) { return BuildFromMemoryChunk(db); } MEDLOADER_EXPORT static MEDFileField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileField1TS *New(med_idt fid, const std::string& fieldName, bool loadAll=true); MEDLOADER_EXPORT static MEDFileField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileField1TS *New(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll=true); MEDLOADER_EXPORT static MEDFileField1TS *New(const MEDFileField1TSWithoutSDA& other, bool shallowCopyOfContent); MEDLOADER_EXPORT static MEDFileField1TS *New(); MEDLOADER_EXPORT MEDFileIntField1TS *convertToInt(bool isDeepCpyGlobs=true) const; // + MEDLOADER_EXPORT MEDCouplingFieldDouble *field(const MEDFileMesh *mesh) const; MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const; MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const; MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const; @@ -737,7 +860,7 @@ namespace MEDCoupling MEDLOADER_EXPORT void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile); // direct forwarding to MEDFileField1TSWithoutSDA instance _content public: - MEDLOADER_EXPORT MEDFileAnyTypeField1TS *shallowCpy() const; + MEDLOADER_EXPORT MEDFileField1TS *shallowCpy() const; MEDLOADER_EXPORT DataArrayDouble *getUndergroundDataArray() const; MEDLOADER_EXPORT DataArrayDouble *getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const; @@ -754,9 +877,9 @@ namespace MEDCoupling MEDFileField1TSWithoutSDA *contentNotNull(); private: ~MEDFileField1TS() { } - MEDFileField1TS(const std::string& fileName, bool loadAll, const MEDFileMeshes *ms); - MEDFileField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms); - MEDFileField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileMeshes *ms); + MEDFileField1TS(med_idt fid, bool loadAll, const MEDFileMeshes *ms); + MEDFileField1TS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms); + MEDFileField1TS(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileMeshes *ms); MEDFileField1TS(const MEDFileField1TSWithoutSDA& other, bool shallowCopyOfContent); MEDFileField1TS(); }; @@ -766,24 +889,31 @@ namespace MEDCoupling public: MEDLOADER_EXPORT static MEDFileIntField1TS *New(); MEDLOADER_EXPORT static MEDFileIntField1TS *New(const std::string& fileName, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileIntField1TS *New(med_idt fid, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileIntField1TS *New(DataArrayByte *db) { return BuildFromMemoryChunk(db); } MEDLOADER_EXPORT static MEDFileIntField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileIntField1TS *New(med_idt fid, const std::string& fieldName, bool loadAll=true); MEDLOADER_EXPORT static MEDFileIntField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileIntField1TS *New(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll=true); MEDLOADER_EXPORT static MEDFileIntField1TS *New(const MEDFileIntField1TSWithoutSDA& other, bool shallowCopyOfContent); MEDLOADER_EXPORT MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const; - MEDLOADER_EXPORT MEDFileAnyTypeField1TS *shallowCpy() const; + MEDLOADER_EXPORT MEDFileIntField1TS *shallowCpy() const; // - MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, DataArrayInt* &arrOut, int renumPol=0) const; - MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, DataArrayInt* &arrOut, int renumPol=0) const; - MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt* &arrOut, int renumPol=0) const; - MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, DataArrayInt* &arrOut, int renumPol=0) const; - MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, DataArrayInt* &arrOut, int renumPol=0) const; + MEDLOADER_EXPORT MEDCouplingFieldInt *field(const MEDFileMesh *mesh) const; + MEDLOADER_EXPORT MEDCouplingFieldInt *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const; + MEDLOADER_EXPORT MEDCouplingFieldInt *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const; + MEDLOADER_EXPORT MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const; + MEDLOADER_EXPORT MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const; + MEDLOADER_EXPORT MEDCouplingFieldInt *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const; MEDLOADER_EXPORT DataArrayInt *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const; // - MEDLOADER_EXPORT void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals); - MEDLOADER_EXPORT void setFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile); + MEDLOADER_EXPORT void setFieldNoProfileSBT(const MEDCouplingFieldInt *field); + MEDLOADER_EXPORT void setFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile); MEDLOADER_EXPORT DataArrayInt *getUndergroundDataArray() const; public: MEDLOADER_EXPORT static DataArrayInt *ReturnSafelyDataArrayInt(MCAuto& arr); + MEDLOADER_EXPORT static MCAuto SetDataArrayDoubleInIntField(MEDCouplingFieldDouble *f, MCAuto& arr); + MEDLOADER_EXPORT static MCAuto ConvertFieldIntToFieldDouble(const MEDCouplingFieldInt *f); public: MEDLOADER_EXPORT MEDFileIntField1TS *extractPart(const std::map >& extractDef, MEDFileMesh *mm) const; private: @@ -793,9 +923,9 @@ namespace MEDCoupling private: ~MEDFileIntField1TS() { } MEDFileIntField1TS(); - MEDFileIntField1TS(const std::string& fileName, bool loadAll, const MEDFileMeshes *ms); - MEDFileIntField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms); - MEDFileIntField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileMeshes *ms); + MEDFileIntField1TS(med_idt fid, bool loadAll, const MEDFileMeshes *ms); + MEDFileIntField1TS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms); + MEDFileIntField1TS(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileMeshes *ms); MEDFileIntField1TS(const MEDFileIntField1TSWithoutSDA& other, bool shallowCopyOfContent); }; @@ -804,8 +934,8 @@ namespace MEDCoupling protected: MEDFileAnyTypeFieldMultiTSWithoutSDA(); MEDFileAnyTypeFieldMultiTSWithoutSDA(const std::string& fieldName); - MEDFileAnyTypeFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const std::vector< std::pair > *entities); - MEDFileAnyTypeFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const std::vector< std::pair > *entities); + MEDFileAnyTypeFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities); + MEDFileAnyTypeFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities); public: MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; @@ -835,6 +965,12 @@ namespace MEDCoupling MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *buildFromTimeStepIds2(int bg, int end, int step) const; MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *partOfThisLyingOnSpecifiedTimeSteps(const std::vector< std::pair >& timeSteps) const; MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *partOfThisNotLyingOnSpecifiedTimeSteps(const std::vector< std::pair >& timeSteps) const; + MEDLOADER_EXPORT bool presenceOfStructureElements() const; + MEDLOADER_EXPORT bool onlyStructureElements() const; + MEDLOADER_EXPORT void killStructureElements(); + MEDLOADER_EXPORT void keepOnlyStructureElements(); + MEDLOADER_EXPORT void keepOnlyOnSE(const std::string& seName); + MEDLOADER_EXPORT void getMeshSENames(std::vector< std::pair >& ps) const; MEDLOADER_EXPORT int getPosOfTimeStep(int iteration, int order) const; MEDLOADER_EXPORT int getPosGivenTime(double time, double eps=1e-8) const; MEDLOADER_EXPORT std::vector< std::pair > getIterations() const; @@ -850,7 +986,7 @@ namespace MEDCoupling MEDLOADER_EXPORT DataArray *getUndergroundDataArray(int iteration, int order) const; MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair,std::pair > >& entries) const; MEDLOADER_EXPORT bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob); - MEDLOADER_EXPORT void loadStructureOrStructureAndBigArraysRecursively(med_idt fid, int nbPdt, med_field_type fieldTyp, bool loadAll, const MEDFileMeshes *ms, const std::vector< std::pair > *entities); + MEDLOADER_EXPORT void loadStructureOrStructureAndBigArraysRecursively(med_idt fid, int nbPdt, med_field_type fieldTyp, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities); MEDLOADER_EXPORT void writeLL(med_idt fid, const MEDFileWritable& opts) const; MEDLOADER_EXPORT void loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc); MEDLOADER_EXPORT void loadBigArraysRecursivelyIfNecessary(med_idt fid, const MEDFileFieldNameScope& nasc); @@ -881,8 +1017,8 @@ namespace MEDCoupling class MEDFileFieldMultiTSWithoutSDA : public MEDFileAnyTypeFieldMultiTSWithoutSDA { public: - MEDLOADER_EXPORT static MEDFileFieldMultiTSWithoutSDA *New(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const std::vector< std::pair > *entities); - MEDLOADER_EXPORT MEDFileFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const std::vector< std::pair > *entities); + MEDLOADER_EXPORT static MEDFileFieldMultiTSWithoutSDA *New(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities); + MEDLOADER_EXPORT MEDFileFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities); MEDLOADER_EXPORT const char *getTypeStr() const; MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const; MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *createNew() const; @@ -890,7 +1026,7 @@ namespace MEDCoupling MEDLOADER_EXPORT MEDFileIntFieldMultiTSWithoutSDA *convertToInt() const; protected: MEDFileFieldMultiTSWithoutSDA(const std::string& fieldName); - MEDFileFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const std::vector< std::pair > *entities); + MEDFileFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities); med_field_type getMEDFileFieldType() const { return MED_FLOAT64; } MEDFileAnyTypeField1TSWithoutSDA *createNew1TSWithoutSDAEmptyInstance() const; void checkCoherencyOfType(const MEDFileAnyTypeField1TSWithoutSDA *f1ts) const; @@ -901,15 +1037,15 @@ namespace MEDCoupling class MEDFileIntFieldMultiTSWithoutSDA : public MEDFileAnyTypeFieldMultiTSWithoutSDA { public: - MEDLOADER_EXPORT static MEDFileIntFieldMultiTSWithoutSDA *New(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const std::vector< std::pair > *entities); - MEDLOADER_EXPORT MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const std::vector< std::pair > *entities); + MEDLOADER_EXPORT static MEDFileIntFieldMultiTSWithoutSDA *New(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities); + MEDLOADER_EXPORT MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities); MEDLOADER_EXPORT const char *getTypeStr() const; MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const; MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *createNew() const; MEDLOADER_EXPORT MEDFileFieldMultiTSWithoutSDA *convertToDouble() const; protected: MEDFileIntFieldMultiTSWithoutSDA(const std::string& fieldName); - MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const std::vector< std::pair > *entities); + MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities); med_field_type getMEDFileFieldType() const { return MED_INT32; } MEDFileAnyTypeField1TSWithoutSDA *createNew1TSWithoutSDAEmptyInstance() const; void checkCoherencyOfType(const MEDFileAnyTypeField1TSWithoutSDA *f1ts) const; @@ -922,24 +1058,26 @@ namespace MEDCoupling /*! * User class. */ - class MEDFileAnyTypeFieldMultiTS : public RefCountObject, public MEDFileWritable, public MEDFileFieldGlobsReal + class MEDFileAnyTypeFieldMultiTS : public RefCountObject, public MEDFileWritableStandAlone, public MEDFileFieldGlobsReal { protected: MEDFileAnyTypeFieldMultiTS(); - MEDFileAnyTypeFieldMultiTS(const std::string& fileName, bool loadAll, const MEDFileMeshes *ms); - MEDFileAnyTypeFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const std::vector< std::pair > *entities=0); + MEDFileAnyTypeFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms); + MEDFileAnyTypeFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=0); MEDFileAnyTypeFieldMultiTS(const MEDFileAnyTypeFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent); - static MEDFileAnyTypeFieldMultiTS *BuildNewInstanceFromContent(MEDFileAnyTypeFieldMultiTSWithoutSDA *c, const std::string& fileName); - static MEDFileAnyTypeFieldMultiTSWithoutSDA *BuildContentFrom(med_idt fid, const std::string& fileName, bool loadAll, const MEDFileMeshes *ms); - static MEDFileAnyTypeFieldMultiTSWithoutSDA *BuildContentFrom(med_idt fid, const std::string& fileName, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const std::vector< std::pair > *entities); + static MEDFileAnyTypeFieldMultiTS *BuildNewInstanceFromContent(MEDFileAnyTypeFieldMultiTSWithoutSDA *c); + static MEDFileAnyTypeFieldMultiTS *BuildNewInstanceFromContent(MEDFileAnyTypeFieldMultiTSWithoutSDA *c, med_idt fid); + static MEDFileAnyTypeFieldMultiTSWithoutSDA *BuildContentFrom(med_idt fid, bool loadAll, const MEDFileMeshes *ms); + static MEDFileAnyTypeFieldMultiTSWithoutSDA *BuildContentFrom(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities); public: MEDLOADER_EXPORT static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileAnyTypeFieldMultiTS *New(med_idt fid, bool loadAll=true); MEDLOADER_EXPORT static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileAnyTypeFieldMultiTS *New(med_idt fid, const std::string& fieldName, bool loadAll=true); MEDLOADER_EXPORT void loadArrays(); MEDLOADER_EXPORT void loadArraysIfNecessary(); MEDLOADER_EXPORT void unloadArrays(); MEDLOADER_EXPORT void unloadArraysWithoutDataLoss(); - MEDLOADER_EXPORT void write(const std::string& fileName, int mode) const; MEDLOADER_EXPORT void writeLL(med_idt fid) const; MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; @@ -992,6 +1130,7 @@ namespace MEDCoupling public: MEDLOADER_EXPORT virtual MEDFileAnyTypeFieldMultiTS *buildNewEmpty() const = 0; MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *extractPart(const std::map >& extractDef, MEDFileMesh *mm) const; + MEDLOADER_EXPORT static MCAuto Aggregate(const std::vector& fmtss, const std::vector< std::vector< std::pair > >& dts); public: MEDLOADER_EXPORT std::vector getPflsReallyUsed() const; MEDLOADER_EXPORT std::vector getLocsReallyUsed() const; @@ -1018,7 +1157,10 @@ namespace MEDCoupling public: MEDLOADER_EXPORT static MEDFileFieldMultiTS *New(); MEDLOADER_EXPORT static MEDFileFieldMultiTS *New(const std::string& fileName, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileFieldMultiTS *New(med_idt fid, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileFieldMultiTS *New(DataArrayByte *db) { return BuildFromMemoryChunk(db); } MEDLOADER_EXPORT static MEDFileFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileFieldMultiTS *New(med_idt fid, const std::string& fieldName, bool loadAll=true); MEDLOADER_EXPORT static MEDFileFieldMultiTS *New(const MEDFileFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent); MEDLOADER_EXPORT static MEDFileFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, const std::vector< std::pair >& entities, bool loadAll=true); MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *shallowCpy() const; @@ -1029,6 +1171,7 @@ namespace MEDCoupling MEDLOADER_EXPORT MEDFileAnyTypeField1TS *getTimeStep(int iteration, int order) const; MEDLOADER_EXPORT MEDFileAnyTypeField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const; // + MEDLOADER_EXPORT MEDCouplingFieldDouble *field(int iteration, int order, const MEDFileMesh *mesh) const; MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const; MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const; MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const; @@ -1050,8 +1193,8 @@ namespace MEDCoupling ~MEDFileFieldMultiTS() { } MEDFileFieldMultiTS(); MEDFileFieldMultiTS(const MEDFileFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent); - MEDFileFieldMultiTS(const std::string& fileName, bool loadAll, const MEDFileMeshes *ms); - MEDFileFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const std::vector< std::pair > *entities=0); + MEDFileFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms); + MEDFileFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=0); }; /*! @@ -1062,23 +1205,27 @@ namespace MEDCoupling public: MEDLOADER_EXPORT static MEDFileIntFieldMultiTS *New(); MEDLOADER_EXPORT static MEDFileIntFieldMultiTS *New(const std::string& fileName, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileIntFieldMultiTS *New(med_idt fid, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileIntFieldMultiTS *New(DataArrayByte *db) { return BuildFromMemoryChunk(db); } MEDLOADER_EXPORT static MEDFileIntFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileIntFieldMultiTS *New(med_idt fid, const std::string& fieldName, bool loadAll=true); MEDLOADER_EXPORT static MEDFileIntFieldMultiTS *New(const MEDFileIntFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent); MEDLOADER_EXPORT static MEDFileIntFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, const std::vector< std::pair >& entities, bool loadAll=true); MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *shallowCpy() const; MEDLOADER_EXPORT void checkCoherencyOfType(const MEDFileAnyTypeField1TS *f1ts) const; - MEDLOADER_EXPORT MEDFileAnyTypeField1TS *getTimeStepAtPos(int pos) const; + MEDLOADER_EXPORT MEDFileIntField1TS *getTimeStepAtPos(int pos) const; MEDLOADER_EXPORT MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const; // - MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, DataArrayInt* &arrOut, int renumPol=0) const; - MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, DataArrayInt* &arrOut, int renumPol=0) const; - MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt* &arrOut, int renumPol=0) const; - MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, DataArrayInt* &arrOut, int renumPol=0) const; - MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, DataArrayInt* &arrOut, int renumPol=0) const; + MEDLOADER_EXPORT MEDCouplingFieldInt *field(int iteration, int order, const MEDFileMesh *mesh) const; + MEDLOADER_EXPORT MEDCouplingFieldInt *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const; + MEDLOADER_EXPORT MEDCouplingFieldInt *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const; + MEDLOADER_EXPORT MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const; + MEDLOADER_EXPORT MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const; + MEDLOADER_EXPORT MEDCouplingFieldInt *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const; MEDLOADER_EXPORT DataArrayInt *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const; // - MEDLOADER_EXPORT void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals); - MEDLOADER_EXPORT void appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile); + MEDLOADER_EXPORT void appendFieldNoProfileSBT(const MEDCouplingFieldInt *field); + MEDLOADER_EXPORT void appendFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile); // MEDLOADER_EXPORT DataArrayInt *getUndergroundDataArray(int iteration, int order) const; public: @@ -1090,8 +1237,8 @@ namespace MEDCoupling ~MEDFileIntFieldMultiTS() { } MEDFileIntFieldMultiTS(); MEDFileIntFieldMultiTS(const MEDFileIntFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent); - MEDFileIntFieldMultiTS(const std::string& fileName, bool loadAll, const MEDFileMeshes *ms); - MEDFileIntFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const std::vector< std::pair > *entities=0); + MEDFileIntFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms); + MEDFileIntFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=0); }; class MEDFileAnyTypeFieldMultiTSIterator @@ -1107,22 +1254,26 @@ namespace MEDCoupling }; class MEDFileFieldsIterator; - + class MEDFileStructureElements; + /*! * Use class. */ - class MEDFileFields : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable + class MEDFileFields : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritableStandAlone { public: MEDLOADER_EXPORT static MEDFileFields *New(); MEDLOADER_EXPORT static MEDFileFields *New(const std::string& fileName, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileFields *New(med_idt fid, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileFields *NewWithDynGT(const std::string& fileName, const MEDFileStructureElements *se, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileFields *NewWithDynGT(med_idt fid, const MEDFileStructureElements *se, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileFields *New(DataArrayByte *db) { return BuildFromMemoryChunk(db); } MEDLOADER_EXPORT static MEDFileFields *LoadPartOf(const std::string& fileName, bool loadAll=true, const MEDFileMeshes *ms=0); MEDLOADER_EXPORT static MEDFileFields *LoadSpecificEntities(const std::string& fileName, const std::vector< std::pair >& entities, bool loadAll=true); MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT MEDFileFields *deepCopy() const; MEDLOADER_EXPORT MEDFileFields *shallowCpy() const; - MEDLOADER_EXPORT void write(const std::string& fileName, int mode) const; MEDLOADER_EXPORT void writeLL(med_idt fid) const; MEDLOADER_EXPORT void loadArrays(); MEDLOADER_EXPORT void loadArraysIfNecessary(); @@ -1147,6 +1298,15 @@ namespace MEDCoupling MEDLOADER_EXPORT MEDFileFields *partOfThisLyingOnSpecifiedMeshName(const std::string& meshName) const; MEDLOADER_EXPORT MEDFileFields *partOfThisLyingOnSpecifiedTimeSteps(const std::vector< std::pair >& timeSteps) const; MEDLOADER_EXPORT MEDFileFields *partOfThisNotLyingOnSpecifiedTimeSteps(const std::vector< std::pair >& timeSteps) const; + MEDLOADER_EXPORT bool presenceOfStructureElements() const; + MEDLOADER_EXPORT void killStructureElements(); + MEDLOADER_EXPORT void keepOnlyStructureElements(); + MEDLOADER_EXPORT void keepOnlyOnMeshSE(const std::string& meshName, const std::string& seName); + MEDLOADER_EXPORT void getMeshSENames(std::vector< std::pair >& ps) const; + MEDLOADER_EXPORT void blowUpSE(MEDFileMeshes *ms, const MEDFileStructureElements *ses); + MEDLOADER_EXPORT MCAuto partOfThisOnStructureElements() const; + MEDLOADER_EXPORT MCAuto partOfThisLyingOnSpecifiedMeshSEName(const std::string& meshName, const std::string& seName) const; + MEDLOADER_EXPORT void aggregate(const MEDFileFields& other); MEDLOADER_EXPORT MEDFileFieldsIterator *iterator(); MEDLOADER_EXPORT void destroyFieldAtPos(int i); MEDLOADER_EXPORT void destroyFieldsAtPos(const int *startIds, const int *endIds); @@ -1165,7 +1325,7 @@ namespace MEDCoupling private: ~MEDFileFields() { } MEDFileFields(); - MEDFileFields(const std::string& fileName, bool loadAll, const MEDFileMeshes *ms, const std::vector< std::pair > *entities); + MEDFileFields(med_idt fid, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities); private: std::vector< MCAuto > _fields; };