dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #09952
Re: Use of real/double
On Thu, Oct 2, 2008 at 6:23 AM, Anders Logg <logg@xxxxxxxxx> wrote:
> We are currently using "real" (almost) everywhere in the code instead
> of "double". real is a typedef for double defined in dolfin/common/types.h:
>
> typedef double real;
>
> The reason for this typedef has been to prepare for changing from
> double to another (higher) precision representation at some point in
> the future.
>
> We (Benjamin Kehlet) have now tried to do this using GMP
> (http://gmplib.org), but this fails for many reasons. For example,
> standard math functions (abs, pow, exp) only work with double. Another
> more obvious reason is dependencies on external libraries like PETSc,
> UFC, libxml2, GTS etc where double is hard-coded.
Not exactly true. PETSc has the same typedef, PetscScalar, and can be
run in extended precision (we have tried it). However in parallel, MPI has
no types for these so things get harder there.
Matt
> Our conclusion is that there is little reason to keep the typedef in
> DOLFIN since it is just an alias for double and it can not easily be
> changed to anything else. I suggest we remove it and replace "real"
> with "double" everywhere. Any objections to this?
>
> The reason we are experimenting with GMP is that we want to use the
> ODE solvers to solve ODEs with very high precision. For this reason,
> we are planning to
>
> 1. Put back typedef real (after first removing it) and only use it
> under dolfin/ode/. If DOLFIN is built without GMP, it will just be a
> typedef for double. Otherwise, it will be a GMP type.
>
> 2. Change the ODE solver interface from
>
> void f(const uBLASVector& u, real t, uBLASVector& y);
>
> to
>
> void f(const real* u, real t, real* y);
>
> uBLAS will be used internally (with some additional copying of data
> from real to double).
>
> Any objections to this?
>
> --
> Anders
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
>
> iD8DBQFI5K89TuwUCDsYZdERAsCzAJ4joC3Uhw+U9WbKq3UhXxA/eN4PjQCfWMhA
> yWf5ZiJq12dczghGdCji5XA=
> =XLC0
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> DOLFIN-dev mailing list
> DOLFIN-dev@xxxxxxxxxx
> http://www.fenics.org/mailman/listinfo/dolfin-dev
>
>
--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which
their experiments lead.
-- Norbert Wiener
Follow ups
References