From: Anthony Geay Date: Fri, 26 Feb 2021 15:35:52 +0000 (+0100) Subject: Get rid of tab introduced in 7fef2459b44 X-Git-Tag: V9_7_0a1~20 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=41e02428a2a3d377cf7476b1e315822bcdc9ae45;p=tools%2Fmedcoupling.git Get rid of tab introduced in 7fef2459b44 --- diff --git a/src/MEDLoader/MeshFormatReader.hxx b/src/MEDLoader/MeshFormatReader.hxx index 9f55a46bd..9bd822e42 100644 --- a/src/MEDLoader/MeshFormatReader.hxx +++ b/src/MEDLoader/MeshFormatReader.hxx @@ -41,161 +41,165 @@ namespace MEDCoupling { -class DataArrayDouble; -class DataArrayInt; -class MEDFileData; -class MEDFileFields; -class MEDFileFieldMultiTS; -class MEDFileUMesh; -class MEDCouplingUMesh; - - -struct MeshFormatElement { - MeshFormatElement(int type, int id=0):_type(type), _id(id) {} + class DataArrayDouble; + class DataArrayInt; + class MEDFileData; + class MEDFileFields; + class MEDFileFieldMultiTS; + class MEDFileUMesh; + class MEDCouplingUMesh; + + struct MeshFormatElement + { + MeshFormatElement(int type, int id = 0) : _type(type), _id(id) {} int _type; int _id; - inline friend bool operator==(const MeshFormatElement& a, const MeshFormatElement&b ) { - return ((a._type == b._type) && (a._id == b._id)); + inline friend bool operator==(const MeshFormatElement &a, const MeshFormatElement &b) + { + return ((a._type == b._type) && (a._id == b._id)); } -}; + }; -struct MeshFormatFamily { + struct MeshFormatFamily + { - std::map * > _meshFormatFams; - std::map * > _meshFormatFams_0; - std::map * > _meshFormatFams_1; - std::map * > _meshFormatFams_2; - std::map * > _meshFormatFamsNodes; + std::map *> _meshFormatFams; + std::map *> _meshFormatFams_0; + std::map *> _meshFormatFams_1; + std::map *> _meshFormatFams_2; + std::map *> _meshFormatFamsNodes; -public: + public: void insert(std::pair addToFamily, int dimRelMax) { - insertPairInMap(_meshFormatFams, addToFamily); - insertPairInMap(getMapAtLevel(dimRelMax), addToFamily); + insertPairInMap(_meshFormatFams, addToFamily); + insertPairInMap(getMapAtLevel(dimRelMax), addToFamily); } -private: - void insertPairInMap(std::map * >& aMap, std::pair addToFamily) - { - std::map * >::iterator it = aMap.find(addToFamily.first); - if (it!= aMap.end()) - { - aMap[addToFamily.first]->push_back(addToFamily.second); - } - else - { - std::vector * tmpVec = new std::vector ; - tmpVec->push_back(addToFamily.second); - aMap.insert(std::pair * > (addToFamily.first, tmpVec) ); - - } + private: + void insertPairInMap(std::map *> &aMap, std::pair addToFamily) + { + std::map *>::iterator it = aMap.find(addToFamily.first); + if (it != aMap.end()) + { + aMap[addToFamily.first]->push_back(addToFamily.second); + } + else + { + std::vector *tmpVec = new std::vector; + tmpVec->push_back(addToFamily.second); + aMap.insert(std::pair *>(addToFamily.first, tmpVec)); + } } -public: + + public: void remove(std::pair removeFromFamily, int dimRelMax) { - removePairFromMap(_meshFormatFams, removeFromFamily); - removePairFromMap(getMapAtLevel(dimRelMax), removeFromFamily); - + removePairFromMap(_meshFormatFams, removeFromFamily); + removePairFromMap(getMapAtLevel(dimRelMax), removeFromFamily); } -private: - void removePairFromMap(std::map * > & aMap, const std::pair removeFromFamily) + + private: + void removePairFromMap(std::map *> &aMap, const std::pair removeFromFamily) { - if (!aMap.size() ) return; - std::map * >::iterator itTmp = aMap.find(removeFromFamily.first); - if (itTmp == aMap.end()) return; - else - { - std::vector * tmpVec2 = aMap[removeFromFamily.first]; -#if __GNUC_PREREQ(4,9) - std::vector ::const_iterator itt2; + if (!aMap.size()) + return; + std::map *>::iterator itTmp = aMap.find(removeFromFamily.first); + if (itTmp == aMap.end()) + return; + else + { + std::vector *tmpVec2 = aMap[removeFromFamily.first]; +#if __GNUC_PREREQ(4, 9) + std::vector::const_iterator itt2; #else - std::vector ::iterator itt2; + std::vector::iterator itt2; #endif - const MeshFormatElement e = removeFromFamily.second; - itt2 = std::find(tmpVec2->begin(), tmpVec2->end(), e); - if (itt2 != tmpVec2->end()) - tmpVec2->erase(itt2); - - if (!tmpVec2->size()) - { - delete tmpVec2; - aMap.erase(removeFromFamily.first); - } + const MeshFormatElement e = removeFromFamily.second; + itt2 = std::find(tmpVec2->begin(), tmpVec2->end(), e); + if (itt2 != tmpVec2->end()) + tmpVec2->erase(itt2); + + if (!tmpVec2->size()) + { + delete tmpVec2; + aMap.erase(removeFromFamily.first); } + } } -public: - std::map * > & getMapAtLevel(int dimRelMax) + + public: + std::map *> &getMapAtLevel(int dimRelMax) { - switch(dimRelMax) - { - case 0 : - return _meshFormatFams_0; - break; - case -1 : - return _meshFormatFams_1; - break; - case -2 : - return _meshFormatFams_2; - break; - case 1 : - return _meshFormatFamsNodes; - break; - } + switch (dimRelMax) + { + case 0: + return _meshFormatFams_0; + break; + case -1: + return _meshFormatFams_1; + break; + case -2: + return _meshFormatFams_2; + break; + case 1: + return _meshFormatFamsNodes; + break; + } } -public: + + public: ~MeshFormatFamily() { - freeMap(_meshFormatFams); - freeMap(_meshFormatFams_0); - freeMap(_meshFormatFams_1); - freeMap(_meshFormatFams_2); - freeMap(_meshFormatFamsNodes); - + freeMap(_meshFormatFams); + freeMap(_meshFormatFams_0); + freeMap(_meshFormatFams_1); + freeMap(_meshFormatFams_2); + freeMap(_meshFormatFamsNodes); } -private: - void freeMap(std::map * > & aMap) + private: + void freeMap(std::map *> &aMap) { - std::map * >::iterator it = aMap.begin(); - for (; it !=aMap.end(); ++it) delete it->second; + std::map *>::iterator it = aMap.begin(); + for (; it != aMap.end(); ++it) + delete it->second; } - -}; -class MeshFormatReader -{ -public : + }; + class MeshFormatReader + { + public: MEDLOADER_EXPORT MeshFormatReader(); - MEDLOADER_EXPORT MeshFormatReader(const std::string& meshFileName, const std::vector& fieldFileName); + MEDLOADER_EXPORT MeshFormatReader(const std::string &meshFileName, const std::vector &fieldFileName); MEDLOADER_EXPORT ~MeshFormatReader(); - - MEDLOADER_EXPORT MEDCoupling::MCAuto loadInMedFileDS() ; - MEDLOADER_EXPORT void setMeshName(const std::string& theMeshName); + + MEDLOADER_EXPORT MEDCoupling::MCAuto loadInMedFileDS(); + MEDLOADER_EXPORT void setMeshName(const std::string &theMeshName); MEDLOADER_EXPORT std::string getMeshName() const; - MEDLOADER_EXPORT void setFile(const std::string& theFileName); - MEDLOADER_EXPORT void setFieldFileNames(const std::vector& theFieldFileNames); + MEDLOADER_EXPORT void setFile(const std::string &theFileName); + MEDLOADER_EXPORT void setFieldFileNames(const std::vector &theFieldFileNames); MEDLOADER_EXPORT std::vector getFieldFileNames() const; - MEDLOADER_EXPORT std::vector< std::string > getErroMessage() const; - -private : + MEDLOADER_EXPORT std::vector getErroMessage() const; - MeshFormat::Status addMessage(const std::string& msg, const bool isFatal=false); + private: + MeshFormat::Status addMessage(const std::string &msg, const bool isFatal = false); MeshFormat::Status perform(); MeshFormat::Status performFields(); - MeshFormat::Status setNodes(MEDCoupling::DataArrayDouble* coordArray); - void setEdges(MEDCoupling::MEDCouplingUMesh* dimMesh1, int nbEdges); - void setTriangles( MEDCoupling::MEDCouplingUMesh* dimMesh2, int nbTria); - void setQuadrangles( MEDCoupling::MEDCouplingUMesh* dimMesh2, int nbQuad); - void setTetrahedras( MEDCoupling::MEDCouplingUMesh* dimMesh3, int nbTet); - void setPyramids(MEDCoupling::MEDCouplingUMesh* dimMesh3, int nbPyr); - void setHexahedras(MEDCoupling::MEDCouplingUMesh* dimMesh3, int nbHex); - void setPrisms(MEDCoupling::MEDCouplingUMesh* dimMesh3, int nbPrism); - void callParserGetLin( MeshFormat::GmfKwdCod kwd, double* val, int valSize, int* ref); - void setTypeOfFieldAndDimRel(MeshFormat::GmfKwdCod kwd, MEDCoupling::TypeOfField* typeOfField, int* dimRel ); - void backward_shift(MEDCoupling::mcIdType*, int size); - void setFields( MeshFormat::GmfKwdCod kwd, int nmbSol, int nbComp); + MeshFormat::Status setNodes(MEDCoupling::DataArrayDouble *coordArray); + void setEdges(MEDCoupling::MEDCouplingUMesh *dimMesh1, int nbEdges); + void setTriangles(MEDCoupling::MEDCouplingUMesh *dimMesh2, int nbTria); + void setQuadrangles(MEDCoupling::MEDCouplingUMesh *dimMesh2, int nbQuad); + void setTetrahedras(MEDCoupling::MEDCouplingUMesh *dimMesh3, int nbTet); + void setPyramids(MEDCoupling::MEDCouplingUMesh *dimMesh3, int nbPyr); + void setHexahedras(MEDCoupling::MEDCouplingUMesh *dimMesh3, int nbHex); + void setPrisms(MEDCoupling::MEDCouplingUMesh *dimMesh3, int nbPrism); + void callParserGetLin(MeshFormat::GmfKwdCod kwd, double *val, int valSize, int *ref); + void setTypeOfFieldAndDimRel(MeshFormat::GmfKwdCod kwd, MEDCoupling::TypeOfField *typeOfField, int *dimRel); + void backward_shift(MEDCoupling::mcIdType *, int size); + void setFields(MeshFormat::GmfKwdCod kwd, int nmbSol, int nbComp); INTERP_KERNEL::NormalizedCellType toMedType(MeshFormat::GmfKwdCod kwd); void buildFamilies(); void buildNodesFamilies(); @@ -208,8 +212,8 @@ private : std::string _myMeshName; std::vector _myFieldFileNames; int _dim, _version; - std::vector< std::string > _myErrorMessages; - MeshFormat::Status _myStatus; + std::vector _myErrorMessages; + MeshFormat::Status _myStatus; MEDCoupling::MCAuto _myMed; MEDCoupling::MCAuto _uMesh; MEDCoupling::MCAuto _fields; @@ -219,6 +223,6 @@ private : int _dim1NbEl; int _dim2NbEl; int _dim3NbEl; -}; -} + }; +} // namespace MEDCoupling #endif //MESHFORMATREADER_HXX