OOF2: The Manual
When OOF2 saves data files that are meant to be read by OOF2 itself, it saves the data in the form of OOF2 commands from the OOF.LoadData menu. (Data files destined for some other use, such as being read by a plotting program, are not stored this way.) These data command files can be written in one of three formats. The best format depends on how the file is to be used. Every data file must begin with a FileVersion command, which identifies the format being used.
The script format saves the file as a
Python script containing OOF2 menu commands. The file is
easily editable, and arbitrary Python code can be inserted
into it. However, because the file can contain any valid
Python code and is read by the Python interpreter, it presents
a (theoretical) security risk. A malicious Python program
could be masquerading as an OOF2 script.
script files can be loaded into OOF2
by the OOF.File.Load.Script command.
Example.
OOF.LoadData.FileVersion(number=1.0, format='script) microname = "MyFavoriteMicrostructure" physicalsize = Point(1.2, 1.2) pixelsize = iPoint(100, 100) OOF.LoadData.Microstructure.New(name=microname, size=physicalsize, isize=pixelsize)
This file contains two OOF2 commands, one of which is written in
terms of three Python variables,
microname,
physicalsize, and pixelsize.
Files in the ascii format contain
Python-like code that can be easily read and edited, but when
loaded into OOF2 is not processed by the Python interpreter.
This format does not present any security risk, because the
OOF2 routines for reading ascii files
do not understand arbitrary Python code: they only understand
OOF2 menu commands. There is no danger when loading
ascii files from unknown sources. Their
disadvantage is that they cannot contain most Python
constructions: they can't define variables, import other
files, or make general function calls.
ascii files are slightly smaller than
script files.
To convert an ascii file to a
script file, it's only necessary to
prepend OOF.LoadData. to the beginning
of each line in the file. A script file
can be converted to an ascii file by
removing the OOF.LoadData. from each
line, provided that no Python code has been inserted into the
file.
ascii files can be loaded into OOF2
by the OOF.File.Load.Data command.
Example.
The example script file above could be
converted to an ascii file by removing
the variable assignments and leaving off the
OOF.LoadData. part of the commands:
FileVersion(number=1.0, format='ascii') Microstructure.New(name="MyFavoriteMicrostructure", size=Point(1.2,1.2), isize=iPoint(100,100))
The binary format has the advantages that
it is more accurate than the script or
ascii formats. By storing the full
binary representation of data, it avoids errors introduced by
converting numerical values to text and back.
Binary files are generally smaller and
faster to read and write, as well. They don't have the
security problems of script files. Their
disadvantage is that they are not user-friendly: they cannot
be viewed or edited in a text editor.
binary files can be loaded into OOF2
by the OOF.File.Load.Data command.
![]() |
Note |
|---|---|
|
The binary files are designed to be as portable as possible, in that they detect and correct for the differences between big-endian and little-endian computers. The files cannot be shared between machines with fundamentally different representations of floating point numbers, though. |
Skeletons and Meshes can be saved in
abaqus format, which allows them to be
read by the Abaqus finite element program. The
OOF2 Materials are not stored in the file because there is
in general no simple translation from OOF2 Materials to
Abaqus materials. However, the output file contains comments
indicating where the Abaqus materials should be defined, and
creates element groups for each OOF2 Material type.


![[Note]](IMAGES/note.png)

