X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDLoader%2FMEDFileFieldOverView.hxx;h=19c83992595a3c96015321d945177e770aaec978;hb=844b1a4785909ad42206965838a6d0f826dfb5c1;hp=b6d0da38c232eb5110f801d5582b2f28ea5524eb;hpb=659f8c67d0348350e12fde38fe8c4de1ff95dffe;p=tools%2Fmedcoupling.git diff --git a/src/MEDLoader/MEDFileFieldOverView.hxx b/src/MEDLoader/MEDFileFieldOverView.hxx index b6d0da38c..19c839925 100644 --- a/src/MEDLoader/MEDFileFieldOverView.hxx +++ b/src/MEDLoader/MEDFileFieldOverView.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2014 CEA/DEN, EDF R&D +// Copyright (C) 2007-2019 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 @@ -23,7 +23,7 @@ #include "MEDLoaderDefines.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include "MEDCouplingRefCountObject.hxx" #include "MEDCoupling1GTUMesh.hxx" @@ -32,7 +32,7 @@ #include -namespace ParaMEDMEM +namespace MEDCoupling { class DataArrayInt; class MEDCouplingMesh; @@ -51,13 +51,16 @@ namespace ParaMEDMEM public: MEDLOADER_EXPORT static MEDFileMeshStruct *New(const MEDFileMesh *mesh); std::size_t getHeapMemorySizeWithoutChildren() const; - std::vector getDirectChildren() const; + std::vector getDirectChildrenWithNull() const; const MEDFileMesh *getTheMesh() const { return _mesh; } int getNumberOfNodes() const { return _nb_nodes; } + bool doesManageGeoType(INTERP_KERNEL::NormalizedCellType t) const; int getNumberOfElemsOfGeoType(INTERP_KERNEL::NormalizedCellType t) const; int getLevelOfGeoType(INTERP_KERNEL::NormalizedCellType t) const; int getNumberOfLevs() const; int getNumberOfGeoTypesInLev(int relativeLev) const; + // non const methods + void appendIfImplicitType(INTERP_KERNEL::NormalizedCellType t); private: MEDFileMeshStruct(const MEDFileMesh *mesh); private: @@ -66,30 +69,32 @@ namespace ParaMEDMEM int _nb_nodes; std::vector< std::vector > _geo_types_distrib; }; - + class MEDFileField1TSStructItem; - + class MEDMeshMultiLev : public RefCountObject { public: std::size_t getHeapMemorySizeWithoutChildren() const; - std::vector getDirectChildren() const; + std::vector getDirectChildrenWithNull() const; public: static MEDMeshMultiLev *New(const MEDFileMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); static MEDMeshMultiLev *New(const MEDFileMesh *m, const std::vector& levs); static MEDMeshMultiLev *NewOnlyOnNode(const MEDFileMesh *m, const DataArrayInt *pflOnNode); void setNodeReduction(const DataArrayInt *nr); + void setCellReduction(const DataArrayInt *cr); bool isFastlyTheSameStruct(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs) const; MEDLOADER_EXPORT DataArray *buildDataArray(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs, const DataArray *vals) const; MEDLOADER_EXPORT void retrieveFamilyIdsOnCells(DataArrayInt *& famIds, bool& isWithoutCopy) const; MEDLOADER_EXPORT void retrieveNumberIdsOnCells(DataArrayInt *& numIds, bool& isWithoutCopy) const; MEDLOADER_EXPORT void retrieveFamilyIdsOnNodes(DataArrayInt *& famIds, bool& isWithoutCopy) const; MEDLOADER_EXPORT void retrieveNumberIdsOnNodes(DataArrayInt *& numIds, bool& isWithoutCopy) const; + MEDLOADER_EXPORT DataArrayInt *retrieveGlobalNodeIdsIfAny() const; MEDLOADER_EXPORT std::vector< INTERP_KERNEL::NormalizedCellType > getGeoTypes() const; - void setFamilyIdsOnCells(DataArrayInt *famIds, bool isNoCopy); - void setNumberIdsOnCells(DataArrayInt *numIds, bool isNoCopy); - void setFamilyIdsOnNodes(DataArrayInt *famIds, bool isNoCopy); - void setNumberIdsOnNodes(DataArrayInt *numIds, bool isNoCopy); + void setFamilyIdsOnCells(DataArrayInt *famIds); + void setNumberIdsOnCells(DataArrayInt *numIds); + void setFamilyIdsOnNodes(DataArrayInt *famIds); + void setNumberIdsOnNodes(DataArrayInt *numIds); virtual void selectPartOfNodes(const DataArrayInt *pflNodes) = 0; virtual MEDMeshMultiLev *prepare() const = 0; int getNumberOfCells(INTERP_KERNEL::NormalizedCellType t) const; @@ -99,31 +104,29 @@ namespace ParaMEDMEM DataArray *constructDataArray(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs, const DataArray *vals) const; virtual void appendVertices(const DataArrayInt *verticesToAdd, DataArrayInt *nr); protected: - MEDMeshMultiLev(); + MEDMeshMultiLev(const MEDFileMesh *mesh); MEDMeshMultiLev(const MEDMeshMultiLev& other); - MEDMeshMultiLev(int nbNodes, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); + MEDMeshMultiLev(const MEDFileMesh *mesh, int nbNodes, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); protected: - std::vector< MEDCouplingAutoRefCountObjectPtr > _pfls; + const MEDFileMesh *_mesh; + std::vector< MCAuto > _pfls; std::vector< INTERP_KERNEL::NormalizedCellType > _geo_types; std::vector _nb_entities; - MEDCouplingAutoRefCountObjectPtr _node_reduction; + MCAuto _node_reduction; int _nb_nodes; // - MEDCouplingAutoRefCountObjectPtr _cell_fam_ids; - bool _cell_fam_ids_nocpy; - MEDCouplingAutoRefCountObjectPtr _cell_num_ids; - bool _cell_num_ids_nocpy; - MEDCouplingAutoRefCountObjectPtr _node_fam_ids; - bool _node_fam_ids_nocpy; - MEDCouplingAutoRefCountObjectPtr _node_num_ids; - bool _node_num_ids_nocpy; + MCAuto _cell_fam_ids; + MCAuto _cell_num_ids; + MCAuto _node_fam_ids; + MCAuto _node_num_ids; public: - static const int PARAMEDMEM_2_VTKTYPE_LGTH=34; - static const unsigned char PARAMEDMEM_2_VTKTYPE[PARAMEDMEM_2_VTKTYPE_LGTH]; + MEDLOADER_EXPORT static const int PARAMEDMEM_2_VTKTYPE_LGTH=34; + MEDLOADER_EXPORT static const unsigned char PARAMEDMEM_2_VTKTYPE[PARAMEDMEM_2_VTKTYPE_LGTH]; + MEDLOADER_EXPORT static const unsigned char HEXA27_PERM_ARRAY[27]; }; - + class MEDStructuredMeshMultiLev; - + class MEDUMeshMultiLev : public MEDMeshMultiLev { public: @@ -131,20 +134,20 @@ namespace ParaMEDMEM static MEDUMeshMultiLev *New(const MEDFileUMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); void selectPartOfNodes(const DataArrayInt *pflNodes); MEDMeshMultiLev *prepare() const; - MEDUMeshMultiLev(const MEDStructuredMeshMultiLev& other, const MEDCouplingAutoRefCountObjectPtr& part); + MEDUMeshMultiLev(const MEDStructuredMeshMultiLev& other, const MCAuto& part); MEDLOADER_EXPORT bool buildVTUArrays(DataArrayDouble *& coords, DataArrayByte *&types, DataArrayInt *&cellLocations, DataArrayInt *& cells, DataArrayInt *&faceLocations, DataArrayInt *&faces) const; protected: void appendVertices(const DataArrayInt *verticesToAdd, DataArrayInt *nr); private: - void reorderNodesIfNecessary(MEDCouplingAutoRefCountObjectPtr& coords, DataArrayInt *nodalConnVTK, DataArrayInt *polyhedNodalConnVTK) const; + void reorderNodesIfNecessary(MCAuto& coords, DataArrayInt *nodalConnVTK, DataArrayInt *polyhedNodalConnVTK) const; 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; + std::vector< MCAuto > _parts; //! this attribute is used only for mesh with no cells but having coordinates. For classical umeshes those pointer is equal to pointer of coordinates of instances in this->_parts. - MEDCouplingAutoRefCountObjectPtr _coords; + MCAuto _coords; }; class MEDStructuredMeshMultiLev : public MEDMeshMultiLev @@ -153,14 +156,21 @@ namespace ParaMEDMEM void selectPartOfNodes(const DataArrayInt *pflNodes); virtual std::vector getNodeGridStructure() const = 0; protected: - MEDStructuredMeshMultiLev(); MEDStructuredMeshMultiLev(const MEDStructuredMeshMultiLev& other); MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, const std::vector& lev); MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, int nbOfNodes, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); + void dealWithImplicitUnstructuredMesh(const MEDFileMesh *m); + protected: + void moveFaceToCell() const; + bool prepareForImplicitUnstructuredMeshCase(MEDMeshMultiLev *&ret) const; + private: + void initStdFieldOfIntegers(const MEDFileStructuredMesh *m); protected: bool _is_internal; + MCAuto _face_fam_ids; + MCAuto _face_num_ids; }; - + class MEDCMeshMultiLev : public MEDStructuredMeshMultiLev { public: @@ -174,7 +184,7 @@ namespace ParaMEDMEM 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; + std::vector< MCAuto > _coords; }; class MEDCurveLinearMeshMultiLev : public MEDStructuredMeshMultiLev @@ -190,7 +200,7 @@ namespace ParaMEDMEM 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; + MCAuto _coords; std::vector _structure; }; @@ -204,7 +214,7 @@ namespace ParaMEDMEM void checkWithMeshStructForGaussPT(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs); // MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDLOADER_EXPORT std::vector getDirectChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; // const DataArrayInt *getPfl(const MEDFileFieldGlobsReal *globs) const; INTERP_KERNEL::NormalizedCellType getGeo() const { return _geo_type; } @@ -215,7 +225,7 @@ namespace ParaMEDMEM //! warning this method also set _nb_of_entity attribute ! void checkInRange(int nbOfEntity, int nip, const MEDFileFieldGlobsReal *globs); bool isFastlyEqual(int& startExp, INTERP_KERNEL::NormalizedCellType gt, const std::string& pflName) const; - bool operator==(const MEDFileField1TSStructItem2& other) const throw(INTERP_KERNEL::Exception); + bool operator==(const MEDFileField1TSStructItem2& other) const; bool isCellSupportEqual(const MEDFileField1TSStructItem2& other, const MEDFileFieldGlobsReal *globs) const; bool isNodeSupportEqual(const MEDFileField1TSStructItem2& other, const MEDFileFieldGlobsReal *globs) const; static MEDFileField1TSStructItem2 BuildAggregationOf(const std::vector& objs, const MEDFileFieldGlobsReal *globs); @@ -224,7 +234,7 @@ namespace ParaMEDMEM private: INTERP_KERNEL::NormalizedCellType _geo_type; std::pair _start_end; - MEDCouplingAutoRefCountObjectPtr _pfl; + MCAuto _pfl; std::string _loc; int _nb_of_entity; }; @@ -232,17 +242,17 @@ namespace ParaMEDMEM class MEDFileField1TSStructItem : public BigMemoryObject { public: - MEDFileField1TSStructItem() { } + MEDFileField1TSStructItem():_computed(false),_type(ON_CELLS) { } MEDFileField1TSStructItem(TypeOfField a, const std::vector< MEDFileField1TSStructItem2 >& b); void checkWithMeshStruct(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs); - bool operator==(const MEDFileField1TSStructItem& other) const throw(INTERP_KERNEL::Exception); + bool operator==(const MEDFileField1TSStructItem& other) const; MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDLOADER_EXPORT std::vector getDirectChildren() const; + MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; bool isEntityCell() const; bool isComputed() const { return _computed; } TypeOfField getType() const { return _type; } std::size_t getNumberOfItems() const { return _items.size(); } - const MEDFileField1TSStructItem2& operator[](std::size_t i) const throw(INTERP_KERNEL::Exception); + const MEDFileField1TSStructItem2& operator[](std::size_t i) const; // bool isCellSupportEqual(const MEDFileField1TSStructItem& other, const MEDFileFieldGlobsReal *globs) const; bool isNodeSupportEqual(const MEDFileField1TSStructItem& other, const MEDFileFieldGlobsReal *globs) const; @@ -264,7 +274,7 @@ namespace ParaMEDMEM static MEDFileField1TSStruct *New(const MEDFileAnyTypeField1TS *ref, MEDFileMeshStruct *mst); void checkWithMeshStruct(MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs); std::size_t getHeapMemorySizeWithoutChildren() const; - std::vector getDirectChildren() const; + std::vector getDirectChildrenWithNull() const; bool isEqualConsideringThePast(const MEDFileAnyTypeField1TS *other, const MEDFileMeshStruct *mst) const; bool isSupportSameAs(const MEDFileAnyTypeField1TS *other, const MEDFileMeshStruct *meshSt); bool isCompatibleWithNodesDiscr(const MEDFileAnyTypeField1TS *other, const MEDFileMeshStruct *meshSt); @@ -290,12 +300,12 @@ namespace ParaMEDMEM bool isEqual(const MEDFileAnyTypeFieldMultiTS *other); bool isCompatibleWithNodesDiscr(const MEDFileAnyTypeFieldMultiTS *other); std::size_t getHeapMemorySizeWithoutChildren() const; - std::vector getDirectChildren() const; + std::vector getDirectChildrenWithNull() const; private: MEDFileFastCellSupportComparator(const MEDFileMeshStruct *m, const MEDFileAnyTypeFieldMultiTS *ref); private: - MEDCouplingAutoRefCountObjectPtr _mesh_comp; - std::vector< MEDCouplingAutoRefCountObjectPtr > _f1ts_cmps; + MCAuto _mesh_comp; + std::vector< MCAuto > _f1ts_cmps; }; }