OOF2: The Manual

8.2. Python Package Layout

The Python package structure mimics the directory layout described in Section 8.1. The top-level package is ooflib, and within it are packages called common, engine, image, and orientationmap. When OOF2 is started, it modifies the Python path so that the ooflib package can be found.

Python modules created by swig, however, are installed into the package ooflib.SWIG. Within ooflib.SWIG are packages named common, engine, image, and orientationmap.

For example, the Python code defining the Microstructure SRC/common/microstructure.py can be imported into another Python file with

from ooflib.common import microstructure 

and the C++ underpinnings of the class, defined in SRC/common/cmicrostructure.C and wrapped by SRC/common/cmicrostructure.swg, can be imported with

from ooflib.SWIG.common import cmicrostructure