Hi everyone,
I have a doubt about how to allocate arrays in a structure.
Type node_type
real, dimension(3) :: coord
…
End type
Type RBC_type
…
type(node_type), allocatable, dimension(:) :: node
End type
And then in the main I have
type(RBC_type), DEVICE, allocatable, dimension(:) :: RBC
Then, when I have to allocate the structure, I do the following:
Allocate(RBC(N))
and it seems to work.
But when I try to allocate the node:
do i = 1, N
allocate(RBC(i)%node(num_nodes))
end do
I can compile, but when running I get this error: Segmentation fault (core dumped).
I am allocating everything on the host side. Could you help me with this?
Thank you.