1 // Copyright (C) 2007-2013 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"
48 NOT_IK_ONLY_PREFERED = 1,
51 } InterpolationMatrixPolicy;
53 class MEDCouplingRemapper : public TimeLabel, public INTERP_KERNEL::InterpolationOptions
56 void updateTime() const;
58 MEDCouplingRemapper();
59 ~MEDCouplingRemapper();
60 int prepare(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const char *method) throw(INTERP_KERNEL::Exception);
61 int prepareEx(const MEDCouplingFieldTemplate *src, const MEDCouplingFieldTemplate *target) throw(INTERP_KERNEL::Exception);
62 void transfer(const MEDCouplingFieldDouble *srcField, MEDCouplingFieldDouble *targetField, double dftValue) throw(INTERP_KERNEL::Exception);
63 void partialTransfer(const MEDCouplingFieldDouble *srcField, MEDCouplingFieldDouble *targetField) throw(INTERP_KERNEL::Exception);
64 void reverseTransfer(MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *targetField, double dftValue) throw(INTERP_KERNEL::Exception);
65 MEDCouplingFieldDouble *transferField(const MEDCouplingFieldDouble *srcField, double dftValue) throw(INTERP_KERNEL::Exception);
66 MEDCouplingFieldDouble *reverseTransferField(const MEDCouplingFieldDouble *targetField, double dftValue) throw(INTERP_KERNEL::Exception);
67 bool setOptionInt(const std::string& key, int value) throw(INTERP_KERNEL::Exception);
68 bool setOptionDouble(const std::string& key, double value) throw(INTERP_KERNEL::Exception);
69 bool setOptionString(const std::string& key, const std::string& value) throw(INTERP_KERNEL::Exception);
70 int getInterpolationMatrixPolicy() const throw(INTERP_KERNEL::Exception);
71 void setInterpolationMatrixPolicy(int newInterpMatPol) throw(INTERP_KERNEL::Exception);
73 int nullifiedTinyCoeffInCrudeMatrixAbs(double maxValAbs) throw(INTERP_KERNEL::Exception);
74 int nullifiedTinyCoeffInCrudeMatrix(double scaleFactor) throw(INTERP_KERNEL::Exception);
75 double getMaxValueInCrudeMatrix() const throw(INTERP_KERNEL::Exception);
78 PyObject *getCrudeMatrix() const throw(INTERP_KERNEL::Exception)
80 const std::vector<std::map<int,double> >& m=self->getCrudeMatrix();
81 std::size_t sz=m.size();
82 PyObject *ret=PyList_New(sz);
83 for(std::size_t i=0;i<sz;i++)
85 const std::map<int,double>& row=m[i];
86 PyObject *ret0=PyDict_New();
87 for(std::map<int,double>::const_iterator it=row.begin();it!=row.end();it++)
88 PyDict_SetItem(ret0,PyInt_FromLong((*it).first),PyFloat_FromDouble((*it).second));
89 PyList_SetItem(ret,i,ret0);
98 def ParaMEDMEMDataArrayDoubleIadd(self,*args):
99 import _MEDCouplingRemapper
100 return _MEDCouplingRemapper.DataArrayDouble____iadd___(self, self, *args)
101 def ParaMEDMEMDataArrayDoubleIsub(self,*args):
102 import _MEDCouplingRemapper
103 return _MEDCouplingRemapper.DataArrayDouble____isub___(self, self, *args)
104 def ParaMEDMEMDataArrayDoubleImul(self,*args):
105 import _MEDCouplingRemapper
106 return _MEDCouplingRemapper.DataArrayDouble____imul___(self, self, *args)
107 def ParaMEDMEMDataArrayDoubleIdiv(self,*args):
108 import _MEDCouplingRemapper
109 return _MEDCouplingRemapper.DataArrayDouble____idiv___(self, self, *args)
110 def ParaMEDMEMDataArrayDoubleIpow(self,*args):
111 import _MEDCouplingRemapper
112 return _MEDCouplingRemapper.DataArrayDouble____ipow___(self, self, *args)
113 def ParaMEDMEMMEDCouplingFieldDoubleIadd(self,*args):
114 import _MEDCouplingRemapper
115 return _MEDCouplingRemapper.MEDCouplingFieldDouble____iadd___(self, self, *args)
116 def ParaMEDMEMMEDCouplingFieldDoubleIsub(self,*args):
117 import _MEDCouplingRemapper
118 return _MEDCouplingRemapper.MEDCouplingFieldDouble____isub___(self, self, *args)
119 def ParaMEDMEMMEDCouplingFieldDoubleImul(self,*args):
120 import _MEDCouplingRemapper
121 return _MEDCouplingRemapper.MEDCouplingFieldDouble____imul___(self, self, *args)
122 def ParaMEDMEMMEDCouplingFieldDoubleIdiv(self,*args):
123 import _MEDCouplingRemapper
124 return _MEDCouplingRemapper.MEDCouplingFieldDouble____idiv___(self, self, *args)
125 def ParaMEDMEMMEDCouplingFieldDoubleIpow(self,*args):
126 import _MEDCouplingRemapper
127 return _MEDCouplingRemapper.MEDCouplingFieldDouble____ipow___(self, self, *args)
128 def ParaMEDMEMDataArrayIntIadd(self,*args):
129 import _MEDCouplingRemapper
130 return _MEDCouplingRemapper.DataArrayInt____iadd___(self, self, *args)
131 def ParaMEDMEMDataArrayIntIsub(self,*args):
132 import _MEDCouplingRemapper
133 return _MEDCouplingRemapper.DataArrayInt____isub___(self, self, *args)
134 def ParaMEDMEMDataArrayIntImul(self,*args):
135 import _MEDCouplingRemapper
136 return _MEDCouplingRemapper.DataArrayInt____imul___(self, self, *args)
137 def ParaMEDMEMDataArrayIntIdiv(self,*args):
138 import _MEDCouplingRemapper
139 return _MEDCouplingRemapper.DataArrayInt____idiv___(self, self, *args)
140 def ParaMEDMEMDataArrayIntImod(self,*args):
141 import _MEDCouplingRemapper
142 return _MEDCouplingRemapper.DataArrayInt____imod___(self, self, *args)
143 def ParaMEDMEMDataArrayIntIpow(self,*args):
144 import _MEDCouplingRemapper
145 return _MEDCouplingRemapper.DataArrayInt____ipow___(self, self, *args)
146 def ParaMEDMEMDataArrayDoubleTupleIadd(self,*args):
147 import _MEDCouplingRemapper
148 return _MEDCouplingRemapper.DataArrayDoubleTuple____iadd___(self, self, *args)
149 def ParaMEDMEMDataArrayDoubleTupleIsub(self,*args):
150 import _MEDCouplingRemapper
151 return _MEDCouplingRemapper.DataArrayDoubleTuple____isub___(self, self, *args)
152 def ParaMEDMEMDataArrayDoubleTupleImul(self,*args):
153 import _MEDCouplingRemapper
154 return _MEDCouplingRemapper.DataArrayDoubleTuple____imul___(self, self, *args)
155 def ParaMEDMEMDataArrayDoubleTupleIdiv(self,*args):
156 import _MEDCouplingRemapper
157 return _MEDCouplingRemapper.DataArrayDoubleTuple____idiv___(self, self, *args)
158 def ParaMEDMEMDataArrayIntTupleIadd(self,*args):
159 import _MEDCouplingRemapper
160 return _MEDCouplingRemapper.DataArrayIntTuple____iadd___(self, self, *args)
161 def ParaMEDMEMDataArrayIntTupleIsub(self,*args):
162 import _MEDCouplingRemapper
163 return _MEDCouplingRemapper.DataArrayIntTuple____isub___(self, self, *args)
164 def ParaMEDMEMDataArrayIntTupleImul(self,*args):
165 import _MEDCouplingRemapper
166 return _MEDCouplingRemapper.DataArrayIntTuple____imul___(self, self, *args)
167 def ParaMEDMEMDataArrayIntTupleIdiv(self,*args):
168 import _MEDCouplingRemapper
169 return _MEDCouplingRemapper.DataArrayIntTuple____idiv___(self, self, *args)
170 def ParaMEDMEMDataArrayIntTupleImod(self,*args):
171 import _MEDCouplingRemapper
172 return _MEDCouplingRemapper.DataArrayIntTuple____imod___(self, self, *args)
175 %include "MEDCouplingFinalize.i"