- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i wrote the following code to check if i can use allocatable components in derived types.
When i run the program end try to change the initial values of A(Type(Region_2D))they remain unchanged.
What is wrong???
P.S. When i use allocatable arrays of type Real, as a Derived type Component There 's nothing wrong.
module
Analytic_Geometry_Types !---Data-Types-----------------------------------------------!**************************************************** !***************************************************** !---------------------- !*Point 2D* !---------------------- Type :: Point_2D real :: x real :: y End Type!-----------------------
!*Vector2D*
!------------------------ Type :: Vector_2D Type(Point_2D) :: i Type(Point_2D) :: j End Type !*****************************************************!*Region2D* !--------------------------------- Type :: Region_2D integer :: Sec_Number Type(Vector_2D),allocatable,Dimension(:) :: Sections end Type !*****************************************************
end moduleAnalytic_Geometry_Types
program main< /FONT>
use Analytic_Geometry_Types
Type(Region_2D) :: A
allocate (A%Sections(3))
A%Sec_Number = 3
do I=1,A%Sec_Number
A%Sections(I)%i%x=1.0
A%Sections(I)%j%x=1.0
A%Sections(I)%i%y=1.0
A%Sections(I)%j%y=1.0
enddo
stop
end
Message Edited by ipeta on 06-15-2004 10:39 AM
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
in the original message i wrote by mistake
do I=1,Sec_Number
in my code the statement for the do loop is:
do I=1,A%Sec_Number
but even if i write
do i=1,3
i cannot change the initial values of A
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page