X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FMEDCoupling_Swig%2FMEDCouplingRemapper.i;h=5bd23b19833d51212f038df76dc4dc3ed93fb58b;hb=a019ec6e72f540d3378f3e869c2b19bf4886459c;hp=8b3e9ace623977fba195ce6581fef21a77a1c877;hpb=3bd1cd600254cfa2854c67cb0a7c30ea7c73ee1c;p=tools%2Fmedcoupling.git diff --git a/src/MEDCoupling_Swig/MEDCouplingRemapper.i b/src/MEDCoupling_Swig/MEDCouplingRemapper.i index 8b3e9ace6..5bd23b198 100644 --- a/src/MEDCoupling_Swig/MEDCouplingRemapper.i +++ b/src/MEDCoupling_Swig/MEDCouplingRemapper.i @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2015 CEA/DEN, EDF R&D +// Copyright (C) 2007-2016 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,93 +19,11 @@ %module MEDCouplingRemapper -#define MEDCOUPLING_EXPORT -#define INTERPKERNEL_EXPORT -#define MEDCOUPLINGREMAPPER_EXPORT - -%{ -#include "MEDCouplingMemArray.hxx" -#include "MEDCouplingUMesh.hxx" -#include "MEDCouplingField.hxx" -#include "MEDCouplingFieldDouble.hxx" -#include "MEDCouplingRemapper.hxx" - -using namespace MEDCoupling; -using namespace INTERP_KERNEL; -%} - -%newobject MEDCoupling::MEDCouplingRemapper::transferField; -%newobject MEDCoupling::MEDCouplingRemapper::reverseTransferField; - %include "MEDCouplingCommon.i" -%include "InterpolationOptions.hxx" -namespace MEDCoupling -{ - typedef enum - { - IK_ONLY_PREFERED = 0, - NOT_IK_ONLY_PREFERED = 1, - IK_ONLY_FORCED = 2, - NOT_IK_ONLY_FORCED =3 - } InterpolationMatrixPolicy; - - class MEDCouplingRemapper : public TimeLabel, public INTERP_KERNEL::InterpolationOptions - { - private: - void updateTime() const; - public: - MEDCouplingRemapper(); - ~MEDCouplingRemapper(); - int prepare(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const std::string& 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 partialTransfer(const MEDCouplingFieldDouble *srcField, MEDCouplingFieldDouble *targetField) 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) throw(INTERP_KERNEL::Exception); - bool setOptionDouble(const std::string& key, double value) throw(INTERP_KERNEL::Exception); - bool setOptionString(const std::string& key, const std::string& value) throw(INTERP_KERNEL::Exception); - int getInterpolationMatrixPolicy() const throw(INTERP_KERNEL::Exception); - void setInterpolationMatrixPolicy(int newInterpMatPol) throw(INTERP_KERNEL::Exception); - // - int nullifiedTinyCoeffInCrudeMatrixAbs(double maxValAbs) throw(INTERP_KERNEL::Exception); - int nullifiedTinyCoeffInCrudeMatrix(double scaleFactor) throw(INTERP_KERNEL::Exception); - double getMaxValueInCrudeMatrix() const throw(INTERP_KERNEL::Exception); - int getNumberOfColsOfMatrix() const throw(INTERP_KERNEL::Exception); - static std::string BuildMethodFrom(const std::string& meth1, const std::string& meth2) throw(INTERP_KERNEL::Exception); - %extend - { - PyObject *getCrudeMatrix() const throw(INTERP_KERNEL::Exception) - { - 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; - } -#if defined(WITH_NUMPY) && defined(WITH_SCIPY) - PyObject *getCrudeCSRMatrix() const throw(INTERP_KERNEL::Exception) - { - return ToCSRMatrix(self->getCrudeMatrix(),self->getNumberOfColsOfMatrix()); - } -#endif - } - }; -} +%include "MEDCouplingRemapperCommon.i" %pythoncode %{ -def MEDCouplingDataArrayDoublenew(cls,*args): - import _MEDCouplingRemapper - return _MEDCouplingRemapper.DataArrayDouble____new___(cls,args) def MEDCouplingDataArrayDoubleIadd(self,*args): import _MEDCouplingRemapper return _MEDCouplingRemapper.DataArrayDouble____iadd___(self, self, *args) @@ -121,30 +39,33 @@ def MEDCouplingDataArrayDoubleIdiv(self,*args): def MEDCouplingDataArrayDoubleIpow(self,*args): import _MEDCouplingRemapper return _MEDCouplingRemapper.DataArrayDouble____ipow___(self, self, *args) -def ParaMEDMEMMEDCouplingFieldDoublenew(cls,*args): - import _MEDCouplingRemapper - return _MEDCouplingRemapper.MEDCouplingFieldDouble____new___(cls,args) -def ParaMEDMEMMEDCouplingFieldDoubleIadd(self,*args): +def MEDCouplingFieldDoubleIadd(self,*args): import _MEDCouplingRemapper return _MEDCouplingRemapper.MEDCouplingFieldDouble____iadd___(self, self, *args) -def ParaMEDMEMMEDCouplingFieldDoubleIsub(self,*args): +def MEDCouplingFieldDoubleIsub(self,*args): import _MEDCouplingRemapper return _MEDCouplingRemapper.MEDCouplingFieldDouble____isub___(self, self, *args) -def ParaMEDMEMMEDCouplingFieldDoubleImul(self,*args): +def MEDCouplingFieldDoubleImul(self,*args): import _MEDCouplingRemapper return _MEDCouplingRemapper.MEDCouplingFieldDouble____imul___(self, self, *args) -def ParaMEDMEMMEDCouplingFieldDoubleIdiv(self,*args): +def MEDCouplingFieldDoubleIdiv(self,*args): import _MEDCouplingRemapper return _MEDCouplingRemapper.MEDCouplingFieldDouble____idiv___(self, self, *args) -def ParaMEDMEMMEDCouplingFieldDoubleIpow(self,*args): +def MEDCouplingFieldDoubleIpow(self,*args): import _MEDCouplingRemapper return _MEDCouplingRemapper.MEDCouplingFieldDouble____ipow___(self, self, *args) -def MEDCouplingDataArrayIntnew(cls,*args): +def MEDCouplingDataArrayFloatIadd(self,*args): + import _MEDCouplingRemapper + return _MEDCouplingRemapper.DataArrayFloat____iadd___(self, self, *args) +def MEDCouplingDataArrayFloatIsub(self,*args): import _MEDCouplingRemapper - return _MEDCouplingRemapper.DataArrayInt____new___(cls,args) -def MEDCouplingDataArrayIntnew(cls,*args): - import _MEDCoupling - return _MEDCoupling.DataArrayInt____new___(cls,args) + return _MEDCouplingRemapper.DataArrayFloat____isub___(self, self, *args) +def MEDCouplingDataArrayFloatImul(self,*args): + import _MEDCouplingRemapper + return _MEDCouplingRemapper.DataArrayFloat____imul___(self, self, *args) +def MEDCouplingDataArrayFloatIdiv(self,*args): + import _MEDCouplingRemapper + return _MEDCouplingRemapper.DataArrayFloat____idiv___(self, self, *args) def MEDCouplingDataArrayIntIadd(self,*args): import _MEDCouplingRemapper return _MEDCouplingRemapper.DataArrayInt____iadd___(self, self, *args) @@ -190,33 +111,12 @@ def MEDCouplingDataArrayIntTupleIdiv(self,*args): def MEDCouplingDataArrayIntTupleImod(self,*args): import _MEDCouplingRemapper return _MEDCouplingRemapper.DataArrayIntTuple____imod___(self, self, *args) -def ParaMEDMEMDenseMatrixIadd(self,*args): +def MEDCouplingDenseMatrixIadd(self,*args): import _MEDCouplingRemapper return _MEDCouplingRemapper.DenseMatrix____iadd___(self, self, *args) -def ParaMEDMEMDenseMatrixIsub(self,*args): +def MEDCouplingDenseMatrixIsub(self,*args): import _MEDCouplingRemapper return _MEDCouplingRemapper.DenseMatrix____isub___(self, self, *args) -def ParaMEDMEMMEDCouplingUMeshnew(cls,*args): - import _MEDCouplingRemapper - return _MEDCouplingRemapper.MEDCouplingUMesh____new___(cls,args) -def ParaMEDMEMMEDCoupling1DGTUMeshnew(cls,*args): - import _MEDCouplingRemapper - return _MEDCouplingRemapper.MEDCoupling1DGTUMesh____new___(cls,args) -def ParaMEDMEMMEDCoupling1SGTUMeshnew(cls,*args): - import _MEDCouplingRemapper - return _MEDCouplingRemapper.MEDCoupling1SGTUMesh____new___(cls,args) -def ParaMEDMEMMEDCouplingCurveLinearMeshnew(cls,*args): - import _MEDCouplingRemapper - return _MEDCouplingRemapper.MEDCouplingCurveLinearMesh____new___(cls,args) -def ParaMEDMEMMEDCouplingCMeshnew(cls,*args): - import _MEDCouplingRemapper - return _MEDCouplingRemapper.MEDCouplingCMesh____new___(cls,args) -def ParaMEDMEMMEDCouplingIMeshnew(cls,*args): - import _MEDCouplingRemapper - return _MEDCouplingRemapper.MEDCouplingIMesh____new___(cls,args) -def ParaMEDMEMMEDCouplingExtrudedMeshnew(cls,*args): - import _MEDCouplingRemapper - return _MEDCouplingRemapper.MEDCouplingExtrudedMesh____new___(cls,args) %} %include "MEDCouplingFinalize.i"