OOF2: The Manual


ScalarField — A scalar-valued Field


Only functions relevant to people writing OOF2 extensions are listed here. Base class functions are described in the Field and CompoundField documentation.

C++ Synopsis

#include "engine/field.h"
class ScalarField: , public CompoundField {
  DegreeOfFreedom* operator()(const FuncNode* node) const;
  DegreeOfFreedom* operator()(const FuncNode& node) const;
  DegreeOfFreedom* operator()(const ElementFuncNodeIterator& node) const;

Python Synopsis

from oof2.SWIG.engine.field import ScalarField
class ScalarField(CompoundField):
  def __init__(self, name)

Source Files

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


ScalarField is a Field whose value is a number at every point in a Mesh. ScalarFields should always be constructed in Python (see Section 8.1). The constructor has a single argument, which is the name of the Field.

When a ScalarField is constructed, its out-of-plane part will be constructed automatically. The out-of-plane part of a scalar field is its z derivative, which is also a scalar. The name of the out-of-plane part is constructed by appending _z to the name of the in-plane part.

Constructing a ScalarField and passing it to problem.advertise() makes it available for future use. It does not automatically define or activate the Field.

It is not necessary to keep an explicit reference to a newly constructed ScalarField. All Fields are automatically stored in the list-like object oof2.SWIG.engine.field.allFields.


Methods defined in the base classes are not mentioned here.

DegreeOfFreedom* operator()(...)

DegreeOfFreedom* operator()(const FuncNode *node) const;
DegreeOfFreedom* operator()(const FuncNode& node) const;
DegreeOfFreedom* operator()(const ElementFuncNodeIterator& node) const; 

These three functions are different ways of obtaining the DegreeOfFreedom object containing the value of a Field at a Node. They are identical to the operator() methods defined in the Field base class, except that they don't require the component index to be specified. Specifying the component of a scalar field is a bit silly.