Changeset 427 for trunk/ADOL-C/include


Ignore:
Timestamp:
Apr 3, 2013 5:30:24 AM (7 years ago)
Author:
kulshres
Message:

Merge branch 'master' of 'gitclone' into svn trunk

The following changes were merged:
commit 02942597253216bdf58b5c7f2f9a5288ce274777
Author: Max Sagebaum <sagebaum@…>
Date: Wed Apr 3 10:55:33 2013 +0200

Allow adouble objects to be initialized late

This functionality is specially required for large codes that allocate
memory using malloc/calloc and we only wish to substitute the double
datatype with adouble for tracing purposes. With malloc/calloc the
adouble constructor is not called, creating problems later in the code.
Late initialization defers some of the initialization to the first use
of an allocated space as an adouble object. This is only possible because
the class heirarchy in ADOL-C does not require polymorphism, and virtual
tables to be allocated, which can only be done in a chained superclass
constructor call.

The functionality is disabled by default and can be enabled by a configure
switch --enable-lateinit

This code is experimental and has only be tested with particular codes.

From: Max Sagebaum <sagebaum@…>
Signed-off-by: Kshitij Kulshreshtha <kshitij@…>
CC: Andrea Walther <andrea.walther@…>
CC: Nicolas Gauger <gauger@…>

commit 768851025e58a7605f0e9b6a65f51bfc3c2977f4
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Tue Apr 2 11:14:50 2013 +0200

add dvi file to gitignore

Signed-off-by: Kshitij Kulshreshtha <kshitij@…>

commit 80357742a527a4f4b9ef6323553279eb260cc7df
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Tue Apr 2 11:14:37 2013 +0200

remove as many compiler warnings from gcc -Wall as possible

only -Wunused-value remains, as we do indeed ignore some
values computed when we are in INDO, NONL_IND or
INT_FOR, INT_REV modes.

Signed-off-by: Kshitij Kulshreshtha <kshitij@…>

Location:
trunk/ADOL-C/include/adolc
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/ADOL-C/include/adolc/adouble.h

    r378 r427  
    9090    explicit badouble( locint lo ) {
    9191        location = lo;
     92        isInit = true;
    9293    };
     94
     95    bool isInit;  // marker if the badouble is properly initialized
    9396
    9497public:
     
    9699    badouble( const badouble& a ) {
    97100        location = a.location;
     101        isInit = true;
    98102    }
    99103    ;           /* ctor */
     
    366370class ADOLC_DLL_EXPORT adouble:public badouble {
    367371    friend ADOLC_DLL_EXPORT class advector;
     372protected:
     373    void initInternal(void); // Init for late initialization
    368374public:
    369375    adouble( const adub& );
     
    382388    adouble& operator = ( double );
    383389    adouble& operator = ( const badouble& );
    384     /* adouble& operator = ( const adouble& );
    385        !!! olvo 991210 was the same as badouble-assignment */
     390    adouble& operator = ( const adouble& );
    386391    adouble& operator = ( const adub& );
     392   
     393    inline locint loc(void) const;
    387394};
    388395
     
    393400/*--------------------------------------------------------------------------*/
    394401inline locint badouble::loc( void ) const {
     402    return location;
     403}
     404
     405inline locint adouble::loc( void ) const {
     406    const_cast<adouble*>(this)->initInternal();
    395407    return location;
    396408}
  • trunk/ADOL-C/include/adolc/advector.h

    r408 r427  
    113113    ADOLC_DLL_EXPORT ~advector() {}
    114114    ADOLC_DLL_EXPORT advector(const advector& x) : blk(x.data.size()), data(x.data) { delete blk.dflt; }
    115     ADOLC_DLL_EXPORT advector(const vector<adouble>& v) : blk(v.size()), data(v) { delete blk.dflt; }
     115    ADOLC_DLL_EXPORT advector(const std::vector<adouble>& v) : blk(v.size()), data(v) { delete blk.dflt; }
    116116    ADOLC_DLL_EXPORT size_t size() const { return data.size(); }
    117     ADOLC_DLL_EXPORT operator const vector<adouble>&() const { return data; }
    118     ADOLC_DLL_EXPORT operator vector<adouble>&() { return data; }
     117    ADOLC_DLL_EXPORT operator const std::vector<adouble>&() const { return data; }
     118    ADOLC_DLL_EXPORT operator std::vector<adouble>&() { return data; }
    119119    ADOLC_DLL_EXPORT adub operator[](const badouble& index) const;
    120120    ADOLC_DLL_EXPORT adubref operator[](const badouble& index);
  • trunk/ADOL-C/include/adolc/common.h

    r392 r427  
    2626#   include <cstdlib>
    2727#   include <cstdio>
    28     using namespace std;
    2928#endif
    3029
Note: See TracChangeset for help on using the changeset viewer.