X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDCoupling%2FMEDCouplingStructuredMesh.hxx;h=2982f9e64e515c5e05e9cbc0c91916286b161e21;hb=b219559763498c4bd10c730cd3d2c62b1eed45db;hp=07c73d71ee4ef0ab43c692cf2bb153caaf902a03;hpb=c8525740e5eb8a5f7de6e330b0dea007fbb182ec;p=tools%2Fmedcoupling.git diff --git a/src/MEDCoupling/MEDCouplingStructuredMesh.hxx b/src/MEDCoupling/MEDCouplingStructuredMesh.hxx index 07c73d71e..2982f9e64 100644 --- a/src/MEDCoupling/MEDCouplingStructuredMesh.hxx +++ b/src/MEDCoupling/MEDCouplingStructuredMesh.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 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 // 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 @@ -24,45 +24,101 @@ #include "MEDCoupling.hxx" #include "MEDCouplingMesh.hxx" -namespace ParaMEDMEM +namespace MEDCoupling { - class MEDCOUPLING_EXPORT MEDCouplingStructuredMesh : public MEDCouplingMesh + class MEDCoupling1SGTUMesh; + + class MEDCouplingStructuredMesh : public MEDCouplingMesh { public: - INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const; - std::set getAllGeoTypes() const; - int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const; - DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception); - DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception); - DataArrayInt *computeNbOfFacesPerCell() const throw(INTERP_KERNEL::Exception); - static void GetPosFromId(int nodeId, int meshDim, const int *split, int *res); - static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception); - void getNodeIdsOfCell(int cellId, std::vector& conn) const; - std::size_t getHeapMemorySize() const; - void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception); - bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const throw(INTERP_KERNEL::Exception); + MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(mcIdType cellId) const; + MEDCOUPLING_EXPORT std::set getAllGeoTypes() const; + MEDCOUPLING_EXPORT mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const; + MEDCOUPLING_EXPORT DataArrayIdType *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const; + MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfNodesPerCell() const; + MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfFacesPerCell() const; + MEDCOUPLING_EXPORT DataArrayIdType *computeEffectiveNbOfNodesPerCell() const; + MEDCOUPLING_EXPORT std::vector getLocationFromCellId(mcIdType cellId) const; + MEDCOUPLING_EXPORT std::vector getLocationFromNodeId(mcIdType nodeId) const; + MEDCOUPLING_EXPORT static void GetPosFromId(mcIdType eltId, int meshDim, const mcIdType *split, mcIdType *res); + MEDCOUPLING_EXPORT static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension( int meshDim); + MEDCOUPLING_EXPORT void getNodeIdsOfCell(mcIdType cellId, std::vector& conn) const; + MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingMesh *other); + MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const; //tools - std::vector getDistributionOfTypes() const throw(INTERP_KERNEL::Exception); - DataArrayInt *checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const throw(INTERP_KERNEL::Exception); - void splitProfilePerType(const DataArrayInt *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType) const throw(INTERP_KERNEL::Exception); - MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception); - MEDCouplingMesh *buildPart(const int *start, const int *end) const; - MEDCouplingMesh *buildPartAndReduceNodes(const int *start, const int *end, DataArrayInt*& arr) const; - DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception); - MEDCouplingFieldDouble *buildOrthogonalField() const; - void fill1DUnstructuredMesh(MEDCouplingUMesh *m) const; - void fill2DUnstructuredMesh(MEDCouplingUMesh *m) const; - void fill3DUnstructuredMesh(MEDCouplingUMesh *m) const; + MEDCOUPLING_EXPORT std::vector getDistributionOfTypes() const; + MEDCOUPLING_EXPORT DataArrayIdType *checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const; + MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayIdType *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType, bool smartPflKiller=true) const; + MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *build1SGTUnstructured() const; + MEDCOUPLING_EXPORT MEDCouplingUMesh *buildUnstructured() const; + MEDCOUPLING_EXPORT MEDCouplingMesh *buildPart(const mcIdType *start, const mcIdType *end) const; + MEDCOUPLING_EXPORT MEDCouplingMesh *buildPartAndReduceNodes(const mcIdType *start, const mcIdType *end, DataArrayIdType*& arr) const; + MEDCOUPLING_EXPORT DataArrayIdType *simplexize(int policy); + MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildOrthogonalField() const; + MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const; //some useful methods - int getCellIdFromPos(int i, int j, int k) const; - int getNodeIdFromPos(int i, int j, int k) const; - virtual void getNodeGridStructure(int *res) const = 0; - virtual void getSplitCellValues(int *res) const = 0; - virtual void getSplitNodeValues(int *res) const = 0; + MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *build1SGTSubLevelMesh() const; + MEDCOUPLING_EXPORT mcIdType getCellIdFromPos(mcIdType i, mcIdType j, mcIdType k) const; + MEDCOUPLING_EXPORT mcIdType getNodeIdFromPos(mcIdType i, mcIdType j, mcIdType k) const; + MEDCOUPLING_EXPORT mcIdType getNumberOfCells() const; + MEDCOUPLING_EXPORT mcIdType getNumberOfNodes() const; + MEDCOUPLING_EXPORT int getMeshDimension() const; + MEDCOUPLING_EXPORT mcIdType getNumberOfCellsOfSubLevelMesh() const; + MEDCOUPLING_EXPORT int getSpaceDimensionOnNodeStruct() const; + MEDCOUPLING_EXPORT virtual void getNodeGridStructure(mcIdType *res) const = 0; + MEDCOUPLING_EXPORT virtual void getSplitCellValues(mcIdType *res) const; + MEDCOUPLING_EXPORT virtual void getSplitNodeValues(mcIdType *res) const; + MEDCOUPLING_EXPORT virtual std::vector getNodeGridStructure() const = 0; + MEDCOUPLING_EXPORT std::vector getCellGridStructure() const; + MEDCOUPLING_EXPORT double computeSquareness() const; + MEDCOUPLING_EXPORT virtual MEDCouplingStructuredMesh *buildStructuredSubPart(const std::vector< std::pair >& cellPart) const = 0; + MEDCOUPLING_EXPORT static std::vector GetSplitVectFromStruct(const std::vector& strct); + MEDCOUPLING_EXPORT static bool IsPartStructured(const mcIdType *startIds, const mcIdType *stopIds, const std::vector& st, std::vector< std::pair >& partCompactFormat); + MEDCOUPLING_EXPORT static std::vector GetDimensionsFromCompactFrmt(const std::vector< std::pair >& partCompactFormat); + MEDCOUPLING_EXPORT static std::vector< std::pair > GetCompactFrmtFromDimensions(const std::vector& dims); + MEDCOUPLING_EXPORT static std::vector< std::pair > IntersectRanges(const std::vector< std::pair >& r1, const std::vector< std::pair >& r2); + MEDCOUPLING_EXPORT static bool AreRangesIntersect(const std::vector< std::pair >& r1, const std::vector< std::pair >& r2); + MEDCOUPLING_EXPORT static void SwitchOnIdsFrom(const std::vector& st, const std::vector< std::pair >& partCompactFormat, std::vector& vectToSwitchOn); + MEDCOUPLING_EXPORT static void ExtractFieldOfBoolFrom(const std::vector& st, const std::vector& fieldOfBool, const std::vector< std::pair >& partCompactFormat, std::vector& fieldOut); + MEDCOUPLING_EXPORT static DataArrayDouble *ExtractFieldOfDoubleFrom(const std::vector& st, const DataArrayDouble *fieldOfDbl, const std::vector< std::pair >& partCompactFormat); + MEDCOUPLING_EXPORT static void AssignPartOfFieldOfDoubleUsing(const std::vector& st, DataArrayDouble *fieldOfDbl, const std::vector< std::pair >& partCompactFormat, const DataArrayDouble *other); + MEDCOUPLING_EXPORT static void ChangeReferenceFromGlobalOfCompactFrmt(const std::vector< std::pair >& bigInAbs, const std::vector< std::pair >& partOfBigInAbs, std::vector< std::pair >& partOfBigRelativeToBig, bool check=true); + MEDCOUPLING_EXPORT static void ChangeReferenceToGlobalOfCompactFrmt(const std::vector< std::pair >& bigInAbs, const std::vector< std::pair >& partOfBigRelativeToBig, std::vector< std::pair >& partOfBigInAbs, bool check=true); + MEDCOUPLING_EXPORT static std::vector< std::pair > TranslateCompactFrmt(const std::vector< std::pair >& part, const std::vector& translation); + MEDCOUPLING_EXPORT static std::vector FindTranslationFrom(const std::vector< std::pair >& startingFrom, const std::vector< std::pair >& goingTo); + MEDCOUPLING_EXPORT static DataArrayIdType *BuildExplicitIdsFrom(const std::vector& st, const std::vector< std::pair >& partCompactFormat); + MEDCOUPLING_EXPORT static void MultiplyPartOf(const std::vector& st, const std::vector< std::pair >& part, double factor, DataArrayDouble *da); + MEDCOUPLING_EXPORT static void MultiplyPartOfByGhost(const std::vector& st, const std::vector< std::pair >& part, mcIdType ghostSize, double factor, DataArrayDouble *da); + MEDCOUPLING_EXPORT static void PutInGhostFormat(mcIdType ghostSize, const std::vector& st, const std::vector< std::pair >& part, std::vector& stWithGhost, std::vector< std::pair >&partWithGhost); + MEDCOUPLING_EXPORT static void ApplyGhostOnCompactFrmt(std::vector< std::pair >& partBeforeFact, mcIdType ghostSize); + MEDCOUPLING_EXPORT static DataArrayIdType *Build1GTNodalConnectivity(const mcIdType *nodeStBg, const mcIdType *nodeStEnd); + MEDCOUPLING_EXPORT static DataArrayIdType *Build1GTNodalConnectivityOfSubLevelMesh(const mcIdType *nodeStBg, const mcIdType *nodeStEnd); + MEDCOUPLING_EXPORT static DataArrayIdType *ComputeCornersGhost(const std::vector& st, mcIdType ghostLev); + MEDCOUPLING_EXPORT static mcIdType DeduceNumberOfGivenRangeInCompactFrmt(const std::vector< std::pair >& partCompactFormat); + MEDCOUPLING_EXPORT static mcIdType DeduceNumberOfGivenStructure(const std::vector& st); + MEDCOUPLING_EXPORT static void FindTheWidestAxisOfGivenRangeInCompactFrmt(const std::vector< std::pair >& partCompactFormat, int& axisId, mcIdType& sizeOfRange); + MEDCOUPLING_EXPORT static mcIdType FindMinimalPartOf(mcIdType minPatchLgth, const std::vector& st, const std::vector& crit, std::vector& reducedCrit, std::vector< std::pair >& partCompactFormat); + MEDCOUPLING_EXPORT static std::vector< std::vector > ComputeSignaturePerAxisOf(const std::vector& st, const std::vector& crit); + private: + static mcIdType GetNumberOfCellsOfSubLevelMesh(const std::vector& cgs, int mdim); + static void GetReverseNodalConnectivity1(const std::vector& ngs, DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx); + static void GetReverseNodalConnectivity2(const std::vector& ngs, DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx); + static void GetReverseNodalConnectivity3(const std::vector& ngs, DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx); + static DataArrayIdType *Build1GTNodalConnectivity1D(const mcIdType *nodeStBg); + static DataArrayIdType *Build1GTNodalConnectivity2D(const mcIdType *nodeStBg); + static DataArrayIdType *Build1GTNodalConnectivity3D(const mcIdType *nodeStBg); + static DataArrayIdType *Build1GTNodalConnectivityOfSubLevelMesh2D(const mcIdType *nodeStBg); + static DataArrayIdType *Build1GTNodalConnectivityOfSubLevelMesh3D(const mcIdType *nodeStBg); + static mcIdType FindMinimalPartOf1D(const std::vector& st, const std::vector& crit, std::vector< std::pair >& partCompactFormat); + static mcIdType FindMinimalPartOf2D(const std::vector& st, const std::vector& crit, std::vector< std::pair >& partCompactFormat); + static mcIdType FindMinimalPartOf3D(const std::vector& st, const std::vector& crit, std::vector< std::pair >& partCompactFormat); + protected: + static int ZipNodeStructure(const mcIdType *nodeStBg, const mcIdType *nodeStEnd, mcIdType zipNodeSt[3]); protected: - MEDCouplingStructuredMesh(); - MEDCouplingStructuredMesh(const MEDCouplingStructuredMesh& other, bool deepCpy); - ~MEDCouplingStructuredMesh(); + MEDCOUPLING_EXPORT MEDCouplingStructuredMesh(); + MEDCOUPLING_EXPORT MEDCouplingStructuredMesh(const MEDCouplingStructuredMesh& other, bool deepCpy); + MEDCOUPLING_EXPORT ~MEDCouplingStructuredMesh(); }; }