# OOF2: The Manual

## Name

ElementShapeFuncIterator — Base class for other Node iterators

## Synopses

### C++ Synopsis

#include "engine/elementnodeiterator.h"

class ElementShapeFuncIterator: , public ElementNodeIterator {`virtual double shapefunction(const MasterPosition& position) const = 0;`

`virtual double dshapefunction(SpaceIndex derivative,`

const MasterPosition& position) const = 0;`virtual double masterderiv(SpaceIndex derivative,`

const MasterPosition& position) const = 0;

}

### Python Synopsis

from oof2.SWIG.engine import elementnodeiterator

class ElementShapeFuncIterator(ElementNodeIterator):`def shapefunction(self, position)`

`def dshapefunction(self, derivative, position)`

## Description

`ElementShapeFuncIterator`

is derived
from `ElementNodeIterator`

and serves as an abstract base class for `ElementMapNodeIterator`

,
`ElementFuncNodeIterator`

,
and `EdgeNodeIterator`

, and as such
should never be used explicitly.

`ElementShapeFuncIterator`

provides an
API for looping over `Nodes`

with
associated shape
functions, and for evaluating those functions.

## Methods

See `ElementNodeIterator`

for the functions defined in the base class. This section
only lists the new methods introduced in
`ElementShapeFuncIterator`

.

`double shapefunction(const MasterPosition& position)`

Each `Element`

's
shapefunctions are zero at all but one of the
`Element`

's `FuncNode`

s.
By pairing shape functions with the nodes at which they're
non-zero, a node iterator can identify a shape function as
well as a `FuncNode`

.
`ElementFuncNodeIterator::shapefunction`

evaluates the iterator's shape function at the master space coordinate
given by `position`

.

```
double dshapefunction(SpaceIndex derivative,
const MasterPosition& position) const
```

`dshapefunction`

is just like `shapefunction`

,
but it returns the value of the specified
`derivative`

of the shape function. The
`SpaceIndex`

takes the value
`0`

for *x* and
`1`

for
*y*.^{[66]}

```
double masterderiv(SpaceIndex derivative, const
MasterPosition& position) const
```

`masterderiv`

is just like `dshapefunction`

,
except that it computes the derivative in master coordinate space,
instead of physical space. This is cheaper to compute, but
usually less useful.