# CompScienceMeshes.jl

Meshes, charts, and differential geometry for finite and boundary element solvers.

## Installation

In addition to the dependencies declared in REQUIRE, this package relies for some of its functionality on `gmsh`

. Make sure `gmsh`

is installed and on the system path if you require this functionality.

## Introduction

This package provides the geometric framework to facilitated the construction of finite element spaces and the assembly of matrices stemming from the discretisation of local (differential) and global (integral) operators on those finite element spaces.

The package roughly contains three components:

Meshes: allowing for the (almost) linear construction of connectivity matrices. A default implementation is provided but the algorithms should be easily extendable to user defined mesh structures. It is very common, for example, that mesh data structures contain problem specific information (local elasticity, permittivity, boundary conditions). User can use those enriched structures if they extend a limited number of functions.

Charts: a concept designed after the differential geometric concept of a chart on a manifold. It allows for the construction of points in Euclidian space from a set of parameters and the other way around.

Neighborhoods: a concept designed after the derivative of a chart as a map from the parametrising vector space to the tangent space of a point of the manifold. It allows querying for tangents, normal, and the Jacobian determinant for use in integration routines.

## Mesh Interface

This package introduces a minimalistic mesh interface and a standard implementation `CompScienceMeshes.Mesh`

. The interface is defined by the semantics of the following functions:

### Functions to query a mesh for its characteristics

`CompScienceMeshes.dimension`

— Method`dim = dimension(mesh)`

Returns the dimension of the mesh. Note that this is the dimension of the cells, not of the surrounding space.

`dimension(simplex)`

Return the manifold dimension of the simplex.

`CompScienceMeshes.universedimension`

— Method`universedimension(mesh)`

Returns the dimension of the surrounding space. Equals the number of coordinates required to describe a vertex.

`CompScienceMeshes.vertextype`

— Function`vt = vertextype(mesh)`

Returns type of the vertices used to define the cells of the mesh.

`CompScienceMeshes.coordtype`

— Method`coordtype(mesh)`

Returns `eltype(vertextype(mesh))`

`coordtype(simplex)`

Return coordinate type used by simplex.

`CompScienceMeshes.numvertices`

— Function`numvertices(mesh)`

Returns the number of vertices in the mesh.

*Note*: this is the number of vertices in the vertex buffer and might include floatin vertices or vertices not appearing in any cell. In other words the following is not necessarily true:

` numvertices(mesh) == numcells(skeleton(mesh,0))`

`CompScienceMeshes.numcells`

— Function`numcells(mesh)`

Returns the number of cells in the mesh.

### Functions to iterate over the mesh' cells and the underlying point set

`CompScienceMeshes.vertices`

— Function`vertices(mesh)`

Returns an indexable iterable to the vertices of the mesh

`CompScienceMeshes.cells`

— Function`cells(mesh)`

Return an iterable collection containing the cells making up the mesh.

### Functions to retrieve adjacency information about the mesh

`CompScienceMeshes.skeleton`

— Function`skeleton(mesh, dim)`

Returns a mesh comprising the `dim`

-dimensional sub cells of `mesh`

. For example to retrieve the edges of a given surface `mesh`

,

`edges = skelton(mesh, 1)`

`skeleton(pred, mesh, dim)`

Like `skeleton(mesh, dim)`

, but only cells for which `pred(cell)`

returns true are withheld.

`CompScienceMeshes.connectivity`

— Function`connectivity(faces, cells, op=sign)`

Create a sparse matrix `D`

of size `numcells(cells)`

by `numcells(faces)`

that contiains the connectivity info of the mesh. In particular `D[m,k]`

is `op(r)`

where `r`

is the local index of face `k`

in cell `m`

. The sign of `r`

is positive or negative depending on the relative orientation of face `k`

in cell `m`

.

For `op=sign`

, the matrix returned is the classic connectivity matrix, i.e. the graph version of the exterior derivative.