# Tests of the scuff-em core library

The `libscuff`

unit of the scuff-em test suite
tests several elemental calculations implemented by `libscuff`

routines
for assembling and post-processing the linear SIE system.

## SIE matrix elements: Singular and non-singular 4-dimensional integrals

This subunit tests `libscuff`

routines for computing element of the SIE
system matrix, which involve singular and nonsingular 4-dimensional
integrals over pairs of triangular panels.

### SIE matrix elements in scuff-em

First we review the computation of SIE matrix elements in scuff-em.

#### Matrix elements

In the most general case, each pair of RWG basis functions contributes a block of entries to the system matrix:

where runs over the indices of the (zero, one, or two) regions through which the basis functions interact, are the material properties and wavevector magnitude in region , and are the homogeneous dyadic Green's functions of Maxwell's equations.

If one or both basis functions lie on PEC surfaces then reduces to a , , or matrix.

#### Edge-edge interactions

Matrix elements of the and operators are 4-dimensional integrals over the supports of the basis functions that may be written in terms of the scalar Greens' function:

with

#### Panel-panel interactions

Each edge-edge integral is a sum of 4 panel-panel integrals, e.g.

(This is for the general case in which both basis functions are *full*
RWG basis functions; if one or both are *half*-RWG functions then the
number of contributing panel pairs reduces to 2 or 1.)

The panel-panel integrals are

#### Desingularization

For pairs of basis functions with 1 or more common vertices I desingularize by subtracting off the first 3 nonvanishing terms in the small- series for and and integrating these terms separately. Thus I put

and e.g.

### Reference values

As reference values for testing `libscuff`

routines for evaluating RWG integrals, I consider matrix elements between
RWG functions on the following surface mesh, in which the triangles are sufficiently regular that it's
easy to write down and evaluate the required 4-dimensional integrals.

For example, the positive-positive-panel contribution to reads

Parameterize the integral according to

to yield an integral over the unit 4-dimensional hypercube: