I have defined two simple types in a module in Fortran 95. The types are defined as:
TYPE :: SPINVECTOR
DOUBLE PRECISION, dimension(0:3,1:3,1:3,1:3) :: x, y, z
END TYPE SPINVECTOR
TYPE :: IVECTOR
integer :: x, y, z
END TYPE IVECTOR
I am then using these types to pass information from the main program to a function. The function uses the data from the SPINVECTOR type to assign values to a variable of type IVECTOR which is needed by main.
Data passed using the SPINVECTOR type is fine but if I use the IVECTOR type I get different results from my calculations that are done in the function. Both the main program and the function have use module statements.
So, is there some sort of data corruption that can happen when passing types as parameters and, if so, why am I only getting strange results when I use the second one (if only spinvector is used I get the same results as if I passed the function three separate variables for the x, y, and z component for the IVECTOR).
TYPE :: SPINVECTOR
DOUBLE PRECISION, dimension(0:3,1:3,1:3,1:3) :: x, y, z
END TYPE SPINVECTOR
TYPE :: IVECTOR
integer :: x, y, z
END TYPE IVECTOR
I am then using these types to pass information from the main program to a function. The function uses the data from the SPINVECTOR type to assign values to a variable of type IVECTOR which is needed by main.
Data passed using the SPINVECTOR type is fine but if I use the IVECTOR type I get different results from my calculations that are done in the function. Both the main program and the function have use module statements.
So, is there some sort of data corruption that can happen when passing types as parameters and, if so, why am I only getting strange results when I use the second one (if only spinvector is used I get the same results as if I passed the function three separate variables for the x, y, and z component for the IVECTOR).