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:
DO i..... ALLOCATE(MACROCELLNODE(i)%WFX(n)) ... ...
My question is:
Is it possible deallocate only one field of it?
Thank to all of you
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.
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.