X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDLoader%2FMEDFileMeshLL.hxx;h=4be19e047a2fbdd9156186f4bf950b80987217f9;hb=701d5a29e2682e1687b49bc61e09b9d7b38d2110;hp=c956ce7b4546245ae87c7ceeeafc11f42b8b469a;hpb=ba46d95e15064cd3768d78ec9ffff33bb72fcec5;p=tools%2Fmedcoupling.git diff --git a/src/MEDLoader/MEDFileMeshLL.hxx b/src/MEDLoader/MEDFileMeshLL.hxx index c956ce7b4..4be19e047 100644 --- a/src/MEDLoader/MEDFileMeshLL.hxx +++ b/src/MEDLoader/MEDFileMeshLL.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D +// Copyright (C) 2007-2014 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 // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -27,6 +27,7 @@ #include "MEDCouplingUMesh.hxx" #include "MEDCouplingCMesh.hxx" #include "MEDCoupling1GTUMesh.hxx" +#include "MEDCouplingPartDefinition.hxx" #include "MEDCouplingCurveLinearMesh.hxx" #include "MEDCouplingAutoRefCountObjectPtr.hxx" @@ -37,25 +38,26 @@ namespace ParaMEDMEM { class MEDFileMeshReadSelector; - + class MEDFileMeshL2 : public RefCountObject { public: MEDFileMeshL2(); std::size_t getHeapMemorySizeWithoutChildren() const; - std::vector getDirectChildren() const; + std::vector getDirectChildrenWithNull() const; const char *getName() const { return _name.getReprForWrite(); } const char *getDescription() const { return _description.getReprForWrite(); } const char *getUnivName() const { return _univ_name.getReprForWrite(); } const char *getTimeUnit() const { return _dt_unit.getReprForWrite(); } int getIteration() const { return _iteration; } int getOrder() const { return _order; } - double getTime() { return _time; } - std::vector getAxisInfoOnMesh(med_idt fid, int mId, const char *mName, ParaMEDMEM::MEDCouplingMeshType& meshType, int& nstep, int& Mdim); - static int GetMeshIdFromName(med_idt fid, const char *mName, ParaMEDMEM::MEDCouplingMeshType& meshType, int& dt, int& it, std::string& dtunit1); - static double CheckMeshTimeStep(med_idt fid, const char *mname, int nstep, int dt, int it); - static void ReadFamiliesAndGrps(med_idt fid, const char *mname, std::map& fams, std::map >& grps, MEDFileMeshReadSelector *mrs); - static void WriteFamiliesAndGrps(med_idt fid, const char *mname, const std::map& fams, const std::map >& grps, int tooLongStrPol); + double getTime() const { return _time; } + MEDCouplingAutoRefCountObjectPtr getPartDefOfCoo() const { return _part_coords; } + std::vector getAxisInfoOnMesh(med_idt fid, int mId, const std::string& mName, ParaMEDMEM::MEDCouplingMeshType& meshType, int& nstep, int& Mdim); + static int GetMeshIdFromName(med_idt fid, const std::string& mName, ParaMEDMEM::MEDCouplingMeshType& meshType, int& dt, int& it, std::string& dtunit1); + static double CheckMeshTimeStep(med_idt fid, const std::string& mname, int nstep, int dt, int it); + static void ReadFamiliesAndGrps(med_idt fid, const std::string& mname, std::map& fams, std::map >& grps, MEDFileMeshReadSelector *mrs); + static void WriteFamiliesAndGrps(med_idt fid, const std::string& mname, const std::map& fams, const std::map >& grps, int tooLongStrPol); protected: MEDFileString _name; MEDFileString _description; @@ -64,15 +66,20 @@ namespace ParaMEDMEM int _iteration; int _order; double _time; + MEDCouplingAutoRefCountObjectPtr _part_coords; }; class MEDFileUMeshL2 : public MEDFileMeshL2 { public: MEDFileUMeshL2(); - void loadAll(med_idt fid, int mId, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs); - void loadConnectivity(med_idt fid, int mdim, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs); - void loadCoords(med_idt fid, int mId, const std::vector& infosOnComp, const char *mName, int dt, int it); + std::vector loadCommonPart(med_idt fid, int mId, const std::string& mName, int dt, int it, int& Mdim); + void loadAll(med_idt fid, int mId, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs); + void loadPart(med_idt fid, int mId, const std::string& mName, const std::vector& types, const std::vector& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs); + void loadConnectivity(med_idt fid, int mdim, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs); + void loadPartOfConnectivity(med_idt fid, int mdim, const std::string& mName, const std::vector& types, const std::vector& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs); + void loadCoords(med_idt fid, int mId, const std::vector& infosOnComp, const std::string& mName, int dt, int it); + void loadPartCoords(med_idt fid, int mId, const std::vector& infosOnComp, const std::string& mName, int dt, int it, int nMin, int nMax); int getNumberOfLevels() const { return _per_type_mesh.size(); } bool emptyLev(int levId) const { return _per_type_mesh[levId].empty(); } const std::vector< MEDCouplingAutoRefCountObjectPtr >& getLev(int levId) const { return _per_type_mesh[levId]; } @@ -83,7 +90,7 @@ namespace ParaMEDMEM MEDCouplingAutoRefCountObjectPtr getCoordsFamily() const { return _fam_coords; } MEDCouplingAutoRefCountObjectPtr getCoordsNum() const { return _num_coords; } MEDCouplingAutoRefCountObjectPtr getCoordsName() const { return _name_coords; } - static void WriteCoords(med_idt fid, const char *mname, int dt, int it, double time, const DataArrayDouble *coords, const DataArrayInt *famCoords, const DataArrayInt *numCoords, const DataArrayAsciiChar *nameCoords); + static void WriteCoords(med_idt fid, const std::string& mname, int dt, int it, double time, const DataArrayDouble *coords, const DataArrayInt *famCoords, const DataArrayInt *numCoords, const DataArrayAsciiChar *nameCoords); private: void sortTypes(); private: @@ -102,19 +109,19 @@ namespace ParaMEDMEM { public: MEDFileCMeshL2(); - void loadAll(med_idt fid, int mId, const char *mName, int dt, int it); + void loadAll(med_idt fid, int mId, const std::string& mName, int dt, int it); MEDCouplingCMesh *getMesh() { return _cmesh; } private: static med_data_type GetDataTypeCorrespondingToSpaceId(int id); private: MEDCouplingAutoRefCountObjectPtr _cmesh; }; - + class MEDFileCLMeshL2 : public MEDFileStrMeshL2 { public: MEDFileCLMeshL2(); - void loadAll(med_idt fid, int mId, const char *mName, int dt, int it); + void loadAll(med_idt fid, int mId, const std::string& mName, int dt, int it); MEDCouplingCurveLinearMesh *getMesh() { return _clmesh; } private: MEDCouplingAutoRefCountObjectPtr _clmesh; @@ -123,13 +130,15 @@ namespace ParaMEDMEM class MEDFileMesh; class MEDFileUMeshSplitL1; - class MEDFileUMeshPermCompute + class MEDFileUMeshPermCompute : public BigMemoryObject { public: MEDFileUMeshPermCompute(const MEDFileUMeshSplitL1* st); operator MEDCouplingUMesh *() const; void operator=(MEDCouplingUMesh *m); void updateTime() const; + std::vector getDirectChildrenWithNull() const; + std::size_t getHeapMemorySizeWithoutChildren() const; private: const MEDFileUMeshSplitL1 *_st; mutable std::size_t _mpt_time; @@ -141,15 +150,19 @@ namespace ParaMEDMEM { public: MEDFileUMeshAggregateCompute(); + void setName(const std::string& name); void assignParts(const std::vector< const MEDCoupling1GTUMesh * >& mParts); + void assignDefParts(const std::vector& partDefs); void assignUMesh(MEDCouplingUMesh *m); MEDCouplingUMesh *getUmesh() const; std::vector getParts() const; - std::vector getPartsWithoutComputation() const; - MEDCoupling1GTUMesh *getPartWithoutComputation(INTERP_KERNEL::NormalizedCellType gt) const; + std::vector getGeoTypes() const; + std::vector retrievePartsWithoutComputation() const; + MEDCoupling1GTUMesh *retrievePartWithoutComputation(INTERP_KERNEL::NormalizedCellType gt) const; + void getStartStopOfGeoTypeWithoutComputation(INTERP_KERNEL::NormalizedCellType gt, int& start, int& stop) const; std::size_t getTimeOfThis() const; std::size_t getHeapMemorySizeWithoutChildren() const; - std::vector getDirectChildren() const; + std::vector getDirectChildrenWithNull() const; MEDFileUMeshAggregateCompute deepCpy(DataArrayDouble *coords) const; bool isEqual(const MEDFileUMeshAggregateCompute& other, double eps, std::string& what) const; void clearNonDiscrAttributes() const; @@ -159,8 +172,9 @@ namespace ParaMEDMEM std::vector getDistributionOfTypes() const; int getSize() const; void setCoords(DataArrayDouble *coords); - private: void forceComputationOfPartsFromUMesh() const; + const PartDefinition *getPartDefOfWithoutComputation(INTERP_KERNEL::NormalizedCellType gt) const; + private: std::size_t getTimeOfParts() const; std::size_t getTimeOfUMesh() const; private: @@ -168,24 +182,29 @@ namespace ParaMEDMEM mutable std::size_t _mp_time; mutable std::size_t _m_time; mutable MEDCouplingAutoRefCountObjectPtr _m; + mutable std::vector< MEDCouplingAutoRefCountObjectPtr > _part_def; }; - + class MEDFileUMeshSplitL1 : public RefCountObject { friend class MEDFileUMeshPermCompute; public: MEDFileUMeshSplitL1(const MEDFileUMeshSplitL1& other); - MEDFileUMeshSplitL1(const MEDFileUMeshL2& l2, const char *mName, int id); + MEDFileUMeshSplitL1(const MEDFileUMeshL2& l2, const std::string& mName, int id); + MEDFileUMeshSplitL1(MEDCoupling1GTUMesh *m); MEDFileUMeshSplitL1(MEDCouplingUMesh *m); MEDFileUMeshSplitL1(MEDCouplingUMesh *m, bool newOrOld); + void setName(const std::string& name); std::size_t getHeapMemorySizeWithoutChildren() const; - std::vector getDirectChildren() const; + std::vector getDirectChildrenWithNull() const; MEDFileUMeshSplitL1 *deepCpy(DataArrayDouble *coords) const; void setCoords(DataArrayDouble *coords); bool isEqual(const MEDFileUMeshSplitL1 *other, double eps, std::string& what) const; void clearNonDiscrAttributes() const; void synchronizeTinyInfo(const MEDFileMesh& master) const; void assignMesh(MEDCouplingUMesh *m, bool newOrOld); + void assignParts(const std::vector< const MEDCoupling1GTUMesh * >& mParts); + void forceComputationOfParts() const; bool empty() const; bool presenceOfOneFams(const std::vector& ids) const; int getMeshDimension() const; @@ -194,18 +213,22 @@ namespace ParaMEDMEM MEDCouplingUMesh *getFamilyPart(const int *idsBg, const int *idsEnd, bool renum) const; DataArrayInt *getFamilyPartArr(const int *idsBg, const int *idsEnd, bool renum) const; MEDCouplingUMesh *getWholeMesh(bool renum) const; - std::vector getDirectUndergroundSingleGeoTypeMeshes() const { return _m_by_types.getPartsWithoutComputation(); } - MEDCoupling1GTUMesh *getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const { return _m_by_types.getPartWithoutComputation(gt); } + std::vector getGeoTypes() const; + std::vector getDirectUndergroundSingleGeoTypeMeshes() const { return _m_by_types.retrievePartsWithoutComputation(); } + MEDCoupling1GTUMesh *getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const { return _m_by_types.retrievePartWithoutComputation(gt); } + DataArrayInt *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const; + DataArrayInt *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const; std::vector getDistributionOfTypes() const { return _m_by_types.getDistributionOfTypes(); } DataArrayInt *getOrCreateAndGetFamilyField(); const DataArrayInt *getFamilyField() const; const DataArrayInt *getNumberField() const; const DataArrayAsciiChar *getNameField() const; const DataArrayInt *getRevNumberField() const; + const PartDefinition *getPartDef(INTERP_KERNEL::NormalizedCellType gt) const; void eraseFamilyField(); void setGroupsFromScratch(const std::vector& ms, std::map& familyIds, - std::map >& groups) throw(INTERP_KERNEL::Exception); - void write(med_idt fid, const char *mName, int mdim) const; + std::map >& groups); + void write(med_idt fid, const std::string& mName, int mdim) const; // void setFamilyArr(DataArrayInt *famArr); void setRenumArr(DataArrayInt *renumArr); @@ -221,6 +244,7 @@ namespace ParaMEDMEM static DataArrayInt *Renumber(const DataArrayInt *renum, const DataArrayInt *da); static MEDCouplingUMesh *Renumber2(const DataArrayInt *renum, MEDCouplingUMesh *m, const int *cellIds); private: + void assignCommonPart(); MEDCouplingUMesh *renumIfNeeded(MEDCouplingUMesh *m, const int *cellIds) const; DataArrayInt *renumIfNeededArr(const DataArrayInt *da) const; void computeRevNum() const;