Changeset 13185


Ignore:
Timestamp:
08/30/12 06:59:13 (13 years ago)
Author:
utke
Message:

NEW : register externally differentiated function for ADOL-C ; introduce a generic parameter class to hold a structure of such registry items

Location:
issm/trunk-jpl/src/c
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/Makefile.am

    r13129 r13185  
    136136                                        ./classes/matrix/Vector.cpp\
    137137                                        ./classes/objects/Params/Param.h\
     138                                        ./classes/objects/Params/GenericParam.h\
    138139                                        ./classes/objects/Params/BoolParam.cpp\
    139140                                        ./classes/objects/Params/BoolParam.h\
     
    196197                                        ./shared/Matrix/matrix.h\
    197198                                        ./shared/Matrix/MatrixUtils.cpp\
     199                                        ./shared/Numerics/adolc_edf.h\
    198200                                        ./shared/Numerics/numerics.h\
    199201                                        ./shared/Numerics/Verbosity.h\
  • issm/trunk-jpl/src/c/classes/objects/objects.h

    r13129 r13185  
    112112
    113113/*Params: */
     114#include "./Params/GenericParam.h"
    114115#include "./Params/BoolParam.h"
    115116#include "./Params/DoubleMatParam.h"
  • issm/trunk-jpl/src/c/modules/Solverx/Solverx.h

    r12988 r13185  
    2727void SolverxSeq(double** pX,double* A,double* B,int n);
    2828
     29#ifdef _HAVE_ADOLC_
     30ADOLC_ext_fct EDF_for_solverx;
     31#endif
     32
    2933#endif  /* _SOLVERX_H */
    3034
  • issm/trunk-jpl/src/c/modules/Solverx/SolverxSeq.cpp

    r13062 r13185  
    4545}/*}}}*/
    4646#ifdef _HAVE_ADOLC_
     47
     48int EDF_for_solverx(int n, IssmPDouble *x, int m, IssmPDouble *y) {
     49    if(m*(m+1)!=n)_error_("Stiffness matrix should be square!");
     50    SolverxSeq(&y,x, x+m*m, m);
     51    return 0;
     52}
     53
    4754void SolverxSeq(IssmDouble** pX,IssmDouble* A,IssmDouble* B,int n){//{{{
    4855        /* if we use Adol-C then the IssmDouble will be an adouble
     
    6168
    6269        /*First, transfer from IssmDouble to double all our matrices and vectors: */
    63         pdoubleA=xNew<double>(n*n);
    64         pdoubleB=xNew<double>(n);
     70        pdoubleA=xNew<IssmPDouble>(n*n);
     71        pdoubleB=xNew<IssmPDouble>(n);
    6572        for(i=0;i<n*n;i++)pdoubleA[i]=reCast<IssmPDouble>(A[i]);
    6673        for(i=0;i<n;i++)pdoubleB[i]=reCast<IssmPDouble>(B[i]);
  • issm/trunk-jpl/src/c/solutions/issm.cpp

    r13083 r13185  
    55#include "../issm.h"
    66#include "../include/globals.h"
     7#include "../shared/Numerics/adolc_edf.h"
    78
    89int main(int argc,char **argv){
     
    119120        /*If running AD, then initialize the tape: */
    120121        #ifdef _HAVE_ADOLC_
     122        GenericParam<Adolc_edf> *theAdolcEDF_p=new GenericParam<Adolc_edf>(AdolcParamEnum);
     123        theAdolcEDF_p->GetParameterValue().myEDF_for_solverx_p=reg_ext_fct(EDF_for_solverx);
     124        femmodel->parameters->AddObject(theAdolcEDF_p);
    121125        if(autodiff) trace_on(1);
    122126        #endif
Note: See TracChangeset for help on using the changeset viewer.