X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FMEDCoupling%2FMEDCouplingUMesh.hxx;h=c09784c41691ae608ee484f895181245e9640325;hb=84031c1872103b9a0c9546ea12c4ebd03838034d;hp=87a1c9a7d8a2c9d08013e9119fe22ff39805a2ed;hpb=b219559763498c4bd10c730cd3d2c62b1eed45db;p=tools%2Fmedcoupling.git diff --git a/src/MEDCoupling/MEDCouplingUMesh.hxx b/src/MEDCoupling/MEDCouplingUMesh.hxx index 87a1c9a7d..c09784c41 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-2020 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" @@ -42,6 +41,7 @@ namespace MEDCoupling public: MEDCOUPLING_EXPORT static MEDCouplingUMesh *New(); MEDCOUPLING_EXPORT static MEDCouplingUMesh *New(const std::string& meshName, int meshDim); + MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingUMesh"); } // Copy methods MEDCOUPLING_EXPORT MEDCouplingUMesh *deepCopy() const; MEDCOUPLING_EXPORT MEDCouplingUMesh *clone(bool recDeepCpy) const; @@ -359,7 +359,6 @@ namespace MEDCoupling MEDCOUPLING_EXPORT static DataArrayIdType *ComputeRangesFromTypeDistribution(const std::vector& code); MEDCOUPLING_EXPORT static const int N_MEDMEM_ORDER=25; MEDCOUPLING_EXPORT static const INTERP_KERNEL::NormalizedCellType MEDMEM_ORDER[N_MEDMEM_ORDER]; - MEDCOUPLING_EXPORT static const mcIdType MEDCOUPLING2VTKTYPETRADUCER[INTERP_KERNEL::NORM_MAXTYPE+1]; /// @endcond private: int _mesh_dim; @@ -442,6 +441,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