X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDLoader%2FSwig%2FMEDLoaderTypemaps.i;h=6f9d3c4bcbb5161370d0fe146326d2c4f73edc30;hb=e95ee11e7df126315ffd11c2518b648a6915ad51;hp=e32be543f05e4431de6644a4a06117f7075759f9;hpb=b219559763498c4bd10c730cd3d2c62b1eed45db;p=tools%2Fmedcoupling.git diff --git a/src/MEDLoader/Swig/MEDLoaderTypemaps.i b/src/MEDLoader/Swig/MEDLoaderTypemaps.i index e32be543f..6f9d3c4bc 100644 --- a/src/MEDLoader/Swig/MEDLoaderTypemaps.i +++ b/src/MEDLoader/Swig/MEDLoaderTypemaps.i @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2019 CEA/DEN, EDF R&D +// Copyright (C) 2007-2021 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 @@ -19,6 +19,31 @@ // Author : Anthony Geay (EDF R&D) #include +#include + +class MEDVectorMIIterator : public std::iterator< std::input_iterator_tag, long, long, const std::pair *, std::pair > +{ + long _num = 0; + std::vector< std::pair > _data; +public: + explicit MEDVectorMIIterator(long num , std::vector< std::pair > data) : _num(num),_data(data) {} + MEDVectorMIIterator& operator++() { ++_num; return *this;} + bool operator==(const MEDVectorMIIterator& other) const {return _num == other._num;} + bool operator!=(const MEDVectorMIIterator& other) const {return !(*this == other);} + reference operator*() const {return {(int)_data[_num].first,_data[_num].second}; } +}; + +class MEDVectorVectorMIIterator : public std::iterator< std::input_iterator_tag, long, long, const std::vector< std::pair >*, std::vector< std::pair > > +{ + long _num = 0; + std::vector< std::vector< std::pair > > _data; +public: + explicit MEDVectorVectorMIIterator(long num , std::vector< std::vector< std::pair > > data) : _num(num),_data(data) {} + MEDVectorVectorMIIterator& operator++() { ++_num; return *this;} + bool operator==(const MEDVectorVectorMIIterator& other) const {return _num == other._num;} + bool operator!=(const MEDVectorVectorMIIterator& other) const {return !(*this == other);} + reference operator*() const { auto data = _data[_num]; return reference(MEDVectorMIIterator(0,data),MEDVectorMIIterator(data.size(),data)); } +}; static PyObject *convertMEDFileMesh(MEDCoupling::MEDFileMesh* mesh, int owner) { @@ -66,8 +91,10 @@ static PyObject *convertMEDFileField1TS(MEDCoupling::MEDFileAnyTypeField1TS *p, } if(dynamic_cast(p)) ret=SWIG_NewPointerObj((void*)p,SWIGTYPE_p_MEDCoupling__MEDFileField1TS,owner); - if(dynamic_cast(p)) - ret=SWIG_NewPointerObj((void*)p,SWIGTYPE_p_MEDCoupling__MEDFileIntField1TS,owner); + if(dynamic_cast(p)) + ret=SWIG_NewPointerObj((void*)p,SWIGTYPE_p_MEDCoupling__MEDFileInt32Field1TS,owner); + if(dynamic_cast(p)) + ret=SWIG_NewPointerObj((void*)p,SWIGTYPE_p_MEDCoupling__MEDFileInt64Field1TS,owner); if(dynamic_cast(p)) ret=SWIG_NewPointerObj((void*)p,SWIGTYPE_p_MEDCoupling__MEDFileFloatField1TS,owner); if(!ret) @@ -85,8 +112,10 @@ static PyObject *convertMEDFileFieldMultiTS(MEDCoupling::MEDFileAnyTypeFieldMult } if(dynamic_cast(p)) ret=SWIG_NewPointerObj((void*)p,SWIGTYPE_p_MEDCoupling__MEDFileFieldMultiTS,owner); - if(dynamic_cast(p)) - ret=SWIG_NewPointerObj((void*)p,SWIGTYPE_p_MEDCoupling__MEDFileIntFieldMultiTS,owner); + if(dynamic_cast(p)) + ret=SWIG_NewPointerObj((void*)p,SWIGTYPE_p_MEDCoupling__MEDFileInt32FieldMultiTS,owner); + if(dynamic_cast(p)) + ret=SWIG_NewPointerObj((void*)p,SWIGTYPE_p_MEDCoupling__MEDFileInt64FieldMultiTS,owner); if(dynamic_cast(p)) ret=SWIG_NewPointerObj((void*)p,SWIGTYPE_p_MEDCoupling__MEDFileFloatFieldMultiTS,owner); if(!ret)