← Back to team overview

dolfin team mailing list archive

Re: Use of Array<type> class (in assembly)

 

On Wednesday January 25 2012 15:21:12 Joachim Berdal Haga wrote:
> Hi,
> 
> I'm looking a bit on assembly performance at the moment. It looks like
> a lot of time (almost 25% in poisson/linear lagrange) of the time is
> spent in these two lines of GenericFunction::evaluate():
> 
>   Array<double> _values(value_size(), values);
>   const Array<double> x(cell.geometric_dimension,
> const_cast<double*>(coordinates));
> 
> This seems to be because of the instantiation of boost::shared_arrays.
> The ownership of the array data is not transferred (the data will be
> deleted by the caller of evaluate()), so this does not really add any
> safety.
> 
> I don't have a complete picture of how Array<> is used, does the
> Python layer rely on the shared semantics (in other places)? If not,
> it might be better to make them non-shared and create copies for use
> in Python where needed.

I am pretty sure the shared_array object were added as a simple way of 
deciding ownership of the data. If the creation of the shared_array is costly 
we could use a ownership flag instead.

Johan


Follow ups

References