- sw=-1;
- if(PyFloat_Check(value))
- {
- val=PyFloat_AS_DOUBLE(value);
- sw=1;
- if(nbCompExpected!=1)
- {
- std::ostringstream oss; oss << msg << "dimension expected to be " << nbCompExpected << " , and your data in input has dimension one (single PyFloat) !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- nbTuples=1;
- return &val;
- }
- if(PyInt_Check(value))
- {
- val=(double)PyInt_AS_LONG(value);
- sw=1;
- if(nbCompExpected!=1)
- {
- std::ostringstream oss; oss << msg << "dimension expected to be " << nbCompExpected << " , and your data in input has dimension one (single PyInt) !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- nbTuples=1;
- return &val;
- }
- if(PyTuple_Check(value))
- {
- int size=PyTuple_Size(value);
- f.resize(size);
- for(int i=0;i<size;i++)
- {
- PyObject *o=PyTuple_GetItem(value,i);
- if(PyFloat_Check(o))
- f[i]=PyFloat_AS_DOUBLE(o);
- else if(PyInt_Check(o))
- f[i]=(double)PyInt_AS_LONG(o);
- else
- {
- std::ostringstream oss; oss << "Tuple as been detected but element #" << i << " is not double ! only tuples of doubles accepted or integer !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- }
- sw=4;
- if(size%nbCompExpected!=0)
- {
- std::ostringstream oss; oss << msg << "dimension expected to be a multiple of " << nbCompExpected << " , and your data in input has dimension " << f.size() << " !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- nbTuples=size/nbCompExpected;
- return &f[0];
- }
- if(PyList_Check(value))
- {
- int size=PyList_Size(value);
- f.resize(size);
- for(int i=0;i<size;i++)
- {
- PyObject *o=PyList_GetItem(value,i);
- if(PyFloat_Check(o))
- f[i]=PyFloat_AS_DOUBLE(o);
- else if(PyInt_Check(o))
- f[i]=(double)PyInt_AS_LONG(o);
- else
- {
- std::ostringstream oss; oss << "List as been detected but element #" << i << " is not double ! only lists of doubles accepted or integer !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- }
- sw=4;
- if(size%nbCompExpected!=0)
- {
- std::ostringstream oss; oss << msg << "dimension expected to be a multiple of " << nbCompExpected << " , and your data in input has dimension " << f.size() << " !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- nbTuples=size/nbCompExpected;
- return &f[0];
- }
- void *argp;
- int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,0|0);
- if(SWIG_IsOK(status))
- {
- d=reinterpret_cast< ParaMEDMEM::DataArrayDouble * >(argp);
- sw=2;
- if(d)
- {
- if(d->getNumberOfComponents()==nbCompExpected)
- {
- nbTuples=d->getNumberOfTuples();
- return d->getConstPointer();
- }
- else
- {
- std::ostringstream oss; oss << msg << "nb of components expected to be a multiple of " << nbCompExpected << " , and input has " << d->getNumberOfComponents() << " components !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- }
- else
- {
- if(throwIfNullPt)
- {
- std::ostringstream oss; oss << msg << " null pointer not accepted!";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- else
- { nbTuples=0; return 0; }
- }
- }
- status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayDoubleTuple,0|0);
- if(SWIG_IsOK(status))
- {
- e=reinterpret_cast< ParaMEDMEM::DataArrayDoubleTuple * >(argp);
- sw=3;
- if(e)
- {
- if(e->getNumberOfCompo()==nbCompExpected)
- {
- nbTuples=1;
- return e->getConstPointer();
- }
- else
- {
- std::ostringstream oss; oss << msg << "nb of components expected to be " << nbCompExpected << " , and input DataArrayDoubleTuple has " << e->getNumberOfCompo() << " components !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- }
- else
- {
- if(throwIfNullPt)
- {
- std::ostringstream oss; oss << msg << " null pointer not accepted!";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- else
- { nbTuples=0; return 0; }
- }
- }
- throw INTERP_KERNEL::Exception("4 types accepted : integer, double, DataArrayDouble, DataArrayDoubleTuple");
+ self->checkConsistencyLight();
+ PyObject *ret(PyTuple_New(1));
+ PyObject *ret0(PyDict_New());
+ {
+ PyObject *a(PyInt_FromLong(0)),*b(PyInt_FromLong(self->getTypeOfField())),*c(PyInt_FromLong(self->getTimeDiscretization()));
+ PyObject *d(PyTuple_New(2)); PyTuple_SetItem(d,0,b); PyTuple_SetItem(d,1,c);
+ PyDict_SetItem(ret0,a,d);
+ Py_DECREF(a); Py_DECREF(d);
+ }
+ PyTuple_SetItem(ret,0,ret0);
+ return ret;