- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear all,
I have the following type variable:
TYPE::tMACROCELLNODE INTEGER :: nElem INTEGER :: AA INTEGER :: IDnode INTEGER :: IDmCell REAL(KIND=8),ALLOCATABLE,DIMENSION(:) :: WFX REAL(KIND=8),ALLOCATABLE,DIMENSION(:) :: WFY ! REAL(KIND=8),ALLOCATABLE,DIMENSION(:) :: WFtime REAL(KIND=8),ALLOCATABLE,DIMENSION(:) :: WFpdf ! REAL :: qs ENDTYPE
During my program, I allocate it as:
first of all:
ALLOCATE(MACROCELLNODE(npairs))
and then
DO i..... ALLOCATE(MACROCELLNODE(i)%WFX(n)) ... ...
My question is:
Is it possible deallocate only one field of it?
for example:
i=10 DEALLOCATE(MACRCELLNODE(i)%WFX(:))
Thank to all of you
Diego
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, you can do that. You can also deallocate the entire array and each of the components will be deallocated as necessary.
You have the syntax a bit wrong in the DEALLOCATE, though - no (:) at the end.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear all, Dear Steve,
Thanks a lot, but what is the difference between
VECTOR(:) or VECTOR?
Just to better understand
Thanks again
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When you allocate an array, you have to specify the extent of the array. When you deallocate, however, you do not specify a range of indices. You may deallocate only the entire array, and not chosen portions of it. Therefore, writing (:) in the deallocation statement would be superfluous, and the language rules do not let you write that qualifier.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page