| 1 | C |
| 2 | C Copyright (c) 1997 Silvano Bonazzola |
| 3 | C |
| 4 | C This file is part of LORENE. |
| 5 | C |
| 6 | C LORENE is free software; you can redistribute it and/or modify |
| 7 | C it under the terms of the GNU General Public License as published by |
| 8 | C the Free Software Foundation; either version 2 of the License, or |
| 9 | C (at your option) any later version. |
| 10 | C |
| 11 | C LORENE is distributed in the hope that it will be useful, |
| 12 | C but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | C GNU General Public License for more details. |
| 15 | C |
| 16 | C You should have received a copy of the GNU General Public License |
| 17 | C along with LORENE; if not, write to the Free Software |
| 18 | C Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 19 | C |
| 20 | C |
| 21 | |
| 22 | |
| 23 | |
| 24 | subroutine lege1(n,ndim,m1,wp) |
| 25 | c |
| 26 | implicit none |
| 27 | c |
| 28 | c routine pour le calcul par rcourance ascendente |
| 29 | c des fonctions associees de llegendre d'ordre m=m1-1 |
| 30 | c de dgree compris entre m et n dans l'interval |
| 31 | c 0.le.teta.le.pi. |
| 32 | c |
| 33 | C |
| 34 | C $Id: lege1.f,v 1.2 2012/03/30 12:12:44 j_novak Exp $ |
| 35 | C $Log: lege1.f,v $ |
| 36 | C Revision 1.2 2012/03/30 12:12:44 j_novak |
| 37 | C Cleaning of fortran files |
| 38 | C |
| 39 | C Revision 1.1.1.1 2001/11/20 15:19:30 e_gourgoulhon |
| 40 | C LORENE |
| 41 | C |
| 42 | c Revision 1.2 1997/05/23 11:39:50 hyc |
| 43 | c *** empty log message *** |
| 44 | c |
| 45 | C Revision 1.1 1997/03/17 20:40:51 hyc |
| 46 | C Initial revision |
| 47 | C |
| 48 | C |
| 49 | C $Header: /cvsroot/Lorene/F77/Source/Poisson2d/lege1.f,v 1.2 2012/03/30 12:12:44 j_novak Exp $ |
| 50 | C |
| 51 | C |
| 52 | character*120 header |
| 53 | data header/'$Header: /cvsroot/Lorene/F77/Source/Poisson2d/lege1.f,v 1.2 2012/03/30 12:12:44 j_novak Exp $'/ |
| 54 | |
| 55 | REAL*8 |
| 56 | 1 x1,x0,pig,pi,teta,cosen,prod,facto1,facto2,fac1,fac2 |
| 57 | 1 ,wp,x,se,sen |
| 58 | |
| 59 | integer ndim,n1,n2,n,n21,m,m1,m2,m22,jmax,l,isin,j,nj1 |
| 60 | 1 ,nm21,nmn,ncon |
| 61 | |
| 62 | dimension wp(ndim,*),sen(259),cosen(259) |
| 63 | c |
| 64 | save ncon,n2,n21,n1,jmax,x0,pig,pi,cosen |
| 65 | c |
| 66 | data ncon /0/ |
| 67 | c |
| 68 | if(n.gt.258) then |
| 69 | write(*,*) |
| 70 | 1 'dimensions insuffisantes dasns la routine lege1,n=',n |
| 71 | call exit |
| 72 | endif |
| 73 | c |
| 74 | if(n.eq.ncon) go to 999 |
| 75 | ncon=n |
| 76 | n1=n+1 |
| 77 | n2=n/2 |
| 78 | n21=n2+1 |
| 79 | jmax=n1 |
| 80 | x0=0 |
| 81 | pig=acos(x0) |
| 82 | pi=pig/n |
| 83 | do 1 l=1,n1 |
| 84 | teta=(l-1)*pi+pig |
| 85 | cosen(l)=cos(teta) |
| 86 | 1 continue |
| 87 | 999 continue |
| 88 | c |
| 89 | m=m1-1 |
| 90 | m2=m+2 |
| 91 | m22=m+m |
| 92 | c |
| 93 | prod=1 |
| 94 | facto1=prod |
| 95 | facto2=prod*(m22+1) |
| 96 | isin=(-1)**m |
| 97 | fac1=facto1*isin |
| 98 | fac2=facto2*isin |
| 99 | do 3 l=1,n1 |
| 100 | wp(l,1)=fac1 |
| 101 | wp(l,2)=cosen(l)*fac2 |
| 102 | 3 continue |
| 103 | c |
| 104 | if(m.gt.0) then |
| 105 | do 4 l=1,n1 |
| 106 | x=cosen(l) |
| 107 | se=sqrt(1-x**2)**m |
| 108 | wp(l,1)=wp(l,1)*se |
| 109 | wp(l,2)=wp(l,2)*se |
| 110 | sen(l)=se |
| 111 | 4 continue |
| 112 | endif |
| 113 | c |
| 114 | c calcul des polyn. par recourance ascendente. |
| 115 | c |
| 116 | do 5 j=3,jmax |
| 117 | nj1=m+j-2 |
| 118 | nm21=2*nj1+1 |
| 119 | nmn=nj1+m |
| 120 | x1=1 |
| 121 | fac1=x1/(nj1+1-m) |
| 122 | 300 format(1x,3i5,10e11.3) |
| 123 | do 6 l=1,n1 |
| 124 | wp(l,j)=(nm21*cosen(l)*wp(l,j-1)-nmn*wp(l,j-2))*fac1 |
| 125 | 6 continue |
| 126 | 5 continue |
| 127 | 100 format(1x,10d12.4) |
| 128 | 101 format(1x,' ') |
| 129 | return |
| 130 | end |