Commit 8e129a81 authored by Roy Fabrice's avatar Roy Fabrice
Browse files

lots of code writing improvements

parent d4b178ec
......@@ -3,12 +3,12 @@ MPIFC=h5pfc
# Intel release flags
#FCFLAGS= -O3 -g -cpp -DLONGINT -DOPTI #-convert big_endian
# Intel debug flags
FCFLAGS= -O0 -g -warn all -check all,noarg_temp_created -traceback -cpp -DLONGINT -DDEBUG -DOPTI #-convert big_endian
#FCFLAGS= -O0 -g -warn all -check all,noarg_temp_created -traceback -cpp -DLONGINT -DDEBUG -DOPTI #-convert big_endian
# GNU release flags
#FCFLAGS= -O3 -g -cpp -DLONGINT -DOPTI #-fconvert=big-endian
# GNU debug flags
#FCFLAGS= -O0 -g -Wall -Wextra -finit-local-zero -std=f2003 -fcheck=all -fbacktrace -cpp -DDEBUG -DLONGINT -DOPTI #-fconvert=big-endian
FCFLAGS= -O0 -g -Wall -Wextra -finit-local-zero -std=f2008 -fcheck=all -fbacktrace -cpp -DDEBUG -DLONGINT -DOPTI -fmax-errors=10 #-fconvert=big-endian
LDFLAGS=-g
......
......@@ -13,22 +13,23 @@ contains
subroutine compute_halo_mass_and_id(halo_id_vector, halo_mass_vector, final_local_halo_number, finalstructureid)
use iso_fortran_env, only : OUTPUT_UNIT
use modconstant, only : PRI
use modconstant, only : IDKIND
use modmpicommons, only : procid
integer(kind=PRI), intent(inout), dimension(:) :: halo_id_vector
integer(kind=IDKIND), intent(inout), dimension(:) :: halo_id_vector
integer(kind=4), intent(inout), dimension(:) :: halo_mass_vector
Integer(kind=4), intent(in) :: final_local_halo_number
Integer(kind=PRI), intent(in), dimension(:) :: finalstructureid
Integer(kind=IDKIND), intent(in), dimension(:) :: finalstructureid
Integer(kind=PRI) :: current_id
Integer(kind=IDKIND) :: current_id
Integer(kind=4) :: current_index
Integer(kind=4) :: current_size
Integer(kind=PRI) :: ip
Integer(kind=PRI) :: particle_number
Integer(kind=IDKIND) :: ip
Integer(kind=IDKIND) :: particle_number
#ifdef DEBUG
Write(OUTPUT_UNIT,'(A,I6,A,I9)') 'Enter computemassandid on process ',procID, ' with final_local_halo_number=',final_local_halo_number
Write(OUTPUT_UNIT,'(A,I6,A,I9)') 'Enter computemassandid on process ',procID, &
' with final_local_halo_number=',final_local_halo_number
#endif
......
......@@ -44,7 +44,7 @@
module modconstant
use iso_c_binding
use mpi, Only : MPI_INTEGER, MPI_INTEGER8
use mpi, only : MPI_INTEGER, MPI_INTEGER8
implicit none
......@@ -63,9 +63,10 @@ module modconstant
Type_info_cone_part, &
Type_common_metadata, &
ERR_MSG_LEN, &
FILENAME_LEN, &
PR, &
PRI, &
MPI_PRI, &
IDKIND, &
MPI_IDKIND, &
NAME_CONECREATOR_PART, &
NAME_CONECREATOR_GRAV, &
NAME_CONEMAPPER, &
......@@ -85,11 +86,11 @@ module modconstant
#endif
#ifdef LONGINT
integer, parameter :: PRI = 8 !< Precision for integer arrays (id)
integer, parameter :: MPI_PRI = MPI_INTEGER8 !< MPI precision for integer arrays
integer, parameter :: IDKIND = 8
integer, parameter :: MPI_IDKIND = MPI_INTEGER8
#else
integer, parameter :: PRI = 4 !< Precision for integer arrays (id)
integer, parameter :: MPI_PRI = MPI_INTEGER !< MPI precision for integer arrays
integer, parameter :: IDKIND = 4
integer, parameter :: MPI_IDKIND = MPI_INTEGER
#endif
! Name of the codes to write as metadata in HDF5 files
......@@ -99,12 +100,21 @@ module modconstant
character(len=16), parameter :: NAME_PFOF_SNAP='pfof_snap'
character(len=16), parameter :: NAME_PFOF_CONE='pfof_cone'
character(len=16), parameter :: NAME_PSOD_SNAP='psod_snap'
! filename length
integer, parameter :: FILENAME_LEN = 400
! Output Units
integer, parameter :: LOG_UNIT=50 !< I/O unit for text log file
integer, parameter :: LOG_UNIT = 50 !< I/O unit for text log file
! error handling
integer, parameter :: ERR_MSG_LEN=500
integer, parameter :: ERR_MSG_LEN = 500
integer, parameter :: ERR_CODE_FILE_NOT_FOUND = 1
integer, parameter :: ERR_CODE_READ_ERROR = 2
integer, parameter :: ERR_CODE_WRONG_PARAMETER = 3
integer, parameter :: ERR_CODE_HDF5 = 10
integer, parameter :: ERR_CODE_MEM_ALLOC = 20
integer, parameter :: ERR_CODE_COMPUTATION = 30
! SVN Revision
character(len=32), parameter :: svn_version=SVNREV
......
......@@ -43,41 +43,40 @@
!> Authors: F. Roy, V. Bouillot
! ======================================================================
Module modfofmpi
module modfofmpi
Use mpi
Use modconstant, only : PRI
use mpi, only : MPI_INTEGER, MPI_LAND, MPI_LOGICAL, MPI_REAL, MPI_STATUS_SIZE, &
mpi_allreduce, mpi_irecv, mpi_isend, mpi_wait, mpi_waitall
use modconstant, only : IDKIND
Implicit none
implicit none
Real (kind=4), dimension(:,:), allocatable :: posAva, posArr, posBas, posDro, posGau, posHau
Integer(kind=PRI), dimension(:), allocatable :: strAva, strArr, strBas, strDro, strGau, strHau, strRec
Integer(kind=IDKIND), dimension(:), allocatable :: strAva, strArr, strBas, strDro, strGau, strHau, strRec
Integer(kind=4) :: nbridgearr, nbridgeava, nbridgegau
Integer(kind=4) :: nbridgedro, nbridgebas, nbridgehau
Integer(kind=PRI), dimension(:,:), allocatable :: bridgeArr, bridgeAva, bridgeGau
Integer(kind=PRI), dimension(:,:), allocatable :: bridgeDro, bridgeBas, bridgeHau
Integer(kind=IDKIND), dimension(:,:), allocatable :: bridgeArr, bridgeAva, bridgeGau
Integer(kind=IDKIND), dimension(:,:), allocatable :: bridgeDro, bridgeBas, bridgeHau
Integer(kind=4), dimension(6) :: nflagrecv
Integer(kind=4), dimension(6) :: nflagloc
Integer(kind=1), dimension(:), allocatable :: border
Private
private
Public :: border, nflagloc
public :: border, &
nflagloc, &
mergehaloes
Public :: mergehaloes
Contains
contains
! ======================================================================
!> This routine merges haloes that extends across several process by setting
!> their halo ID to the same value.
Subroutine mergehaloes(perco2, info_proc)
subroutine mergehaloes(perco2, info_proc)
use modmpicommons, only : type_info_process
Use modmpicommons
Implicit none
Real(kind=4), intent(in) :: perco2 !< Value of the percolation length to the square in normalized units (where the box length in equal to 1.0)
Type(Type_info_process), intent(in) :: info_proc
......@@ -148,10 +147,8 @@ Contains
Subroutine initmerging(info_proc)
Use modvarcommons, only : local_npart, position, structure_id
Use modmpicommons
Use modmpicommons, only : type_info_process
Implicit None
Type(Type_info_process), intent(in) :: info_proc
Integer(kind=4) :: debh, debb, deba, debr, debg, debd
......@@ -236,9 +233,9 @@ Contains
!! meaning that the local process exchanges information with the processes located in these two directions.
Subroutine findbridge(nloc, nrecv, pos1, pos2, nbridge1, bridge1, nbridge2, bridge2, r2, v1, v2, info_proc)
Use modmpicommons
Use modconstant
Implicit None
Use modmpicommons, only : type_info_process
Use modconstant, only : IDKIND
! input
Integer(kind=4), intent(in), dimension(6) :: nloc !< local number of particles flagged for link detection in direction 1
Integer(kind=4), intent(in), dimension(6) :: nrecv !< local number of particles flagged for link detection in direction 2
......@@ -254,8 +251,8 @@ Contains
! output
Integer(kind=4), intent(inout) :: nbridge1 !< number of "bridges" found, e.g. pairs of particles that should be linked, in direction 1
Integer(kind=4), intent(inout) :: nbridge2 !< number of "bridges" found, e.g. pairs of particles that should be linked, in direction 2
Integer(kind=PRI), dimension(:,:), allocatable, intent(inout) :: bridge1 !< array of indices of the particles forming a bridge in direction 1
Integer(kind=PRI), dimension(:,:), allocatable, intent(inout) :: bridge2 !< array of indices of the particles forming a bridge in direction 2
Integer(kind=IDKIND), dimension(:,:), allocatable, intent(inout) :: bridge1 !< array of indices of the particles forming a bridge in direction 1
Integer(kind=IDKIND), dimension(:,:), allocatable, intent(inout) :: bridge2 !< array of indices of the particles forming a bridge in direction 2
! local
Integer(kind=4) :: mpistat(MPI_STATUS_SIZE) ! MPI comm. status
......@@ -393,12 +390,10 @@ Contains
!! to each particles that are in the same halo.
Subroutine setcommonhaloid(info_proc)
Use modconstant
Use modmpicommons
Use modconstant, only : IDKIND, MPI_IDKIND
Use modmpicommons, only : type_info_process
Use modvarcommons, only : local_npart, structure_id
Implicit none
!!$ Integer, intent(in) :: mpicomm !< MPI communicator used in this subroutine
Type(Type_info_process), intent(in) :: info_proc
......@@ -406,7 +401,7 @@ Contains
Logical :: nopermut, finished
Integer(kind=4) :: sendID, recvID
Integer(kind=4) :: ib, k
Integer(kind=PRI) :: il, ir
Integer(kind=IDKIND) :: il, ir
Integer(kind=4) :: mpistat(MPI_STATUS_SIZE) ! MPI comm. status
Integer(kind=4) :: mpierr
Integer(kind=4) :: mpireqr, mpireqs
......@@ -418,7 +413,7 @@ Contains
raccordement : Do
nopermut = .true.
nbpassage = nbpassage + 1
If(ProcID == 0) Print *,'Loop number ',nbpassage
If(info_proc%global_comm%pid == 0) Print *,'Loop number ',nbpassage
!------------------------------------------------------!
! Envoi du bas vers le bas et reception venant du haut !
......@@ -431,8 +426,8 @@ Contains
Allocate (strRec(nflagrecv(6)))
Call Mpi_ISend(strBas,nflagloc(5), MPI_PRI,sendID,1,info_proc%global_comm%name,mpireqs,mpierr)
Call Mpi_IRecv(strRec,nflagrecv(6),MPI_PRI,recvID,1,info_proc%global_comm%name,mpireqr,mpierr)
Call Mpi_ISend(strBas,nflagloc(5), MPI_IDKIND,sendID,1,info_proc%global_comm%name,mpireqs,mpierr)
Call Mpi_IRecv(strRec,nflagrecv(6),MPI_IDKIND,recvID,1,info_proc%global_comm%name,mpireqr,mpierr)
Call Mpi_Wait(mpireqs,mpistat,mpierr)
Call Mpi_Wait(mpireqr,mpistat,mpierr)
......@@ -478,8 +473,8 @@ Contains
recvID = info_proc%global_comm%neighbours(5)
Allocate (strRec(nflagrecv(5)))
Call Mpi_ISend(strHau,nflagloc(6), MPI_PRI,sendID,2,info_proc%global_comm%name,mpireqs,mpierr)
Call Mpi_IRecv(strRec,nflagrecv(5),MPI_PRI,recvID,2,info_proc%global_comm%name,mpireqr,mpierr)
Call Mpi_ISend(strHau,nflagloc(6), MPI_IDKIND,sendID,2,info_proc%global_comm%name,mpireqs,mpierr)
Call Mpi_IRecv(strRec,nflagrecv(5),MPI_IDKIND,recvID,2,info_proc%global_comm%name,mpireqr,mpierr)
Call Mpi_Wait(mpireqs,mpistat,mpierr)
Call Mpi_Wait(mpireqr,mpistat,mpierr)
......@@ -527,8 +522,8 @@ Contains
Allocate (strRec(nflagrecv(3)))
Call Mpi_ISend(strDro,nflagloc(4), MPI_PRI,sendID,3,info_proc%global_comm%name,mpireqs,mpierr)
Call Mpi_IRecv(strRec,nflagrecv(3),MPI_PRI,recvID,3,info_proc%global_comm%name,mpireqr,mpierr)
Call Mpi_ISend(strDro,nflagloc(4), MPI_IDKIND,sendID,3,info_proc%global_comm%name,mpireqs,mpierr)
Call Mpi_IRecv(strRec,nflagrecv(3),MPI_IDKIND,recvID,3,info_proc%global_comm%name,mpireqr,mpierr)
Call Mpi_Wait(mpireqs,mpistat,mpierr)
Call Mpi_Wait(mpireqr,mpistat,mpierr)
......@@ -577,8 +572,8 @@ Contains
Allocate (strRec(nflagrecv(4)))
Call Mpi_ISend(strGau,nflagloc(3), MPI_PRI,sendID,4,info_proc%global_comm%name,mpireqs,mpierr)
Call Mpi_IRecv(strRec,nflagrecv(4),MPI_PRI,recvID,4,info_proc%global_comm%name,mpireqr,mpierr)
Call Mpi_ISend(strGau,nflagloc(3), MPI_IDKIND,sendID,4,info_proc%global_comm%name,mpireqs,mpierr)
Call Mpi_IRecv(strRec,nflagrecv(4),MPI_IDKIND,recvID,4,info_proc%global_comm%name,mpireqr,mpierr)
Call Mpi_Wait(mpireqs,mpistat,mpierr)
Call Mpi_Wait(mpireqr,mpistat,mpierr)
......@@ -628,8 +623,8 @@ Contains
Allocate (strRec(nflagrecv(1)))
Call Mpi_ISend(strAva,nflagloc(2), MPI_PRI,sendID,5,info_proc%global_comm%name,mpireqs,mpierr)
Call Mpi_IRecv(strRec,nflagrecv(1),MPI_PRI,recvID,5,info_proc%global_comm%name,mpireqr,mpierr)
Call Mpi_ISend(strAva,nflagloc(2), MPI_IDKIND,sendID,5,info_proc%global_comm%name,mpireqs,mpierr)
Call Mpi_IRecv(strRec,nflagrecv(1),MPI_IDKIND,recvID,5,info_proc%global_comm%name,mpireqr,mpierr)
Call Mpi_Wait(mpireqs,mpistat,mpierr)
Call Mpi_Wait(mpireqr,mpistat,mpierr)
......@@ -679,8 +674,8 @@ Contains
Allocate (strRec(nflagrecv(2)))
Call Mpi_ISend(strArr,nflagloc(1), MPI_PRI,sendID,6,info_proc%global_comm%name,mpireqs,mpierr)
Call Mpi_IRecv(strRec,nflagrecv(2),MPI_PRI,recvID,6,info_proc%global_comm%name,mpireqr,mpierr)
Call Mpi_ISend(strArr,nflagloc(1), MPI_IDKIND,sendID,6,info_proc%global_comm%name,mpireqs,mpierr)
Call Mpi_IRecv(strRec,nflagrecv(2),MPI_IDKIND,recvID,6,info_proc%global_comm%name,mpireqr,mpierr)
Call Mpi_Wait(mpireqs,mpistat,mpierr)
Call Mpi_Wait(mpireqr,mpistat,mpierr)
......@@ -716,7 +711,7 @@ Contains
Deallocate(strRec)
Call Mpi_AllReduce(nopermut,finished,1,Mpi_Logical,Mpi_Land,info_proc%global_comm%name,mpierr)
call mpi_allreduce(nopermut,finished,1,Mpi_Logical,Mpi_Land,info_proc%global_comm%name,mpierr)
If(finished) Exit
End Do raccordement
......
......@@ -44,8 +44,8 @@
Module modhalo
Use modconstant, only : PRI, &
MPI_PRI, &
Use modconstant, only : IDKIND, &
MPI_IDKIND, &
Type_parameter_pfof, &
Type_parameter_pfof_snap, &
Type_parameter_pfof_cone
......@@ -81,9 +81,9 @@ Module modhalo
Integer(kind=4) :: halopartNB !< number of particles belonging to one of the local haloes
Integer(kind=4) :: final_local_npart !< number of particles after the particles have been exchanged to gather them by haloes
Integer(kind=4), dimension(:), allocatable :: haloMass !< mass of the haloes
Integer(kind=PRI), dimension(:), allocatable :: haloID !< ID of the haloes
Integer(kind=PRI), dimension(:), allocatable :: halopartID !< ID of the particles belonging to a halo
Integer(kind=PRI), dimension(:), allocatable :: halopartramsesID !< RAMSES ID of the particles belonging to a halo, used only for lightcone halo
Integer(kind=IDKIND), dimension(:), allocatable :: haloID !< ID of the haloes
Integer(kind=IDKIND), dimension(:), allocatable :: halopartID !< ID of the particles belonging to a halo
Integer(kind=IDKIND), dimension(:), allocatable :: halopartramsesID !< RAMSES ID of the particles belonging to a halo, used only for lightcone halo
Integer(kind=4), dimension(:), allocatable :: haloSubHaloNB !< number of subhalo for each halo
Real(kind=4), dimension(:,:), allocatable :: halopartPos !< position of the particles belonging to one of the local haloes
Real(kind=4), dimension(:,:), allocatable :: halopartVel !< velocity of the particles belonging to one of the local haloes
......@@ -101,19 +101,18 @@ Contains
!> Exchange the particles so that particles belonging to one halo are gathered on the same process.
Subroutine gatherhaloes(mpicomm, param)
Use mpi
Use mpi, only : MPI_COMM_WORLD, MPI_INTEGER, MPI_REAL, MPI_STATUS_SIZE, MPI_SUM, &
mpi_allreduce, mpi_irecv, mpi_isend, mpi_wait
Use modvarcommons
Use modmpicommons
Use modtiming
Implicit None
Integer, intent(in) :: mpicomm !< MPI communicator used for the communications
Class(Type_parameter_pfof), intent(in) :: param
Integer(kind=PRI), dimension(:), allocatable :: strSend ! structure ID array, and tmp array used for comm
Integer(kind=PRI), dimension(:), allocatable :: idSend ! particle ID array and tmp array used for comm
Integer(kind=PRI), dimension(:), allocatable :: ramsesidSend
Integer(kind=IDKIND), dimension(:), allocatable :: strSend ! structure ID array, and tmp array used for comm
Integer(kind=IDKIND), dimension(:), allocatable :: idSend ! particle ID array and tmp array used for comm
Integer(kind=IDKIND), dimension(:), allocatable :: ramsesidSend
Real(kind=4), dimension(:,:), allocatable :: posSend, velSend, forSend
Real(kind=4), dimension(:), allocatable :: potSend
Integer(kind=4) :: strPID
......@@ -123,9 +122,9 @@ Contains
Integer(kind=4) :: allocStat
Integer(kind=4) :: mpistat(MPI_STATUS_SIZE) ! MPI comm. status
Integer(kind=4) :: nbrec, nbsend ! nb of elements to recv and to send
Integer(kind=PRI) :: strNBbeg, strNBend
Integer(kind=PRI) :: smin,smax
Integer(kind=PRI) :: tmpdi
Integer(kind=IDKIND) :: strNBbeg, strNBend
Integer(kind=IDKIND) :: smin,smax
Integer(kind=IDKIND) :: tmpdi
Integer(kind=4) :: NPparProc
Integer(kind=4) :: recvpoint
Integer(kind=4) :: mpierr
......@@ -226,27 +225,27 @@ Contains
Call EmergencyStop('Error 1 while sharing structures for output.',2)
End If
Call Mpi_Isend(strSend,nbsend, MPI_PRI, sendID,1,mpicomm,mpireqs1,mpierr)
Call Mpi_Isend(strSend,nbsend, MPI_IDKIND, sendID,1,mpicomm,mpireqs1,mpierr)
Call Mpi_Isend(posSend,3*nbsend,Mpi_Real,sendID,2,mpicomm,mpireqs2,mpierr)
Call Mpi_Isend(velSend,3*nbsend,Mpi_Real,sendID,3,mpicomm,mpireqs3,mpierr)
Call Mpi_Isend(idSend, nbsend, MPI_PRI, sendID,4,mpicomm,mpireqs4,mpierr)
Call Mpi_Isend(idSend, nbsend, MPI_IDKIND, sendID,4,mpicomm,mpireqs4,mpierr)
If(param%do_read_potential) Call Mpi_Isend(potSend, nbsend, Mpi_Real, sendID, 5,mpicomm,mpireqs5,mpierr)
If(param%do_read_gravitational_field) Call Mpi_Isend(forSend,3*nbsend,Mpi_Real,sendID,6,mpicomm,mpireqs6,mpierr)
If(do_read_ramses_part_id) Call Mpi_Isend(ramsesidSend,nbsend,MPI_PRI,&
If(do_read_ramses_part_id) Call Mpi_Isend(ramsesidSend,nbsend,MPI_IDKIND,&
sendID,7,mpicomm,mpireqs7,mpierr)
End If
If(nbrec /= 0) Then
Call Mpi_IRecv(fstructure_id(recvpoint), nbrec, MPI_PRI, recvID,1,mpicomm,mpireqr1,mpierr)
Call Mpi_IRecv(fstructure_id(recvpoint), nbrec, MPI_IDKIND, recvID,1,mpicomm,mpireqr1,mpierr)
Call Mpi_IRecv(fposition(1,recvpoint),3*nbrec,Mpi_Real,recvID,2,mpicomm,mpireqr2,mpierr)
Call Mpi_IRecv(fvelocity(1,recvpoint),3*nbrec,Mpi_Real,recvID,3,mpicomm,mpireqr3,mpierr)
Call Mpi_IRecv(fpfof_id(recvpoint), nbrec, MPI_PRI, recvID,4,mpicomm,mpireqr4,mpierr)
Call Mpi_IRecv(fpfof_id(recvpoint), nbrec, MPI_IDKIND, recvID,4,mpicomm,mpireqr4,mpierr)
If(param%do_read_potential) Call Mpi_IRecv(fpotential(recvpoint), nbrec, &
Mpi_Real, recvID,5,mpicomm,mpireqr5,mpierr)
If(param%do_read_gravitational_field) Call Mpi_IRecv(ffield(1,recvpoint),3*nbrec, &
Mpi_Real,recvID,6,mpicomm,mpireqr6,mpierr)
If(do_read_ramses_part_id) Call Mpi_Irecv(framses_id(recvpoint), nbrec, MPI_PRI, &
If(do_read_ramses_part_id) Call Mpi_Irecv(framses_id(recvpoint), nbrec, MPI_IDKIND, &
recvID, 7, mpicomm, mpireqr7, mpierr)
recvpoint=recvpoint+nbrec
End If
......@@ -321,14 +320,10 @@ Contains
! Select haloes whose mass is >= Mmin
Subroutine selecthaloes(param)
#ifdef DEBUG
Use mpi
#endif
Use modconstant
Use modvarcommons
Use modmpicommons, only : procID, EmergencyStop
Implicit none
Class(Type_parameter_pfof), intent(in) :: param
......@@ -453,8 +448,8 @@ Contains
! Computes the position and the velocity of the center of mass for each halo
Subroutine computecom(periodic)
Use mpi
Implicit none
use mpi, only : MPI_COMM_WORLD, MPI_INTEGER, MPI_SUM, &
mpi_allreduce
Logical, intent(in) :: periodic
......@@ -517,7 +512,6 @@ Contains
! ======================================================================
Subroutine computeradius(periodic)
Implicit None
Logical, intent(in) :: periodic
......
......@@ -159,7 +159,6 @@ Contains
Use modmpicommons, only : procID, &
procNB
Use mpi
Integer(kind=4), intent(inout) :: local_structure_number
Integer(kind=PRI), allocatable, dimension(:,:), intent(inout) :: global_count
......
This diff is collapsed.
......@@ -43,9 +43,8 @@
Module modhdf5
Use mpi, only : MPI_COMM_WORLD,&
MPI_INTEGER,&
MPI_INFO_NULL
Use mpi, only : MPI_COMM_WORLD, MPI_INTEGER, MPI_INFO_NULL, &
mpi_abort, mpi_allgather, mpi_comm_rank, mpi_comm_size
Use hdf5
Use iso_c_binding, only : C_PTR,&
C_LOC
......
......@@ -53,7 +53,9 @@ module modmpicommons
type_parameter_pfof_snap,&
type_info_ramses
use mpi
use mpi, only : MPI_ADDRESS_KIND, MPI_CHARACTER, MPI_COMM_WORLD, MPI_DOUBLE_PRECISION, &
MPI_INTEGER, MPI_INTEGER8, MPI_LOGICAL, MPI_REAL, &
mpi_abort, mpi_get_address, mpi_type_commit, mpi_type_create_struct
implicit none
......@@ -96,8 +98,8 @@ module modmpicommons
type(type_info_communicator) :: write_comm
end type type_info_process
Integer(kind=4) :: procID !< process id in the global communicator
Integer(kind=4) :: procNB !< process number in the global communicator
integer(kind=4) :: procid !< process id in the global communicator
integer(kind=4) :: procnb !< process number in the global communicator
! Integer(kind=4) :: neighbours(6) !< array containing the id of the neighbours of the local process in the MpiCube communicator
Integer(kind=4) :: Mpi_Type_info_ramses !< MPI type corresponding to Type_info_ramses
......@@ -634,4 +636,4 @@ contains
End Subroutine EmergencyStop
End Module modmpicommons
end module modmpicommons
......@@ -46,6 +46,8 @@ Module modreadhalo
Use modconstant
implicit none
Private
Public :: h5read_halo_hfprop
......@@ -54,10 +56,8 @@ Contains
Subroutine h5read_halo_hfprop(filename, common_metadata, parameter_pfof, info_ramses, info_cone, &
position_halo, velocity_halo, rmax_halo, identity_halo, npart_halo)
Use modhdf5
Use modiocommons
Implicit None
use modhdf5
use modiocommons
! input/output variables
Character(len=400), intent(in) :: filename !< Name of the file
......
This diff is collapsed.
......@@ -42,47 +42,47 @@
!>
!> Authors: F. Roy, V. Bouillot
Module modvarcommons
module modvarcommons
Use modconstant, only : PRI
use modconstant, only : IDKIND
Implicit none
implicit none
Integer(kind=4) :: local_npart
integer(kind=4) :: local_npart
!< local particle number
Integer(kind=4) :: nres
integer(kind=4) :: nres
!< 1-D resolution: number of grid points in each dimension ; nres = 2 ** lmin
Integer(kind=PRI) :: global_npart
integer(kind=IDKIND) :: global_npart
!< total particle number: npart = nres ** 3
Real(kind=4), dimension(:,:), allocatable :: position
real(kind=4), dimension(:,:), allocatable :: position
!< position of the particles
Real(kind=4), dimension(:,:), allocatable :: velocity
real(kind=4), dimension(:,:), allocatable :: velocity
!< velocity of the particles
Real(kind=4), dimension(:,:), allocatable :: field
real(kind=4), dimension(:,:), allocatable :: field
!< force on the particles
Real(kind=4), dimension(:), allocatable :: potential
real(kind=4), dimension(:), allocatable :: potential
!< potential at the position of the particles (optional)
Integer(kind=PRI), dimension(:), allocatable :: pfof_id
integer(kind=IDKIND), dimension(:), allocatable :: pfof_id
!< ID of the particles used by pfof to identify particles (= ramses_id for snapshot)
Integer(kind=PRI), dimension(:), allocatable :: structure_id
!< Halo ID of the partickes; Integer8 if particle number exceeds 2^31-1
Integer(kind=PRI), dimension(:), allocatable :: ramses_id
!< RAMSES id of the particles; Integer8 if particle number exceeds 2^31-1
integer(kind=IDKIND), dimension(:), allocatable :: structure_id
!< Halo ID of the partickes; integer8 if particle number exceeds 2^31-1
integer(kind=IDKIND), dimension(:), allocatable :: ramses_id
!< RAMSES id of the particles; integer8 if particle number exceeds 2^31-1
Real(kind=4), dimension(:,:), allocatable :: fposition
real(kind=4), dimension(:,:), allocatable :: fposition
!< position of the particles
Real(kind=4), dimension(:,:), allocatable :: fvelocity
real(kind=4), dimension(:,:), allocatable :: fvelocity
!< velocity of the particles
Real(kind=4), dimension(:,:), allocatable :: ffield
real(kind=4), dimension(:,:), allocatable :: ffield
!< force on the particles
Real(kind=4), dimension(:), allocatable :: fpotential
real(kind=4), dimension(:), allocatable :: fpotential
!< potential at the position of the particles (optional)
Integer(kind=PRI), dimension(:), allocatable :: fpfof_id
integer(kind=IDKIND), dimension(:), allocatable :: fpfof_id
!< ID of the particles used by pfof to identify particles
Integer(kind=PRI), dimension(:), allocatable :: fstructure_id