6  Subroutine RIM3

C      SUBROUTINE RIM3(K,
C     *                 MAXNV,NV,VERTEX,MAXNPI,NPI,SELV,
C     *                 MAXNPE,NPE,PEXT,
C     *                 PIALPHA,PIBETA,PIF,
C     *                 LSOL,LVALID,EGEOM,
C     *                 PIPHI,PIVEL,PEPHI,
C     *                 WKSPC1,WKSPC2,WKSPC3,WKSPC4,WKSPC5,WKSPC6)

C The parameters to the subroutine
C ================================

C Wavenumber (input)
C real K: Must be positive.

C Geometry of the plate {\Pi} (input)
C integer MAXNV: The limit on the number of vertices of the triangles
C  that defines (approximates) {\Pi}. MAXNV>=3.
C integer NV: The number of vertices on {\Pi}. 3<=NV<=MAXNV.
C real VERTEX(MAXNV,3): The coordinates of the vertices. VERTEX(i,1),
C  VERTEX(i,2), VERTEX(i,3) are the x,y,z coordinates of the i-th 
C  vertex. The vertices must be co-planar.
C integer MAXNPI: The limit on the number of elements describing {\Pi}.
C  MAXNPI>=1.
C integer NPI: The number of elements describing {\Pi}. 1<=NPI<=MAXNPI.
C integer SELV(MAXNPI,3): The indices of the three vertices defining
C  each element. The i-th element have vertices 
C  (VERTEX(SELV(i,1),1),VERTEX(SELV(i,1),2)),VERTEX(SELV(i,1),3)),
C  (VERTEX(SELV(i,2),1),VERTEX(SELV(i,2),2)),VERTEX(SELV(i,2),3)) and
C  (VERTEX(SELV(i,3),1),VERTEX(SELV(i,3),2)),VERTEX(SELV(i,3),3)).

C Exterior points at which the solution is to be observed (input)
C integer MAXNPE: Limit on the number of points exterior to the
C  plate. MAXNPE>=1.
C integer NPE: The number of exterior points. 0<=NPE<=MAXNPE.
C real PEXT(MAXNPE,3). The coordinates of the exterior point.
C  PEXT(i,1),PEXT(i,2),PEXT(i,3) are the x,y,z coordinates of the i-th
C  point. 

C The plate condition ({\alpha} phi + {\beta} v = f) (input)
C complex PIALPHA(MAXNPI): The values of {\alpha} at the centres
C  of the elements.
C complex PIBETA(MAXNPI): The values of {\beta} at the centres
C  of the elements.
C complex PIF(MAXNPI): The values of f at the centres of the 
C  elements.

C Validation and control parameters (input) 
C logical LSOL: A switch to control whether the particular solution is
C  required.
C logical LVALID: A switch to enable the choice of checking of 
C  subroutine parameters.
C real EGEOM: The maximum absolute error in the parameters that
C  describe the geometry.

C Solution (output)
C complex PIPHI(MAXNPI): The velocity potential ({\phi}) at the 
C  centres of the plate elements.
C complex PIVEL(MAXNPI): The velocity (v or d{\phi}/dn where n is
C  the outward normal to the plate) at the centres of the plate 
C  elements.
C complex PEPHI(MAXNPE): The velocity potential ({\phi}) at the 
C  exterior points.

C  Working space 
C      COMPLEX*16 WKSPC1(MAXNPI,MAXNPI)
C      COMPLEX*16 WKSPC2(MAXNPE,MAXNPI)
C      COMPLEX*16 WKSPC3(MAXNPI,MAXNPI)
C      COMPLEX*16 WKSPC4(MAXNPI)
C      COMPLEX*16 WKSPC5(MAXNPI)
C      LOGICAL    WKSPC6(MAXNPI)