I haven't ever used derived types, I'm not sure if this is applicable to
your problem. I have a few simulation models that create what I call a
data dictionary as one file and a my data in another file. I can then read
the newly created file into the same program using the data
dictionary. The data I read is a set of binary arrays which can vary in
size. The data are derived from Census Social Science
surveys. Typically we process a household at a time. A household can
contain multiple family records and different number of persons.
My data dictionary tells me how many variables are in each record type
(household,family,person). I also write out variables in front of my
arrays that tell me how many family and person records follow for this
household.
Once I read in the 2 variables (the file is binary), I have enough
information
to allocate all the data arrays for this household in exactly the right
size. I then read in the three arrays with a binary read of the
arrays. No do loops
I can add new variables to the file, delete, or rename the variables, or
even select which variables to write out. I read in an ASCII text file
that contains file names, and text for the variables to keep or
delete. Then there are the simulation parameters, but that's not the
point. If you're interested in more details (if this method is of
interest), please email me.
PS, how does one unsubscribe?
At 02:11 PM 10/23/01 -0500, you wrote:
>Hello,
>
>MATLAB has a wonderful command "save" which saves (all or some) the
>variables in the worksheet. A simple "load" will later reinstate these
>and one can continue where the previous session stopped. I am wondering
>if someone has any tools/ideas of how to do this in Fortran (with any
>changes in F2x--I know it adds IO for derived types).
>
>In my codes I have big derived data types that contain a lot of arrays
>(say ALLOCATABLE in F2x) and possibly other sub datatypes, or maybe even
>pointers to other derived objects. It seems to me I need to write
>separate IO routines for each such complicated type, and ALLOCATE all
>arrays again manually and then read the data manually, etc. But if
>someone has some better ideas, I would appreciate some pointers. Does
>the new standard help in this respect and if yes, which sections should
>I look at?
>
>Thank you,
>Aleksandar
>
>--
>__________________________________
>Aleksandar Donev
>Complex Materials Theory Group (http://cherrypit.princeton.edu/)
>Princeton Materials Institute & Program in Applied and Computational
>Mathematics
>@ Princeton University
>Address:
> 419 Bowen Hall, 70 Prospect Avenue
> Princeton University
> Princeton, NJ 08540-5211
>E-mail: [log in to unmask]
>WWW: http://atom.princeton.edu/donev
>Phone: (609) 258-2775
>Fax: (609) 258-6878
>__________________________________
Bob Cohen
(703) 534-7618
[log in to unmask]
|