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