Re: derived data type extension
- From: Tobias Burnus <burnus@xxxxxxxx>
- Date: Mon, 2 May 2011 09:25:07 -0700 (PDT)
On May 2, 5:49 pm, rudra <bnrj.ru...@xxxxxxxxx> wrote:
type(point), dimension(100000) :: coordinate
type, extends(point)::latspn
real(rdp),dimension(1,3)::spin
end type latspn
type(latspn),dimension(100000)::corspn
So, is
there any better way to initialize the extended data type corspn from
its parent coordinate?
How about:
corspn(:)%point = coordinate
corspn(:)%spin = 1
Extended derived types have a component with the name of the parent
derived-type name. Thus for:
type t
integer :: x
end type t
type, extends(t) :: t2
end type t2
type, extends(t) :: t3
end type t3
type(t3) :: a
one can access the "x" using: a%x, a%t2%x and a%t2%t%x.
Tobias
.
- Follow-Ups:
- Re: derived data type extension
- From: Richard Maine
- Re: derived data type extension
- References:
- derived data type extension
- From: rudra
- derived data type extension
- Prev by Date: derived data type extension
- Next by Date: Re: derived data type extension
- Previous by thread: derived data type extension
- Next by thread: Re: derived data type extension
- Index(es):