OOF2: The Manual

Name

ScalarField — A scalar-valued Field

Synopses

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;
  double value(const FEMesh* mesh,
               const Element element,
               const MasterPosition& point) const;

  double gradient(const FEMesh* mesh,
                  const Element element,
                  const MasterPosition& point,
                  SpaceIndex direction) const;

  virtual FieldIndex* getIndex(const std::string& name) const;
}

Python Synopsis

from ooflib.SWIG.engine.field import ScalarField 
class ScalarField(CompoundField):
  def __init__(self, name)
  def getIndex(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.

Description

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.3). The constructor has a single argument, which is the name of the Field.

Because ScalarField is a CompoundField, when it is constructed its out-of-plane part and time derivative parts will be constructed automatically. The out-of-plane part of a scalar field is its z derivative, which is also a scalar.

It is not necessary to keep an explicit Python reference to a newly constructed ScalarField. Existing Fields may be retrieved with getField.

The FieldIndex class for ScalarField is ScalarFieldIndex.

Methods

Methods defined in the base classes are not mentioned here, unless the derived class functions behave differently in some way.

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. However, there is no Python equivalent of these functions.

double value(...) const

double value(const FEMesh* mesh, const Element* element, const MasterPosition& point) const;

This version of value() computes the value of a ScalarField at the given point within the given element. It is a non-virtual method, inaccessible from a generic Field pointer. Unlike the generic virtual method in the Field class, this version does not require a component argument.

double gradient(...) const

double gradient(const FEMesh* mesh, const Element* element, const MasterPosition& point,
                SpaceIndex direction) const;
      

gradient() is like value(), but it computes the gradient of the Field in the given direction.

double gradient(...) const

double gradient(const FEMesh* mesh, const Element* element, const MasterPosition& point, SpaceIndex direction) const;

This version of gradient() computes the gradient of a ScalarField in the given direction at the given point within the given element. It is a non-virtual method, inaccessible from a generic Field pointer. Unlike the generic virtual method in the Field class, this version does not require a component argument.

FieldIndex *getIndex(const std::string &name) const

ScalarField::getIndex() returns a pointer to a ScalarFieldIndex. The name argument is ignored.