I need to have a mixed type array with short integer*1 values first and a real value last. I read all the examples and am
doing everything correct but it refuses to work !! This is only a simple trial example to try first. Later i will need to have much more than just
11 integer values and need a way to assign values in program loops. Using as .f95
integer*1 id(11)
type mixd;integer*1 id(11);real val;end type
type(mixd) mixr(9)
do i=1,9;do j=1,11;id(j)=i*j ;mixr(i)=(id,real(i)/real(j));enddo;enddo
end
As one can see above that is perfectly valid code but it refuses to accept ! and does not seem to matter whether i put the first "integer*1 id(11)"
or not.
As an alternative i even try manually as eg:
mixr(3)=mixd(1,2,3,4,5,6,7,8,9,10,11,0.2)
or try
mixr(3)=mixd((1,2,3,4,5,6,7,8,9,10,11),0.2)
Both of which are perfectly valid and even neither of these work !
NOw the following does work
type mixd1;integer*1 id1 ;integer*1 id2;real val1;end type
type (mixd1) mixr1(9)
mixr1(3)=mixd1(2,3,5.5)
print*,mixr1(3)
end
BUt i don't want to have to repeat integer*1 id1,..., integer*1 id99 written out that many times - that is ridiculous to have to force one to do it that way!
And then it is most unwiedly to have to assign values this way also - no way to do it in a loop.
doing everything correct but it refuses to work !! This is only a simple trial example to try first. Later i will need to have much more than just
11 integer values and need a way to assign values in program loops. Using as .f95
integer*1 id(11)
type mixd;integer*1 id(11);real val;end type
type(mixd) mixr(9)
do i=1,9;do j=1,11;id(j)=i*j ;mixr(i)=(id,real(i)/real(j));enddo;enddo
end
As one can see above that is perfectly valid code but it refuses to accept ! and does not seem to matter whether i put the first "integer*1 id(11)"
or not.
As an alternative i even try manually as eg:
mixr(3)=mixd(1,2,3,4,5,6,7,8,9,10,11,0.2)
or try
mixr(3)=mixd((1,2,3,4,5,6,7,8,9,10,11),0.2)
Both of which are perfectly valid and even neither of these work !
NOw the following does work
type mixd1;integer*1 id1 ;integer*1 id2;real val1;end type
type (mixd1) mixr1(9)
mixr1(3)=mixd1(2,3,5.5)
print*,mixr1(3)
end
BUt i don't want to have to repeat integer*1 id1,..., integer*1 id99 written out that many times - that is ridiculous to have to force one to do it that way!
And then it is most unwiedly to have to assign values this way also - no way to do it in a loop.