1 // Copyright (C) 2007-2012 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 %module MEDCouplingRemapper
22 #define MEDCOUPLING_EXPORT
23 #define INTERPKERNEL_EXPORT
24 #define MEDCOUPLINGREMAPPER_EXPORT
27 #include "MEDCouplingMemArray.hxx"
28 #include "MEDCouplingUMesh.hxx"
29 #include "MEDCouplingField.hxx"
30 #include "MEDCouplingFieldDouble.hxx"
31 #include "MEDCouplingRemapper.hxx"
33 using namespace ParaMEDMEM;
34 using namespace INTERP_KERNEL;
37 %newobject ParaMEDMEM::MEDCouplingRemapper::transferField;
38 %newobject ParaMEDMEM::MEDCouplingRemapper::reverseTransferField;
40 %include "MEDCouplingCommon.i"
41 %include "InterpolationOptions.hxx"
45 class MEDCouplingRemapper : public TimeLabel, public INTERP_KERNEL::InterpolationOptions
48 void updateTime() const;
50 MEDCouplingRemapper();
51 ~MEDCouplingRemapper();
52 int prepare(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const char *method) throw(INTERP_KERNEL::Exception);
53 int prepareEx(const MEDCouplingFieldTemplate *src, const MEDCouplingFieldTemplate *target) throw(INTERP_KERNEL::Exception);
54 void transfer(const MEDCouplingFieldDouble *srcField, MEDCouplingFieldDouble *targetField, double dftValue) throw(INTERP_KERNEL::Exception);
55 void partialTransfer(const MEDCouplingFieldDouble *srcField, MEDCouplingFieldDouble *targetField) throw(INTERP_KERNEL::Exception);
56 void reverseTransfer(MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *targetField, double dftValue) throw(INTERP_KERNEL::Exception);
57 MEDCouplingFieldDouble *transferField(const MEDCouplingFieldDouble *srcField, double dftValue) throw(INTERP_KERNEL::Exception);
58 MEDCouplingFieldDouble *reverseTransferField(const MEDCouplingFieldDouble *targetField, double dftValue) throw(INTERP_KERNEL::Exception);
59 bool setOptionInt(const std::string& key, int value);
60 bool setOptionDouble(const std::string& key, double value);
61 bool setOptionString(const std::string& key, const std::string& value);
64 PyObject *getCrudeMatrix() const
66 const std::vector<std::map<int,double> >& m=self->getCrudeMatrix();
67 std::size_t sz=m.size();
68 PyObject *ret=PyList_New(sz);
69 for(std::size_t i=0;i<sz;i++)
71 const std::map<int,double>& row=m[i];
72 PyObject *ret0=PyDict_New();
73 for(std::map<int,double>::const_iterator it=row.begin();it!=row.end();it++)
74 PyDict_SetItem(ret0,PyInt_FromLong((*it).first),PyFloat_FromDouble((*it).second));
75 PyList_SetItem(ret,i,ret0);
84 def ParaMEDMEMDataArrayDoubleIadd(self,*args):
85 import _MEDCouplingRemapper
86 return _MEDCouplingRemapper.DataArrayDouble____iadd___(self, self, *args)
87 def ParaMEDMEMDataArrayDoubleIsub(self,*args):
88 import _MEDCouplingRemapper
89 return _MEDCouplingRemapper.DataArrayDouble____isub___(self, self, *args)
90 def ParaMEDMEMDataArrayDoubleImul(self,*args):
91 import _MEDCouplingRemapper
92 return _MEDCouplingRemapper.DataArrayDouble____imul___(self, self, *args)
93 def ParaMEDMEMDataArrayDoubleIdiv(self,*args):
94 import _MEDCouplingRemapper
95 return _MEDCouplingRemapper.DataArrayDouble____idiv___(self, self, *args)
96 def ParaMEDMEMMEDCouplingFieldDoubleIadd(self,*args):
97 import _MEDCouplingRemapper
98 return _MEDCouplingRemapper.MEDCouplingFieldDouble____iadd___(self, self, *args)
99 def ParaMEDMEMMEDCouplingFieldDoubleIsub(self,*args):
100 import _MEDCouplingRemapper
101 return _MEDCouplingRemapper.MEDCouplingFieldDouble____isub___(self, self, *args)
102 def ParaMEDMEMMEDCouplingFieldDoubleImul(self,*args):
103 import _MEDCouplingRemapper
104 return _MEDCouplingRemapper.MEDCouplingFieldDouble____imul___(self, self, *args)
105 def ParaMEDMEMMEDCouplingFieldDoubleIdiv(self,*args):
106 import _MEDCouplingRemapper
107 return _MEDCouplingRemapper.MEDCouplingFieldDouble____idiv___(self, self, *args)
108 def ParaMEDMEMDataArrayIntIadd(self,*args):
109 import _MEDCouplingRemapper
110 return _MEDCouplingRemapper.DataArrayInt____iadd___(self, self, *args)
111 def ParaMEDMEMDataArrayIntIsub(self,*args):
112 import _MEDCouplingRemapper
113 return _MEDCouplingRemapper.DataArrayInt____isub___(self, self, *args)
114 def ParaMEDMEMDataArrayIntImul(self,*args):
115 import _MEDCouplingRemapper
116 return _MEDCouplingRemapper.DataArrayInt____imul___(self, self, *args)
117 def ParaMEDMEMDataArrayIntIdiv(self,*args):
118 import _MEDCouplingRemapper
119 return _MEDCouplingRemapper.DataArrayInt____idiv___(self, self, *args)
120 def ParaMEDMEMDataArrayIntImod(self,*args):
121 import _MEDCouplingRemapper
122 return _MEDCouplingRemapper.DataArrayInt____imod___(self, self, *args)
125 %include "MEDCouplingFinalize.i"