D06DAF (PDF version)
D06 Chapter Contents
D06 Chapter Introduction
NAG Library Manual

NAG Library Routine Document

D06DAF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

 Contents

    1  Purpose
    7  Accuracy
    10  Example

1  Purpose

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

2  Specification

SUBROUTINE D06DAF ( NV, NEDGE, NELT, NTRANS, ITYPE, TRANS, COORI, EDGEI, CONNI, COORO, EDGEO, CONNO, ITRACE, RWORK, LRWORK, IFAIL)
INTEGER  NV, NEDGE, NELT, NTRANS, ITYPE(NTRANS), EDGEI(3,NEDGE), CONNI(3,NELT), EDGEO(3,NEDGE), CONNO(3,NELT), ITRACE, LRWORK, IFAIL
REAL (KIND=nag_wp)  TRANS(6,NTRANS), COORI(2,NV), COORO(2,NV), RWORK(LRWORK)

3  Description

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
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).

4  References

None.

5  Parameters

1:     NV – INTEGERInput
On entry: the total number of vertices in the input mesh.
Constraint: NV3.
2:     NEDGE – INTEGERInput
On entry: the number of the boundary or interface edges in the input mesh.
Constraint: NEDGE1.
3:     NELT – INTEGERInput
On entry: the number of triangles in the input mesh.
Constraint: NELT2×NV-1.
4:     NTRANS – INTEGERInput
On entry: the number of transformations of the input mesh.
Constraint: NTRANS1.
5:     ITYPENTRANS – INTEGER arrayInput
On entry: ITYPEi, for i=1,2,,NTRANS, indicates the type of each transformation as follows:
ITYPEi=0
Identity transformation.
ITYPEi=1
Translation.
ITYPEi=2
Symmetric transformation with respect to a user-supplied line.
ITYPEi=3
Rotation.
ITYPEi=4
Scaling.
ITYPEi=10
User-supplied analytic transformation.
Note that the transformations are applied in the order described in ITYPE.
Constraint: ITYPEi=0, 1, 2, 3, 4 or 10, for i=1,2,,NTRANS.
6:     TRANS6NTRANS – REAL (KIND=nag_wp) arrayInput
On entry: the parameters for each transformation. For i=1,2,,NTRANS, TRANS1i to TRANS6i contain the parameters of the ith transformation.
If ITYPEi=0, elements TRANS1i to TRANS6i are not referenced.
If ITYPEi=1, the translation vector is u= a b , where a=TRANS1i and b=TRANS2i, while elements TRANS3i to TRANS6i are not referenced.
If ITYPEi=2, the user-supplied line is the curve {x,y2; such that ax+by+c=0}, where a=TRANS1i, b=TRANS2i and c=TRANS3i, while elements TRANS4i to TRANS6i are not referenced.
If ITYPEi=3, the centre of the rotation is x0,y0 where x0=TRANS1i and y0=TRANS2i, θ=TRANS3i is its angle in degrees, while elements TRANS4i to TRANS6i are not referenced.
If ITYPEi=4, a=TRANS1i is the scaling coefficient in the x-direction, b=TRANS2i is the scaling coefficient in the y-direction, and x0,y0 are the scaling centre coordinates, with x0=TRANS3i and y0=TRANS4i; while elements TRANS5i to TRANS6i are not referenced.
If ITYPEi=10, the user-supplied analytic affine transformation Y=A×X+B is such that A=akl1k,l2 and B=bk1k2 whereakl=TRANS2×k-1+li, and bk=TRANS4+ki with k,l=1,2.
7:     COORI2NV – REAL (KIND=nag_wp) arrayInput/Output
On entry: COORI1i contains the x coordinate of the ith vertex of the input mesh, for i=1,2,,NV; while COORI2i contains the corresponding y coordinate.
On exit: see Section 9.
8:     EDGEI3NEDGE – INTEGER arrayInput/Output
On entry: the specification of the boundary or interface edges. EDGEI1j and EDGEI2j contain the vertex numbers of the two end points of the jth boundary edge. EDGEI3j is a user-supplied tag for the jth boundary edge.
Constraint: 1EDGEIijNV and EDGEI1jEDGEI2j, for i=1,2 and j=1,2,,NEDGE.
On exit: see Section 9.
9:     CONNI3NELT – INTEGER arrayInput/Output
On entry: the connectivity of the input mesh between triangles and vertices. For each triangle j, CONNIij gives the indices of its three vertices (in anticlockwise order), for i=1,2,3 and j=1,2,,NELT.
Constraints:
  • 1CONNIijNV;
  • CONNI1jCONNI2j;
  • CONNI1jCONNI3j and CONNI2jCONNI3j, for i=1,2,3 and j=1,2,,NELT.
On exit: see Section 9.
10:   COORO2NV – REAL (KIND=nag_wp) arrayOutput
On exit: COORO1i will contain the x coordinate of the ith vertex of the transformed mesh, for i=1,2,,NV; while COORO2i will contain the corresponding y coordinate.
11:   EDGEO3NEDGE – INTEGER arrayOutput
On exit: the specification of the boundary or interface edges of the transformed mesh. If the number of symmetric transformations is even or zero thenEDGEOij=EDGEIij, for i=1,2,3 and j=1,2,,NEDGE; otherwise EDGEO1j=EDGEI2j,EDGEO2j=EDGEI1j and EDGEO3j=EDGEI3j, for j=1,2,,NEDGE.
12:   CONNO3NELT – INTEGER arrayOutput
On exit: the connectivity of the transformed mesh between triangles and vertices. If the number of symmetric transformations is even or zero thenCONNOij=CONNIij, for i=1,2,3 and j=1,2,,NELT; otherwise CONNO1j=CONNI1j, CONNO2j=CONNI3j and CONNO3j=CONNI2j, for j=1,2,,NELT.
13:   ITRACE – INTEGERInput
On entry: the level of trace information required from D06DAF.
ITRACE0
No output is generated.
ITRACE1
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:   RWORKLRWORK – REAL (KIND=nag_wp) arrayWorkspace
15:   LRWORK – INTEGERInput
On entry: the dimension of the array RWORK as declared in the (sub)program from which D06DAF is called.
Constraint: LRWORK12×NTRANS.
16:   IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to 0, -1​ or ​1. If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value -1​ or ​1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is 0. When the value -1​ or ​1 is used it is essential to test the value of IFAIL on exit.
On exit: IFAIL=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6  Error Indicators and Warnings

If on entry 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:
IFAIL=1
On entry,NV<3;
orNELT>2×NV-1;
orNEDGE<1;
orEDGEIij<1 or EDGEIij>NV for some i=1,2 and j=1,2,,NEDGE;
orEDGEI1j=EDGEI2j for some j=1,2,,NEDGE;
orCONNIij<1 or CONNIij>NV for some i=1,2,3 and j=1,2,,NELT;
orCONNI1j=CONNI2j or CONNI1j=CONNI3j or
CONNI2j=CONNI3j for some j=1,2,,NELT;
orNTRANS<1;
orITYPEi0, 1, 2, 3, 4 or 10 for some i=1,2,,NTRANS;
orLRWORK<12×NTRANS.
IFAIL=2
A serious error has occurred in an internal call to an auxiliary routine. Check the input mesh especially the triangles/vertices and the edges/vertices connectivities as well as the details of each transformations.
IFAIL=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 3.8 in the Essential Introduction for further information.
IFAIL=-399
Your licence key may have expired or may not have been installed correctly.
See Section 3.7 in the Essential Introduction for further information.
IFAIL=-999
Dynamic memory allocation failed.
See Section 3.6 in the Essential Introduction for further information.

7  Accuracy

Not applicable.

8  Parallelism and Performance

D06DAF is not threaded by NAG in any implementation.
D06DAF makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

9  Further Comments

You may not wish to save the input mesh (COORI, EDGEI and CONNI) and could call D06DAF using the same parameters for the input and the output (transformed) mesh.

10  Example

For an example of the use of this utility routine, see Section 10 in D06DBF.

D06DAF (PDF version)
D06 Chapter Contents
D06 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2015