Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bug typederived parameters

Status
Not open for further replies.

vincent23

Technical User
Nov 27, 2010
2
FR
Hi,
i have a problem with a type parameters, that my module:

module toto
type to3
real, dimension(3) :: k
end type to3

type alfa
type(to3) :: tik
type(to3) :: tok
end type alfa

type agra
real :: r, g, u, z
type(alfa) ::sup
end type agra


TYPE(agra), parameter :: fat_GROS=agra(0.,0.,0.,0.,sup%tik%k(/0.,0.,0./))
! Unexpected Array reference at (1)k(/0.,0.,0./)

end module toto


I don't know what to change with sup%tik%k(/0.,0.,0./)...
At the end, i want to create a constant fat_GROS with all r, g, z, u, and k

Thank you for your help !
Vincent.
 
I don't know why you want to create such parameter entity. Here is the easiest way in several steps :

Code:
   type(to3),parameter :: t03_null=to3((/0.,0.,0./))
   type(alfa),parameter :: alfa_null=alfa(t03_null,t03_null)
   type(agra), parameter :: fat_GROS=agra(0.,0.,0.,0.,alfa_null)

Now, could you explain me why you want such complicated parameter entity ? I say "entity" because a parameter is not a variable : it is a constant which cannot be modified.

François Jacq
 
Thank you for your answer.
At the end, i want to create a constant (a parameter) call fat_GROS who will include r, g, u, z, sup, tik, tok, k.
fat_GROS have to be a parameter for all.

I tried something and it work :
Code:
TYPE(agra), parameter :: fat_GROS=agra(0.,0.,0.,0.,alfa(to3((/0.,0.,0./)),to3((/0.,0.,0./))))

But, it could exist an easier solution ?
 
I think FJacq's declaration is a lot clearer. Remember that programs are read more often than they are written. You want the reader to be able to understand the program quickly and move on to the bits that are relevant instead of pondering about what you've written.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top