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);
76 int getNumberOfColsOfMatrix() const throw(INTERP_KERNEL::Exception);
79 PyObject *getCrudeMatrix() const throw(INTERP_KERNEL::Exception)
81 const std::vector<std::map<int,double> >& m=self->getCrudeMatrix();
82 std::size_t sz=m.size();
83 PyObject *ret=PyList_New(sz);
84 for(std::size_t i=0;i<sz;i++)
86 const std::map<int,double>& row=m[i];
87 PyObject *ret0=PyDict_New();
88 for(std::map<int,double>::const_iterator it=row.begin();it!=row.end();it++)
89 PyDict_SetItem(ret0,PyInt_FromLong((*it).first),PyFloat_FromDouble((*it).second));
90 PyList_SetItem(ret,i,ret0);
95 PyObject *getCrudeCSRMatrix() const throw(INTERP_KERNEL::Exception)
97 return ToCSRMatrix(self->getCrudeMatrix(),self->getNumberOfColsOfMatrix());
105 def ParaMEDMEMDataArrayDoubleIadd(self,*args):
106 import _MEDCouplingRemapper
107 return _MEDCouplingRemapper.DataArrayDouble____iadd___(self, self, *args)
108 def ParaMEDMEMDataArrayDoubleIsub(self,*args):
109 import _MEDCouplingRemapper
110 return _MEDCouplingRemapper.DataArrayDouble____isub___(self, self, *args)
111 def ParaMEDMEMDataArrayDoubleImul(self,*args):
112 import _MEDCouplingRemapper
113 return _MEDCouplingRemapper.DataArrayDouble____imul___(self, self, *args)
114 def ParaMEDMEMDataArrayDoubleIdiv(self,*args):
115 import _MEDCouplingRemapper
116 return _MEDCouplingRemapper.DataArrayDouble____idiv___(self, self, *args)
117 def ParaMEDMEMDataArrayDoubleIpow(self,*args):
118 import _MEDCouplingRemapper
119 return _MEDCouplingRemapper.DataArrayDouble____ipow___(self, self, *args)
120 def ParaMEDMEMMEDCouplingFieldDoubleIadd(self,*args):
121 import _MEDCouplingRemapper
122 return _MEDCouplingRemapper.MEDCouplingFieldDouble____iadd___(self, self, *args)
123 def ParaMEDMEMMEDCouplingFieldDoubleIsub(self,*args):
124 import _MEDCouplingRemapper
125 return _MEDCouplingRemapper.MEDCouplingFieldDouble____isub___(self, self, *args)
126 def ParaMEDMEMMEDCouplingFieldDoubleImul(self,*args):
127 import _MEDCouplingRemapper
128 return _MEDCouplingRemapper.MEDCouplingFieldDouble____imul___(self, self, *args)
129 def ParaMEDMEMMEDCouplingFieldDoubleIdiv(self,*args):
130 import _MEDCouplingRemapper
131 return _MEDCouplingRemapper.MEDCouplingFieldDouble____idiv___(self, self, *args)
132 def ParaMEDMEMMEDCouplingFieldDoubleIpow(self,*args):
133 import _MEDCouplingRemapper
134 return _MEDCouplingRemapper.MEDCouplingFieldDouble____ipow___(self, self, *args)
135 def ParaMEDMEMDataArrayIntIadd(self,*args):
136 import _MEDCouplingRemapper
137 return _MEDCouplingRemapper.DataArrayInt____iadd___(self, self, *args)
138 def ParaMEDMEMDataArrayIntIsub(self,*args):
139 import _MEDCouplingRemapper
140 return _MEDCouplingRemapper.DataArrayInt____isub___(self, self, *args)
141 def ParaMEDMEMDataArrayIntImul(self,*args):
142 import _MEDCouplingRemapper
143 return _MEDCouplingRemapper.DataArrayInt____imul___(self, self, *args)
144 def ParaMEDMEMDataArrayIntIdiv(self,*args):
145 import _MEDCouplingRemapper
146 return _MEDCouplingRemapper.DataArrayInt____idiv___(self, self, *args)
147 def ParaMEDMEMDataArrayIntImod(self,*args):
148 import _MEDCouplingRemapper
149 return _MEDCouplingRemapper.DataArrayInt____imod___(self, self, *args)
150 def ParaMEDMEMDataArrayIntIpow(self,*args):
151 import _MEDCouplingRemapper
152 return _MEDCouplingRemapper.DataArrayInt____ipow___(self, self, *args)
153 def ParaMEDMEMDataArrayDoubleTupleIadd(self,*args):
154 import _MEDCouplingRemapper
155 return _MEDCouplingRemapper.DataArrayDoubleTuple____iadd___(self, self, *args)
156 def ParaMEDMEMDataArrayDoubleTupleIsub(self,*args):
157 import _MEDCouplingRemapper
158 return _MEDCouplingRemapper.DataArrayDoubleTuple____isub___(self, self, *args)
159 def ParaMEDMEMDataArrayDoubleTupleImul(self,*args):
160 import _MEDCouplingRemapper
161 return _MEDCouplingRemapper.DataArrayDoubleTuple____imul___(self, self, *args)
162 def ParaMEDMEMDataArrayDoubleTupleIdiv(self,*args):
163 import _MEDCouplingRemapper
164 return _MEDCouplingRemapper.DataArrayDoubleTuple____idiv___(self, self, *args)
165 def ParaMEDMEMDataArrayIntTupleIadd(self,*args):
166 import _MEDCouplingRemapper
167 return _MEDCouplingRemapper.DataArrayIntTuple____iadd___(self, self, *args)
168 def ParaMEDMEMDataArrayIntTupleIsub(self,*args):
169 import _MEDCouplingRemapper
170 return _MEDCouplingRemapper.DataArrayIntTuple____isub___(self, self, *args)
171 def ParaMEDMEMDataArrayIntTupleImul(self,*args):
172 import _MEDCouplingRemapper
173 return _MEDCouplingRemapper.DataArrayIntTuple____imul___(self, self, *args)
174 def ParaMEDMEMDataArrayIntTupleIdiv(self,*args):
175 import _MEDCouplingRemapper
176 return _MEDCouplingRemapper.DataArrayIntTuple____idiv___(self, self, *args)
177 def ParaMEDMEMDataArrayIntTupleImod(self,*args):
178 import _MEDCouplingRemapper
179 return _MEDCouplingRemapper.DataArrayIntTuple____imod___(self, self, *args)
182 %include "MEDCouplingFinalize.i"