粒子数に一致するSoA領域を確保する。位置・速度・電荷・質量は呼出し元で埋める。 重みは1、粒子種IDは0、放出元は-1、aliveはtrueで初期化する。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(particles_soa), | intent(out) | :: | pcls | |||
| integer(kind=i32), | intent(in) | :: | n |
subroutine allocate_particles(pcls, n) type(particles_soa), intent(out) :: pcls integer(i32), intent(in) :: n if (n < 0_i32) error stop "n must be non-negative" pcls%n = n allocate (pcls%x(3, n), pcls%v(3, n), pcls%q(n), pcls%m(n), pcls%w(n), & pcls%species_id(n), pcls%source_element(n), pcls%alive(n)) pcls%w = 1.0_dp pcls%species_id = 0_i32 pcls%source_element = -1_i32 pcls%alive = .true. end subroutine allocate_particles