Quantcast
Channel: Intel® Fortran Compiler
Viewing all articles
Browse latest Browse all 3270

variable type in out a subroutine

$
0
0

dear all,

I would like to know how works the allocatable variable type in and out a subroutine

This is my problem.

I have this variable type:

  TYPE tParticle
    SEQUENCE
    INTEGER               :: ip
    INTEGER               :: mc
    INTEGER               :: bcflag
    INTEGER               :: cpu
    REAL    ,ALLOCATABLE  :: RP(:)
    REAL    ,ALLOCATABLE  :: QQ(:)
    REAL    ,ALLOCATABLE  :: UU0(:)
    REAL                  :: lij
    REAL                  :: lmls
    REAL                  :: vol
  ENDTYPE tParticle

and I allocate it in the following way:

  ALLOCATE (PART          (nptPbuffer))

 DO ip=1,nptPbuffer
     ALLOCATE(PART(ip)%RP(di))
     ALLOCATE(PART(ip)%QQ(nVar))
     ALLOCATE(PART(ip)%UU0(countBufferRK))
ENDDO

Here the problem: how can I pass the variable type?

Here an example:

SUBROUTINE SPH(nptTot,PART)
 TYPE(tParticle),DIMENSION(nptTot)      ,INTENT(IN)  :: PART

is it correct?

How can I deallocate the variable type? Can I simple do:

DEALLOCATE(PART)

thank to all of you


Viewing all articles
Browse latest Browse all 3270

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>