1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
25 #include "MESHClient.hxx"
26 #include "SUPPORTClient.hxx"
27 #include "FIELDClient.hxx"
28 #include CORBA_CLIENT_HEADER(MED)
30 using namespace MEDMEM;
31 using namespace MED_EN;
35 if ((SWIG_ConvertPtr($input, (void **) &$1, $1_descriptor, 0)) == -1) {
37 if ((SWIG_ConvertPtr($input, (void **) &client, $descriptor(MESHClient *), 0)) == -1) {
38 SWIG_Python_TypeError("MESH* or MESHClient*", $input);
45 %include "libMedCorba_Swig.i"
46 %include "libMEDMEM_Swig.i"
48 %typecheck(SWIG_TYPECHECK_POINTER) SALOME_MED::FIELDDOUBLE_ptr, SALOME_MED::FIELDINT_ptr
54 managing C++ exception in the Python API
58 class PyAllowThreadsGuard {
60 PyAllowThreadsGuard() { _save = PyEval_SaveThread(); }
61 ~PyAllowThreadsGuard() { PyEval_RestoreThread(_save); }
66 PyAllowThreadsGuard guard;
71 class MESHClient : public MESH {
75 MESHClient(const SALOME_MED::MESH_ptr m);
81 self->removeReference();
86 MESH * getMeshPointer(MESHClient * input);
88 MESH * getMeshPointer(MESHClient * input)
90 return (MESH *) input;
94 class SUPPORTClient : public SUPPORT {
98 SUPPORTClient(const SALOME_MED::SUPPORT_ptr S,
105 self->removeReference();
111 template<class T, class INTERLACING_TAG>
112 class FIELDClient : public FIELD<T,INTERLACING_TAG>
116 FIELDClient(U ptrCorba,MEDMEM::SUPPORT * S = NULL);
120 %template (FIELDDOUBLEClient) FIELDClient<double, FullInterlace>;
121 %template (FIELDDOUBLENOINTERLACEClient) FIELDClient<double, NoInterlace>;
122 %template (FIELDDOUBLENOINTERLACEBYTYPEClient) FIELDClient<double, NoInterlaceByType>;
123 %template (FIELDINTClient) FIELDClient<int, FullInterlace>;
124 %template (FIELDINTNOINTERLACEClient) FIELDClient<int, NoInterlace>;
125 %template (FIELDINTNOINTERLACEBYTYPEClient) FIELDClient<int, NoInterlaceByType>;
127 %extend FIELDClient<double, FullInterlace>
129 %template(FIELDDOUBLEClient) FIELDClient<SALOME_MED::FIELDDOUBLE_ptr>;
132 %extend FIELDClient<double, NoInterlace>
134 %template(FIELDDOUBLENOINTERLACEClient) FIELDClient<SALOME_MED::FIELDDOUBLE_ptr>;
137 %extend FIELDClient<double, NoInterlaceByType>
139 %template(FIELDDOUBLENOINTERLACEBYTYPEClient) FIELDClient<SALOME_MED::FIELDDOUBLE_ptr>;
142 %extend FIELDClient<int, FullInterlace>
144 %template(FIELDINTClient) FIELDClient<SALOME_MED::FIELDINT_ptr>;
147 %extend FIELDClient<int, NoInterlace>
149 %template(FIELDINTNOINTERLACEClient) FIELDClient<SALOME_MED::FIELDINT_ptr>;
152 %extend FIELDClient<int, NoInterlaceByType>
154 %template(FIELDINTNOINTERLACEBYTYPEClient) FIELDClient<SALOME_MED::FIELDINT_ptr>;
157 FIELD<double> * getDoublePointer(FIELDClient<double,FullInterlace> * input);
159 FIELD<double,NoInterlace> *getDoubleNoInterlacePointer(FIELDClient<double,NoInterlace> * input);
161 FIELD<double,NoInterlaceByType> *getDoubleNoInterlaceByTypePointer(FIELDClient<double,NoInterlaceByType> * input);
163 FIELD<int> * getIntPointer(FIELDClient<int,FullInterlace> * input);
165 FIELD<int,NoInterlace> * getIntNoInterlacePointer(FIELDClient<int,NoInterlace> * input);
167 FIELD<int,NoInterlaceByType> * getIntNoInterlaceByTypePointer(FIELDClient<int,NoInterlaceByType> * input);
170 FIELD<double> * getDoublePointer(FIELDClient<double,FullInterlace> * input)
172 return (FIELD<double> *) input;
175 FIELD<double,NoInterlace> *getDoubleNoInterlacePointer(FIELDClient<double,NoInterlace> * input)
177 return (FIELD<double,NoInterlace> *) input;
180 FIELD<double,NoInterlaceByType> *getDoubleNoInterlaceByTypePointer(FIELDClient<double,NoInterlaceByType> * input)
182 return (FIELD<double,NoInterlaceByType> *) input;
185 FIELD<int> * getIntPointer(FIELDClient<int,FullInterlace> * input)
187 return (FIELD<int> *) input;
190 FIELD<int,NoInterlace> * getIntNoInterlacePointer(FIELDClient<int,NoInterlace> * input)
192 return (FIELD<int,NoInterlace> *) input;
195 FIELD<int,NoInterlaceByType> * getIntNoInterlaceByTypePointer(FIELDClient<int,NoInterlaceByType> * input)
197 return (FIELD<int,NoInterlaceByType> *) input;