Changeset 735


Ignore:
Timestamp:
May 30, 2017 4:39:11 AM (4 months ago)
Author:
kulshres
Message:

add a flag in edfs to avoid memory internally and use only user allocated

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

Location:
trunk/ADOL-C
Files:
4 edited

Legend:

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

    r600 r735  
    251251   */
    252252  char* allmem;
     253
     254  /**
     255   * This is a reference to an object for the C++ object-oriented
     256   * implementation of the external function ** do not touch **
     257   */
     258  void* obj;
     259
     260  /**
     261   * This flag indicates that user allocates memory and internally no
     262   * memory should be allocated
     263   */
     264  char user_allocated_mem;
    253265}
    254266ext_diff_fct;
  • trunk/ADOL-C/include/adolc/externfcts2.h

    r605 r735  
    175175   */
    176176  char* allmem;
     177  /**
     178   * This is a reference to an object for the C++ object-oriented
     179   * implementation of the external function ** do not touch **
     180   */
     181  void* obj;
     182  /**
     183   * This flag indicates that user allocates memory and internally no
     184   * memory should be allocated
     185   */
     186  char user_allocated_mem;
    177187}
    178188ext_diff_fct_v2;
  • trunk/ADOL-C/src/externfcts.cpp

    r608 r735  
    8282      free(edf->allmem);
    8383  edf->allmem=NULL;
     84  edf->user_allocated_mem=0;
    8485}
    8586
     
    178179  }
    179180
    180   update_ext_fct_memory(edfct,n,m);
     181  if (!edfct->user_allocated_mem)
     182      update_ext_fct_memory(edfct,n,m);
    181183
    182184  /* update taylor buffer if keep != 0 ; possible double counting as in
  • trunk/ADOL-C/src/externfcts2.cpp

    r608 r735  
    6060      free(edf->allmem);
    6161  edf->allmem=NULL;
     62  edf->user_allocated_mem=0;
    6263}
    6364
     
    147148        memcpy(vals,ADOLC_GLOBAL_TAPE_VARS.store, numVals*sizeof(double));
    148149    }
    149     update_ext_fct_memory(edfct,nin,nout,insz,outsz);
     150    if (!edfct->user_allocated_mem)
     151        update_ext_fct_memory(edfct,nin,nout,insz,outsz);
    150152    if (oldTraceFlag != 0) {
    151153        if (edfct->dp_x_changes)
Note: See TracChangeset for help on using the changeset viewer.