Changeset 658


Ignore:
Timestamp:
Dec 15, 2015 5:16:23 AM (4 years ago)
Author:
kulshres
Message:

few fixes

  • adubref must not be created by user or copied
  • adubref destructor was missing
  • we can have an explicit cast since we have a function to conver adub to adub*
  • erf() was not protected by ATRIG_ERF
  • fix function declarations in psdrivers.h

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

Location:
trunk/ADOL-C
Files:
5 edited

Legend:

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

    r646 r658  
    244244public:
    245245
     246    explicit operator adub*() const { return adubp_from_adub(*this); }
    246247    /*--------------------------------------------------------------------------*/
    247248    /* s = adolc_vec_dot(x,y,size); <=> s = <x,y>_2 */
  • trunk/ADOL-C/include/adolc/advector.h

    r595 r658  
    7070        exit(-2);
    7171    }
     72    adubref( const adubref& ) {
     73        fprintf(DIAG_OUT,"ADOL-C error: illegal copy construction of adubref"
     74               " variable\n");
     75        exit(-2);
     76    }
     77    bool isInit;  // marker if the badouble is properly initialized
    7278public:
    7379    /* adub prevents postfix operators to occur on the left
     
    99105    void declareDependent();
    100106    operator adub() const;
    101     friend ADOLC_DLL_EXPORT void condassign(adubref, const badouble&, const badouble&, const badouble&);
    102     friend ADOLC_DLL_EXPORT void condassign(adubref, const badouble&, const badouble&);
     107    friend ADOLC_DLL_EXPORT void condassign(adubref&, const badouble&, const badouble&, const badouble&);
     108    friend ADOLC_DLL_EXPORT void condassign(adubref&, const badouble&, const badouble&);
     109    ~adubref();
    103110};
    104111
  • trunk/ADOL-C/include/adolc/drivers/psdrivers.h

    r639 r658  
    44 Revision: $Id$
    55 Contents: Easy to use drivers for piecewise smooth functions
    6            (with C and C++ callable interfaces including Fortran
     6           (with C and C++ callable interfaces including Fortran 
    77           callable versions).
    88
     
    1010
    1111 This file is part of ADOL-C. This software is provided as open source.
    12  Any use, reproduction, or distribution of the software constitutes
     12 Any use, reproduction, or distribution of the software constitutes 
    1313 recipient's acceptance of the terms of the accompanying license file.
    14 
     14 
    1515----------------------------------------------------------------------------*/
    1616#if !defined(ADOLC_DRIVERS_PSDRIVERS_H)
     
    2727
    2828/*--------------------------------------------------------------------------*/
    29 /*                                              directional_active_gradient */
     29/*                                             directional_active_gradient_ */
    3030/*                                                                          */
    31 ADOLC_DLL_EXPORT int directional_active_gradient(short,int,double*,short*,double*,double*,short*);
    32 ADOLC_DLL_EXPORT fint directional_active_gradient_(fint,fint,double*,short*,double*,double*,short*);
    33 /*--------------------------------------------------------------------------*/
    34 /*                                                               abs_normal */
    35 /*                                                                          */
    36 ADOLC_DLL_EXPORT int abs_normal(short,int,int,int,double*,short*,double*,double*,double*,double*,double**,double**,double**,double**);
    37 ADOLC_DLL_EXPORT fint abs_normal_(fint*,fint*,fint*,fint*,fdouble*,fint*,fdouble*,fdouble*,fdouble*,fdouble*,fdouble*,fdouble*,fdouble*,fdouble*);
    38 
    39 
    40 END_C_DECLS
    41 
    42 /****************************************************************************/
    43 /****************************************************************************/
    44 /*                                                       Now the C++ THINGS */
    45 #if defined(__cplusplus)
    46 
    47 /****************************************************************************/
    48 /*                                                 DRIVERS FOR PS FUNCTIONS */
    49 
     31ADOLC_DLL_EXPORT fint directional_active_gradient_(fint,fint,double*,short*,double*,double*,short*); 
    5032/*--------------------------------------------------------------------------*/
    5133/*                                              directional_active_gradient */
    5234/*                                                                          */
    53 int directional_active_gradient(short tag,      /* trace identifier */
     35ADOLC_DLL_EXPORT int directional_active_gradient(
     36                                short tag,      /* trace identifier */
    5437                                int n,          /* number of independents */
    5538                                double* x,      /* value of independents */
     
    6346/*                                                               abs_normal */
    6447/*                                                                          */
    65 int abs_normal(short tag,      /* tape identifier */
    66                int m,          /* number of dependents   */
    67                int n,          /* number of independents */
    68                double *x,      /* base point */
    69                short *sigma_x, /* sigma of x */
    70                double *y,      /* function value */
    71                double *z,      /* switching variables */
    72                double *cz,     /* first constant */
    73                double *cy,     /* second constant */
    74                double **a,
    75                double **b,
    76                double **Z,
    77                double **L);
     48ADOLC_DLL_EXPORT fint abs_normal_(fint*,fint*,fint*,fint*,fdouble*,fint*,fdouble*,fdouble*,fdouble*,fdouble*,fdouble*,fdouble*,fdouble*,fdouble*);
     49ADOLC_DLL_EXPORT int abs_normal(short tag,      /* tape identifier */
     50                                int m,          /* number od dependents   */
     51                                int n,          /* number of independents */
     52                                int swchk,      /* number of switches (check) */
     53                                double *x,      /* base point */
     54                                short *sigma,   /* sigma of x */
     55                                double *y,      /* function value */
     56                                double *z,      /* switching variables */
     57                                double *cz,     /* first constant */
     58                                double *cy,     /* second constant */
     59                                double **J,     
     60                                double **Y,
     61                                double **Z,
     62                                double **L);
    7863
    7964
    80 #endif
     65END_C_DECLS
    8166
    8267/****************************************************************************/
    8368
    8469#endif
     70
  • trunk/ADOL-C/include/adolc/internal/adubfunc.h

    r562 r658  
    7171    friend ADOLC_DLL_EXPORT adub acosh ( const badouble& );
    7272    friend ADOLC_DLL_EXPORT adub atanh ( const badouble& );
     73    friend ADOLC_DLL_EXPORT adub erf   ( const badouble& );
    7374#endif
    7475
     
    8687    friend ADOLC_DLL_EXPORT adub ldexp ( const badouble&, int );
    8788    friend ADOLC_DLL_EXPORT adub frexp ( const badouble&, int* );
    88     friend ADOLC_DLL_EXPORT adub erf   ( const badouble& );
    8989
    9090    /*--------------------------------------------------------------------------*/
  • trunk/ADOL-C/src/advector.cpp

    r605 r658  
    3434        adolc_exit(-2,"",__func__,__FILE__,__LINE__);
    3535    }
     36    isInit = true;
     37}
     38
     39adubref::~adubref() {
     40#ifdef adolc_overwrite
     41    if (isInit)
     42        free_loc(location);
     43#endif
    3644}
    3745
     
    346354}
    347355
    348 void condassign( adubref res,         const badouble &cond,
     356void condassign( adubref& res,         const badouble &cond,
    349357                 const badouble &arg1, const badouble &arg2 ) {
    350358    ADOLC_OPENMP_THREAD_NUMBER;
     
    370378}
    371379
    372 void condassign( adubref res, const badouble &cond, const badouble &arg ) {
     380void condassign( adubref& res, const badouble &cond, const badouble &arg ) {
    373381    ADOLC_OPENMP_THREAD_NUMBER;
    374382    ADOLC_OPENMP_GET_THREAD_NUMBER;
Note: See TracChangeset for help on using the changeset viewer.