OOF2: The Manual


Element — Element class for finite element meshes


C++ Synopsis

#include "engine/element.h"
class Element {
  const Material * material() const;
  int nnodes() const;
  int nfuncnodes() const;
  int shapefun_degree() const;
  int dshapefun_degree() const;
  ElementNodeIterator node_iterator() const;
  ElementMapNodeIterator mapnode_iterator() const;
  ElementFuncNodeIterator funcnode_iterator() const;
  ElementCornerNodeIterator cornernode_iterator() const;
  MasterCoord to_master(const Coord& position) const;
  Coord from_master(const MasterCoord& position) const;
  MasterCoord center() const;
  double area() const;
  OutputValue outputField(const Field& field,
                          const MasterPosition& position) const;

  OutputValue outputFieldDeriv(const Field& field,
                               SpaceIndex* derivative,
                               const MasterPosition& position) const;

  OutputValue outputFlux(const FEMesh* mesh,
                         const Flux& flux,
                         const MasterPosition& position) const;


Python Synopsis

from oof2.SWIG.engine import element
class Element:
  def material(self)
  def area(self)
  def shapefun_degree(self)
  def dshapefun_degree(self)
  def node_iterator(self)
  def mapnode_iterator(self)
  def funcnode_iterator(self)
  def cornernode_iterator(self)
  def outputField(self, field, position)
  def outputFlux(self, mesh, flux, position)
  def from_master(self, x, y)
  def to_master(self, x, y)

Source Files

  • SRC/engine/element.C: C++ source code
  • SRC/engine/element.h: C++ header file
  • SRC/engine/element.swg: swig source code.


Element is a swigged C++ class for describing a finite element. It is a generic class: each Element contains a pointer to a MasterElement object that contains all of the geometry-specific details.

Only those parts of the Element class that are useful for writing OOF2 extensions are described here. There are actually many more functions and data members. Consult the source code for the details.


const Material* material() const

material simply returns a pointer to the Material object that describes the Element's physical features.

int nnodes() const

nnodes returns the number of nodes in the Element.

int nfuncnodes() const

nfuncnodes returns the number of so-called function nodes in the element. These are the nodes that store Field values.

int shapefun_degree() const

shapefun_degree returns the polynomial degree of the Element's shape functions, more or less. It actually returns the Gaussian integration order required to perform integrals over the Element's area.

int dshapefun_degree() const

dshapefun_degree returns the Gaussian integration order required to integrate the derivatives of the shape function over the area of the Element.

ElementNodeIterator node_iterator() const

node_iterator returns an ElementNodeIterator which can be used to access all of the Element's Nodes.

ElementMapNodeIterator mapnode_iterator() const

mapnode_iterator returns an ElementMapNodeIterator which can be used to access all of the Element's mapping Nodes. These are the Nodes that determine the Element's shape and position in space. That is, they determine the mapping between master coordinates and physical coordinates.

ElementFuncNodeIterator funcnode_iterator() const

funcnode_iterator returns an ElementFuncNodeIterator which can be used to access all of the Element's FuncNodes. FuncNodes are Nodes which store Field values.

ElementCornerNodeIterator cornernode_iterator() const

cornernode_iterator returns an ElementCornerNodeIterator which can be used to access the Nodes at the corners of the Element.

MasterCoord to_master(const Coord&) const, to_master(x,y)

to_master converts a position in physical space to a position in the Element's master coordinate space. The C++ version takes a Coord argument, but the Python version takes two floats, x and y, which allows it to work equally well with Points and swigged Coords. Both versions return a MasterCoord object.

to_master is a fairly expensive function to compute, so it should be used judiciously.

Coord from_master(const MasterCoord&) const, from_master(x,y)

from_master takes a position in master coordinate space (in the form of a MasterCoord object in C++ or an x,y pair in Python) and returns the corresponding point in physical space. The return value is a Coord in both languages.

MasterCoord center() const

center returns the position of the center of the Element in master coordinate space. This can be converted to a physical coordinate with from_master.

double area() const

area returns the physical area of the Element.

OutputValue outputField(const Field& field, const MasterPosition& position) const

outputField uses finite element interpolation to evaluate a given Field at a given position within the Element. The position must be specified in the Element's master coordinate space. The value of the Field is returned inside a generic OutputValue wrapper, allowing it to be used in the Outputs.

OutputValue outputFieldDeriv(const Field& field, SpaceIndex* derivative, const MasterPosition& position)\

outputFieldDeriv is just like outputField, but it computes a derivative of the Field.

The derivative argument is a SpaceIndex object, which is basically a fancy integer.[66] outputFieldDeriv returns the x derivative if derivative==0 and the y derivative if derivative==1.

OutputValue outputFlux(const FEMesh* mesh, const Flux& flux, const MasterPosition& position) const

outputFlux is just like outputField, except that it computes the value of a Flux.

[66] The wrapper around the integer provides type checking. For example, it prevents a shape function index from being used as a spatial index, although both are integers. See SRC/engine/indextypes.h.