[Fortran] 纯文本查看 复制代码 PROGRAM Main
use ModParticle
implicit none
integer::i
! Local variables
type(ParticleType(x))::TempParticles
do i = 1, 1
TempParticles = CopyParticle(i)
end do
write(*,*) TempParticles
END PROGRAM Main
[Fortran] 纯文本查看 复制代码 module ModParticle
implicit none
integer::x=1
type ParticleType(n)
integer(4), len :: n
!> Particle mass [kg] (corresponds to the gas density)(fixed during simulation - ensures conservation of mass)
real(4),allocatable:: MassGas(:)
end type
contains ! Routines of this module
type(ParticleType(x)) function CopyParticle( ID)
implicit none
integer(4), intent(in) :: ID
CopyParticle%MassGas = 0.1
write(*,*) CopyParticle%MassGas
end function
end module |