UFC

Double pointers used for rectangular arrays

Bug #787405 reported by Garth Wells
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
UFC
Fix Committed
High
Unassigned

Bug Description

The UFC interface uses double pointers for rectangular arrays, e.g.

    virtual void tabulate_coordinates(double** coordinates, const cell& c) const = 0;

This is annoying because it restricts the data structures that can be efficiently used on the library size. For example, boost::multi_array and Armadillo are useful for storing multi-dimensional arrays, and can return plain pointers to the underlying array, but UFC forces double pointers on the user.

Changed in ufc:
status: New → Confirmed
milestone: none → 2.2
Revision history for this message
Garth Wells (garth-wells) wrote :
Changed in ufc:
importance: Undecided → Medium
Revision history for this message
Garth Wells (garth-wells) wrote :

We should look at this - it will allow the removal of some ugly copies in DOLFIN.

Changed in ufc:
importance: Medium → High
Revision history for this message
Johan Hake (johan-hake) wrote : Re: [Bug 787405] Re: Double pointers used for rectangular arrays

On Wednesday September 21 2011 09:00:16 Garth Wells wrote:
> We should look at this - it will allow the removal of some ugly copies
> in DOLFIN.

Agree, but at the moment are boost::multi_arrays not so pleasent for the SWIG
interface. Copying is enforced. Not sure this is a big deal for such a low
lever functionality, but it is sad that it should be needed, if the underlying
structure is just a c-array, which numpy wraps just fine.

Johan

Revision history for this message
Garth Wells (garth-wells) wrote :

On 21 September 2011 17:40, Johan Hake <email address hidden> wrote:
> On Wednesday September 21 2011 09:00:16 Garth Wells wrote:
>> We should look at this  - it will allow the removal of some ugly copies
>> in DOLFIN.
>
> Agree, but at the moment are boost::multi_arrays not so pleasent for the SWIG
> interface. Copying is enforced. Not sure this is a big deal for such a low
> lever functionality, but it is sad that it should be needed, if the underlying
> structure is just a c-array, which numpy wraps just fine.
>

I think that if this type of data is used intensively at the Python
level, then there will be bigger performance issues to worry about
than data copying.

The multi_array interface is somewhat secondary - the important point
is flattening the double pointer in the UFC interface.

Garth

> Johan
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/787405
>
> Title:
>  Double pointers used for rectangular arrays
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/ufc/+bug/787405/+subscriptions
>

Revision history for this message
Anders Logg (logg) wrote :

On Wed, Sep 21, 2011 at 04:54:29PM -0000, Garth Wells wrote:
> On 21 September 2011 17:40, Johan Hake <email address hidden> wrote:
> > On Wednesday September 21 2011 09:00:16 Garth Wells wrote:
> >> We should look at this  - it will allow the removal of some ugly copies
> >> in DOLFIN.
> >
> > Agree, but at the moment are boost::multi_arrays not so pleasent for the SWIG
> > interface. Copying is enforced. Not sure this is a big deal for such a low
> > lever functionality, but it is sad that it should be needed, if the underlying
> > structure is just a c-array, which numpy wraps just fine.
> >
>
> I think that if this type of data is used intensively at the Python
> level, then there will be bigger performance issues to worry about
> than data copying.
>
> The multi_array interface is somewhat secondary - the important point
> is flattening the double pointer in the UFC interface.

We should avoid using any other data structures than plain C arrays in
the UFC interface.

Or we should use STL data structures (or boost) throughout UFC, but
that sounds more like UFC >= 3.0.

--
Anders

> Garth
>
> > Johan
> >
> >
> > Title:
> >  Double pointers used for rectangular arrays
> >
> > To manage notifications about this bug go to:
> > https://bugs.launchpad.net/ufc/+bug/787405/+subscriptions
> >
>

Changed in ufc:
status: Confirmed → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.