← Back to team overview

dolfin team mailing list archive

Re: New Function implementation

 

Is std::pow a template function?

Maybe you can define pow for dolfin::real as a template
specialization, something like:

template<>
dolfin::real std::pow(dolfin::real, dolfin::real) {...}

In that case it should probably not be in the dolfin:: namespace.

(It is a while since I did template stuff like this, I might be way off here).

--
Martin



2008/10/14 Anders Logg <logg@xxxxxxxxx>:
> This is all caused by the pow() functions in real.h which have been
> added since GMP types do not work with std::pow().
>
> This does not give me any problems (g++ 4.2.3) so it's difficult for
> me to debug. Let me know which compiler you are using so I can
> reproduce the bug. (Or even better help me fix it...)
>
> --
> Anders
>
>
> On Tue, Oct 14, 2008 at 04:03:18PM -0400, Shawn Walker wrote:
>> I now get a new bug with an ODE demo.  Should I just disable the ODE
>> demos?
>>
>> /usr/bin/ld: skipping incompatible /usr/lib/libc.a when searching for -lc
>> c++ -o demo/ode/courtemanche/cpp/main.o -c -Wall -pipe -ansi -Werror
>> -DDEBUG -g -DNDEBUG -O2 -DPACKAGE_VERSION=\"0.8.0\" -DHAS_PETSC=1
>> -DHAS_SLEPC=1 -DHAS_UMFPACK=1 -DHAS_GTS=1 -DHAS_CHOLMOD=1
>> -fno-strict-aliasing -I. -I. -Idolfin -I/home/walker/build/include
>> -I/usr/include/boost -I/usr/include/libxml2
>> -I/home/walker/src/petsc-2.3.3-p13/bmake/linux-gnu-cxx-debug
>> -I/home/walker/src/petsc-2.3.3-p13/include -I/home/walker/build/include
>> -I/home/walker/build/lib -Idemo -I/home/walker/src/slepc-2.3.3
>> -I/home/walker/src/slepc-2.3.3/include
>> -I/home/walker/src/petsc-2.3.3-p13/bmake/linux-gnu-cxx-debug
>> -I/home/walker/src/petsc-2.3.3-p13/include -I/home/walker/build/include
>> -I/home/walker/build/lib -Idemo -I/usr/include/suitesparse
>> -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
>> -I/home/walker/build/include -I/usr/include/suitesparse
>> demo/ode/courtemanche/cpp/main.cpp
>> demo/ode/courtemanche/cpp/main.cpp: In member function oid
>> Courtemanche::computeCurrents(const double*)
>> demo/ode/courtemanche/cpp/main.cpp:170: error: call of overloaded
>> ow(double, double)is ambiguous
>> /usr/include/bits/mathcalls.h:154: note: candidates are: double
>> pow(double, double)
>> ./dolfin/common/real.h:71: note:                 dolfin::real
>> dolfin::pow(dolfin::real, dolfin::real)
>> ./dolfin/common/real.h:59: note:                 dolfin::real
>> dolfin::pow(dolfin::real, dolfin::uint)
>> demo/ode/courtemanche/cpp/main.cpp: In member function oid
>> Courtemanche::computeGateCoefficients(const double*)
>> demo/ode/courtemanche/cpp/main.cpp:255: error: call of overloaded
>> ow(double, double)is ambiguous
>> /usr/include/bits/mathcalls.h:154: note: candidates are: double
>> pow(double, double)
>> ./dolfin/common/real.h:71: note:                 dolfin::real
>> dolfin::pow(dolfin::real, dolfin::real)
>> ./dolfin/common/real.h:59: note:                 dolfin::real
>> dolfin::pow(dolfin::real, dolfin::uint)
>> scons: *** [demo/ode/courtemanche/cpp/main.o] Error 1
>> scons: building terminated because of errors.
>>
>> - Shawn
>>
>> On Tue, 14 Oct 2008, Anders Logg wrote:
>>
>>> I guess it's the same bug as Nuno David Lopes reported earlier.
>>> It works fine for me, but I just pushed an attempt to fix this. See if
>>> it helps.
>>>
>>>
>>>
>>> On Tue, Oct 14, 2008 at 03:34:43PM -0400, Shawn Walker wrote:
>>>> I will definitely look at it.  I think it is a good idea.
>>>>
>>>> However, I recently tried to compile, and I got an error with file used
>>>> for dG.  I can reproduce it if you want.
>>>>
>>>> - Shawn
>>>>
>>>> On Tue, 14 Oct 2008, Anders Logg wrote:
>>>>
>>>>> I've finished up the new implementation of the Function class.
>>>>> It's untested, but I'm pretty sure it works... :-) I'm very happy with
>>>>> the way it turned out.
>>>>>
>>>>> Anyway, it would be good if anyone interested would review the design
>>>>> and implementation (in detail, including function names etc).
>>>>>
>>>>> The Function class is central so it would be good if we could agree on
>>>>> a design and keep it stable for some time (like we've managed with the
>>>>> linear algebra interfaces).
>>>>>
>>>>> The main changes compared to the old/current design are as follows:
>>>>>
>>>>> 1. Introduction of a FunctionSpace class. A FunctionSpace is defined
>>>>> by a Mesh, a FiniteElement and a DofMap.
>>>>>
>>>>> 2. Removal of the class hierarchy. Only one class Function remains.
>>>>> This acts dynamically either as a user-defined function (if the vector
>>>>> of coefficients is null) or as the old DiscreteFunction.
>>>>>
>>>>> 3. The proliferation of constructors has been removed. There is
>>>>> essentially only one constructor, namely
>>>>>
>>>>>  v = Function(V)
>>>>>
>>>>> An additional class named Constant should be added to handle constant
>>>>> functions, overloading eval() and providing a bunch of constructors
>>>>> (scalar, vector, tensor).
>>>>>
>>>>> When we've settled on the design/implementation of Function and
>>>>> FunctionSpace, we need to do a round of editing of the DofMap class.
>>>>>
>>>>>
>>>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
>
> iD8DBQFI9RRHTuwUCDsYZdERAu2AAJoDYDXlckSCysGmzJ/73nhTi3hDbgCfdlQq
> n5oO6uDPo5FS4CafDHxgwEg=
> =qR08
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> DOLFIN-dev mailing list
> DOLFIN-dev@xxxxxxxxxx
> http://www.fenics.org/mailman/listinfo/dolfin-dev
>
>


Follow ups

References