X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDLoader%2FMEDFileMesh.hxx;h=8492b0b4aeef8f0af3933e0f73146af4e134ecd2;hb=88c09fef7506f47991febf579dba91e11baf91e1;hp=02df40ac61be2ce5e0c468a80d71e83677bc01b8;hpb=293a6104470482e450701aa8061d9b244f2057d5;p=tools%2Fmedcoupling.git diff --git a/src/MEDLoader/MEDFileMesh.hxx b/src/MEDLoader/MEDFileMesh.hxx index 02df40ac6..8492b0b4a 100644 --- a/src/MEDLoader/MEDFileMesh.hxx +++ b/src/MEDLoader/MEDFileMesh.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2012 CEA/DEN, EDF R&D +// Copyright (C) 2007-2013 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -24,25 +24,35 @@ #include "MEDLoaderDefines.hxx" #include "MEDFileMeshLL.hxx" #include "MEDFileUtilities.hxx" +#include "MEDFileMeshReadSelector.hxx" #include +#include namespace ParaMEDMEM { + class MEDFileFieldGlobsReal; + class MEDFileField1TSStructItem; + class MEDLOADER_EXPORT MEDFileMesh : public RefCountObject, public MEDFileWritable { public: - static MEDFileMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception); - static MEDFileMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception); + static MEDFileMesh *New(const char *fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception); + static MEDFileMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception); + std::size_t getHeapMemorySize() const; + virtual MEDFileMesh *createNewEmpty() const throw(INTERP_KERNEL::Exception) = 0; + virtual MEDFileMesh *deepCpy() const throw(INTERP_KERNEL::Exception) = 0; + virtual MEDFileMesh *shallowCpy() const throw(INTERP_KERNEL::Exception) = 0; virtual bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const; virtual void clearNonDiscrAttributes() const; void setName(const char *name) { _name=name; } bool changeNames(const std::vector< std::pair >& modifTab) throw(INTERP_KERNEL::Exception); - const char *getName() const { return _name.c_str(); } - void setUnivName(const char *name) { _univ_name=name; } + std::string getName() const { return _name; } const char *getUnivName() const { return _univ_name.c_str(); } + bool getUnivNameWrStatus() const { return _univ_wr_status; } + void setUnivNameWrStatus(bool newStatus) { _univ_wr_status=newStatus; } void setDescription(const char *name) { _desc_name=name; } - const char *getDescription() const { return _desc_name.c_str(); } + std::string getDescription() const { return _desc_name; } void setOrder(int order) { _order=order; } int getOrder() const { return _order; } void setIteration(int it) { _iteration=it; } @@ -56,10 +66,15 @@ namespace ParaMEDMEM virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception) = 0; virtual std::vector getNonEmptyLevels() const = 0; virtual std::vector getNonEmptyLevelsExt() const = 0; + virtual std::vector getFamArrNonEmptyLevelsExt() const = 0; + virtual std::vector getNumArrNonEmptyLevelsExt() const = 0; + virtual std::vector getNameArrNonEmptyLevelsExt() const = 0; virtual void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception); virtual void write(med_idt fid) const throw(INTERP_KERNEL::Exception); virtual int getSizeAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception) = 0; virtual MEDCouplingMesh *getGenMeshAtLevel(int meshDimRelToMax, bool renum=false) const throw(INTERP_KERNEL::Exception) = 0; + virtual std::vector getDistributionOfTypes(int meshDimRelToMax) const throw(INTERP_KERNEL::Exception); + virtual void whichAreNodesFetched(const MEDFileField1TSStructItem& st, const MEDFileFieldGlobsReal *globs, std::vector& nodesFetched) const throw(INTERP_KERNEL::Exception) = 0; // bool areFamsEqual(const MEDFileMesh *other, std::string& what) const; bool areGrpsEqual(const MEDFileMesh *other, std::string& what) const; @@ -88,15 +103,27 @@ namespace ParaMEDMEM std::vector getGroupsNames() const; std::vector getFamiliesNames() const; void assignFamilyNameWithGroupName() throw(INTERP_KERNEL::Exception); + std::vector removeEmptyGroups() throw(INTERP_KERNEL::Exception); void removeGroup(const char *name) throw(INTERP_KERNEL::Exception); void removeFamily(const char *name) throw(INTERP_KERNEL::Exception); + std::vector removeOrphanGroups() throw(INTERP_KERNEL::Exception); + std::vector removeOrphanFamilies() throw(INTERP_KERNEL::Exception); void changeGroupName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception); void changeFamilyName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception); void changeFamilyId(int oldId, int newId) throw(INTERP_KERNEL::Exception); + void changeAllGroupsContainingFamily(const char *familyNameToChange, const std::vector& newFamiliesNames) throw(INTERP_KERNEL::Exception); int getFamilyId(const char *name) const throw(INTERP_KERNEL::Exception); + int getMaxAbsFamilyId() const throw(INTERP_KERNEL::Exception); int getMaxFamilyId() const throw(INTERP_KERNEL::Exception); int getMinFamilyId() const throw(INTERP_KERNEL::Exception); + int getTheMaxAbsFamilyId() const throw(INTERP_KERNEL::Exception); + int getTheMaxFamilyId() const throw(INTERP_KERNEL::Exception); + int getTheMinFamilyId() const throw(INTERP_KERNEL::Exception); + virtual int getMaxAbsFamilyIdInArrays() const throw(INTERP_KERNEL::Exception) = 0; + virtual int getMaxFamilyIdInArrays() const throw(INTERP_KERNEL::Exception) = 0; + virtual int getMinFamilyIdInArrays() const throw(INTERP_KERNEL::Exception) = 0; DataArrayInt *getAllFamiliesIdsReferenced() const throw(INTERP_KERNEL::Exception); + DataArrayInt *computeAllFamilyIdsInUse() const throw(INTERP_KERNEL::Exception); std::vector getFamiliesIds(const std::vector& famNames) const throw(INTERP_KERNEL::Exception); std::string getFamilyNameGivenId(int id) const throw(INTERP_KERNEL::Exception); bool ensureDifferentFamIdsPerLevel() throw(INTERP_KERNEL::Exception); @@ -109,9 +136,11 @@ namespace ParaMEDMEM virtual void setGroupsAtLevel(int meshDimRelToMaxExt, const std::vector& grps, bool renum=false) throw(INTERP_KERNEL::Exception); virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr) throw(INTERP_KERNEL::Exception) = 0; virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr) throw(INTERP_KERNEL::Exception) = 0; + virtual void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr) throw(INTERP_KERNEL::Exception) = 0; virtual const DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception) = 0; virtual const DataArrayInt *getNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception) = 0; virtual const DataArrayInt *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception) = 0; + virtual const DataArrayAsciiChar *getNameFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception) = 0; virtual DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector& fams, bool renum=false) const throw(INTERP_KERNEL::Exception) = 0; virtual DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector& grps, bool renum=false) const throw(INTERP_KERNEL::Exception); virtual DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception); @@ -124,14 +153,18 @@ namespace ParaMEDMEM virtual bool unPolyze(std::vector& oldCode, std::vector& newCode, DataArrayInt *& o2nRenumCell) throw(INTERP_KERNEL::Exception) = 0; protected: MEDFileMesh(); + //! protected because no way in MED file API to specify this name + void setUnivName(const char *name) { _univ_name=name; } void addFamilyOnAllGroupsHaving(const char *famName, const char *otherFamName) throw(INTERP_KERNEL::Exception); virtual void writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception) = 0; void dealWithTinyInfo(const MEDCouplingMesh *m) throw(INTERP_KERNEL::Exception); virtual void synchronizeTinyInfoOnLeaves() const = 0; void getFamilyRepr(std::ostream& oss) const; - virtual void appendFamilyEntries(const std::set& famIds, const std::vector< std::vector >& fidsOfGrps, const std::vector& grpNames); + virtual void appendFamilyEntries(const DataArrayInt *famIds, const std::vector< std::vector >& fidsOfGrps, const std::vector& grpNames); virtual void changeFamilyIdArr(int oldId, int newId) throw(INTERP_KERNEL::Exception) = 0; static void TranslateFamilyIds(int offset, DataArrayInt *famArr, std::vector< std::vector >& famIdsPerGrp); + static void ChangeAllGroupsContainingFamily(std::map >& groups, const char *familyNameToChange, const std::vector& newFamiliesNames) throw(INTERP_KERNEL::Exception); + static std::string FindOrCreateAndGiveFamilyWithId(std::map& families, int id, bool& created) throw(INTERP_KERNEL::Exception); static std::string CreateNameNotIn(const std::string& nameTry, const std::vector& namesToAvoid) throw(INTERP_KERNEL::Exception); static int PutInThirdComponentOfCodeOffset(std::vector& code, int strt) throw(INTERP_KERNEL::Exception); protected: @@ -140,7 +173,9 @@ namespace ParaMEDMEM double _time; std::string _dt_unit; std::string _name; - std::string _univ_name; + //! this attribute do not impact the state of instance -> mutable + mutable std::string _univ_name; + bool _univ_wr_status; std::string _desc_name; protected: std::map > _groups; @@ -153,13 +188,20 @@ namespace ParaMEDMEM { friend class MEDFileMesh; public: - static MEDFileUMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception); - static MEDFileUMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception); + static MEDFileUMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception); + static MEDFileUMesh *New(const char *fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception); static MEDFileUMesh *New(); + std::size_t getHeapMemorySize() const; + MEDFileMesh *createNewEmpty() const throw(INTERP_KERNEL::Exception); + MEDFileMesh *deepCpy() const throw(INTERP_KERNEL::Exception); + MEDFileMesh *shallowCpy() const throw(INTERP_KERNEL::Exception); bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const; void clearNonDiscrAttributes() const; ~MEDFileUMesh(); // + int getMaxAbsFamilyIdInArrays() const throw(INTERP_KERNEL::Exception); + int getMaxFamilyIdInArrays() const throw(INTERP_KERNEL::Exception); + int getMinFamilyIdInArrays() const throw(INTERP_KERNEL::Exception); int getMeshDimension() const throw(INTERP_KERNEL::Exception); int getSpaceDimension() const throw(INTERP_KERNEL::Exception); std::string simpleRepr() const; @@ -168,9 +210,14 @@ namespace ParaMEDMEM const DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception); const DataArrayInt *getNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception); const DataArrayInt *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception); + const DataArrayAsciiChar *getNameFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception); int getNumberOfNodes() const throw(INTERP_KERNEL::Exception); + void whichAreNodesFetched(const MEDFileField1TSStructItem& st, const MEDFileFieldGlobsReal *globs, std::vector& nodesFetched) const throw(INTERP_KERNEL::Exception); std::vector getNonEmptyLevels() const; std::vector getNonEmptyLevelsExt() const; + std::vector getFamArrNonEmptyLevelsExt() const; + std::vector getNumArrNonEmptyLevelsExt() const; + std::vector getNameArrNonEmptyLevelsExt() const; std::vector getGrpNonEmptyLevels(const char *grp) const throw(INTERP_KERNEL::Exception); std::vector getGrpNonEmptyLevelsExt(const char *grp) const throw(INTERP_KERNEL::Exception); std::vector getFamNonEmptyLevels(const char *fam) const throw(INTERP_KERNEL::Exception); @@ -188,31 +235,37 @@ namespace ParaMEDMEM DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector& fams, bool renum=false) const throw(INTERP_KERNEL::Exception); MEDCouplingUMesh *getMeshAtLevel(int meshDimRelToMaxExt, bool renum=false) const throw(INTERP_KERNEL::Exception); MEDCouplingMesh *getGenMeshAtLevel(int meshDimRelToMax, bool renum=false) const throw(INTERP_KERNEL::Exception); + std::vector getDistributionOfTypes(int meshDimRelToMax) const throw(INTERP_KERNEL::Exception); MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception); MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception); MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception); MEDCouplingUMesh *getLevelM3Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception); + std::vector getDirectUndergroundSingleGeoTypeMeshes(int meshDimRelToMax) const throw(INTERP_KERNEL::Exception); + MEDCoupling1GTUMesh *getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const throw(INTERP_KERNEL::Exception); // void setFamilyNameAttachedOnId(int id, const std::string& newFamName) throw(INTERP_KERNEL::Exception); void setCoords(DataArrayDouble *coords) throw(INTERP_KERNEL::Exception); void eraseGroupsAtLevel(int meshDimRelToMaxExt) throw(INTERP_KERNEL::Exception); void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr) throw(INTERP_KERNEL::Exception); void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr) throw(INTERP_KERNEL::Exception); - void addNodeGroup(const std::string& name, const std::vector& ids) throw(INTERP_KERNEL::Exception); + void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr) throw(INTERP_KERNEL::Exception); + void addNodeGroup(const DataArrayInt *ids) throw(INTERP_KERNEL::Exception); + void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids) throw(INTERP_KERNEL::Exception); void removeMeshAtLevel(int meshDimRelToMax) throw(INTERP_KERNEL::Exception); void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false) throw(INTERP_KERNEL::Exception); - void setMeshAtLevelGen(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld) throw(INTERP_KERNEL::Exception); - void setGroupsFromScratch(int meshDimRelToMax, const std::vector& ms) throw(INTERP_KERNEL::Exception); - void setGroupsOnSetMesh(int meshDimRelToMax, const std::vector& ms, bool renum) throw(INTERP_KERNEL::Exception); + void setMeshes(const std::vector& ms, bool renum=false) throw(INTERP_KERNEL::Exception); + void setGroupsFromScratch(int meshDimRelToMax, const std::vector& ms, bool renum=false) throw(INTERP_KERNEL::Exception); + void setGroupsOnSetMesh(int meshDimRelToMax, const std::vector& ms, bool renum=false) throw(INTERP_KERNEL::Exception); void optimizeFamilies() throw(INTERP_KERNEL::Exception); - void duplicateNodesOnM1Group(const char *grpNameM1, DataArrayInt *&nodesDuplicated, DataArrayInt *&cellsModified, DataArrayInt *&cellsNotModified) throw(INTERP_KERNEL::Exception); // tools + void duplicateNodesOnM1Group(const char *grpNameM1, DataArrayInt *&nodesDuplicated, DataArrayInt *&cellsModified, DataArrayInt *&cellsNotModified) throw(INTERP_KERNEL::Exception); bool unPolyze(std::vector& oldCode, std::vector& newCode, DataArrayInt *& o2nRenumCell) throw(INTERP_KERNEL::Exception); + DataArrayInt *zipCoords() throw(INTERP_KERNEL::Exception); private: void writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception); MEDFileUMesh(); - MEDFileUMesh(med_idt fid, const char *mName, int dt, int it) throw(INTERP_KERNEL::Exception); - void loadUMeshFromFile(med_idt fid, const char *mName, int dt, int it) throw(INTERP_KERNEL::Exception); + MEDFileUMesh(med_idt fid, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs) throw(INTERP_KERNEL::Exception); + void loadUMeshFromFile(med_idt fid, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs) throw(INTERP_KERNEL::Exception); const MEDFileUMeshSplitL1 *getMeshAtLevSafe(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception); MEDFileUMeshSplitL1 *getMeshAtLevSafe(int meshDimRelToMaxExt) throw(INTERP_KERNEL::Exception); void checkMeshDimCoherency(int meshDim, int meshDimRelToMax) const throw(INTERP_KERNEL::Exception); @@ -220,65 +273,131 @@ namespace ParaMEDMEM void computeRevNum() const; void synchronizeTinyInfoOnLeaves() const; void changeFamilyIdArr(int oldId, int newId) throw(INTERP_KERNEL::Exception); + std::list< MEDCouplingAutoRefCountObjectPtr > getAllNonNullFamilyIds() const; + void addGroupUnderground(bool isNodeGroup, const DataArrayInt *ids, DataArrayInt *famArr) throw(INTERP_KERNEL::Exception); private: std::vector< MEDCouplingAutoRefCountObjectPtr > _ms; MEDCouplingAutoRefCountObjectPtr _coords; MEDCouplingAutoRefCountObjectPtr _fam_coords; MEDCouplingAutoRefCountObjectPtr _num_coords; + MEDCouplingAutoRefCountObjectPtr _name_coords; mutable MEDCouplingAutoRefCountObjectPtr _rev_num_coords; }; - class MEDLOADER_EXPORT MEDFileCMesh : public MEDFileMesh + class MEDLOADER_EXPORT MEDFileStructuredMesh : public MEDFileMesh { friend class MEDFileMesh; public: - static MEDFileCMesh *New(); - static MEDFileCMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception); - static MEDFileCMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception); + std::size_t getHeapMemorySize() const; + int getMaxAbsFamilyIdInArrays() const throw(INTERP_KERNEL::Exception); + int getMaxFamilyIdInArrays() const throw(INTERP_KERNEL::Exception); + int getMinFamilyIdInArrays() const throw(INTERP_KERNEL::Exception); bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const; - int getMeshDimension() const throw(INTERP_KERNEL::Exception); - std::string simpleRepr() const; - std::string advancedRepr() const; void clearNonDiscrAttributes() const; - const MEDCouplingCMesh *getMesh() const; - MEDCouplingMesh *getGenMeshAtLevel(int meshDimRelToMax, bool renum=false) const throw(INTERP_KERNEL::Exception); - void setMesh(MEDCouplingCMesh *m) throw(INTERP_KERNEL::Exception); - int getSizeAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception); DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector& fams, bool renum=false) const throw(INTERP_KERNEL::Exception); + const DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception); void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr) throw(INTERP_KERNEL::Exception); void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr) throw(INTERP_KERNEL::Exception); - int getNumberOfNodes() const throw(INTERP_KERNEL::Exception); - std::vector getNonEmptyLevels() const; - std::vector getNonEmptyLevelsExt() const; - const DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception); + void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr) throw(INTERP_KERNEL::Exception); const DataArrayInt *getNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception); const DataArrayInt *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception); + const DataArrayAsciiChar *getNameFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception); + std::vector getNonEmptyLevels() const; + std::vector getNonEmptyLevelsExt() const; + std::vector getFamArrNonEmptyLevelsExt() const; + std::vector getNumArrNonEmptyLevelsExt() const; + std::vector getNameArrNonEmptyLevelsExt() const; + MEDCouplingMesh *getGenMeshAtLevel(int meshDimRelToMax, bool renum=false) const throw(INTERP_KERNEL::Exception); + int getSizeAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception); + int getNumberOfNodes() const throw(INTERP_KERNEL::Exception); + void whichAreNodesFetched(const MEDFileField1TSStructItem& st, const MEDFileFieldGlobsReal *globs, std::vector& nodesFetched) const throw(INTERP_KERNEL::Exception); // tools bool unPolyze(std::vector& oldCode, std::vector& newCode, DataArrayInt *& o2nRenumCell) throw(INTERP_KERNEL::Exception); - private: - void writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception); - MEDFileCMesh(); - void synchronizeTinyInfoOnLeaves() const; - MEDFileCMesh(med_idt fid, const char *mName, int dt, int it) throw(INTERP_KERNEL::Exception); - void loadCMeshFromFile(med_idt fid, const char *mName, int dt, int it) throw(INTERP_KERNEL::Exception); + protected: void changeFamilyIdArr(int oldId, int newId) throw(INTERP_KERNEL::Exception); + void deepCpyAttributes() throw(INTERP_KERNEL::Exception); + void loadStrMeshFromFile(MEDFileStrMeshL2 *strm, med_idt fid, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs) throw(INTERP_KERNEL::Exception); + void writeStructuredLL(med_idt fid, const char *maa) const throw(INTERP_KERNEL::Exception); + virtual const MEDCouplingStructuredMesh *getStructuredMesh() const = 0; + static med_geometry_type GetGeoTypeFromMeshDim(int meshDim) throw(INTERP_KERNEL::Exception); private: - MEDCouplingAutoRefCountObjectPtr _cmesh; MEDCouplingAutoRefCountObjectPtr _fam_nodes; MEDCouplingAutoRefCountObjectPtr _num_nodes; + MEDCouplingAutoRefCountObjectPtr _names_nodes; MEDCouplingAutoRefCountObjectPtr _fam_cells; MEDCouplingAutoRefCountObjectPtr _num_cells; + MEDCouplingAutoRefCountObjectPtr _names_cells; mutable MEDCouplingAutoRefCountObjectPtr _rev_num_nodes; mutable MEDCouplingAutoRefCountObjectPtr _rev_num_cells; }; + class MEDLOADER_EXPORT MEDFileCMesh : public MEDFileStructuredMesh + { + friend class MEDFileMesh; + public: + static MEDFileCMesh *New(); + static MEDFileCMesh *New(const char *fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception); + static MEDFileCMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception); + std::size_t getHeapMemorySize() const; + MEDFileMesh *createNewEmpty() const throw(INTERP_KERNEL::Exception); + MEDFileMesh *deepCpy() const throw(INTERP_KERNEL::Exception); + MEDFileMesh *shallowCpy() const throw(INTERP_KERNEL::Exception); + bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const; + int getMeshDimension() const throw(INTERP_KERNEL::Exception); + std::string simpleRepr() const; + std::string advancedRepr() const; + void clearNonDiscrAttributes() const; + const MEDCouplingCMesh *getMesh() const; + void setMesh(MEDCouplingCMesh *m) throw(INTERP_KERNEL::Exception); + private: + const MEDCouplingStructuredMesh *getStructuredMesh() const; + void writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception); + MEDFileCMesh(); + void synchronizeTinyInfoOnLeaves() const; + MEDFileCMesh(med_idt fid, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs) throw(INTERP_KERNEL::Exception); + void loadCMeshFromFile(med_idt fid, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs) throw(INTERP_KERNEL::Exception); + private: + MEDCouplingAutoRefCountObjectPtr _cmesh; + }; + + class MEDLOADER_EXPORT MEDFileCurveLinearMesh : public MEDFileStructuredMesh + { + friend class MEDFileMesh; + public: + static MEDFileCurveLinearMesh *New(); + static MEDFileCurveLinearMesh *New(const char *fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception); + static MEDFileCurveLinearMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception); + std::size_t getHeapMemorySize() const; + MEDFileMesh *createNewEmpty() const throw(INTERP_KERNEL::Exception); + MEDFileMesh *deepCpy() const throw(INTERP_KERNEL::Exception); + MEDFileMesh *shallowCpy() const throw(INTERP_KERNEL::Exception); + bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const; + int getMeshDimension() const throw(INTERP_KERNEL::Exception); + std::string simpleRepr() const; + std::string advancedRepr() const; + void clearNonDiscrAttributes() const; + const MEDCouplingCurveLinearMesh *getMesh() const; + void setMesh(MEDCouplingCurveLinearMesh *m) throw(INTERP_KERNEL::Exception); + private: + MEDFileCurveLinearMesh(); + MEDFileCurveLinearMesh(med_idt fid, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs) throw(INTERP_KERNEL::Exception); + const MEDCouplingStructuredMesh *getStructuredMesh() const; + void synchronizeTinyInfoOnLeaves() const; + void writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception); + void loadCLMeshFromFile(med_idt fid, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs) throw(INTERP_KERNEL::Exception);//to imp + private: + MEDCouplingAutoRefCountObjectPtr _clmesh; + }; + class MEDLOADER_EXPORT MEDFileMeshMultiTS : public RefCountObject, public MEDFileWritable { public: static MEDFileMeshMultiTS *New(); static MEDFileMeshMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception); static MEDFileMeshMultiTS *New(const char *fileName, const char *mName) throw(INTERP_KERNEL::Exception); - const char *getName() const throw(INTERP_KERNEL::Exception); + MEDFileMeshMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception); + std::size_t getHeapMemorySize() const; + std::string getName() const throw(INTERP_KERNEL::Exception); void setName(const char *newMeshName) throw(INTERP_KERNEL::Exception); bool changeNames(const std::vector< std::pair >& modifTab) throw(INTERP_KERNEL::Exception); MEDFileMesh *getOneTimeStep() const throw(INTERP_KERNEL::Exception); @@ -301,6 +420,8 @@ namespace ParaMEDMEM public: static MEDFileMeshes *New(); static MEDFileMeshes *New(const char *fileName) throw(INTERP_KERNEL::Exception); + MEDFileMeshes *deepCpy() const throw(INTERP_KERNEL::Exception); + std::size_t getHeapMemorySize() const; std::string simpleRepr() const; void simpleReprWithoutHeader(std::ostream& oss) const; void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);