← Back to team overview

dolfin team mailing list archive

Re: [Branch ~dolfin-core/dolfin/main] Rev 4702: Add cast to T* in Array class

 

Hi,

This broke the build on Ubuntu Hardy:

mpic++ -o dolfin/function/Function.os -c -Wall -pipe -ansi
-BOOST_UBLAS_NDEBUG -DDEBUG -g -O2 -Werror -DHAS_MPI=1
-DMPICH_IGNORE_CXX_SEEK -DPACKAGE_VERSION=\"0.9.7\" -DHAS_LAPACK=1
-DHAS_SLEPC=1 -DHAS_TRILINOS=1 -DHAS_ZLIB=1 -DHAS_UMFPACK=1
-DHAS_PETSC=1 -DHAS_CHOLMOD=1 -DHAS_CGAL=1 -DHAS_SCOTCH=1
-DHAS_PARMETIS=1 -fno-strict-aliasing -frounding-math -fPIC -I.
-I/home/johannr/fenics-dev/include -I/usr/include -I/usr/include
-I/usr/include -I/usr/include/libxml2 -I/usr/lib/slepcdir/3.0.0
-I/usr/lib/slepcdir/3.0.0/linux-gnu-c-opt/include
-I/usr/lib/slepcdir/3.0.0/include
-I/usr/lib/petscdir/3.0.0/linux-gnu-c-opt/include
-I/usr/lib/petscdir/3.0.0/include -I/usr/lib/openmpi/include
-I/usr/lib/openmpi/lib
-I/home/johannr/src/trilinos-10.0.5-Source/Build/local/include/trilinos
-I/usr/include -I/usr/include/suitesparse
-I/usr/lib/petscdir/3.0.0/linux-gnu-c-opt/include
-I/usr/lib/petscdir/3.0.0/include -I/usr/lib/openmpi/include
-I/usr/lib/openmpi/lib -I/usr/include/suitesparse -I/usr/include
-I/home/johannr/src/scotch_5.1.8/src/local/include -I/usr/include
dolfin/function/Function.cpp
dolfin/function/Function.cpp: In member function ‘void
dolfin::Function::eval(dolfin::Array<double>&, const
dolfin::Array<double>&, const dolfin::Cell&, const ufc::cell&) const’:
dolfin/function/Function.cpp:310: error: ISO C++ says that these are
ambiguous, even though the worst conversion for the first is better
than the worst conversion for the second:
./dolfin/common/Array.h:111: note: candidate 1: const T&
dolfin::Array<T>::operator[](dolfin::uint) const [with T = double]
dolfin/function/Function.cpp:310: note: candidate 2: operator[](const
double*, int) <built-in>

See also the build log on the buildbot [1].

Maybe it is time to upgrade the hardy-i386 slave now that Lucid is
out? Hardy is LTS and will be supported until April 2011 [2].

[1] http://fenics.org:8080/builders/dolfin-hardy-i386/builds/477/steps/dolfin%20build/logs/stdio
[2] https://wiki.ubuntu.com/Releases

Johannes

On Thu, Apr 29, 2010 at 7:40 PM,  <noreply@xxxxxxxxxxxxx> wrote:
> ------------------------------------------------------------
> revno: 4702
> committer: Anders Logg <logg@xxxxxxxxx>
> branch nick: dolfin-dev
> timestamp: Thu 2010-04-29 17:23:41 +0200
> message:
>  Add cast to T* in Array class
> modified:
>  demo/adaptivity/time-series/cpp/main.cpp
>  dolfin/common/Array.h
>
>
> --
> lp:dolfin
> https://code.launchpad.net/~dolfin-core/dolfin/main
>
> Your team DOLFIN Core Team is subscribed to branch lp:dolfin.
> To unsubscribe from this branch go to https://code.launchpad.net/~dolfin-core/dolfin/main/+edit-subscription
>
> === modified file 'demo/adaptivity/time-series/cpp/main.cpp'
> --- demo/adaptivity/time-series/cpp/main.cpp    2010-04-27 21:07:58 +0000
> +++ demo/adaptivity/time-series/cpp/main.cpp    2010-04-29 15:23:41 +0000
> @@ -2,7 +2,7 @@
>  // Licensed under the GNU LGPL Version 2.1.
>  //
>  // First added:  2009-11-11
> -// Last changed: 2010-04-27
> +// Last changed: 2010-04-29
>  //
>  // This program demonstrates the use of the TimeSeries
>  // class for storing a series of meshes and vectors.
> @@ -29,16 +29,13 @@
>     Mesh new_mesh = refine(mesh);
>     x.resize(new_mesh.num_vertices());
>
> +    for (dolfin::uint i = 0; i < x.size(); i++)
> +      x.setitem(i, (t + 1.0)*static_cast<double>(i));
> +
>     // Append to series
>     series.store(new_mesh, t);
>     series.store(x, t);
>
> -    //for (dolfin::uint i = 0; i < x.size(); i++)
> -    //  x.setitem(i, (t + 1.0)*static_cast<double>(i));
> -    for (dolfin::uint i = 0; i < x.size(); i++)
> -      x.setitem(i, 3.0);
> -    info(x, true);
> -
>     mesh = new_mesh;
>     t += 0.2;
>   }
>
> === modified file 'dolfin/common/Array.h'
> --- dolfin/common/Array.h       2010-03-11 18:48:12 +0000
> +++ dolfin/common/Array.h       2010-04-29 15:23:41 +0000
> @@ -4,7 +4,7 @@
>  // Modified by Anders Logg, 2010.
>  //
>  // First added:  2009-12-06
> -// Last changed: 2010-03-11
> +// Last changed: 2010-04-29
>
>  #ifndef __DOLFIN_ARRAY_H
>  #define __DOLFIN_ARRAY_H
> @@ -123,6 +123,14 @@
>     boost::shared_array<T> data()
>     { return x; }
>
> +    /// Cast to array (const version)
> +    operator const T*() const
> +    { return x.get(); }
> +
> +    /// Cast to array (non-const version)
> +    operator T*()
> +    { return x.get(); }
> +
>   private:
>
>     // Length of array
>
>
>