# Standalone libCEED

The following two examples have no dependencies, and are designed to be self-contained.
For additional examples that use external discretization libraries (MFEM, PETSc, Nek5000
etc.) see the subdirectories in `examples/`

.

## Ex1-Volume

This example is located in the subdirectory `examples/ceed`

. It illustrates a
simple usage of libCEED to compute the volume of a given body using a matrix-free
application of the mass operator. Arbitrary mesh and solution orders in 1D, 2D, and 3D
are supported from the same code.

This example shows how to compute line/surface/volume integrals of a 1D, 2D, or 3D domain \(\Omega\) respectively, by applying the mass operator to a vector of \(1\)s. It computes:

Using the same notation as in Theoretical Framework, we write here the vector \(u(x)\equiv 1\) in the Galerkin approximation, and find the volume of \(\Omega\) as

with \(v(x) \in \mathcal{V}_p = \{ v \in H^{1}(\Omega_e) \,|\, v \in P_p(\bm{I}), e=1,\ldots,N_e \}\), the test functions.

## Ex2-Surface

This example is located in the subdirectory `examples/ceed`

. It computes the
surface area of a given body using matrix-free application of a diffusion operator.
Similar to Ex1-Volume, arbitrary mesh and solution orders in 1D, 2D, and 3D
are supported from the same code. It computes:

by applying the divergence theorem. In particular, we select \(u(\bm x) = x_0 + x_1 + x_2\), for which \(\nabla u = [1, 1, 1]^T\), and thus \(\nabla u \cdot \hat{\bm n} = 1\).

Given Laplace’s equation,

let us multiply by a test function \(v\) and integrate by parts to obtain

Since we have chosen \(u\) such that \(\nabla u \cdot \hat{\bm n} = 1\), the boundary integrand is \(v 1 \equiv v\). Hence, similar to (3), we can evaluate the surface integral by applying the volumetric Laplacian as follows