X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDLoader%2FMEDFileFieldOverView.hxx;h=1eeedd0c33cde9feb403bb0c8e416b3497204ccb;hb=b3e8c56154c10c414f8a75397cc65ffc9c9e9f70;hp=4b864b8ee839dbbaf4bc385e8409090242011049;hpb=39b2aa5074188f7895ed233a0411e4441780a24e;p=tools%2Fmedcoupling.git diff --git a/src/MEDLoader/MEDFileFieldOverView.hxx b/src/MEDLoader/MEDFileFieldOverView.hxx index 4b864b8ee..1eeedd0c3 100644 --- a/src/MEDLoader/MEDFileFieldOverView.hxx +++ b/src/MEDLoader/MEDFileFieldOverView.hxx @@ -23,6 +23,7 @@ #include "MEDCouplingAutoRefCountObjectPtr.hxx" #include "MEDCouplingRefCountObject.hxx" +#include "MEDCoupling1GTUMesh.hxx" #include "NormalizedUnstructuredMesh.hxx" #include "InterpKernelException.hxx" @@ -34,6 +35,9 @@ namespace ParaMEDMEM class DataArrayInt; class MEDCouplingMesh; class MEDFileMesh; + class MEDFileUMesh; + class MEDFileCMesh; + class MEDFileCurveLinearMesh; class MEDFileFieldGlobs; class MEDFileFieldGlobsReal; class MEDFileAnyTypeField1TS; @@ -57,6 +61,103 @@ namespace ParaMEDMEM std::string _name; int _nb_nodes; std::vector< std::vector > _geo_types_distrib; + }; + + class MEDFileField1TSStructItem; + + class MEDMeshMultiLev : public RefCountObject + { + public: + std::size_t getHeapMemorySize() const; + public: + static MEDMeshMultiLev *New(const MEDFileMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities) throw(INTERP_KERNEL::Exception); + static MEDMeshMultiLev *New(const MEDFileMesh *m, const std::vector& levs) throw(INTERP_KERNEL::Exception); + static MEDMeshMultiLev *NewOnlyOnNode(const MEDFileMesh *m, const DataArrayInt *pflOnNode) throw(INTERP_KERNEL::Exception); + void setNodeReduction(const DataArrayInt *nr); + bool isFastlyTheSameStruct(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception); + DataArray *buildDataArray(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs, const DataArray *vals) const throw(INTERP_KERNEL::Exception); + virtual void selectPartOfNodes(const DataArrayInt *pflNodes) throw(INTERP_KERNEL::Exception) = 0; + virtual MEDMeshMultiLev *prepare() const throw(INTERP_KERNEL::Exception) = 0; + protected: + std::string getPflNameOfId(int id) const; + DataArray *constructDataArray(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs, const DataArray *vals) const throw(INTERP_KERNEL::Exception); + protected: + MEDMeshMultiLev(); + MEDMeshMultiLev(const MEDMeshMultiLev& other); + MEDMeshMultiLev(const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); + protected: + std::vector< MEDCouplingAutoRefCountObjectPtr > _pfls; + std::vector< INTERP_KERNEL::NormalizedCellType > _geo_types; + std::vector _nb_entities; + MEDCouplingAutoRefCountObjectPtr _node_reduction; + public: + static const int PARAMEDMEM_2_VTKTYPE_LGTH=34; + static const unsigned char PARAMEDMEM_2_VTKTYPE[PARAMEDMEM_2_VTKTYPE_LGTH]; + }; + + class MEDStructuredMeshMultiLev; + + class MEDUMeshMultiLev : public MEDMeshMultiLev + { + public: + static MEDUMeshMultiLev *New(const MEDFileUMesh *m, const std::vector& levs) throw(INTERP_KERNEL::Exception); + static MEDUMeshMultiLev *New(const MEDFileUMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities) throw(INTERP_KERNEL::Exception); + void selectPartOfNodes(const DataArrayInt *pflNodes) throw(INTERP_KERNEL::Exception); + MEDMeshMultiLev *prepare() const throw(INTERP_KERNEL::Exception); + MEDUMeshMultiLev(const MEDStructuredMeshMultiLev& other, const MEDCouplingAutoRefCountObjectPtr& part); + void buildVTUArrays(DataArrayDouble *& coords, DataArrayByte *&types, DataArrayInt *&cellLocations, DataArrayInt *& cells, DataArrayInt *&faceLocations, DataArrayInt *&faces) const throw(INTERP_KERNEL::Exception); + private: + void reorderNodesIfNecessary(DataArrayDouble *coords, DataArrayInt *nodalConnVTK, DataArrayInt *polyhedNodalConnVTK) const throw(INTERP_KERNEL::Exception); + private: + MEDUMeshMultiLev(const MEDUMeshMultiLev& other); + MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector& levs); + MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); + private: + std::vector< MEDCouplingAutoRefCountObjectPtr > _parts; + }; + + class MEDStructuredMeshMultiLev : public MEDMeshMultiLev + { + public: + void selectPartOfNodes(const DataArrayInt *pflNodes) throw(INTERP_KERNEL::Exception); + virtual std::vector getNodeGridStructure() const throw(INTERP_KERNEL::Exception) = 0; + protected: + MEDStructuredMeshMultiLev(); + MEDStructuredMeshMultiLev(const MEDStructuredMeshMultiLev& other); + MEDStructuredMeshMultiLev(const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); + }; + + class MEDCMeshMultiLev : public MEDStructuredMeshMultiLev + { + public: + static MEDCMeshMultiLev *New(const MEDFileCMesh *m, const std::vector& levs) throw(INTERP_KERNEL::Exception); + static MEDCMeshMultiLev *New(const MEDFileCMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities) throw(INTERP_KERNEL::Exception); + std::vector getNodeGridStructure() const throw(INTERP_KERNEL::Exception); + MEDMeshMultiLev *prepare() const throw(INTERP_KERNEL::Exception); + std::vector< DataArrayDouble * > buildVTUArrays() const throw(INTERP_KERNEL::Exception); + private: + MEDCMeshMultiLev(const MEDCMeshMultiLev& other); + MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector& levs); + MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); + private: + std::vector< MEDCouplingAutoRefCountObjectPtr > _coords; + }; + + class MEDCurveLinearMeshMultiLev : public MEDStructuredMeshMultiLev + { + public: + static MEDCurveLinearMeshMultiLev *New(const MEDFileCurveLinearMesh *m, const std::vector& levs) throw(INTERP_KERNEL::Exception); + static MEDCurveLinearMeshMultiLev *New(const MEDFileCurveLinearMesh *m, const std::vector& gts, const std::vector& pfls , const std::vector& nbEntities) throw(INTERP_KERNEL::Exception); + std::vector getNodeGridStructure() const throw(INTERP_KERNEL::Exception); + MEDMeshMultiLev *prepare() const throw(INTERP_KERNEL::Exception); + void buildVTUArrays(DataArrayDouble *&coords, std::vector& nodeStrct) const throw(INTERP_KERNEL::Exception); + private: + MEDCurveLinearMeshMultiLev(const MEDCurveLinearMeshMultiLev& other); + MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearMesh *m, const std::vector& levs); + MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); + private: + MEDCouplingAutoRefCountObjectPtr _coords; + std::vector _structure; }; class MEDFileField1TSStructItem2 : public RefCountObject @@ -64,19 +165,27 @@ namespace ParaMEDMEM public: MEDFileField1TSStructItem2(); MEDFileField1TSStructItem2(INTERP_KERNEL::NormalizedCellType a, const std::pair& b, const std::string& pfl, const std::string& loc); - void checkWithMeshStructForCells(const MEDFileMeshStruct *mst, const MEDFileFieldGlobs *globs) throw(INTERP_KERNEL::Exception); - void checkWithMeshStructForGaussNE(const MEDFileMeshStruct *mst, const MEDFileFieldGlobs *globs) throw(INTERP_KERNEL::Exception); - void checkWithMeshStructForGaussPT(const MEDFileMeshStruct *mst, const MEDFileFieldGlobs *globs) throw(INTERP_KERNEL::Exception); + void checkWithMeshStructForCells(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs) throw(INTERP_KERNEL::Exception); + void checkWithMeshStructForGaussNE(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs) throw(INTERP_KERNEL::Exception); + void checkWithMeshStructForGaussPT(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs) throw(INTERP_KERNEL::Exception); // std::size_t getHeapMemorySize() const; // + const DataArrayInt *getPfl(const MEDFileFieldGlobsReal *globs) const; INTERP_KERNEL::NormalizedCellType getGeo() const { return _geo_type; } + int getNbEntity() const { return _nb_of_entity; } + const std::pair& getStartStop() const { return _start_end; } std::string getPflName() const; + int getNbOfIntegrationPts(const MEDFileFieldGlobsReal *globs) const; //! warning this method also set _nb_of_entity attribute ! - void checkInRange(int nbOfEntity, int nip, const MEDFileFieldGlobs *globs) throw(INTERP_KERNEL::Exception); + void checkInRange(int nbOfEntity, int nip, const MEDFileFieldGlobsReal *globs) throw(INTERP_KERNEL::Exception); + bool isFastlyEqual(int& startExp, INTERP_KERNEL::NormalizedCellType gt, const char *pflName) const; bool operator==(const MEDFileField1TSStructItem2& other) const throw(INTERP_KERNEL::Exception); - bool isCellSupportEqual(const MEDFileField1TSStructItem2& other) const throw(INTERP_KERNEL::Exception); - static MEDFileField1TSStructItem2 BuildAggregationOf(const std::vector& objs, const MEDFileFieldGlobs *globs) throw(INTERP_KERNEL::Exception); + bool isCellSupportEqual(const MEDFileField1TSStructItem2& other, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception); + bool isNodeSupportEqual(const MEDFileField1TSStructItem2& other, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception); + static MEDFileField1TSStructItem2 BuildAggregationOf(const std::vector& objs, const MEDFileFieldGlobsReal *globs) throw(INTERP_KERNEL::Exception); + public: + static const char NEWLY_CREATED_PFL_NAME[]; private: INTERP_KERNEL::NormalizedCellType _geo_type; std::pair _start_end; @@ -88,8 +197,9 @@ namespace ParaMEDMEM class MEDFileField1TSStructItem : public RefCountObject { public: + MEDFileField1TSStructItem() { } MEDFileField1TSStructItem(TypeOfField a, const std::vector< MEDFileField1TSStructItem2 >& b); - void checkWithMeshStruct(const MEDFileMeshStruct *mst, const MEDFileFieldGlobs *globs) throw(INTERP_KERNEL::Exception); + void checkWithMeshStruct(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs) throw(INTERP_KERNEL::Exception); bool operator==(const MEDFileField1TSStructItem& other) const throw(INTERP_KERNEL::Exception); std::size_t getHeapMemorySize() const; bool isEntityCell() const; @@ -98,11 +208,13 @@ namespace ParaMEDMEM std::size_t getNumberOfItems() const { return _items.size(); } const MEDFileField1TSStructItem2& operator[](std::size_t i) const throw(INTERP_KERNEL::Exception); // - bool isCellSupportEqual(const MEDFileField1TSStructItem& other) const throw(INTERP_KERNEL::Exception); - MEDFileField1TSStructItem simplifyMeOnCellEntity(const MEDFileFieldGlobs *globs) const throw(INTERP_KERNEL::Exception); - bool isCompatibleWithNodesDiscr(const MEDFileField1TSStructItem& other, const MEDFileMeshStruct *meshSt, const MEDFileFieldGlobs *globs) const throw(INTERP_KERNEL::Exception); + bool isCellSupportEqual(const MEDFileField1TSStructItem& other, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception); + bool isNodeSupportEqual(const MEDFileField1TSStructItem& other, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception); + MEDFileField1TSStructItem simplifyMeOnCellEntity(const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception); + bool isCompatibleWithNodesDiscr(const MEDFileField1TSStructItem& other, const MEDFileMeshStruct *meshSt, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception); bool isFullyOnOneLev(const MEDFileMeshStruct *meshSt, int& theFirstLevFull) const throw(INTERP_KERNEL::Exception); - MEDCouplingMesh *buildFromScratchDataSetSupportOnCells(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception); + MEDMeshMultiLev *buildFromScratchDataSetSupportOnCells(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception); + static MEDFileField1TSStructItem BuildItemFrom(const MEDFileAnyTypeField1TS *ref, const MEDFileMeshStruct *meshSt); private: bool _computed; TypeOfField _type; @@ -113,15 +225,15 @@ namespace ParaMEDMEM { public: static MEDFileField1TSStruct *New(const MEDFileAnyTypeField1TS *ref, MEDFileMeshStruct *mst) throw(INTERP_KERNEL::Exception); - void checkWithMeshStruct(MEDFileMeshStruct *mst, const MEDFileFieldGlobs *globs) throw(INTERP_KERNEL::Exception); + void checkWithMeshStruct(MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs) throw(INTERP_KERNEL::Exception); std::size_t getHeapMemorySize() const; bool isEqualConsideringThePast(const MEDFileAnyTypeField1TS *other, const MEDFileMeshStruct *mst) const throw(INTERP_KERNEL::Exception); bool isSupportSameAs(const MEDFileAnyTypeField1TS *other, const MEDFileMeshStruct *meshSt) throw(INTERP_KERNEL::Exception); bool isCompatibleWithNodesDiscr(const MEDFileAnyTypeField1TS *other, const MEDFileMeshStruct *meshSt) throw(INTERP_KERNEL::Exception); - MEDCouplingMesh *buildFromScratchDataSetSupport(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception); + MEDMeshMultiLev *buildFromScratchDataSetSupport(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception); + bool isDataSetSupportFastlyEqualTo(const MEDFileField1TSStruct& other, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception); private: MEDFileField1TSStruct(const MEDFileAnyTypeField1TS *ref, MEDFileMeshStruct *mst); - static MEDFileField1TSStructItem BuildItemFrom(const MEDFileAnyTypeField1TS *ref, const MEDFileMeshStruct *meshSt); bool presenceOfCellDiscr(int& pos) const throw(INTERP_KERNEL::Exception); bool presenceOfPartialNodeDiscr(int& pos) const throw(INTERP_KERNEL::Exception); private: @@ -131,14 +243,14 @@ namespace ParaMEDMEM class MEDFileFastCellSupportComparator : public RefCountObject { public: - static MEDFileFastCellSupportComparator *New(const MEDFileMesh *m, const MEDFileAnyTypeFieldMultiTS *ref) throw(INTERP_KERNEL::Exception); - MEDCouplingMesh *buildFromScratchDataSetSupport(int timeStepId, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception); - bool isDataSetSupportEqualToThePreviousOne(int timeStepId) const throw(INTERP_KERNEL::Exception); + static MEDFileFastCellSupportComparator *New(const MEDFileMeshStruct *m, const MEDFileAnyTypeFieldMultiTS *ref) throw(INTERP_KERNEL::Exception); + MEDMeshMultiLev *buildFromScratchDataSetSupport(int timeStepId, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception); + bool isDataSetSupportEqualToThePreviousOne(int timeStepId, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception); bool isEqual(const MEDFileAnyTypeFieldMultiTS *other) throw(INTERP_KERNEL::Exception); bool isCompatibleWithNodesDiscr(const MEDFileAnyTypeFieldMultiTS *other) throw(INTERP_KERNEL::Exception); std::size_t getHeapMemorySize() const; private: - MEDFileFastCellSupportComparator(const MEDFileMesh *m, const MEDFileAnyTypeFieldMultiTS *ref); + MEDFileFastCellSupportComparator(const MEDFileMeshStruct *m, const MEDFileAnyTypeFieldMultiTS *ref); private: MEDCouplingAutoRefCountObjectPtr _mesh_comp; std::vector< MEDCouplingAutoRefCountObjectPtr > _f1ts_cmps;