Looks like we need better C++ unit tests :)

get_scalar_value can safely be removed if double() is available in python
so the unit test can stay working. Or the unit test can be moved to C++,
Scalar is not really needed from python.

Martin
20. nov. 2014 14:32 skrev "Anders Logg" <l...@chalmers.se>:

> On Thu, Nov 20, 2014 at 02:27:46PM +0100, Martin Sandve Alnæs wrote:
>
> > How do you use it from user code?
>
> If I do something like this (in C++):
>
>     Scalar m;
>     Assembler assembler;
>     assembler.assemble(m, M); // M is a functional
>     cout << "Value is m = " << sqrt(m) << endl;
>
> > It's important now to call apply before
> > extracting the value. Some times breaking code is better than a
> > silent behaviour change...
>
> Yes, but not silently breaking user code... ;-)
>
> get_scalar_value seems to me just a different name for operator double().
>
> I think we should have both, since we have had operator double()
> before. Are there any objections to add it back? It can just call
> get_scalar_value().
>
> --
> Anders
>
>
> >
> > Martin
> >
> > On 20 November 2014 14:23, Martin Sandve Alnæs <marti...@simula.no>
> wrote:
> >
> >     I thought Scalar was only used internally by the assembler? That's
> why I
> >     didn't consider this an interface change.
> >
> >     Martin
> >
> >     On 20 November 2014 14:22, Martin Sandve Alnæs <marti...@simula.no>
> wrote:
> >
> >         That's correct, I extended Scalar to work properly in parallel
> to fix
> >         that bug.
> >
> >         I think I found the idea of "operator double" dubious because it
> will
> >         now involve MPI communication. It's only used from inside the
> >         assembler.
> >
> >         The function get_scalar_value is public mainly to keep the tests
> >         working, as I discovered unit tests that didn't work before.
> >
> >         Martin
> >
> >         On 20 November 2014 14:18, Jan Blechta <
> blec...@karlin.mff.cuni.cz>
> >         wrote:
> >
> >             Maybe because of this
> >             https://bitbucket.org/fenics-project/dolfin/issue/388/
> >             scalar-apply-is-wrong
> >
> >             Jan
> >
> >
> >             On Thu, 20 Nov 2014 14:12:36 +0100
> >             Anders Logg <l...@chalmers.se> wrote:
> >
> >             > When was this added to Scalar and when/why was conversion
> to
> >             double
> >             > removed?
> >             >
> >
> >             _______________________________________________
> >             fenics mailing list
> >             fenics@fenicsproject.org
> >             http://fenicsproject.org/mailman/listinfo/fenics
> >
> >
> >
> >
> >
> >
>
_______________________________________________
fenics mailing list
fenics@fenicsproject.org
http://fenicsproject.org/mailman/listinfo/fenics

Reply via email to