From ca28d20a016509a88d476aaf65c05ca6a03e12e0 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Mon, 17 Jul 2017 07:09:21 -0500 Subject: [PATCH] Make sure valid communicator is passed to initialize_mpi --- src/initialize.F90 | 15 ++++++++++++--- src/material_header.F90 | 4 ++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/initialize.F90 b/src/initialize.F90 index 98f02863e..69479907e 100644 --- a/src/initialize.F90 +++ b/src/initialize.F90 @@ -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 diff --git a/src/material_header.F90 b/src/material_header.F90 index da2faf4a6..4415ad086 100644 --- a/src/material_header.F90 +++ b/src/material_header.F90 @@ -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