From: ageay Date: Fri, 30 Sep 2011 15:28:09 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: V6_main_FINAL~938 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3641d76de1ee7d14efc0a5050417396064bcd58f;p=tools%2Fmedcoupling.git *** empty log message *** --- diff --git a/src/MEDCoupling/MEDCouplingRemapper.cxx b/src/MEDCoupling/MEDCouplingRemapper.cxx index 9e675e370..1297c1211 100644 --- a/src/MEDCoupling/MEDCouplingRemapper.cxx +++ b/src/MEDCoupling/MEDCouplingRemapper.cxx @@ -658,7 +658,7 @@ void MEDCouplingRemapper::buildFinalInterpolationMatrixByConvolution(const std:: } } -void MEDCouplingRemapper::printMatrix(const std::vector >& m) +void MEDCouplingRemapper::PrintMatrix(const std::vector >& m) { int id=0; for(std::vector >::const_iterator iter1=m.begin();iter1!=m.end();iter1++,id++) @@ -669,3 +669,8 @@ void MEDCouplingRemapper::printMatrix(const std::vector >& std::cout << std::endl; } } + +const std::vector >& MEDCouplingRemapper::getCrudeMatrix() const +{ + return _matrix; +} diff --git a/src/MEDCoupling/MEDCouplingRemapper.hxx b/src/MEDCoupling/MEDCouplingRemapper.hxx index 332a26f4c..81251b1cf 100644 --- a/src/MEDCoupling/MEDCouplingRemapper.hxx +++ b/src/MEDCoupling/MEDCouplingRemapper.hxx @@ -54,7 +54,8 @@ namespace ParaMEDMEM MEDCOUPLINGREMAPPER_EXPORT bool setOptionDouble(const std::string& key, double value); MEDCOUPLINGREMAPPER_EXPORT bool setOptionString(const std::string& key, const std::string& value); public: - MEDCOUPLINGREMAPPER_EXPORT static void printMatrix(const std::vector >& m); + MEDCOUPLINGREMAPPER_EXPORT const std::vector >& getCrudeMatrix() const; + MEDCOUPLINGREMAPPER_EXPORT static void PrintMatrix(const std::vector >& m); private: int prepareUU(const char *method) throw(INTERP_KERNEL::Exception); int prepareEE(const char *method) throw(INTERP_KERNEL::Exception); diff --git a/src/MEDCoupling_Swig/MEDCouplingRemapper.i b/src/MEDCoupling_Swig/MEDCouplingRemapper.i index b3dc0890b..650ff55bd 100644 --- a/src/MEDCoupling_Swig/MEDCouplingRemapper.i +++ b/src/MEDCoupling_Swig/MEDCouplingRemapper.i @@ -39,4 +39,42 @@ using namespace INTERP_KERNEL; %include "MEDCoupling.i" %include "InterpolationOptions.hxx" -%include "MEDCouplingRemapper.hxx" + +namespace ParaMEDMEM +{ + class MEDCouplingRemapper : public TimeLabel, public INTERP_KERNEL::InterpolationOptions + { + private: + void updateTime() const; + public: + MEDCouplingRemapper(); + ~MEDCouplingRemapper(); + int prepare(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const char *method) throw(INTERP_KERNEL::Exception); + int prepareEx(const MEDCouplingFieldTemplate *src, const MEDCouplingFieldTemplate *target) throw(INTERP_KERNEL::Exception); + void transfer(const MEDCouplingFieldDouble *srcField, MEDCouplingFieldDouble *targetField, double dftValue) throw(INTERP_KERNEL::Exception); + void reverseTransfer(MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *targetField, double dftValue) throw(INTERP_KERNEL::Exception); + MEDCouplingFieldDouble *transferField(const MEDCouplingFieldDouble *srcField, double dftValue) throw(INTERP_KERNEL::Exception); + MEDCouplingFieldDouble *reverseTransferField(const MEDCouplingFieldDouble *targetField, double dftValue) throw(INTERP_KERNEL::Exception); + bool setOptionInt(const std::string& key, int value); + bool setOptionDouble(const std::string& key, double value); + bool setOptionString(const std::string& key, const std::string& value); + %extend + { + PyObject *getCrudeMatrix() const + { + const std::vector >& m=self->getCrudeMatrix(); + std::size_t sz=m.size(); + PyObject *ret=PyList_New(sz); + for(std::size_t i=0;i& row=m[i]; + PyObject *ret0=PyDict_New(); + for(std::map::const_iterator it=row.begin();it!=row.end();it++) + PyDict_SetItem(ret0,PyInt_FromLong((*it).first),PyFloat_FromDouble((*it).second)); + PyList_SetItem(ret,i,ret0); + } + return ret; + } + } + }; +}