[Dune-devel] [Dune-Bugs] [#1041] BCRSMatrix does not always initialize data memory

Steffen Müthing steffen.muething at ipvs.uni-stuttgart.de
Tue Jan 22 14:38:04 CET 2013


Hi everybody,

since I initially filed the bug:

Am 22.01.2013 um 13:44 schrieb Oliver Sander:

> 
>>> But let me ask again: why the need for  MatrixHasTrivialConstructor?
>>> Does it really make a measurable difference to omit the empty
>>> default constructors in BCRSMatrix?
>> I do not know, but I am pretty sure that it is not slower. Sure one could
>> rely on the compiler optimization, but why depend on it if we can do
>> it ourselves.
> Because it clutters our code with even more template magic
> for no measurable reason?
> 
>>> And if it does matter: shouldn't we use std::is_pod instead of the
>>> hand-coded MatrixHasTrivialConstructor?
>> I doubt that FieldMatrix can be regarded as a plain old datatype.
>> Quoting cplusplus.com: "A POD type (which stands for Plain Old Data
>> type) is a type whose characteristics are supported by a data type in
>> the C language, either cv-qualified or not."
> There are different variants of std::is_pod that may be better suited.
> How about std::is_trivially_default_constructible() ?

I don't like it either, but the problem is - once more - C++03. All those nice
type traits like std::is_pod et. al. are only available in C++11, so we can not
use them on our current set of supported compilers (and they would be
a pain in the ass (or even impossible) to emulate with a backwards compatibility
layer in Dune).

My bet would also be to just leave out the optimization and hope that the compiler
will do the Right Thing (and even if it fails, I doubt that zeroing some memory is the
big performance pitfall during BCRSMatrix setup…) ;-)

Best,

Steffen

> 
> best,
> Oliver
> 
>> 
>> Cheers,
>> 
>> Markus
>> 
>> _______________________________________________
>> Dune-devel mailing list
>> Dune-devel at dune-project.org
>> http://lists.dune-project.org/mailman/listinfo/dune-devel
> 
> 
> _______________________________________________
> Dune-devel mailing list
> Dune-devel at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune-devel

Steffen Müthing
Universität Stuttgart
Institut für Parallele und Verteilte Systeme
Universitätsstr. 38
70569 Stuttgart
Tel: +49 711 685 88429
Fax: +49 711 685 88340
Email: steffen.muething at ipvs.uni-stuttgart.de

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <https://lists.dune-project.org/pipermail/dune-devel/attachments/20130122/685fb657/attachment.sig>


More information about the Dune-devel mailing list