On Wed, 23 Jan 2008, John Peterson wrote:
Jan Biermann writes:
> Hi developers,
>
> I just downloaded the latest libmesh version and when I compile it in
> complex mode, the compiler throws an error from distributed_vector.h:
>
> In member function »Real DistributedVector<T>::min() const [with T =
> std::complex<double>]«:
> src/numerics/numeric_vector.C:182: instantiated from here
> /libmesh/include/numerics/distributed_vector.h:695: error: ungültiges
> static_cast vom Typ »const std::complex<double>« in den Typ »double«
>
> (and the same for the Real DistributedVector<T>::max() )
>
> The wired thing is though, that my 2.5 years old version of libmesh has
> exactly the same line in the code that throws an error in the new
> version but it works ( double local_min =
> static_cast<double>(*std::min(_values.begin(), _values.end()));).
>
> So what changed since?
I'm not sure what's changed... Roy has factored out some MPI routines
into the Parallel:: namespace, but this isn't the problem. What is the
proper way of casting from from complex to double anyway? Does it just
take the real part? Is that what we want for min/max?
Is that line of code even correct for Reals? std::min isn't supposed
to operate on container iterators, it's just supposed to return the
minimum of two elements with a defined operator<. There's a
std::min_element which is probably what the author (I hope it wasn't
me...) was thinking of.
---
Roy
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Libmesh-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-devel