OOF2: The Manual
Name
TwoVectorField —
A two dimensional vector-valued Field object
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 TwoVectorField: , public CompoundField {virtual FieldIndex* getIndex(const std::string& name) const;DoubleVec values(const FEMesh* mesh,
const Element* element,
const MasterPosition& position);DoubleVec gradients(const FEMesh* mesh,
const Element* element,
const MasterPosition& position,
SpaceIndex direction);
}
Python Synopsis
from ooflib.SWIG.engine.field import TwoVectorField
class TwoVectorField(CompoundField):def __init__(self, name)def getIndex(self, name)
Description
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.3). The constructor has a
single argument, which is the name of the Field.
Because TwoVectorField is a CompoundField,
when it is constructed its out-of-plane and time
derivative parts will be constructed automatically. The
out-of-plane part of a TwoVectorField
field is a ThreeVectorField, the three
dimensional gradient of its z component.
It is not necessary to keep an explicit reference to a newly
constructed TwoVectorField. Existing
fields may be retrieved with getField.
The FieldIndex class for TwoVectorField
is VectorFieldIndex. The
Components class is VectorFieldComponents,
and the ComponentIterator is VectorFieldIterator.
Methods
FieldIndex *getIndex(const std::string &name) const
TwoVectorField::getIndex() returns a pointer to a
VectorFieldIndex.
The name argument can be
"x" or "y".
DoubleVec values(...) const
DoubleVec values(const FEMesh* mesh, const Element* element, const MasterPosition& point) const;
values() is a non-virtual method that
returns all (that is, both) components of a
TwoVectorField in a vector at the given
point within the given
element.
To retrieve Field values from a generic Field*
pointer, either cast the pointer to the derived type and call
values():
DoubleVec vals = dynamic_cast<const TwoVectorField*>(field)->values(mesh, element, point);
or access the components individually via the Field base
class methods:
DoubleVec vals(field->ndof()); for(IndexP i : *field->components()) vals[i.integer()] = field->value(mesh, element, point, i);
DoubleVec gradients(...) const
DoubleVec gradients(const FEMesh* mesh, const Element* element, const MasterPosition& point, SpaceIndex direction) const;
gradients() is just like values(),
but it returns the components of the gradients in the given
direction. That is, gradients(mesh,
element, x, j) returns a vector whose
component
is the -derivative of the
component
of the TwoVectorField.



