OOF2: The Manual


TwoVectorField — A two dimensional vector-valued Field object


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 TwoVectorField: , public CompoundField {
  TwoVectorHelper operator()(const FuncNode* node) const;
  TwoVectorHelper operator()(const FuncNode& node) const;
  TwoVectorHelper operator()(const ElementFuncNodeIterator& node) const;

Python Synopsis

from oof2.SWIG.engine.field import TwoVectorField
class TwoVectorField(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.


TwoVectorField is a Field whose value is a two dimensional (in-plane) vector at every point in a Mesh. TwoVectorFields 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 TwoVectorField is constructed, its out-of-plane part will be constructed automatically. The out-of-plane part of a 2-vector field is a 3-vector: the three dimensional gradient of its z component. The name of the out-of-plane part is constructed by appending _z to the name of the in-plane part.

Constructing a TwoVectorField 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 TwoVectorField. 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.

TwoVectorHelper operator()(...)

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

These functions are provided as a convenient way of getting and setting the value of a TwoVectorField on a Node. (Setting any Field value manually is not recommended -- let the OOF2 field initialization and solving routines do it for you.) The TwoVectorHelper class translates Field values into Coord values, and is meant to be completely transparent to the programmer. It can be used like this:

	    Field *field = ...
	    Coord x = (*field)(mesh, node); // extract Field value
	    Coord y(1.23, 4.56);
	    (*field)(mesh, node) = y; // set Field value