Changeset 20022


Ignore:
Timestamp:
01/29/16 17:15:42 (9 years ago)
Author:
Eric.Larour
Message:

CHG: precompute legendre polynomial values.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/analyses/SealevelriseAnalysis.cpp

    r20014 r20022  
    6666        iomodel->Constant(&legendre_precompute,SealevelriseLegendrePrecomputeEnum);
    6767        if(legendre_precompute){
    68                 iomodel->FetchData(&legendre_coefficients,&M,&nl,SealevelriseLoveKEnum);
    69                 parameters->AddObject(new DoubleMatParam(SealevelriseLegendreCoefficientsEnum,legendre_coefficients,M,nl));
     68
     69                /*compute values at which to evaluate the legendre polynomical values:*/
     70                const IssmDouble degacc=.01; M=reCast<int>(180/degacc+1);
     71                IssmDouble* x=xNew<IssmDouble>(M);
     72                for(int i=0;i<=M;i++){ //watch out the <=
     73                        x[i]=-cos( (reCast<IssmDouble>(i)*degacc) * PI / 180.0);
     74                }
     75                /*compute legendre coefficient matrix:*/
     76                legendre_coefficients=p_polynomial_value(M,nl-1,x);
     77                parameters->AddObject(new DoubleMatParam(SealevelriseLegendreCoefficientsEnum,legendre_coefficients,nl,M));
     78
     79                /*free ressources:*/
     80                xDelete<IssmDouble>(x);
    7081        }
    7182
Note: See TracChangeset for help on using the changeset viewer.