Basically I have a derived type that represents a cell and I wanted it to have pointers to its neighbours. This is the data structure I would like to have:
module XYZ
...
type pointerToCellContainer
type( cellType ), pointer :: p
end type pointerToCellContainer
...
type cellType(nDOFs, nEQs)
integer(itp), len :: nDOFs
integer(isp), len :: nEQs
...
type( pointerToCellContainer ), dimension(2) :: nb
...
contains
...
end type cellType
...
end module XYZWhile the module compiles fine when i try to atribute a cell to the pointer in the main program the compiler returns the error
main.f90(130): error #6795: The target must be of the same type and kind type parameters as the pointer. [P]
mesh%cellList(cID)%nb(1)%p => mesh%cellList(cID-1)
---------------------------------^
main.f90(131): error #6795: The target must be of the same type and kind type parameters as the pointer. [P]
mesh%cellList(cID)%nb(2)%p => mesh%cellList(cID+1)
---------------------------------^My main doubt is if I'm actually trying to do something not allowed by the 2008 standard or if it's just a syntax problem. I'm doing this code to teach myself some features that I never got to use in production code (mainly parameterized derived types, submodules and other OO features) so workarounds and alternative design solution are also welcome.
Thread Topic:
Help Me