The following are the practices that have evolved over the course of FiPy‘s development. Stray from them at your peril.
Object Oriented Design¶
Multiple inheritance is forbidden.
To the greatest extent possible, we follow PEP 8. We make the following exceptions because we had already written a great deal of code before we knew there even was a PEP 8.
- Maximum Line Length
The preferred place to break around a binary operator is before the operator, not after it. Some examples:class Rectangle(Blob): def __init__(self, width, height, color='black', emphasis=None, highlight=0): if (width == 0 and height == 0 and color == 'red' and emphasis == 'strong' or highlight > 100): raise ValueError("sorry, you lose") if width == 0 and height == 0 and (color == 'red' or emphasis is None): raise ValueError("I don't think so -- values are %s, %s" % (width, height)) Blob.__init__(self, width, height, color, emphasis, highlight)
- Package and Module Names
mixedCaserather than all-
- Function and Method Names
Any other deviations from PEP 8 should probably be corrected, but ask if you are unsure. Even the exceptions listed above are open to discussion by anybody willing to do the work of changing the existing code.
- The gmsh executable, version 2.0 or greater, must on the
scipypackage must be importable.
enthought.tvtk) package must be importable.
- FiPy must be running on a single processor.
- FiPy must be running on more than one processor.
- Whether serial or parallel, the test will only be run on processor ID 0.
- The test will only be run on processor ID 0 of a two processor parallel job.
- The test will only be run on processor ID 1 of a two processor parallel job.
- The test will only be run on processor ID 0 of a three processor parallel job.
- The test will only be run on processor ID 1 of a three processor parallel job.
- The test will only be run on processor ID 2 of a three processor job.
lsmlibpackage must be importable.
Further directives can be defined using
register_skipper(). These definitions should
be placed in the file to which they pertain, e.g.,
GMSH is defined in
Enter search terms or a module, class or function name.