PyObject *getUndergroundDataArrayExt() const throw(INTERP_KERNEL::Exception)
{
- std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
- DataArrayDouble *elt0=self->getUndergroundDataArrayExt(elt1Cpp);
- if(elt0)
- elt0->incrRef();
- PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
- std::size_t sz=elt1Cpp.size();
- PyObject *elt=PyList_New(sz);
- for(std::size_t i=0;i<sz;i++)
- {
- PyObject *elt1=PyTuple_New(2);
- PyObject *elt2=PyTuple_New(2);
- PyTuple_SetItem(elt2,0,SWIG_From_int((int)elt1Cpp[i].first.first));
- PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
- PyObject *elt3=PyTuple_New(2);
- PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
- PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
- PyTuple_SetItem(elt1,0,elt2);
- PyTuple_SetItem(elt1,1,elt3);
- PyList_SetItem(elt,i,elt1);
- }
- PyTuple_SetItem(ret,1,elt);
- return ret;
+ return MEDFileField1TS_getUndergroundDataArrayExt<double>(self);
}
}
};
ret->incrRef();
return ret;
}
+
+ PyObject *getUndergroundDataArrayExt() const throw(INTERP_KERNEL::Exception)
+ {
+ return MEDFileField1TS_getUndergroundDataArrayExt<int>(self);
+ }
}
};
ret->incrRef();
return ret;
}
+
+ PyObject *getUndergroundDataArrayExt() const throw(INTERP_KERNEL::Exception)
+ {
+ return MEDFileField1TS_getUndergroundDataArrayExt<float>(self);
+ }
}
};
self.assertEqual(a.getArray().getInfoOnComponents(),['power [MW/m^3]','density [g/cm^3]','temperature [K]'])
self.assertTrue(a.isEqual(f1,1e-12,0))
ff1.write(fname,0)
+ a,b=ff1.getUndergroundDataArrayExt()
+ self.assertEqual(a.getHiddenCppPointer(),ff1.getUndergroundDataArray().getHiddenCppPointer())
+ self.assertEqual(b,[((3,0),(0,2)),((4,0),(2,4)),((6,0),(4,5)),((5,0),(5,6))])
ff2=MEDFileAnyTypeField1TS.New(fname)
self.assertEqual(ff2.getName(),"VectorFieldOnCells")
self.assertEqual(ff2.getTime(),[0,1,2.0])
self.assertTrue(a.isEqual(f1,1e-12,0))
ff2.setTime(1,2,3.)
c=ff2.getUndergroundDataArray() ; c*=2
- ff2.write(fname,0) # 2 time steps in
+ ff2.write(fname,0) # 2 time steps in
ffs1=MEDFileAnyTypeFieldMultiTS.New(fname,"VectorFieldOnCells")
self.assertEqual(ffs1.getTimeSteps(),[(0, 1, 2.0), (1, 2, 3.0)])
self.assertEqual(len(ffs1),2)
self.assertEqual(a.getArray().getInfoOnComponents(),['power [MW/m^3]','density [g/cm^3]','temperature [K]'])
self.assertTrue(a.isEqual(f1,1e-12,1e-12))
ff1.write(fname,0)
+ a,b=ff1.getUndergroundDataArrayExt()
+ self.assertEqual(a.getHiddenCppPointer(),ff1.getUndergroundDataArray().getHiddenCppPointer())
+ self.assertEqual(b,[((3,0),(0,2)),((4,0),(2,4)),((6,0),(4,5)),((5,0),(5,6))])
ff2=MEDFileAnyTypeField1TS.New(fname)
self.assertEqual(ff2.getName(),"VectorFieldOnCells")
self.assertEqual(ff2.getTime(),[0,1,2.0])
return ret;
}
+template<class T>
+PyObject *MEDFileField1TS_getUndergroundDataArrayExt(const typename MLFieldTraits<T>::F1TSType *self)
+{
+ std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
+ typename MEDCoupling::Traits<T>::ArrayType *elt0=self->getUndergroundDataArrayExt(elt1Cpp);
+ if(elt0)
+ elt0->incrRef();
+ PyObject *ret=PyTuple_New(2);
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTITraits<T>::TI, SWIG_POINTER_OWN | 0 ));
+ std::size_t sz=elt1Cpp.size();
+ PyObject *elt=PyList_New(sz);
+ for(std::size_t i=0;i<sz;i++)
+ {
+ PyObject *elt1=PyTuple_New(2);
+ PyObject *elt2=PyTuple_New(2);
+ PyTuple_SetItem(elt2,0,SWIG_From_int((int)elt1Cpp[i].first.first));
+ PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second));
+ PyObject *elt3=PyTuple_New(2);
+ PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first));
+ PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second));
+ PyTuple_SetItem(elt1,0,elt2);
+ PyTuple_SetItem(elt1,1,elt3);
+ PyList_SetItem(elt,i,elt1);
+ }
+ PyTuple_SetItem(ret,1,elt);
+ return ret;
+}