Thanks for all. This is my first post.
I have a customized type such as
type dhd_particle real (kind=8) :: postn(3)=0.D0 ! position real (kind=8) :: veloc(3)=0.D0 ! velocity real (kind=8) :: vorti(3)=0.D0 ! vorticity real (kind=8) :: force(3)=0.D0 ! force real (kind=8) :: torqu(3)=0.D0 ! torque end type
and make 10 of them
type (dhd_particle) :: sphere(10)
Now I have pointer array such as
real(kind=8),pointer :: x(10),y(10),z(10),r(30)
then link them like
x => sphere(:)%postn(1) y => sphere(:)%postn(2) z => sphere(:)%postn(3)
up to which I did not have any problem. What I want to have is a pointer of "r", of which components are
r(1) = x(1) r(2) = y(1) r(3) = z(1) r(4) = x(2) ... r(30) = z(10)
How could I make the pointer array r either using x, y, and z or directly form sphere array?
I first would like to know this is possible or not. If possible, how do I write a code?
Any help will be highly appreciated.
Albert
Zone:
Thread Topic:
How-To