# NAG FL Interfaced06daf (dim2_​transform_​affine)

## ▸▿ Contents

Settings help

FL Name Style:

FL Specification Language:

## 1Purpose

d06daf is a utility which performs an affine transformation of a given mesh.

## 2Specification

Fortran Interface
 Subroutine d06daf ( nv, nelt,
 Integer, Intent (In) :: nv, nedge, nelt, ntrans, itype(ntrans), itrace, lrwork Integer, Intent (Inout) :: edgei(3,nedge), conni(3,nelt), ifail Integer, Intent (Out) :: edgeo(3,nedge), conno(3,nelt) Real (Kind=nag_wp), Intent (In) :: trans(6,ntrans) Real (Kind=nag_wp), Intent (Inout) :: coori(2,nv) Real (Kind=nag_wp), Intent (Out) :: cooro(2,nv), rwork(lrwork)
C Header Interface
#include <nag.h>
 void d06daf_ (const Integer *nv, const Integer *nedge, const Integer *nelt, const Integer *ntrans, const Integer itype[], const double trans[], double coori[], Integer edgei[], Integer conni[], double cooro[], Integer edgeo[], Integer conno[], const Integer *itrace, double rwork[], const Integer *lrwork, Integer *ifail)
The routine may be called by the names d06daf or nagf_mesh_dim2_transform_affine.

## 3Description

d06daf generates a mesh (coordinates, triangle/vertex connectivities and edge/vertex connectivities) resulting from an affine transformation of a given mesh. This transformation is of the form $Y=A×X+B$, where
• $Y$, $X$ and $B$ are in ${ℝ}^{2}$, and
• $A$ is a real $2×2$ matrix.
Such a transformation includes a translation, a rotation, a scale reduction or increase, a symmetric transformation with respect to a user-supplied line, a user-supplied analytic transformation, or a composition of several transformations.
This routine is partly derived from material in the MODULEF package from INRIA (Institut National de Recherche en Informatique et Automatique).

None.

## 5Arguments

1: $\mathbf{nv}$Integer Input
On entry: the total number of vertices in the input mesh.
Constraint: ${\mathbf{nv}}\ge 3$.
2: $\mathbf{nedge}$Integer Input
On entry: the number of the boundary or interface edges in the input mesh.
Constraint: ${\mathbf{nedge}}\ge 1$.
3: $\mathbf{nelt}$Integer Input
On entry: the number of triangles in the input mesh.
Constraint: ${\mathbf{nelt}}\le 2×{\mathbf{nv}}-1$.
4: $\mathbf{ntrans}$Integer Input
On entry: the number of transformations of the input mesh.
Constraint: ${\mathbf{ntrans}}\ge 1$.
5: $\mathbf{itype}\left({\mathbf{ntrans}}\right)$Integer array Input
On entry: ${\mathbf{itype}}\left(\mathit{i}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{ntrans}}$, indicates the type of each transformation as follows:
${\mathbf{itype}}\left(i\right)=0$
Identity transformation.
${\mathbf{itype}}\left(i\right)=1$
Translation.
${\mathbf{itype}}\left(i\right)=2$
Symmetric transformation with respect to a user-supplied line.
${\mathbf{itype}}\left(i\right)=3$
Rotation.
${\mathbf{itype}}\left(i\right)=4$
Scaling.
${\mathbf{itype}}\left(i\right)=10$
User-supplied analytic transformation.
Note that the transformations are applied in the order described in itype.
Constraint: ${\mathbf{itype}}\left(\mathit{i}\right)=0$, $1$, $2$, $3$, $4$ or $10$, for $\mathit{i}=1,2,\dots ,{\mathbf{ntrans}}$.
6: $\mathbf{trans}\left(6,{\mathbf{ntrans}}\right)$Real (Kind=nag_wp) array Input
On entry: the arguments for each transformation. For $i=1,2,\dots ,{\mathbf{ntrans}}$, ${\mathbf{trans}}\left(1,i\right)$ to ${\mathbf{trans}}\left(6,i\right)$ contain the arguments of the $i$th transformation.
If ${\mathbf{itype}}\left(i\right)=0$, elements ${\mathbf{trans}}\left(1,i\right)$ to ${\mathbf{trans}}\left(6,i\right)$ are not referenced.
If ${\mathbf{itype}}\left(i\right)=1$, the translation vector is $\stackrel{\to }{u}=\left(\begin{array}{c}a\\ b\end{array}\right)$, where $a={\mathbf{trans}}\left(1,i\right)$ and $b={\mathbf{trans}}\left(2,i\right)$, while elements ${\mathbf{trans}}\left(3,i\right)$ to ${\mathbf{trans}}\left(6,i\right)$ are not referenced.
If ${\mathbf{itype}}\left(i\right)=2$, the user-supplied line is the curve {$\left(x,y\right)\in {ℝ}^{2}$; such that $ax+by+c=0$}, where $a={\mathbf{trans}}\left(1,i\right)$, $b={\mathbf{trans}}\left(2,i\right)$ and $c={\mathbf{trans}}\left(3,i\right)$, while elements ${\mathbf{trans}}\left(4,i\right)$ to ${\mathbf{trans}}\left(6,i\right)$ are not referenced.
If ${\mathbf{itype}}\left(i\right)=3$, the centre of the rotation is $\left({x}_{0},{y}_{0}\right)$ where ${x}_{0}={\mathbf{trans}}\left(1,i\right)$ and ${y}_{0}={\mathbf{trans}}\left(2,i\right)$, $\theta ={\mathbf{trans}}\left(3,i\right)$ is its angle in degrees, while elements ${\mathbf{trans}}\left(4,i\right)$ to ${\mathbf{trans}}\left(6,i\right)$ are not referenced.
If ${\mathbf{itype}}\left(i\right)=4$, $a={\mathbf{trans}}\left(1,i\right)$ is the scaling coefficient in the $x$-direction, $b={\mathbf{trans}}\left(2,i\right)$ is the scaling coefficient in the $y$-direction, and $\left({x}_{0},{y}_{0}\right)$ are the scaling centre coordinates, with ${x}_{0}={\mathbf{trans}}\left(3,i\right)$ and ${y}_{0}={\mathbf{trans}}\left(4,i\right)$; while elements ${\mathbf{trans}}\left(5,i\right)$ to ${\mathbf{trans}}\left(6,i\right)$ are not referenced.
If ${\mathbf{itype}}\left(i\right)=10$, the user-supplied analytic affine transformation $Y=A×X+B$ is such that $A={\left({a}_{kl}\right)}_{1\le k,l\le 2}$ and $B={\left({b}_{k}\right)}_{1\le k\le 2}$ where${a}_{kl}={\mathbf{trans}}\left(2×\left(k-1\right)+l,i\right)$, and ${b}_{k}={\mathbf{trans}}\left(4+k,i\right)$ with $k,l=1,2$.
7: $\mathbf{coori}\left(2,{\mathbf{nv}}\right)$Real (Kind=nag_wp) array Input/Output
On entry: ${\mathbf{coori}}\left(1,\mathit{i}\right)$ contains the $x$ coordinate of the $\mathit{i}$th vertex of the input mesh, for $\mathit{i}=1,2,\dots ,{\mathbf{nv}}$; while ${\mathbf{coori}}\left(2,i\right)$ contains the corresponding $y$ coordinate.
On exit: see Section 9.
8: $\mathbf{edgei}\left(3,{\mathbf{nedge}}\right)$Integer array Input/Output
On entry: the specification of the boundary or interface edges. ${\mathbf{edgei}}\left(1,j\right)$ and ${\mathbf{edgei}}\left(2,j\right)$ contain the vertex numbers of the two end points of the $j$th boundary edge. ${\mathbf{edgei}}\left(3,j\right)$ is a user-supplied tag for the $j$th boundary edge.
Constraint: $1\le {\mathbf{edgei}}\left(\mathit{i},\mathit{j}\right)\le {\mathbf{nv}}$ and ${\mathbf{edgei}}\left(1,\mathit{j}\right)\ne {\mathbf{edgei}}\left(2,\mathit{j}\right)$, for $\mathit{i}=1,2$ and $\mathit{j}=1,2,\dots ,{\mathbf{nedge}}$.
On exit: see Section 9.
9: $\mathbf{conni}\left(3,{\mathbf{nelt}}\right)$Integer array Input/Output
On entry: the connectivity of the input mesh between triangles and vertices. For each triangle $\mathit{j}$, ${\mathbf{conni}}\left(\mathit{i},\mathit{j}\right)$ gives the indices of its three vertices (in anticlockwise order), for $\mathit{i}=1,2,3$ and $\mathit{j}=1,2,\dots ,{\mathbf{nelt}}$.
Constraints:
• $1\le {\mathbf{conni}}\left(i,j\right)\le {\mathbf{nv}}$;
• ${\mathbf{conni}}\left(1,j\right)\ne {\mathbf{conni}}\left(2,j\right)$;
• ${\mathbf{conni}}\left(1,\mathit{j}\right)\ne {\mathbf{conni}}\left(3,\mathit{j}\right)$ and ${\mathbf{conni}}\left(2,\mathit{j}\right)\ne {\mathbf{conni}}\left(3,\mathit{j}\right)$, for $\mathit{i}=1,2,3$ and $\mathit{j}=1,2,\dots ,{\mathbf{nelt}}$.
On exit: see Section 9.
10: $\mathbf{cooro}\left(2,{\mathbf{nv}}\right)$Real (Kind=nag_wp) array Output
On exit: ${\mathbf{cooro}}\left(1,\mathit{i}\right)$ will contain the $x$ coordinate of the $\mathit{i}$th vertex of the transformed mesh, for $\mathit{i}=1,2,\dots ,{\mathbf{nv}}$; while ${\mathbf{cooro}}\left(2,i\right)$ will contain the corresponding $y$ coordinate.
11: $\mathbf{edgeo}\left(3,{\mathbf{nedge}}\right)$Integer array Output
On exit: the specification of the boundary or interface edges of the transformed mesh. If the number of symmetric transformations is even or zero then${\mathbf{edgeo}}\left(\mathit{i},\mathit{j}\right)={\mathbf{edgei}}\left(\mathit{i},\mathit{j}\right)$, for $\mathit{i}=1,2,3$ and $\mathit{j}=1,2,\dots ,{\mathbf{nedge}}$; otherwise ${\mathbf{edgeo}}\left(1,\mathit{j}\right)={\mathbf{edgei}}\left(2,\mathit{j}\right)$,${\mathbf{edgeo}}\left(2,\mathit{j}\right)={\mathbf{edgei}}\left(1,\mathit{j}\right)$ and ${\mathbf{edgeo}}\left(3,\mathit{j}\right)={\mathbf{edgei}}\left(3,\mathit{j}\right)$, for $\mathit{j}=1,2,\dots ,{\mathbf{nedge}}$.
12: $\mathbf{conno}\left(3,{\mathbf{nelt}}\right)$Integer array Output
On exit: the connectivity of the transformed mesh between triangles and vertices. If the number of symmetric transformations is even or zero then${\mathbf{conno}}\left(\mathit{i},\mathit{j}\right)={\mathbf{conni}}\left(\mathit{i},\mathit{j}\right)$, for $\mathit{i}=1,2,3$ and $\mathit{j}=1,2,\dots ,{\mathbf{nelt}}$; otherwise ${\mathbf{conno}}\left(1,\mathit{j}\right)={\mathbf{conni}}\left(1,\mathit{j}\right)$, ${\mathbf{conno}}\left(2,\mathit{j}\right)={\mathbf{conni}}\left(3,\mathit{j}\right)$ and ${\mathbf{conno}}\left(3,\mathit{j}\right)={\mathbf{conni}}\left(2,\mathit{j}\right)$, for $\mathit{j}=1,2,\dots ,{\mathbf{nelt}}$.
13: $\mathbf{itrace}$Integer Input
On entry: the level of trace information required from d06daf.
${\mathbf{itrace}}\le 0$
No output is generated.
${\mathbf{itrace}}\ge 1$
Details of each transformation, the matrix $A$ and the vector $B$ of the final transformation, which is the composition of all the ntrans transformations, are printed on the current advisory message unit (see x04abf).
14: $\mathbf{rwork}\left({\mathbf{lrwork}}\right)$Real (Kind=nag_wp) array Workspace
15: $\mathbf{lrwork}$Integer Input
On entry: the dimension of the array rwork as declared in the (sub)program from which d06daf is called.
Constraint: ${\mathbf{lrwork}}\ge 12×{\mathbf{ntrans}}$.
16: $\mathbf{ifail}$Integer Input/Output
On entry: ifail must be set to $0$, $-1$ or $1$ to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of $0$ causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of $-1$ means that an error message is printed while a value of $1$ means that it is not.
If halting is not appropriate, the value $-1$ or $1$ is recommended. If message printing is undesirable, then the value $1$ is recommended. Otherwise, the value $0$ is recommended. When the value $-\mathbf{1}$ or $\mathbf{1}$ is used it is essential to test the value of ifail on exit.
On exit: ${\mathbf{ifail}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see Section 6).

## 6Error Indicators and Warnings

If on entry ${\mathbf{ifail}}=0$ or $-1$, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
${\mathbf{ifail}}=1$
On entry, ${\mathbf{conni}}\left(\mathit{I},\mathit{J}\right)=⟨\mathit{\text{value}}⟩$, $\mathit{I}=⟨\mathit{\text{value}}⟩$, $\mathit{J}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{nv}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{conni}}\left(\mathit{I},\mathit{J}\right)\ge 1$ and ${\mathbf{conni}}\left(\mathit{I},\mathit{J}\right)\le {\mathbf{nv}}$.
On entry, ${\mathbf{edgei}}\left(\mathit{I},\mathit{J}\right)=⟨\mathit{\text{value}}⟩$, $\mathit{I}=⟨\mathit{\text{value}}⟩$, $\mathit{J}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{nv}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{edgei}}\left(\mathit{I},\mathit{J}\right)\ge 1$ and ${\mathbf{edgei}}\left(\mathit{I},\mathit{J}\right)\le {\mathbf{nv}}$.
On entry, ${\mathbf{itype}}\left(\mathit{I}\right)=⟨\mathit{\text{value}}⟩$ and $\mathit{I}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{itype}}\left(\mathit{I}\right)=0$, $1$, $2$, $3$, $4$ or $10$.
On entry, ${\mathbf{lrwork}}=⟨\mathit{\text{value}}⟩$ and $\mathrm{LRWKMN}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{lrwork}}\ge \mathrm{LRWKMN}$.
On entry, ${\mathbf{nedge}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{nedge}}\ge 1$.
On entry, ${\mathbf{nelt}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{nv}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{nelt}}\le 2×{\mathbf{nv}}-1$.
On entry, ${\mathbf{ntrans}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{ntrans}}>0$.
On entry, ${\mathbf{nv}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{nv}}\ge 3$.
On entry, the end points of the edge $\mathit{J}$ have the same index $\mathit{I}$: $\mathit{J}=⟨\mathit{\text{value}}⟩$ and $\mathit{I}=⟨\mathit{\text{value}}⟩$.
On entry, vertices $1$ and $2$ of the triangle $\mathit{K}$ have the same index $\mathit{I}$: $\mathit{K}=⟨\mathit{\text{value}}⟩$ and $\mathit{I}=⟨\mathit{\text{value}}⟩$.
On entry, vertices $1$ and $3$ of the triangle $\mathit{K}$ have the same index $\mathit{I}$: $\mathit{K}=⟨\mathit{\text{value}}⟩$ and $\mathit{I}=⟨\mathit{\text{value}}⟩$.
On entry, vertices $2$ and $3$ of the triangle $\mathit{K}$ have the same index $\mathit{I}$: $\mathit{K}=⟨\mathit{\text{value}}⟩$ and $\mathit{I}=⟨\mathit{\text{value}}⟩$.
${\mathbf{ifail}}=2$
A serious error has occurred in an internal call to an auxiliary routine. Check the input mesh especially the connectivities and the details of each transformations.
${\mathbf{ifail}}=-99$
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-399$
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

Not applicable.

## 8Parallelism and Performance

Background information to multithreading can be found in the Multithreading documentation.
d06daf is not threaded in any implementation.

## 9Further Comments

You may not wish to save the input mesh (coori, edgei and conni) and could call d06daf using the same arguments for the input and the output (transformed) mesh.

## 10Example

For an example of the use of this utility routine, see d06dbf.