← Back to team overview

dolfin team mailing list archive

Re: Problem with Array typemape

 

On Wednesday August 11 2010 10:58:21 Anders Logg wrote:
> Thanks! It works now.
> 
> Yes, the copying is absolutely no problem here.
> 
> Should we differentiate between return by value (Array) and return by
> reference (Array&)?
> 
> In the present case, we have return by value so then it should
> naturally be copied, but perhaps there are other cases where we want
> return by reference?

I think we should avoid wrapping return values that are by reference. If it 
was just the Array, it might turn out good. But the point is that we wrap the 
Array into a NumPy array.

It might not be any troubles but I think we do not have it for a reason...

Johan
 
> --
> Anders
> 
> On Wed, Aug 11, 2010 at 10:51:31AM -0700, Johan Hake wrote:
> > Should be fixed now!
> > 
> > The returned by value array went out of scope. I had to copy it using new
> > operator. So I guess there are some unnessesary copying there, but it is
> > probably not a big deal as things returned by value should be small?
> > 
> > Johan
> > 
> > On Wednesday August 11 2010 06:56:12 Anders Logg wrote:
> > > Is the idea that OUT_NUMPY_TYPEMAP_FOR_DOLFIN_ARRAY should take care
> > > of mapping all return values which are Arrays (at least for double,
> > > int, uint)?
> > > 
> > > I'm getting strange return values when calling TimeSeries::vector_times
> > > from Python.
> > > 
> > > The debugging code inside TimeSeries::vector_times prints
> > > 
> > > 0: 0
> > > 1: 0.02
> > > 2: 0.04
> > > 
> > > while the NumPy array contains the values
> > > 
> > > [  6.35862486e-321   0.00000000e+000   4.74303020e-322]



Follow ups

References