Skip to content
Snippets Groups Projects
Forked from Core Modules / dune-common
Source project has a limited visibility.
  • Oliver Sander's avatar
    d6f00739
    Change conversion operators (operator K()) to return references instead of values · d6f00739
    Oliver Sander authored
    We simply return a reference to the internal memory instead of copying the object.
    This should save some copying when using FieldVector/FieldMatrix with non-trivial
    types.  Also, it fixes crashes I have experienced with the ADOL-C automatic
    differentiation toolbox [0].
    
    I hope that this patch doesn't have any nasty side effects.  I didn't see any
    so far.  Comments for this patch had been requested in FS 1449, and there have
    been no objections.
    
    [0] I have contacted the ADOL-C maintainer about this and he said the crashes
    are not really bugs in ADOL-C, but that it is simply very difficult to write
    a good operator-overloading AD program that can handle operator K returning
    values.
    d6f00739
    History
    Change conversion operators (operator K()) to return references instead of values
    Oliver Sander authored
    We simply return a reference to the internal memory instead of copying the object.
    This should save some copying when using FieldVector/FieldMatrix with non-trivial
    types.  Also, it fixes crashes I have experienced with the ADOL-C automatic
    differentiation toolbox [0].
    
    I hope that this patch doesn't have any nasty side effects.  I didn't see any
    so far.  Comments for this patch had been requested in FS 1449, and there have
    been no objections.
    
    [0] I have contacted the ADOL-C maintainer about this and he said the crashes
    are not really bugs in ADOL-C, but that it is simply very difficult to write
    a good operator-overloading AD program that can handle operator K returning
    values.