OOF2: The Manual


Equation — Base class for Equations


(Only those methods useful when extending OOF2 are listed here.)

C++ Synopsis

#include "engine/equation.h"
class Equation {
  const std::string& name() const;
  int dim() const;
  int ndof() const;
  IteratorP iterator() const;
  bool is_active(const FEMesh* mesh) const;

Python Synopsis

from oof2.SWIG.engine.equation import Equation
class Equation:
  def name(self)
  def dim(self)
  def ndof(self)
  def iterator(self)
  def is_active(self, mesh)

Source Files

  • SRC/engine/equation.h: C++ header
  • SRC/engine/equation.C: C++ code
  • SRC/engine/equation.swg: SWIG source code
  • SRC/engine/equation.spy: python code included in equation.swg.


Equation is the abstract base class for all Equation objects. Like Fields and Fluxes, Equation instances are global objects — there is one instance of each particular Equation that is shared among all meshes. For example, there is only one Force_Balance Equation, although many different meshes may be solving it.

Creating an Equation object does not mean that it will be solved on a mesh. Equations are only solved if they have been explicitly activated and their Fluxes depend upon active Fields on the mesh. Whether or not a Flux depends on a Field is a function of the meshes material Properties.

The entire API for Equations is defined in the base class. The derived classes redefine base class methods but do not add any new ones of their own, except for their constructors.

Most OOF2 extensions will probably never need to use an Equation object explicitly, aside from possibly creating a new Equation or checking to see if an Equation is active.


const std::string& name() const

name returns the name assigned to the Equation when it was created. See Section 8.1.

int dim() const, int ndof() const

dim and ndof are equivalent. They return the number of components of in the Equation. For example, the heat equation has one component, while the in-plane force balance equation has two.

IteratorP iterator() const

iterator returns an IteratorP object which can be used to loop over the components of the Equation.

bool is_active(const FEMesh *mesh) const

is_active indicates whether or not the Equation is being solved on the given FEMesh.