-// Copyright (C) 2007-2016 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2017 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
/*
* Don't allow infinite chains of views, always set the base
- * to the first owner of the data.
- * That is, either the first object which isn't an array,
+ * to the first owner of the data.
+ * That is, either the first object which isn't an array,
* or the first object which owns its own data.
*/
while (PyArray_Check(obj) && (PyObject *)arr != obj) {
PyArrayObject *obj_arr = (PyArrayObject *)obj;
PyObject *tmp;
-
+
/* If this array owns its own data, stop collapsing */
- if (PyArray_CHKFLAGS(obj_arr, MED_NUMPY_OWNDATA )) {
+ if (PyArray_CHKFLAGS(obj_arr, MED_NUMPY_OWNDATA )) {
break;
- }
+ }
tmp = PyArray_BASE(obj_arr);
/* If there's no base, stop collapsing */
if (tmp == NULL) {
break;
}
- /* Stop the collapse new base when the would not be of the same
+ /* Stop the collapse new base when the would not be of the same
* type (i.e. different subclass).
*/
if (Py_TYPE(tmp) != Py_TYPE(arr)) {
MEDCoupling::MemArray<T>& mem=self->accessToMemArray();
if(nbComp==0)
{
- std::ostringstream oss; oss << MCDataStr << "::toNumPyArray : number of components of this is 0 ! Should be > 0 !";
+ std::ostringstream oss; oss << MCDataStr << "::toNumPyArray : number of components of this is 0 ! Should be > 0 !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
int nbDims=nbComp==1?1:2;
}
status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,0|0);
if(SWIG_IsOK(status))
- {
+ {
daIntTuple=reinterpret_cast< MEDCoupling::DataArrayIntTuple * >(argp);
sw=4;
return ;
}
status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,0|0);
if(SWIG_IsOK(status))
- {
+ {
MEDCoupling::DataArrayIntTuple *daIntTuple=reinterpret_cast< MEDCoupling::DataArrayIntTuple * >(argp);
sw=4; sz=daIntTuple->getNumberOfCompo();
return daIntTuple->getConstPointer();
void *argp;
int status=SWIG_ConvertPtr(value,&argp,ti_da,0|0);
if(SWIG_IsOK(status))
- {
+ {
d=reinterpret_cast< typename MEDCoupling::Traits<T>::ArrayType * >(argp);
sw=2;
return ;
}
status=SWIG_ConvertPtr(value,&argp,ti_tuple,0|0);
if(SWIG_IsOK(status))
- {
+ {
e=reinterpret_cast< typename MEDCoupling::Traits<T>::ArrayTuple * >(argp);
sw=3;
return ;
sw=1;
if(nbTuplesExpected*nbCompExpected!=1)
{
- std::ostringstream oss; oss << msg << "dimension expected to be " << nbTuplesExpected*nbCompExpected << " , and your data in input has dimension one (single PyFloat) !";
+ std::ostringstream oss; oss << msg << "dimension expected to be " << nbTuplesExpected*nbCompExpected << " , and your data in input has dimension one (single PyFloat) !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
return &val;
sw=1;
if(nbTuplesExpected*nbCompExpected!=1)
{
- std::ostringstream oss; oss << msg << "dimension expected to be " << nbTuplesExpected*nbCompExpected << " , and your data in input has dimension one (single PyInt) !";
+ std::ostringstream oss; oss << msg << "dimension expected to be " << nbTuplesExpected*nbCompExpected << " , and your data in input has dimension one (single PyInt) !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
return &val;
void *argp;
int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0);
if(SWIG_IsOK(status))
- {
+ {
d=reinterpret_cast< MEDCoupling::DataArrayDouble * >(argp);
sw=2;
if(d)
}
status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,0|0);
if(SWIG_IsOK(status))
- {
+ {
e=reinterpret_cast< MEDCoupling::DataArrayDoubleTuple * >(argp);
sw=3;
if(e->getNumberOfCompo()==nbCompExpected)
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) !";
+ 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;
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) !";
+ 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;
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() << " !";
+ 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;
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() << " !";
+ 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;
void *argp;
int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0);
if(SWIG_IsOK(status))
- {
+ {
d=reinterpret_cast< MEDCoupling::DataArrayDouble * >(argp);
sw=2;
if(d)
}
status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,0|0);
if(SWIG_IsOK(status))
- {
+ {
e=reinterpret_cast< MEDCoupling::DataArrayDoubleTuple * >(argp);
sw=3;
if(e)
void *argp;
int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0);
if(SWIG_IsOK(status))
- {
+ {
d=reinterpret_cast< MEDCoupling::DataArrayDouble * >(argp);
sw=2;
if(d)
}
status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,0|0);
if(SWIG_IsOK(status))
- {
+ {
e=reinterpret_cast< MEDCoupling::DataArrayDoubleTuple * >(argp);
sw=3;
if(e)
throw INTERP_KERNEL::Exception(msg);
}
}
-
+
template<class T>
PyObject *DataArrayT_isub__internal(PyObject *trueSelf, PyObject *obj, typename MEDCoupling::Traits<T>::ArrayType *self, swig_type_info *ti_da, swig_type_info *ti_tuple)
{
swig_type_info *SWIGTITraits<float>::TI_TUPLE=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayFloat is null when called here ! Postpone initialization at inlined initializeMe()
swig_type_info *SWIGTITraits<int>::TI_TUPLE=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayFloat is null when called here ! Postpone initialization at inlined initializeMe()
+#ifdef WITH_NUMPY
PyTypeObject *NPYTraits<double>::NPYFunc=&PyCallBackDataArrayDouble_RefType;
PyTypeObject *NPYTraits<float>::NPYFunc=&PyCallBackDataArrayFloat_RefType;
+#endif
template<class T>
typename MEDCoupling::Traits<T>::ArrayType *DataArrayT__setitem__(typename MEDCoupling::Traits<T>::ArrayType *self, PyObject *obj, PyObject *value)