Make sure valid communicator is passed to initialize_mpi

This commit is contained in:
Paul Romano 2017-07-17 07:09:21 -05:00
parent 23cd067bda
commit ca28d20a01
2 changed files with 16 additions and 3 deletions

View file

@ -49,14 +49,23 @@ contains
integer, intent(in), optional :: intracomm ! MPI intracommunicator
! Copy the communicator to a new variable. This is done to avoid changing
! the signature of this subroutine.
! the signature of this subroutine. If MPI is being used but no communicator
! was passed, assume MPI_COMM_WORLD.
#ifdef MPI
#ifdef MPIF08
type(MPI_Comm), intent(in) :: comm ! MPI intracommunicator
comm % MPI_VAL = intracomm
if (present(intracomm)) then
comm % MPI_VAL = intracomm
else
comm = MPI_COMM_WORLD
end if
#else
integer :: comm
comm = intracomm
if (present(intracomm)) then
comm = intracomm
else
comm = MPI_COMM_WORLD
end if
#endif
#endif

View file

@ -48,6 +48,10 @@ module material_header
contains
!===============================================================================
! MATERIAL_SET_DENSITY sets the total density of a material in atom/b-cm.
!===============================================================================
function material_set_density(m, density, nuclides) result(err)
class(Material), intent(inout) :: m
real(8), intent(in) :: density