Changeset 20018


Ignore:
Timestamp:
01/29/16 14:47:47 (9 years ago)
Author:
Eric.Larour
Message:

CHG: new implementation of legendre function.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/classes/Elements/Tria.cpp

    r20012 r20018  
    36483648                                else{
    36493649                                        for(int n=0;n<nl;n++){
    3650                                                 Pn=legendre(Pn1,Pn2,reCast<int,IssmDouble>(cosalpha),n); Pn1=Pn2; Pn2=Pn;
     3650                                                if(n==0)Pn=1;
     3651                                                else if(n==1)Pn=cosalpha;
     3652                                                else Pn= ( (2*n-1)*cosalpha*Pn1 - (n-1)*Pn2 ) /n;
     3653                                                Pn2=Pn1; Pn1=Pn;
    36513654                                                G_elastic += deltalove[n]*Pn;
    36523655                                        }
     
    38093812
    38103813                /*initialize G_elastic:*/
    3811                 G_elastic=xNew<IssmDouble>(gsize);
     3814                G_elastic=xNewZeroInit<IssmDouble>(gsize);
    38123815        }
    38133816        if(compute_G_rigid){
    38143817                /*Initialize G_rigid and G_elastic:*/
    3815                 G_rigid=xNew<IssmDouble>(gsize);
     3818                G_rigid=xNewZeroInit<IssmDouble>(gsize);
    38163819        }
    38173820
     
    38463849                                else{
    38473850                                        for(int n=0;n<nl;n++){
    3848                                                 Pn=legendre(Pn1,Pn2,reCast<int,IssmDouble>(cosalpha),n); Pn1=Pn2; Pn2=Pn;
     3851                                                if(n==0)Pn=1;
     3852                                                else if(n==1)Pn=cosalpha;
     3853                                                else Pn= ( (2*n-1)*cosalpha*Pn1 - (n-1)*Pn2 ) /n;
     3854                                                Pn2=Pn1; Pn1=Pn;
    38493855                                                G_elastic[i] += deltalove[n]*Pn;
    38503856                                        }
Note: See TracChangeset for help on using the changeset viewer.