PartMC  2.8.0
aero_component.F90
Go to the documentation of this file.
1 ! Copyright (C) 2018 Jeffrey Curtis
2 ! Licensed under the GNU General Public License version 2 or (at your
3 ! option) any later version. See the file COPYING for details.
4 
5 !> \file
6 !> The pmc_aero_particle module.
7 
8 !> The aero_particle_t structure and associated subroutines.
10 
11  use pmc_util
12  use pmc_mpi
13 #ifdef PMC_USE_MPI
14  use mpi
15 #endif
16 
17  !> Aerosol particle component data structure.
18  !!
19  !!
20 
22  !> Source.
23  integer :: source_id
24  !> Time the component was created (s).
25  real(kind=dp) :: create_time
26  end type aero_component_t
27 
28 contains
29 
30 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
31 
32  !> Determines the number of bytes required to pack the given value.
33  integer function pmc_mpi_pack_size_aero_component(val)
34 
35  !> Value to pack.
36  type(aero_component_t) :: val
37 
39  pmc_mpi_pack_size_integer(val%source_id) &
40  + pmc_mpi_pack_size_real(val%create_time)
41 
43 
44 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
45 
46  !> Packs the given value into the buffer, advancing position.
47  subroutine pmc_mpi_pack_aero_component(buffer, position, val)
48 
49  !> Memory buffer.
50  character, intent(inout) :: buffer(:)
51  !> Current buffer position.
52  integer, intent(inout) :: position
53  !> Value to pack.
54  type(aero_component_t), intent(in) :: val
55 
56 #ifdef PMC_USE_MPI
57  integer :: prev_position
58 
59  prev_position = position
60  call pmc_mpi_pack_integer(buffer, position, val%source_id)
61  call pmc_mpi_pack_real(buffer, position, val%create_time)
62  call assert(297427248, position - prev_position &
64 #endif
65 
66  end subroutine pmc_mpi_pack_aero_component
67 
68 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
69 
70  !> Unpacks the given value from the buffer, advancing position.
71  subroutine pmc_mpi_unpack_aero_component(buffer, position, val)
72 
73  !> Memory buffer.
74  character, intent(inout) :: buffer(:)
75  !> Current buffer position.
76  integer, intent(inout) :: position
77  !> Value to pack.
78  type(aero_component_t), intent(inout) :: val
79 
80 #ifdef PMC_USE_MPI
81  integer :: prev_position
82 
83  prev_position = position
84  call pmc_mpi_unpack_integer(buffer, position, val%source_id)
85  call pmc_mpi_unpack_real(buffer, position, val%create_time)
86  call assert(297427277, position - prev_position &
88 #endif
89 
90  end subroutine pmc_mpi_unpack_aero_component
91 
92 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
93 
94 end module pmc_aero_component
pmc_mpi
Wrapper functions for MPI.
Definition: mpi.F90:13
pmc_mpi::pmc_mpi_pack_size_real
integer function pmc_mpi_pack_size_real(val)
Determines the number of bytes required to pack the given value.
Definition: mpi.F90:385
pmc_aero_component
The aero_particle_t structure and associated subroutines.
Definition: aero_component.F90:9
pmc_aero_component::pmc_mpi_pack_size_aero_component
integer function pmc_mpi_pack_size_aero_component(val)
Determines the number of bytes required to pack the given value.
Definition: aero_component.F90:34
pmc_aero_component::aero_component_t
Aerosol particle component data structure.
Definition: aero_component.F90:21
pmc_mpi::pmc_mpi_pack_real
subroutine pmc_mpi_pack_real(buffer, position, val)
Packs the given value into the buffer, advancing position.
Definition: mpi.F90:761
pmc_util::assert
subroutine assert(code, condition_ok)
Errors unless condition_ok is true.
Definition: util.F90:104
pmc_aero_component::pmc_mpi_pack_aero_component
subroutine pmc_mpi_pack_aero_component(buffer, position, val)
Packs the given value into the buffer, advancing position.
Definition: aero_component.F90:48
pmc_mpi::pmc_mpi_unpack_integer
subroutine pmc_mpi_unpack_integer(buffer, position, val)
Unpacks the given value from the buffer, advancing position.
Definition: mpi.F90:1139
pmc_util
Common utility subroutines.
Definition: util.F90:9
pmc_mpi::pmc_mpi_pack_size_integer
integer function pmc_mpi_pack_size_integer(val)
Determines the number of bytes required to pack the given value.
Definition: mpi.F90:345
pmc_aero_component::pmc_mpi_unpack_aero_component
subroutine pmc_mpi_unpack_aero_component(buffer, position, val)
Unpacks the given value from the buffer, advancing position.
Definition: aero_component.F90:72
pmc_mpi::pmc_mpi_pack_integer
subroutine pmc_mpi_pack_integer(buffer, position, val)
Packs the given value into the buffer, advancing position.
Definition: mpi.F90:711
pmc_mpi::pmc_mpi_unpack_real
subroutine pmc_mpi_unpack_real(buffer, position, val)
Unpacks the given value from the buffer, advancing position.
Definition: mpi.F90:1189