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 MEDCouplingClient
23 #include "MEDCouplingFieldDoubleClient.hxx"
24 #include "MEDCouplingFieldTemplateClient.hxx"
25 #include "MEDCouplingMultiFieldsClient.hxx"
26 #include "MEDCouplingFieldOverTimeClient.hxx"
27 #include "MEDCouplingUMeshClient.hxx"
28 #include "MEDCouplingExtrudedMeshClient.hxx"
29 #include "MEDCouplingCMeshClient.hxx"
30 #include "DataArrayDoubleClient.hxx"
31 #include "DataArrayIntClient.hxx"
35 using namespace ParaMEDMEM;
38 %include "MEDCouplingCommon.i"
40 %newobject ParaMEDMEM::MEDCouplingFieldDoubleClient::New;
41 %newobject ParaMEDMEM::MEDCouplingFieldTemplateClient::New;
42 %newobject ParaMEDMEM::MEDCouplingUMeshClient::New;
43 %newobject ParaMEDMEM::MEDCouplingExtrudedMeshClient::New;
44 %newobject ParaMEDMEM::MEDCouplingCMeshClient::New;
45 %newobject ParaMEDMEM::MEDCouplingMultiFieldsClient::New;
46 %newobject ParaMEDMEM::MEDCouplingFieldOverTimeClient::New;
47 %newobject ParaMEDMEM::DataArrayDoubleClient::New;
48 %newobject ParaMEDMEM::DataArrayIntClient::New;
55 class MEDCouplingFieldDoubleClient
60 static MEDCouplingFieldDouble *New(PyObject *fieldPtr) throw(INTERP_KERNEL::Exception)
62 PyObject* pdict=PyDict_New();
63 PyDict_SetItemString(pdict,"__builtins__",PyEval_GetBuiltins());
64 PyRun_String("import MEDCouplingCorbaServant_idl",Py_single_input,pdict, pdict);
65 PyRun_String("import CORBA",Py_single_input,pdict, pdict);
66 PyRun_String("orbTmp15634=CORBA.ORB_init([''])", Py_single_input,pdict, pdict);
67 PyObject *orbPython=PyDict_GetItemString(pdict,"orbTmp15634");
68 // Ask omniORBpy to transform SUPPORT (python Corba) ptr to IOR string
69 PyObject *iorField=PyObject_CallMethod(orbPython,(char*)"object_to_string",(char*)"O",fieldPtr);
71 throw INTERP_KERNEL::Exception("Error : the input parameter of MEDCouplingFieldDoubleClient.New appears to differ from CORBA reference ! Expecting a FieldDouble CORBA reference !");
72 char *ior=PyString_AsString(iorField);
74 CORBA::ORB_var orb=CORBA::ORB_init(argc,0);
75 CORBA::Object_var fieldPtrCpp=orb->string_to_object(ior);
76 SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_var fieldPtrCppC=SALOME_MED::MEDCouplingFieldDoubleCorbaInterface::_narrow(fieldPtrCpp);
77 if(CORBA::is_nil(fieldPtrCppC))
78 throw INTERP_KERNEL::Exception("error corba pointer is not a SALOME_MED.MEDCouplingFieldDoubleCorbaInterface_ptr !");
81 MEDCouplingFieldDouble *ret=MEDCouplingFieldDoubleClient::New(fieldPtrCppC);
87 class MEDCouplingFieldTemplateClient
92 static MEDCouplingFieldTemplate *New(PyObject *fieldPtr) throw(INTERP_KERNEL::Exception)
94 PyObject* pdict=PyDict_New();
95 PyDict_SetItemString(pdict,"__builtins__",PyEval_GetBuiltins());
96 PyRun_String("import MEDCouplingCorbaServant_idl",Py_single_input,pdict, pdict);
97 PyRun_String("import CORBA",Py_single_input,pdict, pdict);
98 PyRun_String("orbTmp15634=CORBA.ORB_init([''])", Py_single_input,pdict, pdict);
99 PyObject *orbPython=PyDict_GetItemString(pdict,"orbTmp15634");
100 // Ask omniORBpy to transform SUPPORT (python Corba) ptr to IOR string
101 PyObject *iorField=PyObject_CallMethod(orbPython,(char*)"object_to_string",(char*)"O",fieldPtr);
103 throw INTERP_KERNEL::Exception("Error : the input parameter of MEDCouplingFieldTemplateClient.New appears to differ from CORBA reference ! Expecting a FieldTemplate CORBA reference !");
104 char *ior=PyString_AsString(iorField);
106 CORBA::ORB_var orb=CORBA::ORB_init(argc,0);
107 CORBA::Object_var fieldPtrCpp=orb->string_to_object(ior);
108 SALOME_MED::MEDCouplingFieldTemplateCorbaInterface_var fieldPtrCppC=SALOME_MED::MEDCouplingFieldTemplateCorbaInterface::_narrow(fieldPtrCpp);
109 if(CORBA::is_nil(fieldPtrCppC))
110 throw INTERP_KERNEL::Exception("error corba pointer is not a SALOME_MED.MEDCouplingFieldTemplateCorbaInterface_ptr !");
113 MEDCouplingFieldTemplate *ret=MEDCouplingFieldTemplateClient::New(fieldPtrCppC);
119 class MEDCouplingMultiFieldsClient
124 static MEDCouplingMultiFields *New(PyObject *fieldPtr) throw(INTERP_KERNEL::Exception)
126 PyObject* pdict=PyDict_New();
127 PyDict_SetItemString(pdict,"__builtins__",PyEval_GetBuiltins());
128 PyRun_String("import MEDCouplingCorbaServant_idl",Py_single_input,pdict, pdict);
129 PyRun_String("import CORBA",Py_single_input,pdict, pdict);
130 PyRun_String("orbTmp15634=CORBA.ORB_init([''])", Py_single_input,pdict, pdict);
131 PyObject *orbPython=PyDict_GetItemString(pdict,"orbTmp15634");
132 // Ask omniORBpy to transform SUPPORT (python Corba) ptr to IOR string
133 PyObject *iorField=PyObject_CallMethod(orbPython,(char*)"object_to_string",(char*)"O",fieldPtr);
135 throw INTERP_KERNEL::Exception("Error : the input parameter of MEDCouplingFieldTemplateClient.New appears to differ from CORBA reference ! Expecting a MultiFields CORBA reference !");
136 char *ior=PyString_AsString(iorField);
138 CORBA::ORB_var orb=CORBA::ORB_init(argc,0);
139 CORBA::Object_var fieldPtrCpp=orb->string_to_object(ior);
140 SALOME_MED::MEDCouplingMultiFieldsCorbaInterface_var fieldPtrCppC=SALOME_MED::MEDCouplingMultiFieldsCorbaInterface::_narrow(fieldPtrCpp);
141 if(CORBA::is_nil(fieldPtrCppC))
142 throw INTERP_KERNEL::Exception("error corba pointer is not a SALOME_MED.MEDCouplingMultiFieldsCorbaInterface_ptr !");
145 MEDCouplingMultiFields *ret=MEDCouplingMultiFieldsClient::New(fieldPtrCppC);
151 class MEDCouplingFieldOverTimeClient : public MEDCouplingFieldOverTime
154 std::vector<double> getTimeSteps() const;
157 static MEDCouplingFieldOverTimeClient *New(PyObject *fieldPtr) throw(INTERP_KERNEL::Exception)
159 PyObject* pdict=PyDict_New();
160 PyDict_SetItemString(pdict,"__builtins__",PyEval_GetBuiltins());
161 PyRun_String("import MEDCouplingCorbaServant_idl",Py_single_input,pdict, pdict);
162 PyRun_String("import CORBA",Py_single_input,pdict, pdict);
163 PyRun_String("orbTmp15634=CORBA.ORB_init([''])", Py_single_input,pdict, pdict);
164 PyObject *orbPython=PyDict_GetItemString(pdict,"orbTmp15634");
165 // Ask omniORBpy to transform SUPPORT (python Corba) ptr to IOR string
166 PyObject *iorField=PyObject_CallMethod(orbPython,(char*)"object_to_string",(char*)"O",fieldPtr);
168 throw INTERP_KERNEL::Exception("Error : the input parameter of MEDCouplingFieldOverTimeClient.New appears to differ from CORBA reference ! Expecting a FieldOverTime CORBA reference !");
169 char *ior=PyString_AsString(iorField);
171 CORBA::ORB_var orb=CORBA::ORB_init(argc,0);
172 CORBA::Object_var fieldPtrCpp=orb->string_to_object(ior);
173 SALOME_MED::MEDCouplingFieldOverTimeCorbaInterface_var fieldPtrCppC=SALOME_MED::MEDCouplingFieldOverTimeCorbaInterface::_narrow(fieldPtrCpp);
174 if(CORBA::is_nil(fieldPtrCppC))
175 throw INTERP_KERNEL::Exception("error corba pointer is not a SALOME_MED.MEDCouplingFieldOverTimeCorbaInterface_ptr !");
178 MEDCouplingFieldOverTimeClient *ret=MEDCouplingFieldOverTimeClient::New(fieldPtrCppC);
184 class MEDCouplingUMeshClient
189 static MEDCouplingUMesh *New(PyObject *meshPtr) throw(INTERP_KERNEL::Exception)
191 PyObject* pdict=PyDict_New();
192 PyDict_SetItemString(pdict,"__builtins__",PyEval_GetBuiltins());
193 PyRun_String("import MEDCouplingCorbaServant_idl",Py_single_input,pdict, pdict);
194 PyRun_String("import CORBA",Py_single_input,pdict, pdict);
195 PyRun_String("orbTmp15634=CORBA.ORB_init([''])", Py_single_input,pdict, pdict);
196 PyObject *orbPython=PyDict_GetItemString(pdict,"orbTmp15634");
197 // Ask omniORBpy to transform SUPPORT (python Corba) ptr to IOR string
198 PyObject *iorMesh=PyObject_CallMethod(orbPython,(char*)"object_to_string",(char*)"O",meshPtr);
200 throw INTERP_KERNEL::Exception("Error : the input parameter of MEDCouplingUMeshClient.New appears to differ from CORBA reference ! Expecting a UMeshCorbaInterface CORBA reference !");
201 char *ior=PyString_AsString(iorMesh);
203 CORBA::ORB_var orb=CORBA::ORB_init(argc,0);
204 CORBA::Object_var meshPtrCpp=orb->string_to_object(ior);
205 SALOME_MED::MEDCouplingUMeshCorbaInterface_var meshPtrCppC=SALOME_MED::MEDCouplingUMeshCorbaInterface::_narrow(meshPtrCpp);
206 if(CORBA::is_nil(meshPtrCppC))
207 throw INTERP_KERNEL::Exception("error corba pointer is not a SALOME_MED.MEDCouplingUMeshInterface_ptr !");
210 MEDCouplingUMesh *ret=MEDCouplingUMeshClient::New(meshPtrCppC);
216 class MEDCouplingExtrudedMeshClient
221 static MEDCouplingExtrudedMesh *New(PyObject *meshPtr) throw(INTERP_KERNEL::Exception)
223 PyObject* pdict=PyDict_New();
224 PyDict_SetItemString(pdict,"__builtins__",PyEval_GetBuiltins());
225 PyRun_String("import MEDCouplingCorbaServant_idl",Py_single_input,pdict, pdict);
226 PyRun_String("import CORBA",Py_single_input,pdict, pdict);
227 PyRun_String("orbTmp15634=CORBA.ORB_init([''])", Py_single_input,pdict, pdict);
228 PyObject *orbPython=PyDict_GetItemString(pdict,"orbTmp15634");
229 // Ask omniORBpy to transform SUPPORT (python Corba) ptr to IOR string
230 PyObject *iorMesh=PyObject_CallMethod(orbPython,(char*)"object_to_string",(char*)"O",meshPtr);
232 throw INTERP_KERNEL::Exception("Error : the input parameter of MEDCouplingExtrudedMeshClient.New appears to differ from CORBA reference ! Expecting an ExtrudedMeshCorbaInterface CORBA reference !");
233 char *ior=PyString_AsString(iorMesh);
235 CORBA::ORB_var orb=CORBA::ORB_init(argc,0);
236 CORBA::Object_var meshPtrCpp=orb->string_to_object(ior);
237 SALOME_MED::MEDCouplingExtrudedMeshCorbaInterface_var meshPtrCppC=SALOME_MED::MEDCouplingExtrudedMeshCorbaInterface::_narrow(meshPtrCpp);
238 if(CORBA::is_nil(meshPtrCppC))
239 throw INTERP_KERNEL::Exception("error corba pointer is not a SALOME_MED.MEDCouplingExtrudedMeshInterface_ptr !");
242 MEDCouplingExtrudedMesh *ret=MEDCouplingExtrudedMeshClient::New(meshPtrCppC);
248 class MEDCouplingCMeshClient
253 static MEDCouplingCMesh *New(PyObject *meshPtr) throw(INTERP_KERNEL::Exception)
255 PyObject* pdict=PyDict_New();
256 PyDict_SetItemString(pdict,"__builtins__",PyEval_GetBuiltins());
257 PyRun_String("import MEDCouplingCorbaServant_idl",Py_single_input,pdict, pdict);
258 PyRun_String("import CORBA",Py_single_input,pdict, pdict);
259 PyRun_String("orbTmp15634=CORBA.ORB_init([''])", Py_single_input,pdict, pdict);
260 PyObject *orbPython=PyDict_GetItemString(pdict,"orbTmp15634");
261 // Ask omniORBpy to transform SUPPORT (python Corba) ptr to IOR string
262 PyObject *iorMesh=PyObject_CallMethod(orbPython,(char*)"object_to_string",(char*)"O",meshPtr);
264 throw INTERP_KERNEL::Exception("Error : the input parameter of MEDCouplingCMeshClient.New appears to differ from CORBA reference ! Expecting a CMeshCorbaInterface CORBA reference !");
265 char *ior=PyString_AsString(iorMesh);
267 CORBA::ORB_var orb=CORBA::ORB_init(argc,0);
268 CORBA::Object_var meshPtrCpp=orb->string_to_object(ior);
269 SALOME_MED::MEDCouplingCMeshCorbaInterface_var meshPtrCppC=SALOME_MED::MEDCouplingCMeshCorbaInterface::_narrow(meshPtrCpp);
270 if(CORBA::is_nil(meshPtrCppC))
271 throw INTERP_KERNEL::Exception("error corba pointer is not a SALOME_MED.MEDCouplingCMeshInterface_ptr !");
274 MEDCouplingCMesh *ret=MEDCouplingCMeshClient::New(meshPtrCppC);
280 class DataArrayDoubleClient
285 static DataArrayDouble *New(PyObject *meshPtr) throw(INTERP_KERNEL::Exception)
287 PyObject* pdict=PyDict_New();
288 PyDict_SetItemString(pdict,"__builtins__",PyEval_GetBuiltins());
289 PyRun_String("import MEDCouplingCorbaServant_idl",Py_single_input,pdict, pdict);
290 PyRun_String("import CORBA",Py_single_input,pdict, pdict);
291 PyRun_String("orbTmp15634=CORBA.ORB_init([''])", Py_single_input,pdict, pdict);
292 PyObject *orbPython=PyDict_GetItemString(pdict,"orbTmp15634");
293 // Ask omniORBpy to transform SUPPORT (python Corba) ptr to IOR string
294 PyObject *iorMesh=PyObject_CallMethod(orbPython,(char*)"object_to_string",(char*)"O",meshPtr);
296 throw INTERP_KERNEL::Exception("Error : the input parameter of DataArrayDoubleClient.New appears to differ from CORBA reference ! Expecting a DataArrayDoubleCorbaInterface CORBA reference !");
297 char *ior=PyString_AsString(iorMesh);
299 CORBA::ORB_var orb=CORBA::ORB_init(argc,0);
300 CORBA::Object_var meshPtrCpp=orb->string_to_object(ior);
301 SALOME_MED::DataArrayDoubleCorbaInterface_var meshPtrCppC=SALOME_MED::DataArrayDoubleCorbaInterface::_narrow(meshPtrCpp);
302 if(CORBA::is_nil(meshPtrCppC))
303 throw INTERP_KERNEL::Exception("error corba pointer is not a SALOME_MED.DataArrayDoubleInterface_ptr ");
306 DataArrayDouble *ret=DataArrayDoubleClient::New(meshPtrCppC);
312 class DataArrayIntClient
317 static DataArrayInt *New(PyObject *meshPtr) throw(INTERP_KERNEL::Exception)
319 PyObject* pdict=PyDict_New();
320 PyDict_SetItemString(pdict,"__builtins__",PyEval_GetBuiltins());
321 PyRun_String("import MEDCouplingCorbaServant_idl",Py_single_input,pdict, pdict);
322 PyRun_String("import CORBA",Py_single_input,pdict, pdict);
323 PyRun_String("orbTmp15634=CORBA.ORB_init([''])", Py_single_input,pdict, pdict);
324 PyObject *orbPython=PyDict_GetItemString(pdict,"orbTmp15634");
325 // Ask omniORBpy to transform SUPPORT (python Corba) ptr to IOR string
326 PyObject *iorMesh=PyObject_CallMethod(orbPython,(char*)"object_to_string",(char*)"O",meshPtr);
328 throw INTERP_KERNEL::Exception("Error : the input parameter of DataArrayIntClient.New appears to differ from CORBA reference ! Expecting a DataArrayIntCorbaInterface CORBA reference !");
329 char *ior=PyString_AsString(iorMesh);
331 CORBA::ORB_var orb=CORBA::ORB_init(argc,0);
332 CORBA::Object_var meshPtrCpp=orb->string_to_object(ior);
333 SALOME_MED::DataArrayIntCorbaInterface_var meshPtrCppC=SALOME_MED::DataArrayIntCorbaInterface::_narrow(meshPtrCpp);
334 if(CORBA::is_nil(meshPtrCppC))
335 throw INTERP_KERNEL::Exception("error corba pointer is not a SALOME_MED.DataArrayIntInterface_ptr !");
338 DataArrayInt *ret=DataArrayIntClient::New(meshPtrCppC);
346 def ParaMEDMEMDataArrayDoubleIadd(self,*args):
347 import _MEDCouplingClient
348 return _MEDCouplingClient.DataArrayDouble____iadd___(self, self, *args)
349 def ParaMEDMEMDataArrayDoubleIsub(self,*args):
350 import _MEDCouplingClient
351 return _MEDCouplingClient.DataArrayDouble____isub___(self, self, *args)
352 def ParaMEDMEMDataArrayDoubleImul(self,*args):
353 import _MEDCouplingClient
354 return _MEDCouplingClient.DataArrayDouble____imul___(self, self, *args)
355 def ParaMEDMEMDataArrayDoubleIdiv(self,*args):
356 import _MEDCouplingClient
357 return _MEDCouplingClient.DataArrayDouble____idiv___(self, self, *args)
358 def ParaMEDMEMMEDCouplingFieldDoubleIadd(self,*args):
359 import _MEDCouplingClient
360 return _MEDCouplingClient.MEDCouplingFieldDouble____iadd___(self, self, *args)
361 def ParaMEDMEMMEDCouplingFieldDoubleIsub(self,*args):
362 import _MEDCouplingClient
363 return _MEDCouplingClient.MEDCouplingFieldDouble____isub___(self, self, *args)
364 def ParaMEDMEMMEDCouplingFieldDoubleImul(self,*args):
365 import _MEDCouplingClient
366 return _MEDCouplingClient.MEDCouplingFieldDouble____imul___(self, self, *args)
367 def ParaMEDMEMMEDCouplingFieldDoubleIdiv(self,*args):
368 import _MEDCouplingClient
369 return _MEDCouplingClient.MEDCouplingFieldDouble____idiv___(self, self, *args)
370 def ParaMEDMEMDataArrayIntIadd(self,*args):
371 import _MEDCouplingClient
372 return _MEDCouplingClient.DataArrayInt____iadd___(self, self, *args)
373 def ParaMEDMEMDataArrayIntIsub(self,*args):
374 import _MEDCouplingClient
375 return _MEDCouplingClient.DataArrayInt____isub___(self, self, *args)
376 def ParaMEDMEMDataArrayIntImul(self,*args):
377 import _MEDCouplingClient
378 return _MEDCouplingClient.DataArrayInt____imul___(self, self, *args)
379 def ParaMEDMEMDataArrayIntIdiv(self,*args):
380 import _MEDCouplingClient
381 return _MEDCouplingClient.DataArrayInt____idiv___(self, self, *args)
382 def ParaMEDMEMDataArrayIntImod(self,*args):
383 import _MEDCouplingClient
384 return _MEDCouplingClient.DataArrayInt____imod___(self, self, *args)
387 %include "MEDCouplingFinalize.i"