Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
nschorgh committed Apr 4, 2016
1 parent 1da9480 commit de8aea3
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 9 deletions.
14 changes: 6 additions & 8 deletions Common/tridag.for
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@ C================================================
INTEGER j
REAL*8 bet,gam(NMAX)
if(b(1).eq.0.) then
print *, 'tridag: rewrite equations'
stop
endif
if(n.gt.NMAX) then
print *, 'tridag: too many points, set NMAX>',n
& ,' and recompile'
stop
stop 'tridag: rewrite equations'
endif
c if(n.gt.NMAX) then
c print *, 'tridag: too many points, set NMAX>',n
c stop
c endif
bet=b(1)
u(1)=r(1)/bet
do 11 j=2,n
Expand All @@ -29,4 +27,4 @@ c if(bet.eq.0.)pause 'tridag failed'
12 continue
return
END

C (C) Copr. 1986-92 Numerical Recipes Software 0(9p#31&#5(+.
47 changes: 47 additions & 0 deletions Craters/hpsort.for
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
SUBROUTINE hpsort(n,ra,ind)
implicit none
INTEGER, intent(IN) :: n
REAL(8), intent(INOUT) :: ra(n)
INTEGER, intent(OUT) :: ind(n)
INTEGER rind
INTEGER i,ir,j,l
REAL(8) rra
if (n==1) ind(1)=1
if (n.lt.2) return
l=n/2+1
ir=n
do i=1,n
ind(i)=i
enddo
10 continue
if(l.gt.1)then
l=l-1
rra=ra(l); rind=ind(l)
else
rra=ra(ir); rind=ind(ir)
ra(ir)=ra(1); ind(ir)=ind(1)
ir=ir-1
if(ir.eq.1)then
ra(1)=rra; ind(1)=rind
return
endif
endif
i=l
j=l+l
20 if(j.le.ir)then
if(j.lt.ir)then
if(ra(j).lt.ra(j+1))j=j+1
endif
if(rra.lt.ra(j))then
ra(i)=ra(j); ind(i)=ind(j)
i=j
j=j+j
else
j=ir+1
endif
goto 20
endif
ra(i)=rra; ind(i)=rind
goto 10
END
C (C) Copr. 1986-92 Numerical Recipes Software 0(9p#31&#5(+.
2 changes: 1 addition & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ Documentation: Schorghofer, N. (2016) submitted to Icarus



NOTE: Third party source code (from Numerical Recipes) is not included in this distribution. These are files ending with .for. Most of this code will not work without them. Contact me if you cannot find them elsewhere.
NOTE: Third party source code from Numerical Recipes is included in this distribution, but is covered by a separate copyright. These are files ending with .for. Most of this code will not work without them.



Expand Down

0 comments on commit de8aea3

Please sign in to comment.