Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make num comply (mostly) with Fortran 2008 standard #702

Merged
merged 35 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
216b0de
num: set free form test files extension to f90
VincentVanlaer Jul 30, 2024
e2beead
num: make test src f2008 standard compliant
VincentVanlaer Jul 30, 2024
533a61e
num: make private include files f2008 standard compliant
VincentVanlaer Jul 31, 2024
9f1fe8f
build: ensure test source files actually use -std=f2008
VincentVanlaer Jul 31, 2024
b4c417f
Merge pull request #696 from VincentVanlaer/num-test-standard
warrickball Aug 5, 2024
0be77cf
[ci skip] modernize test_newuoa.f90
pmocz Aug 5, 2024
7484755
[ci skip] modernize test_bobyqa.f90
pmocz Aug 5, 2024
9d5f5a6
modernize test_medakzo.f90
pmocz Aug 5, 2024
7c64285
[ci skip] modernize test_medakzo.f90
pmocz Aug 5, 2024
9a8175a
[ci skip] modernize bari_beam.f
pmocz Aug 5, 2024
9df27cb
modernize mod_dopri5.f
pmocz Aug 6, 2024
16cba9d
[ci skip] modernize /mod_dop853.f
pmocz Aug 6, 2024
fb4d3a4
[ci skip] modernize /mod_newuoa.f part 1
pmocz Aug 6, 2024
bd97e7a
[ci skip] modernize mod_newuoa.f part3
pmocz Aug 6, 2024
492eea9
[ci skip] mod_newuoa.f part 4
pmocz Aug 6, 2024
f4f126b
mod_newuoa part 5
pmocz Aug 6, 2024
cbbded7
[ci skip] mod_newuoa part 6
pmocz Aug 6, 2024
675a883
[ci skip] slvrod.dek mod_rosenbrock.f
pmocz Aug 6, 2024
994415e
[ci skip] mod_bobyqa part 3
pmocz Aug 7, 2024
bac521d
[ci skip] mod_bobyqa part 4
pmocz Aug 7, 2024
6661306
[ci skip] mod_bobyqa part 5
pmocz Aug 7, 2024
7d01d27
[ci skip] mod_bobyqa part 6 cycle
pmocz Aug 7, 2024
6138a28
[ci skip] mod_bobyqa part 8 cycle
pmocz Aug 7, 2024
acce425
[ci skip] mod_bobyqa part 9
pmocz Aug 7, 2024
c4f48af
[ci skip] mod_bobyqa part 10 cycle
pmocz Aug 7, 2024
fa72bb1
[ci skip] mod_bobyqa part 11
pmocz Aug 7, 2024
c8b37bd
[ci skip] mod_bobyqa part 12
pmocz Aug 7, 2024
3d16bd2
[ci skip] mod_newuoa.f part 1
pmocz Aug 7, 2024
234d9b4
[ci skip] mod_newuoa.f part 2
pmocz Aug 7, 2024
024fe8e
[ci skip] mod_newuoa.f part 3
pmocz Aug 7, 2024
4bb2248
[ci skip] mod_newuoa.f part 4
pmocz Aug 7, 2024
e0f3aab
bugfix in call fgong_amdl
pmocz Aug 7, 2024
5e41678
[ci skip] remove warning in star evolve
pmocz Aug 8, 2024
75f6471
throw in a couple kap modernization to f2008 as a bonus
pmocz Aug 8, 2024
62d2773
Merge branch 'main' into vv/num-test-standard
pmocz Aug 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 17 additions & 20 deletions astero/private/adipls_support.f90
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,7 @@ subroutine store_model_for_adipls (s, add_atmosphere, do_redistribute_mesh, ierr

ivers = 0 ! It's not clear what this does in fgong_amdl

call fgong_amdl( &
cgrav, nn_in, iconst, ivar, ivers, global_data, point_data, data, aa, nn, ierr)
call fgong_amdl(cgrav, nn_in, iconst, ivar, ivers, global_data, point_data, data, aa, nn, ierr)
deallocate(global_data, point_data)

if (ierr /= 0) then
Expand Down Expand Up @@ -682,8 +681,7 @@ subroutine read_and_store(iriche, iturpr, cgrav)
write(*,*) 'read_and_store failed in read_fgong_file'
call mesa_error(__FILE__,__LINE__)
end if
call fgong_amdl( &
pmocz marked this conversation as resolved.
Show resolved Hide resolved
cgrav, nn, iconst, ivar, ivers, glob, var, data, aa, nn, ierr)
call fgong_amdl(cgrav, nn_in, iconst, ivar, ivers, glob, var, data, aa, nn, ierr)
if (ierr /= 0) then
write(*,*) 'read_and_store failed in fgong_amdl'
call mesa_error(__FILE__,__LINE__)
Expand Down Expand Up @@ -726,16 +724,16 @@ subroutine store_amdl(nn_in, iriche, iturpr, data, aa, x, nn, ierr)

! test for singular centre and/or surface

sincen=aa1(1,1).eq.0
sinsur=data(7).ge.0
sincen=aa1(1,1) == 0
sinsur=data(7) >= 0
nsin=0
if (sincen) nsin=nsin+1
if (sinsur) nsin=nsin+1

! test for inclusion of g/(g tilde)

idata8 = int(data(8)+0.1)
if (mod(idata8/10,10).eq.2) then
if (mod(idata8/10,10) == 2) then
iggt = 1
iturpr=8
else
Expand All @@ -746,13 +744,13 @@ subroutine store_amdl(nn_in, iriche, iturpr, data, aa, x, nn, ierr)

! test for number of nonsingular points

if (iriche.ne.1.or.mod(nn-nsin,2).eq.1) then
if (iriche /= 1.or.mod(nn-nsin,2) == 1) then
nshift=0
else
nshift=1
end if
nnr=nn
if (nshift.ne.0) then
if (nshift /= 0) then
nn=nn-nshift
end if

Expand All @@ -772,7 +770,7 @@ subroutine store_amdl(nn_in, iriche, iturpr, data, aa, x, nn, ierr)
end do
else
do n=1,nnr
if (n.eq.1) then
if (n == 1) then
n1=1
else
n1=n+nshift
Expand All @@ -788,16 +786,16 @@ subroutine store_amdl(nn_in, iriche, iturpr, data, aa, x, nn, ierr)

! set g/gtilde (=1 in models without turbulent pressure)

if (iturpr.eq.1) then
if (iturpr == 1) then
do n=1,nn
if (x(n).lt.0.999) then
if (x(n) < 0.999) then
ggt=1
else
ggt=1./(x(n)*x(n)*x(n)*aa(1,n))
end if
aa(10,n)=ggt
end do
else if (iggt.eq.1) then
else if (iggt == 1) then
do n=1,nn
aa(10,n)=aa(6,n)
end do
Expand All @@ -815,8 +813,7 @@ subroutine store_amdl(nn_in, iriche, iturpr, data, aa, x, nn, ierr)
end subroutine store_amdl


subroutine fgong_amdl( &
cgrav, nn_in, iconst, ivar, ivers, glob, var, data, aa, nn, ierr)
subroutine fgong_amdl(cgrav, nn_in, iconst, ivar, ivers, glob, var, data, aa, nn, ierr)
! derived from fgong-amdl.d.f
real(dp), intent(in) :: cgrav
integer, intent(in) :: nn_in, iconst, ivar, ivers
Expand All @@ -834,7 +831,7 @@ subroutine fgong_amdl( &
ierr = 0
nn = nn_in

if (var(1,1).gt.var(1,nn)) then
if (var(1,1) > var(1,nn)) then
nn1=nn+1
do i=1,ivar
do n=1,nn
Expand All @@ -846,7 +843,7 @@ subroutine fgong_amdl( &
end do
end if

if (var(1,1).gt.1.d6) then
if (var(1,1) > 1.d6) then
do i=1,ivar
do n=1,nn
var1(i,n+1)=var(i,n)
Expand Down Expand Up @@ -895,23 +892,23 @@ subroutine fgong_amdl( &
aa(4,1)=var(10,1)
aa(5,1)=0
aa(6,1)=3.d0
if (aa(5,nn).le.10) then
if (aa(5,nn) <= 10) then
nn=nn-1
!write(6,*) 'Chop off outermost point'
end if
data(1)=glob(1)
data(2)=glob(2)
data(3)=var(4,1)
data(4)=var(5,1)
if (glob(11).lt.0.and.glob(11).gt.-10000) then
if (glob(11) < 0.and.glob(11) > -10000) then
data(5)=-glob(11)/var(10,1)
data(6)=-glob(12)
else
data(5)=four_thirds_pi*cgrav*(var(5,1)*glob(2))**2/(var(4,1)*var(10,1))
d2amax=0.d0
do n=2,nn
d2amax=max(d2amax,aa(5,n)/x(n)**2)
if (x(n).ge.0.05d0) exit
if (x(n) >= 0.05d0) exit
end do
data(6)=d2amax+data(5)
!write(6,140) data(5), data(6)
Expand Down
4 changes: 2 additions & 2 deletions astero/private/astero_support.f90
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ subroutine get_one_el_info( &

real(dp) :: nu_obs, dist_j, nu, dist, min_dist, min_freq, &
R, G, M, sig_fac, b, sum_1, sum_2, sum_3, empty(0)
integer :: min_dist_j, min_order, n, cnt, int_empty(0)
integer :: min_dist_j, min_order, n, cnt, int_empty(0), int_empty2(0)
integer :: nsel, itrsig, nsig
real(dp) :: els1, dels, sig1, sig2, dfsig
integer :: num_l0_terms, k, i, j
Expand Down Expand Up @@ -162,7 +162,7 @@ subroutine get_one_el_info( &
call set_to_closest(freq_target(0,:), &
model_freq(0,:), empty, empty, &
model_inertia(0,:), empty, empty, &
model_order(0,:), int_empty, int_empty, ierr)
model_order(0,:), int_empty, int_empty2, ierr)

model_freq_alt_up(0,:) = model_freq(0,:)
model_inertia_alt_up(0,:) = model_inertia(0,:)
Expand Down
15 changes: 5 additions & 10 deletions num/make/makefile_base
Original file line number Diff line number Diff line change
Expand Up @@ -69,26 +69,21 @@ nodeps : $(.DEFAULT_GOAL)
#
# COMPULATION RULES

#COMPILE_LEGACY = $(filter-out -std=f2008, $(COMPILE_TO_TEST))
COMPILE_LEGACY = $(filter-out -std=f2008, $(COMPILE_TO_DEPLOY)) -std=legacy
COMPILE = $(COMPILE_TO_DEPLOY) $(FCfixed)

COMPILE = $(COMPILE_LEGACY) $(FCfixed)

COMPILE_FREE = $(COMPILE_LEGACY) $(FCfree)
COMPILE_FREE = $(COMPILE_TO_DEPLOY) $(FCfree)

#COMPILE_XTRA = $(COMPILE_NO_CHECKS) $(FCfixed) -c
COMPILE_XTRA = $(COMPILE_BASIC) $(FCopt) $(FCfixed) -c

COMPILE_LEGACY_XTRA = $(filter-out -std=f2008, $(COMPILE_XTRA)) -std=legacy

COMPILE_CMD = $(COMPILE)

mod_bobyqa.o mod_newuoa.o mod_dop853.o mod_dopri5.o mod_dc_decsol.o mod_rosenbrock.o : %.o : %.f
ifneq ($(QUIET),)
@echo COMPILE_LEGACY_XTRA $<
@$(COMPILE_LEGACY_XTRA) $<
@echo COMPILE_XTRA $<
@$(COMPILE_XTRA) $<
else
$(COMPILE_LEGACY_XTRA) $<
$(COMPILE_XTRA) $<
endif

%.o : %.mod
Expand Down
16 changes: 8 additions & 8 deletions num/private/decomc.dek
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
#include "mtx_decsolc.dek"
#include "mtx_decsolcs.dek"
end interface
integer :: m1, m2, nm1, lde1, ijob
integer :: mle, mue, mbjac, mbb, mdiag, mdiff, mbdiag
integer :: nzmax, isparse, lcd, lrd, lid
integer :: ierr, ip2(nm1), n, ldjac, ldmas, mlmas, mumas
integer :: ia(*), ja(nzmax) ! ia(n+1) when used; ia(2) when not.
double precision :: sparse_jac(nzmax)
double precision :: sar(nzmax), sai(nzmax)
Expand All @@ -19,10 +23,6 @@
double precision :: fjac(ldjac,n), fmas(ldmas,nm1)
double precision :: e2r(lde1,nm1), e2i(lde1,nm1)
double precision :: br(n), bi(n), alphn, betan
integer :: ierr, ip2(nm1), n, ldjac, ldmas, mlmas, mumas
integer :: m1, m2, nm1, lde1, ijob
integer :: mle, mue, mbjac, mbb, mdiag, mdiff, mbdiag
integer :: nzmax, isparse, lcd, lrd, lid

! LOCALS
integer :: i, j, k, jm1, mm, imle, ib, hint
Expand Down Expand Up @@ -313,6 +313,10 @@
#include "mtx_decsolc.dek"
#include "mtx_decsolcs.dek"
end interface
integer :: m1, m2, nm1, lde1, ijob
integer :: mle, mue, mbjac, mbb, mdiag, mdiff, mbdiag
integer :: nzmax, isparse, lcd, lrd, lid
integer :: ierr, ip2(nm1), n, ldjac, ldmas, mlmas, mumas
integer :: ia(:) ! (n+1)
integer :: ja(:) ! (nzmax)
real(dp) :: sparse_jac(:) ! (nzmax)
Expand All @@ -328,10 +332,6 @@

double precision :: br(n), bi(n), alphn, betan

integer :: ierr, ip2(nm1), n, ldjac, ldmas, mlmas, mumas
integer :: m1, m2, nm1, lde1, ijob
integer :: mle, mue, mbjac, mbb, mdiag, mdiff, mbdiag
integer :: nzmax, isparse, lcd, lrd, lid


goto (1,2,3,4,5,6,55,8,9,55,11,12,13,14,15), ijob
Expand Down
8 changes: 4 additions & 4 deletions num/private/estrad.dek
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
#include "mtx_decsol.dek"
#include "mtx_decsols.dek"
end interface
integer, pointer :: ip1(:) ! (nm1)
integer :: n, iphes(n), nerror, ldjac, mljac, mujac, ldmas, mlmas, mumas
integer :: nfcn, ijob, m1, m2, nm1, lde1, lrpar, lipar, ier, mle, mue
integer :: mbjac, mbb, mdiag, mdiff, mbdiag, nzmax, isparse, lrd, lid
integer :: ia(:) ! (n+1)
integer :: ja(:) ! (nzmax)
double precision :: sa(nzmax)
Expand All @@ -19,10 +23,6 @@
integer, intent(inout), pointer :: ipar(:) ! (lipar)
real(dp), intent(inout), pointer :: rpar(:) ! (lrpar)

integer, pointer :: ip1(:) ! (nm1)
integer :: iphes(n), n, nerror, ldjac, mljac, mujac, ldmas, mlmas, mumas
integer :: nfcn, ijob, m1, m2, nm1, lde1, lrpar, lipar, ier, mle, mue
integer :: mbjac, mbb, mdiag, mdiff, mbdiag, nzmax, isparse, lrd, lid
double precision :: fjac(ldjac,n), fmas(ldmas,nm1)
double precision, pointer :: e1_1D(:)
double precision :: x, scal(n), y0(n), y(n)
Expand Down
Loading
Loading