57 aero_particle_array%n_part = 0
58 allocate(aero_particle_array%particle(0))
70 integer,
intent(in) :: n_part
74 aero_particle_array%n_part = n_part
75 allocate(aero_particle_array%particle(n_part))
92 do i = 1,aero_particle_array%n_part
95 deallocate(aero_particle_array%particle)
104 aero_particle_array_to)
115 aero_particle_array_from%n_part)
116 do i = 1,aero_particle_array_from%n_part
118 aero_particle_array_to%particle(i))
132 allocate(aero_particle_array%particle(0))
133 aero_particle_array%n_part = 0
150 integer,
intent(in) :: new_length
155 n_part = aero_particle_array%n_part
156 call
assert(867444847, new_length >= n_part)
157 allocate(new_particles(new_length))
158 do i = 1,aero_particle_array%n_part
162 deallocate(aero_particle_array%particle)
163 aero_particle_array%particle => new_particles
177 integer :: length, new_length
179 length =
size(aero_particle_array%particle)
180 new_length = max(length * 2, length + 1)
193 integer,
intent(in) :: n
195 do while (
size(aero_particle_array%particle) < n)
210 integer :: n_part, length, new_length
212 n_part = aero_particle_array%n_part
213 length =
size(aero_particle_array%particle)
214 new_length = length / 2
215 do while ((n_part <= new_length) .and. (length > 0))
217 length =
size(aero_particle_array%particle)
218 new_length = length / 2
236 n = aero_particle_array%n_part + 1
240 aero_particle_array%particle(n))
241 aero_particle_array%n_part = aero_particle_array%n_part + 1
254 integer,
intent(in) :: index
256 call
assert(992946227, index >= 1)
257 call
assert(711246139, index <= aero_particle_array%n_part)
259 if (index < aero_particle_array%n_part)
then
262 aero_particle_array%particle(aero_particle_array%n_part), &
263 aero_particle_array%particle(index))
265 aero_particle_array%n_part = aero_particle_array%n_part - 1
278 integer :: i, total_size
283 total_size = total_size &
296 character,
intent(inout) :: buffer(:)
298 integer,
intent(inout) :: position
303 integer :: prev_position, i
305 prev_position = position
322 character,
intent(inout) :: buffer(:)
324 integer,
intent(inout) :: position
329 integer :: prev_position, i
332 prev_position = position
334 allocate(val%particle(val%n_part))
subroutine pmc_mpi_pack_aero_particle(buffer, position, val)
Packs the given value into the buffer, advancing position.
subroutine aero_particle_array_copy(aero_particle_array_from, aero_particle_array_to)
Copies aero_particle_array_from to aero_particle_array_to, both of which must already be allocated...
subroutine aero_particle_array_deallocate(aero_particle_array)
Deallocates.
integer function pmc_mpi_pack_size_integer(val)
Determines the number of bytes required to pack the given value.
1-D arrays of particles, used by aero_state to build a ragged array.
subroutine pmc_mpi_unpack_aero_particle(buffer, position, val)
Unpacks the given value from the buffer, advancing position.
subroutine aero_particle_array_zero(aero_particle_array)
Resets an aero_particle_array to contain zero particles.
The aero_particle_t structure and associated subroutines.
subroutine aero_particle_deallocate(aero_particle)
Deallocates memory associated with an aero_particle_t.
subroutine aero_particle_array_allocate_size(aero_particle_array, n_part)
Allocates and initializes to the given size.
subroutine aero_particle_shift(aero_particle_from, aero_particle_to)
Shift data from one aero_particle_t to another and free the first one.
subroutine aero_particle_array_realloc(aero_particle_array, new_length)
Changes the given aero_particle_array to exactly the given new_length.
The aero_particle_array_t structure and assoicated subroutines.
subroutine pmc_mpi_pack_integer(buffer, position, val)
Packs the given value into the buffer, advancing position.
subroutine aero_particle_array_add_particle(aero_particle_array, aero_particle)
Adds the given particle to the end of the array.
Common utility subroutines.
subroutine pmc_mpi_unpack_integer(buffer, position, val)
Unpacks the given value from the buffer, advancing position.
Wrapper functions for MPI.
subroutine aero_particle_array_shrink(aero_particle_array)
Possibly shrinks the storage of the given array, ensuring that it can still store the allocated parti...
subroutine aero_particle_allocate(aero_particle)
Allocates memory in an aero_particle_t.
Single aerosol particle data structure.
Reading formatted text input.
subroutine aero_particle_array_remove_particle(aero_particle_array, index)
Removes the particle at the given index.
subroutine aero_particle_array_enlarge_to(aero_particle_array, n)
Enlarges the given array so that it is at least of size n.
subroutine pmc_mpi_unpack_aero_particle_array(buffer, position, val)
Unpacks the given value from the buffer, advancing position.
subroutine aero_particle_array_allocate(aero_particle_array)
Allocates and initializes.
subroutine aero_particle_array_enlarge(aero_particle_array)
Enlarges the given aero_particle_array by at least one element.
integer function pmc_mpi_pack_size_aero_particle(val)
Determines the number of bytes required to pack the given value.
subroutine assert(code, condition_ok)
Errors unless condition_ok is true.
subroutine pmc_mpi_pack_aero_particle_array(buffer, position, val)
Packs the given value into the buffer, advancing position.
subroutine aero_particle_copy(aero_particle_from, aero_particle_to)
Copies a particle.
integer function pmc_mpi_pack_size_apa(val)
Determines the number of bytes required to pack the given value.