Salome HOME
Copyright update 2020
[tools/medcoupling.git] / src / PyWrapping / medcoupling.i
1 // Copyright (C) 2017-2020  CEA/DEN, EDF R&D
2 //
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, or (at your option) any later version.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 // Author : Anthony Geay (EDF R&D)
21
22 %module medcoupling
23
24 #define MEDCOUPLINGREMAPPER_EXPORT
25 #define INTERPKERNEL_EXPORT
26 #define MEDCOUPLING_EXPORT
27 #define MEDLOADER_EXPORT
28
29 %include "MEDCouplingCommon.i"
30
31 %include "MEDCouplingRemapperCommon.i"
32
33 #ifdef WITH_MED_FILE
34 %include "MEDLoaderCommon.i"
35 #endif
36
37 #ifdef WITH_RENUMBER
38 %include "MEDRenumberImpl.i"
39 #endif
40
41 #ifdef WITH_PARTITIONER
42 %include "MEDPartitionerCommon.i"
43 #endif
44
45 #ifdef WITH_PARALLEL_INTERPOLATOR
46 %include "ParaMEDMEMCommon.i"
47 #endif
48
49 %{
50   static const char SEQ_INTERPOL_EXT[]="Sequential interpolator";
51   static const char MEDFILEIO_EXT[]="MED file I/O";
52   static const char RENUM_EXT[]="Renumberer";
53   static const char PART_EXT[]="Partitioner";
54   static const char PAR_INTERPOL_EXT[]="Parallel interpolator (SPMD paradigm)";
55   
56   static const char *EXTENSIONS[]={SEQ_INTERPOL_EXT,MEDFILEIO_EXT,RENUM_EXT,PART_EXT,PAR_INTERPOL_EXT};
57   static const int NB_OF_EXTENSIONS=sizeof(EXTENSIONS)/sizeof(const char *);
58 %}
59
60 %inline
61 {
62   std::vector<std::string> AllPossibleExtensions()
63   {
64     std::vector<std::string> ret(EXTENSIONS,EXTENSIONS+NB_OF_EXTENSIONS);
65     return ret;
66   }
67
68   bool HasMEDFileExt()
69   {
70 #ifdef WITH_MED_FILE
71     return true;
72 #else
73     return false;
74 #endif
75   }
76
77   bool HasRenumberExt()
78   {
79 #ifdef WITH_RENUMBER
80     return true;
81 #else
82     return false;
83 #endif
84   }
85
86   bool HasPartitionerExt()
87   {
88 #ifdef WITH_PARTITIONER
89     return true;
90 #else
91     return false;
92 #endif
93   }
94
95   bool HasScotchPartitionerAlg()
96   {
97 #ifdef WITH_PARTITIONER
98     return MEDPartitioner::HasScotchAlg();
99 #else
100     return false;
101 #endif    
102   }
103
104   bool HasPTScotchPartitionerAlg()
105   {
106 #ifdef WITH_PARTITIONER
107     return MEDPartitioner::HasPTScotchAlg();
108 #else
109     return false;
110 #endif    
111   }
112
113   bool HasMetisPartitionerAlg()
114   {
115 #ifdef WITH_PARTITIONER
116     return MEDPartitioner::HasMetisAlg();
117 #else
118     return false;
119 #endif    
120   }
121   
122   bool HasParallelInterpolatorExt()
123   {
124 #ifdef WITH_PARALLEL_INTERPOLATOR
125     return true;
126 #else
127     return false;
128 #endif
129   }
130   
131   std::vector<std::string> ActiveExtensions()
132   {
133     std::vector<std::string> ret;
134     ret.push_back(std::string(SEQ_INTERPOL_EXT));
135 #ifdef WITH_MED_FILE
136     ret.push_back(std::string(MEDFILEIO_EXT));
137 #endif
138 #ifdef WITH_RENUMBER
139     ret.push_back(std::string(RENUM_EXT));
140 #endif
141 #ifdef WITH_PARTITIONER
142     ret.push_back(std::string(PART_EXT));
143 #endif
144 #ifdef WITH_PARALLEL_INTERPOLATOR
145     ret.push_back(std::string(PAR_INTERPOL_EXT));
146 #endif
147     return ret;
148   }
149 }
150
151 %pythoncode %{
152 def MEDCouplingDataArrayDoubleIadd(self,*args):
153     import _medcoupling
154     return _medcoupling.DataArrayDouble____iadd___(self, self, *args)
155 def MEDCouplingDataArrayDoubleIsub(self,*args):
156     import _medcoupling
157     return _medcoupling.DataArrayDouble____isub___(self, self, *args)
158 def MEDCouplingDataArrayDoubleImul(self,*args):
159     import _medcoupling
160     return _medcoupling.DataArrayDouble____imul___(self, self, *args)
161 def MEDCouplingDataArrayDoubleIdiv(self,*args):
162     import _medcoupling
163     return _medcoupling.DataArrayDouble____idiv___(self, self, *args)
164 def MEDCouplingDataArrayDoubleIpow(self,*args):
165     import _medcoupling
166     return _medcoupling.DataArrayDouble____ipow___(self, self, *args)
167 def MEDCouplingFieldDoubleIadd(self,*args):
168     import _medcoupling
169     return _medcoupling.MEDCouplingFieldDouble____iadd___(self, self, *args)
170 def MEDCouplingFieldDoubleIsub(self,*args):
171     import _medcoupling
172     return _medcoupling.MEDCouplingFieldDouble____isub___(self, self, *args)
173 def MEDCouplingFieldDoubleImul(self,*args):
174     import _medcoupling
175     return _medcoupling.MEDCouplingFieldDouble____imul___(self, self, *args)
176 def MEDCouplingFieldDoubleIdiv(self,*args):
177     import _medcoupling
178     return _medcoupling.MEDCouplingFieldDouble____idiv___(self, self, *args)
179 def MEDCouplingFieldDoubleIpow(self,*args):
180     import _medcoupling
181     return _medcoupling.MEDCouplingFieldDouble____ipow___(self, self, *args)
182 def MEDCouplingDataArrayInt32Iadd(self,*args):
183     import _medcoupling
184     return _medcoupling.DataArrayInt32____iadd___(self, self, *args)
185 def MEDCouplingDataArrayInt32Isub(self,*args):
186     import _medcoupling
187     return _medcoupling.DataArrayInt32____isub___(self, self, *args)
188 def MEDCouplingDataArrayInt32Imul(self,*args):
189     import _medcoupling
190     return _medcoupling.DataArrayInt32____imul___(self, self, *args)
191 def MEDCouplingDataArrayInt32Idiv(self,*args):
192     import _medcoupling
193     return _medcoupling.DataArrayInt32____idiv___(self, self, *args)
194 def MEDCouplingDataArrayInt32Imod(self,*args):
195     import _medcoupling
196     return _medcoupling.DataArrayInt32____imod___(self, self, *args)
197 def MEDCouplingDataArrayInt32Ipow(self,*args):
198     import _medcoupling
199     return _medcoupling.DataArrayInt32____ipow___(self, self, *args)
200 def MEDCouplingDataArrayInt64Iadd(self,*args):
201     import _medcoupling
202     return _medcoupling.DataArrayInt64____iadd___(self, self, *args)
203 def MEDCouplingDataArrayInt64Isub(self,*args):
204     import _medcoupling
205     return _medcoupling.DataArrayInt64____isub___(self, self, *args)
206 def MEDCouplingDataArrayInt64Imul(self,*args):
207     import _medcoupling
208     return _medcoupling.DataArrayInt64____imul___(self, self, *args)
209 def MEDCouplingDataArrayInt64Idiv(self,*args):
210     import _medcoupling
211     return _medcoupling.DataArrayInt64____idiv___(self, self, *args)
212 def MEDCouplingDataArrayInt64Imod(self,*args):
213     import _medcoupling
214     return _medcoupling.DataArrayInt64____imod___(self, self, *args)
215 def MEDCouplingDataArrayInt64Ipow(self,*args):
216     import _medcoupling
217     return _medcoupling.DataArrayInt64____ipow___(self, self, *args)
218 def MEDCouplingDataArrayFloatIadd(self,*args):
219     import _medcoupling
220     return _medcoupling.DataArrayFloat____iadd___(self, self, *args)
221 def MEDCouplingDataArrayFloatIsub(self,*args):
222     import _medcoupling
223     return _medcoupling.DataArrayFloat____isub___(self, self, *args)
224 def MEDCouplingDataArrayFloatImul(self,*args):
225     import _medcoupling
226     return _medcoupling.DataArrayFloat____imul___(self, self, *args)
227 def MEDCouplingDataArrayFloatIdiv(self,*args):
228     import _medcoupling
229     return _medcoupling.DataArrayFloat____idiv___(self, self, *args)
230 def MEDCouplingDataArrayDoubleTupleIadd(self,*args):
231     import _medcoupling
232     return _medcoupling.DataArrayDoubleTuple____iadd___(self, self, *args)
233 def MEDCouplingDataArrayDoubleTupleIsub(self,*args):
234     import _medcoupling
235     return _medcoupling.DataArrayDoubleTuple____isub___(self, self, *args)
236 def MEDCouplingDataArrayDoubleTupleImul(self,*args):
237     import _medcoupling
238     return _medcoupling.DataArrayDoubleTuple____imul___(self, self, *args)
239 def MEDCouplingDataArrayDoubleTupleIdiv(self,*args):
240     import _medcoupling
241     return _medcoupling.DataArrayDoubleTuple____idiv___(self, self, *args)
242 def MEDCouplingDataArrayInt32TupleIadd(self,*args):
243     import _medcoupling
244     return _medcoupling.DataArrayInt32Tuple____iadd___(self, self, *args)
245 def MEDCouplingDataArrayInt32TupleIsub(self,*args):
246     import _medcoupling
247     return _medcoupling.DataArrayInt32Tuple____isub___(self, self, *args)
248 def MEDCouplingDataArrayInt32TupleImul(self,*args):
249     import _medcoupling
250     return _medcoupling.DataArrayInt32Tuple____imul___(self, self, *args)
251 def MEDCouplingDataArrayInt32TupleIdiv(self,*args):
252     import _medcoupling
253     return _medcoupling.DataArrayInt32Tuple____idiv___(self, self, *args)
254 def MEDCouplingDataArrayInt32TupleImod(self,*args):
255     import _medcoupling
256     return _medcoupling.DataArrayInt32Tuple____imod___(self, self, *args)
257 def MEDCouplingDataArrayInt64TupleIadd(self,*args):
258     import _medcoupling
259     return _medcoupling.DataArrayInt64Tuple____iadd___(self, self, *args)
260 def MEDCouplingDataArrayInt64TupleIsub(self,*args):
261     import _medcoupling
262     return _medcoupling.DataArrayInt64Tuple____isub___(self, self, *args)
263 def MEDCouplingDataArrayInt64TupleImul(self,*args):
264     import _medcoupling
265     return _medcoupling.DataArrayInt64Tuple____imul___(self, self, *args)
266 def MEDCouplingDataArrayInt64TupleIdiv(self,*args):
267     import _medcoupling
268     return _medcoupling.DataArrayInt64Tuple____idiv___(self, self, *args)
269 def MEDCouplingDataArrayInt64TupleImod(self,*args):
270     import _medcoupling
271     return _medcoupling.DataArrayInt64Tuple____imod___(self, self, *args)
272 def MEDCouplingDenseMatrixIadd(self,*args):
273     import _medcoupling
274     return _medcoupling.DenseMatrix____iadd___(self, self, *args)
275 def MEDCouplingDenseMatrixIsub(self,*args):
276     import _medcoupling
277     return _medcoupling.DenseMatrix____isub___(self, self, *args)
278 %}
279
280 %include "MEDCouplingFinalize.i"
281
282 #ifdef WITH_MED_FILE
283 %include "MEDLoaderFinalize.i"
284 #endif
285
286 %include "medcoupling_pycode"
287