If you will be using Intel Fortran and don't mind using an extension, this also works:
integer :: something_array(sizeof(something)/sizeof(0))
There is work going on in both the MPI and Fortran committees to make use of MPI in "modern Fortran" easier.
Also, I suggest adding BIND(C) to your derived type to prevent padding or reordering.
Steve
-----Original Message-----
From: Fortran 90 List [mailto:[log in to unmask]] On Behalf Of Ted Stern
Sent: Thursday, December 16, 2010 3:31 PM
To: [log in to unmask]
Subject: Re: size of a derived type
Thanks, Steve, for both the workaround and the promise of an eventual
improvement.
All I'm trying to do is get some data from a namelist and propagate it
throughout the MPI job.
IMO the MPI standard should be able to do something like this
internally with Fortran derived types so you don't have to go through
these shenanigans just to pass data around.
But MPI is somewhat primitive in that respect and has more of an f77/c
flavor. I don't like the size(transfer(...)) syntax either, but one
has to work with the tools available.
Ted
|