1 // Copyright (C) 2007-2014 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, or (at your option) any later version.
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
19 // Author : Anthony Geay (CEA/DEN)
23 static PyObject* convertMEDCalculatorDBField(ParaMEDMEM::MEDCalculatorDBField *f, int owner)
26 if(dynamic_cast<ParaMEDMEM::MEDCalculatorDBFieldReal *>(f))
27 ret=SWIG_NewPointerObj((void*)f,SWIGTYPE_p_ParaMEDMEM__MEDCalculatorDBFieldReal,owner);
28 if(dynamic_cast<ParaMEDMEM::MEDCalculatorDBFieldCst *>(f))
29 ret=SWIG_NewPointerObj((void*)f,SWIGTYPE_p_ParaMEDMEM__MEDCalculatorDBFieldCst,owner);
33 void convertPyObjToRS(PyObject *o, ParaMEDMEM::MEDCalculatorDBRangeSelection& rs)
37 int val=(int)PyInt_AS_LONG(o);
43 char *s=PyString_AsString(o);
47 PyErr_SetString(PyExc_TypeError,"Range selection must be an integer or a string !");
50 void convertPyObjToRS2(PyObject *o, ParaMEDMEM::MEDCalculatorDBRangeSelection& rs, const char *msg)
54 int val=(int)PyInt_AS_LONG(o);
60 std::ostringstream oss;
61 oss << "Expecting a slice or an integer for " << msg << " !";
62 throw INTERP_KERNEL::Exception(oss.str().c_str());
64 Py_ssize_t strt,stp,step;
65 PySliceObject *oC=reinterpret_cast<PySliceObject *>(o);
66 PySlice_GetIndices(oC,std::numeric_limits<int>::max(),&strt,&stp,&step);