Pointers and derived data types

leandro gth745m@mail.gatech.edu
Fri Jul 14 06:04:00 GMT 2006


I would like to know if gfortran is still having problems with complex
structures of derived data types and pointers.
I'm using gfortran and I'm having problems allocating some variables
that are defined as shown below. When I run the program using valgrind
it works, if not it doesn't.


    TYPE :: boundaryface
        INTEGER :: bc,nnodes
        INTEGER, DIMENSION(2) :: bconnect
        REAL, DIMENSION(:), POINTER :: bcdata
        INTEGER, DIMENSION(:), POINTER :: nodes
    END TYPE

    TYPE :: elements
        INTEGER :: el_type
        INTEGER :: nnodes
        INTEGER, DIMENSION(:), POINTER :: nodes
    END TYPE

    TYPE :: domine
        INTEGER :: imax, jmax, kmax, nnodes,nel
        CHARACTER (LEN=10) :: dom_name
        REAL (KIND=4), DIMENSION(:), POINTER :: x,y,z
        TYPE (elements), DIMENSION(:), POINTER :: element
        INTEGER, DIMENSION(:), POINTER :: dirichletnodes,
nondirichletnodes
        INTEGER :: el_type
        REAL, DIMENSION(:), POINTER :: T
        REAL, DIMENSION(:,:), POINTER :: var
        INTEGER :: nbfaces
        TYPE (boundaryface), DIMENSION(:), POINTER :: bface
    END TYPE

    TYPE :: boundarycondition
        CHARACTER (LEN=80) :: bname
        INTEGER :: btype
        REAL, DIMENSION(:), POINTER :: bdata
    END TYPE

    TYPE (boundarycondition), DIMENSION(:), ALLOCATABLE :: bc
    TYPE (domine), DIMENSION(:), ALLOCATABLE :: dom



More information about the Fortran mailing list