X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDCoupling%2FMEDCouplingUMesh.hxx;h=b47c167f702e4169376b6114b6e40fe7813e7e2c;hb=e047259d4379db94f72d88eb21596f08f4ca6613;hp=11e26a7813b3f2d6546a0a553388e24ca6b6d830;hpb=f014e72b8511050572b7020e545c3927d4e76732;p=tools%2Fmedcoupling.git diff --git a/src/MEDCoupling/MEDCouplingUMesh.hxx b/src/MEDCoupling/MEDCouplingUMesh.hxx index 11e26a781..b47c167f7 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.hxx +++ b/src/MEDCoupling/MEDCouplingUMesh.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2019 CEA/DEN, EDF R&D +// Copyright (C) 2007-2022 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 @@ -18,8 +18,7 @@ // // Author : Anthony Geay (CEA/DEN) -#ifndef __PARAMEDMEM_MEDCOUPLINGUMESH_HXX__ -#define __PARAMEDMEM_MEDCOUPLINGUMESH_HXX__ +#pragma once #include "MEDCoupling.hxx" #include "MEDCouplingPointSet.hxx" @@ -58,6 +57,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const; MEDCOUPLING_EXPORT void checkConsistencyLight() const; MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const; + MEDCOUPLING_EXPORT void checkGeomConsistency(double eps=1e-12) const; MEDCOUPLING_EXPORT void setMeshDimension(int meshDim); MEDCOUPLING_EXPORT void allocateCells(mcIdType nbOfCells=0); MEDCOUPLING_EXPORT void insertNextCell(INTERP_KERNEL::NormalizedCellType type, mcIdType size, const mcIdType *nodalConnOfCell); @@ -144,7 +144,8 @@ namespace MEDCoupling MEDCOUPLING_EXPORT DataArrayIdType *findCellIdsOnBoundary() const; MEDCOUPLING_EXPORT void findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords, DataArrayIdType *&cellIdsRk0, DataArrayIdType *&cellIdsRk1) const; MEDCOUPLING_EXPORT MEDCouplingUMesh *computeSkin() const; - MEDCOUPLING_EXPORT void findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords, DataArrayIdType *& nodeIdsToDuplicate, + MEDCOUPLING_EXPORT DataArrayIdType *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const; + MEDCOUPLING_EXPORT void findCellsToRenumber(const MEDCouplingUMesh& otherDimM1OnSameCoords, const mcIdType *nodeIdsToDuplicateBg, const mcIdType *nodeIdsToDuplicateEnd, DataArrayIdType *& cellIdsNeededToBeRenum, DataArrayIdType *& cellIdsNotModified) const; MEDCOUPLING_EXPORT void duplicateNodes(const mcIdType *nodeIdsToDuplicateBg, const mcIdType *nodeIdsToDuplicateEnd); MEDCOUPLING_EXPORT void renumberNodesWithOffsetInConn(mcIdType offset); @@ -196,6 +197,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT bool removeDegenerated1DCells(); MEDCOUPLING_EXPORT void are2DCellsNotCorrectlyOriented(const double *vec, bool polyOnly, std::vector& cells) const; MEDCOUPLING_EXPORT void orientCorrectly2DCells(const double *vec, bool polyOnly); + MEDCOUPLING_EXPORT void orientCorrectly2DCells(const MEDCouplingUMesh* refFaces = nullptr); MEDCOUPLING_EXPORT void changeOrientationOfCells(); MEDCOUPLING_EXPORT void arePolyhedronsNotCorrectlyOriented(std::vector& cells) const; MEDCOUPLING_EXPORT void orientCorrectlyPolyhedrons(); @@ -442,6 +444,31 @@ namespace MEDCoupling mcIdType _conn_lgth; static const int NOTICABLE_FIRST_VAL=-7; }; + + template + class UMeshGenIterator : public std::iterator< std::input_iterator_tag, const TOUT *, mcIdType, const TOUT **, const TOUT *> + { + std::size_t _num = 0; + std::vector *_data = nullptr; + using my_reference = typename std::iterator< std::input_iterator_tag, const TOUT *, mcIdType, const TOUT **, const TOUT *>::reference; + public: + explicit UMeshGenIterator(std::size_t num , std::vector *data) : _num(num),_data(data) {} + UMeshGenIterator& operator++() { ++_num; return *this; } + bool operator==(const UMeshGenIterator& other) const { return _num == other._num; } + bool operator!=(const UMeshGenIterator& other) const { return !(*this == other); } + my_reference operator*() const { T tt; return tt((*_data)[_num]); } + }; + + struct UMeshIndexConnectivityFunctor { const DataArrayIdType *operator()(const MEDCouplingUMesh *um) { return um->getNodalConnectivityIndex(); } }; + + using UMeshConnectivityIndexIterator = UMeshGenIterator; + + struct UMeshConnectivityFunctor { const DataArrayIdType *operator()(const MEDCouplingUMesh *um) { return um->getNodalConnectivity(); } }; + + using UMeshConnectivityIterator = UMeshGenIterator; + + struct UMeshCoordsFunctor { const DataArrayDouble *operator()(const MEDCouplingUMesh *um) { return um->getCoords(); } }; + + using UMeshCoordsIterator = UMeshGenIterator; } -#endif