diff --git a/Makefile.Defines b/Makefile.Defines index 4a283b655..7bb6ae32e 100644 --- a/Makefile.Defines +++ b/Makefile.Defines @@ -54,24 +54,24 @@ VTUNE_FLAGS = -g -O2 -vec -simd -shared-intel -qopenmp -debug inline-debug-info IDEBUG = -O0 -nogen-interfaces -no-pie -no-ftz -fpe-all=0 -g -traceback -mp1 -fp-model strict -fpe0 -debug all -align all -pad -ip -prec-div -prec-sqrt -assume protect-parens -CB -no-wrap-margin -init=snan,arrays STRICTREAL = -fp-model strict -fp-model no-except -prec-div -prec-sqrt -assume protect-parens SIMDVEC = -simd -xhost -align all -assume contiguous_assumed_shape -vecabi=cmdtarget -prec-div -prec-sqrt -assume protect-parens -PAR = -parallel -qopenmp +PAR = -qopenmp #-parallel Something goes wrong in SyMBA at the moment with auto-paralellization enabled HEAPARR = -heap-arrays 1048576 -OPTIMIZE = -qopt-report=5 +OPTREPORT = -qopt-report=5 #gfortran flags -GDEBUG = -g -O0 -fbacktrace -fbounds-check +GDEBUG = -g -Og -fbacktrace -fbounds-check GPRODUCTION = -O3 GPAR = -fopenmp -ftree-parallelize-loops=4 GMEM = -fsanitize=undefined -fsanitize=address -fsanitize=leak GWARNINGS = -Wall -Warray-bounds -Wimplicit-interface -Wextra -Warray-temporaries -#FFLAGS = $(IDEBUG) $(HEAPARR) -FFLAGS = -init=snan,arrays -no-wrap-margin -O3 $(STRICTREAL) $(SIMDVEC) $(PAR) $(HEAPARR) +#FFLAGS = $(IDEBUG) $(HEAPARR) $(SIMDVEC) $(PAR) +FFLAGS = -init=snan,arrays -no-wrap-margin -O3 $(STRICTREAL) $(PAR) $(SIMDVEC) $(HEAPARR) FORTRAN = ifort #AR = xiar #FORTRAN = gfortran -#FFLAGS = -ffree-line-length-none $(GDEBUG) #$(GMEM) +#FFLAGS = -ffree-line-length-none $(GPRODUCTION) $(GPAR) #$(GDEBUG) $(GMEM) AR = ar # DO NOT include in CFLAGS the "-c" option to compile object only diff --git a/src/modules/symba_classes.f90 b/src/modules/symba_classes.f90 index 05698d44c..056e6f390 100644 --- a/src/modules/symba_classes.f90 +++ b/src/modules/symba_classes.f90 @@ -497,8 +497,8 @@ module recursive subroutine symba_step_recur_system(self, param, t, ireci) implicit none class(symba_nbody_system), intent(inout) :: self !! SyMBA nbody system object class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters - real(DP), value :: t - integer(I4B), value :: ireci !! input recursion level + real(DP), intent(in) :: t + integer(I4B), intent(in) :: ireci !! input recursion level end subroutine symba_step_recur_system module subroutine symba_step_reset_system(self, param) diff --git a/src/symba/symba_step.f90 b/src/symba/symba_step.f90 index cde5aff29..ed5985c0b 100644 --- a/src/symba/symba_step.f90 +++ b/src/symba/symba_step.f90 @@ -146,8 +146,8 @@ module recursive subroutine symba_step_recur_system(self, param, t, ireci) ! Arguments class(symba_nbody_system), intent(inout) :: self !! SyMBA nbody system object class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters - real(DP), value :: t - integer(I4B), value :: ireci !! input recursion level + real(DP), intent(in) :: t + integer(I4B), intent(in) :: ireci !! input recursion level ! Internals integer(I4B) :: i, j, irecp, nloops real(DP) :: dtl, dth @@ -235,32 +235,38 @@ module subroutine symba_step_reset_system(self, param) class is (symba_pl) select type(tp => system%tp) class is (symba_tp) - if (pl%nbody > 0) then - pl%lcollision(:) = .false. - pl%kin(:)%parent = [(i, i=1, pl%nbody)] - pl%kin(:)%nchild = 0 - do i = 1, pl%nbody - if (allocated(pl%kin(i)%child)) deallocate(pl%kin(i)%child) - end do - pl%nplenc(:) = 0 - pl%ntpenc(:) = 0 - pl%levelg(:) = -1 - pl%levelm(:) = -1 - pl%lencounter = .false. - pl%lcollision = .false. - system%plplenc_list%nenc = 0 - system%plplcollision_list%nenc = 0 - end if - - if (tp%nbody > 0) then - tp%nplenc(:) = 0 - tp%levelg(:) = -1 - tp%levelm(:) = -1 - system%pltpenc_list%nenc = 0 - end if + associate(npl => pl%nbody, ntp => tp%nbody) + if (npl > 0) then + pl%lcollision(1:npl) = .false. + pl%kin(1:npl)%parent = [(i, i=1, npl)] + pl%kin(1:npl)%nchild = 0 + do i = 1, npl + if (allocated(pl%kin(i)%child)) deallocate(pl%kin(i)%child) + end do + pl%nplenc(1:npl) = 0 + pl%ntpenc(1:npl) = 0 + pl%levelg(1:npl) = -1 + pl%levelm(1:npl) = -1 + pl%lencounter(1:npl) = .false. + pl%lcollision(1:npl) = .false. + pl%ldiscard(1:npl) = .false. + pl%lmask(1:npl) = .true. + system%plplenc_list%nenc = 0 + system%plplcollision_list%nenc = 0 + end if + + if (ntp > 0) then + tp%nplenc(1:ntp) = 0 + tp%levelg(1:ntp) = -1 + tp%levelm(1:ntp) = -1 + tp%lmask(1:ntp) = .true. + pl%ldiscard(1:npl) = .false. + system%pltpenc_list%nenc = 0 + end if - call system%pl_adds%setup(0, param) - call system%pl_discards%setup(0, param) + call system%pl_adds%setup(0, param) + call system%pl_discards%setup(0, param) + end associate end select end select end associate