On Thu, Nov 20, 2014 at 02:54:19PM +0100, Martin Sandve Alnæs wrote:
> Looks like we need better C++ unit tests :)

Yes...

> 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.

ok. I'll remove get_scalar_value and back operator() + a C++ unit test
for it.

-- 
Anders


> Martin
>
> 20. nov. 2014 14:32 skrev "Anders Logg" <[email protected]>:
>
>     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().
>
>
>
>     >
>     > Martin
>     >
>     > On 20 November 2014 14:23, Martin Sandve Alnæs <[email protected]>
>     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 <[email protected]>
>     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 <
>     [email protected]>
>     >         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 <[email protected]> wrote:
>     >
>     >             > When was this added to Scalar and when/why was conversion
>     to
>     >             double
>     >             > removed?
>     >             >
>     >
>     >             _______________________________________________
>     >             fenics mailing list
>     >             [email protected]
>     >             http://fenicsproject.org/mailman/listinfo/fenics
>     >
>     >
>     >
>     >
>     >
>     >
>
_______________________________________________
fenics mailing list
[email protected]
http://fenicsproject.org/mailman/listinfo/fenics

Reply via email to