← Back to team overview

dolfin team mailing list archive

Re: [HG DOLFIN] Permit access to values and size for a Constant.

 

Add this as well, and you should be able to use a scalar Constant as
if it was a double:

    /// Scalar conversion operator
    operator double() const
    {
        if(_size > 1)
            error("Cannot convert non-scalar Constant to a double.");
        return _values[0];
    }

I won't commit this myself since I currently can't compile dolfin,
it complains about program_options although I have it and use
it in some syfi demos. Probably the same as someone else
experienced, but I don't have time to figure it out now.

Martin



On Thu, May 21, 2009 at 8:23 PM, DOLFIN <dolfin@xxxxxxxxxx> wrote:
> One or more new changesets pushed to the primary dolfin repository.
> A short summary of the last three changesets is included below.
>
> changeset:   6201:7bc584e24501b34ad40dc19b9e683b925681f5ad
> tag:         tip
> user:        "Garth N. Wells <gnw20@xxxxxxxxx>"
> date:        Thu May 21 19:22:35 2009 +0100
> files:       demo/mesh/built-in/python/demo.py dolfin/function/Constant.h dolfin/mesh/UnitCircle.cpp
> description:
> Permit access to values and size for a Constant.
>
> This avoid duplications like
>
>  double dt = 1.0;
>  Constant delta_t(dt);
>  double T = 100*dt;
>
>
> changeset:   6200:dff601b6ee4aa498c3eda723ae5fba83feebf0fb
> user:        "Garth N. Wells <gnw20@xxxxxxxxx>"
> date:        Thu May 21 17:46:52 2009 +0100
> files:       demo/mesh/built-in/python/demo.py dolfin/mesh/Rectangle.cpp dolfin/mesh/UnitCircle.cpp dolfin/mesh/UnitSquare.cpp
> description:
> Fix a few bugs introduced in previous commits.
>
>
> changeset:   6199:cbec89ba60e4e7ef9d7041963b82505ab62f90aa
> user:        "Garth N. Wells <gnw20@xxxxxxxxx>"
> date:        Thu May 21 17:16:25 2009 +0100
> files:       dolfin/mesh/Box.cpp dolfin/mesh/Rectangle.cpp dolfin/mesh/UnitCircle.cpp dolfin/mesh/UnitSphere.cpp dolfin/mesh/UnitSquare.cpp
> description:
> Some clean up of built-in meshes.
>
> ----------------------------------------------------------------------
> For more details, visit http://www.fenics.org/hg/dolfin
> _______________________________________________
> DOLFIN-dev mailing list
> DOLFIN-dev@xxxxxxxxxx
> http://www.fenics.org/mailman/listinfo/dolfin-dev
>


Follow ups

References