# Vector representation¶

In GooseFEM there are three ways to represent vectors. In particular, a vector field (e.g. the displacement) can be collected:

- per node (denoted “nodevec”, see below),
- per degree-of-freedom (denoted “dofval”, see below),
- per element (denoted “elemvec”, see below).

Warning

Watch out with the conversion from one representation to the other as downsizing can be done in more than one way, see Conversion.

Consider a simple two-dimensional mesh of just two elements, and a displacement vector per node:

## Collected per node (nodevec)¶

## Collected per degree-of-freedom (dofval)¶

The following definition

gives:

Whereby “dofs” can be used to:

**Reorder**“u” such that is can be easily (even directly) partitioned. For example, consider that all -coordinates are*Prescribed*and all -coordinates are*Unknown*. In particular,gives

which allows

**Eliminate**dependent nodes. For example, suppose that the displacement of all top nodes is equal to that of the bottom nodes. In this one could:

Note

Vector applies the reordering itself. One does not need to change “dofs”, but one simply supplies “iip”.

## Collected per element (elemvec)¶

For this example:

The storage per node proceeds in

In particular:

and

## Conversion¶

Conversion to a larger representation (upsizing) can always be done uniquely, however, conversion to a more compact representation (downsizing) can be done in two ways. In particular:

From | To | Function | Remarks |
---|---|---|---|

dofval | nodevec | asNode(…) | unique |

dofval | elemvec | asElement(…) | unique |

nodevec | elemvec | asElement(…) | unique |

nodevec | dofval | asDofs(…) | overwrites reoccurring items |

elemvec | dofval | asDofs(…) | overwrites reoccurring items |

elemvec | nodevec | asNode(…) | overwrites reoccurring items |

nodevec | dofval | assembleDofs(…) | adds reoccurring items |

elemvec | dofval | assembleDofs(…) | adds reoccurring items |

elemvec | nodevec | assembleNode(…) | adds reoccurring items |