← Back to team overview

dolfin team mailing list archive

Re: [Blueprint stl-vectors-la] Use std::vector in la interface in place of pointers

 

On Fri, Mar 12, 2010 at 04:58:38PM -0000, Garth Wells wrote:
> Blueprint changed by Garth Wells:
>
> Whiteboard changed:
>   Implications for PyDOLFIN:
>   Using std::vectors instead of double* in exchanging data will force us to copy data in the python interface. Sometimes this is OK but sometimes we loose functionality, for example copying Mesh::coordinates does not make sense.
>
>   When do we copy Mesh::coordinates into a Vector?
>
>   JH: Never(?) I misinterpreted the design suggestion to change all
>   argument handling from double * to std::vector. (Mesh::coordinates might
>   still be a bad example for this :P)
> +
> + GNW: I suggest that we use dolfin::Array. This provides safety and a
> + simple interface to Python.

Yes. I think we should just change to Array everywhere.

The only problem is it requires some work since we have used
std::vector in quite a few places. I count ca 150 occurences of
std::vector in the C++ interface.

A couple of more issues:

1. We need a constructor for Array that takes std::vector as input
which is useful for C++ programmers that don't rely on dolfin::Array
as their basic container.

2. The ODE solvers use real* but could easily switch to Array<real>.

--
Anders


Attachment: signature.asc
Description: Digital signature


References