Creates an MPI data type for parallel communication of the Lagrangian objects.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(lagrangian_set), | intent(inout) | :: | this |
A set of Lagrangian objects |
impure subroutine lagrangian_set_CreateMPIType(this) !> Creates an MPI data type for parallel communication ! of the Lagrangian objects. implicit none class(lagrangian_set), intent(inout) :: this !! A set of Lagrangian objects ! Work variables integer, allocatable :: lengths(:) type(MPI_DATATYPE), allocatable :: types(:) integer(kind=MPI_ADDRESS_KIND), allocatable :: displacement(:) integer(kind=MPI_ADDRESS_KIND) :: extent,lb type(MPI_DATATYPE) :: type_tmp integer :: ierr associate(mpi=>this%parallel) ! Compute types, lengths and displacements call this%SetMPIDataTypeParams(types,lengths,displacement) ! Create MPI type call MPI_TYPE_CREATE_STRUCT(size(lengths),lengths,displacement,types,type_tmp,ierr) if (ierr.ne.0) error stop "Problem with MPI_TYPE" ! Get actual lower bound and extent of this type call MPI_TYPE_GET_EXTENT(type_tmp,lb,extent,ierr) if (ierr.ne.0) error stop "Problem with MPI_TYPE" ! Adjust upper and lower bounds call MPI_TYPE_CREATE_RESIZED(type_tmp,lb,extent,this%MPI_TYPE,ierr) call MPI_TYPE_COMMIT(this%MPI_TYPE,ierr) if (ierr.ne.0) error stop "Problem with MPI_TYPE" ! Get the size of this type call MPI_TYPE_SIZE(this%MPI_TYPE,this%MPI_SIZE,ierr) if (ierr.ne.0) error stop "Problem with MPI_TYPE" end associate return end subroutine lagrangian_set_CreateMPIType