marker_set_SetMPIDataTypeParams Subroutine

private impure subroutine marker_set_SetMPIDataTypeParams(this, types, lengths, displacement)

Uses

  • proc~~marker_set_setmpidatatypeparams~~UsesGraph proc~marker_set_setmpidatatypeparams marker_set%marker_set_SetMPIDataTypeParams mpi_f08 mpi_f08 proc~marker_set_setmpidatatypeparams->mpi_f08

Sets up parameters for creating the MPI derived type. Create the MPI structure

Type Bound

marker_set

Arguments

Type IntentOptional Attributes Name
class(marker_set), intent(inout) :: this

A collection of tessellation elements

type(MPI_Datatype), intent(out), allocatable :: types(:)

Array of types

integer, intent(out), allocatable :: lengths(:)

Array of lengths

integer(kind=MPI_ADDRESS_KIND), intent(out), allocatable :: displacement(:)

Array of displacements


Calls

proc~~marker_set_setmpidatatypeparams~~CallsGraph proc~marker_set_setmpidatatypeparams marker_set%marker_set_SetMPIDataTypeParams mpi_get_address mpi_get_address proc~marker_set_setmpidatatypeparams->mpi_get_address

Source Code

    impure subroutine marker_set_SetMPIDataTypeParams(this,types,lengths,displacement)
      !> Sets up parameters for creating the MPI derived type.
      use mpi_f08
      implicit none
      class(marker_set),  intent(inout) :: this                                !! A collection of tessellation elements
      type(MPI_Datatype), intent(out),   &
                            allocatable :: types(:)                            !! Array of types
      integer,            intent(out),   &
                            allocatable :: lengths(:)                          !! Array of lengths
      integer(kind=MPI_ADDRESS_KIND),    &
                          intent(out),   &
                            allocatable :: displacement(:)                     !! Array of displacements
      ! Work variable
      type(marker_obj) :: sample
      integer :: N
      integer :: ierr

      associate(mpi=>this%parallel)
                                                                               !! Create the MPI structure
        N=11
        allocate(types(N),displacement(N),lengths(N))
        types( 1) = mpi%INT8    ; lengths( 1) = 1                 ! id     --  integer
        types( 2) = mpi%REAL_WP ; lengths( 2) = size(sample%p)    ! p      --  real*3
        types( 3) = mpi%INTEGER ; lengths( 3) = size(sample%c)    ! c      --  integer*3
        types( 4) = mpi%INTEGER ; lengths( 4) = 1                 ! s      --  integer
        types( 5) = mpi%INTEGER ; lengths( 5) = 1                 ! t      --  integer
        types( 6) = mpi%REAL_WP ; lengths( 6) = 1                 ! SA     --  real
        types( 7) = mpi%REAL_WP ; lengths( 7) = size(sample%n)    ! n      --  real*3
        types( 8) = mpi%REAL_WP ; lengths( 8) = size(sample%v)    ! v      --  real*3
        types( 9) = mpi%REAL_WP ; lengths( 9) = size(sample%f)    ! f      --  real*3
        types(10) = mpi%REAL_WP ; lengths(10) = size(sample%pold) ! pold   --  real*3
        types(11) = mpi%REAL_WP ; lengths(11) = size(sample%vold) ! vold   --  real*3
        ! Count the displacement for this structure
        call MPI_GET_ADDRESS(sample%id,     displacement( 1),ierr)
        call MPI_GET_ADDRESS(sample%p(1),   displacement( 2),ierr)
        call MPI_GET_ADDRESS(sample%c(1),   displacement( 3),ierr)
        call MPI_GET_ADDRESS(sample%s,      displacement( 4),ierr)
        call MPI_GET_ADDRESS(sample%t,      displacement( 5),ierr)
        call MPI_GET_ADDRESS(sample%SA,     displacement( 6),ierr)
        call MPI_GET_ADDRESS(sample%n(1),   displacement( 7),ierr)
        call MPI_GET_ADDRESS(sample%v(1),   displacement( 8),ierr)
        call MPI_GET_ADDRESS(sample%f(1),   displacement( 9),ierr)
        call MPI_GET_ADDRESS(sample%pold(1),displacement(10),ierr)
        call MPI_GET_ADDRESS(sample%vold(1),displacement(11),ierr)
        displacement = displacement - displacement( 1)
      end associate

      return
    end subroutine marker_set_SetMPIDataTypeParams