H2Lib  3.0
Data Structures | Typedefs | Functions
tri2p1

Piecewise linear space with nodal basis functions on a two-dimensional triangular mesh. More...

Data Structures

struct  _tri2dp1
 Representation of a trial space with piecewise linear nodal basis functions on a two-dimensional triangular mesh. More...
 

Typedefs

typedef struct _tri2dp1 tri2dp1
 Representation of a trial space with piecewise linear nodal basis functions on a two-dimensional triangular mesh.
 
typedef tri2dp1ptri2dp1
 Pointer to a tri2p1 object.
 
typedef const tri2dp1pctri2dp1
 Pointer to a constant tri2p1 object.
 

Functions

ptri2dp1 new_tri2dp1 (pctri2d gr)
 Create a tri2p1 object using a tri2d mesh. More...
 
void del_tri2dp1 (ptri2dp1 dc)
 Delete a tri2p1 object. More...
 
psparsematrix build_tri2dp1_sparsematrix (pctri2dp1 dc)
 Create a sparsematrix with a sparsity pattern matching the nodal basis functions representing the system matrix. More...
 
psparsematrix build_tri2dp1_interaction_sparsematrix (pctri2dp1 dc)
 Create a sparsematrix with a sparsity pattern matching the nodal basis functions representing the interaction matrix. More...
 
psparsematrix build_tri2dp1_prolongation_sparsematrix (pctri2dp1 dfine, pctri2dp1 dcoarse, pctri2dref rf)
 Create a prolongation matrix. More...
 
void assemble_tri2dp1_laplace_sparsematrix (pctri2dp1 dc, psparsematrix A, psparsematrix Af)
 Assemble stiffness matrix. More...
 
void assemble_tri2dp1_mass_sparsematrix (pctri2dp1 dc, psparsematrix M, psparsematrix Mf)
 Assemble mass matrix. More...
 
void assemble_tri2dp1_dirichlet_avector (pctri2dp1 dc, field(*d)(const real *x, void *fdata), void *fdata, pavector dv)
 Discretize Dirichlet boundary values. More...
 
void assemble_tri2dp1_functional_avector (ptri2dp1 dc, field(*f)(const real *x, void *fdata), void *fdata, pavector fv)
 Discretize an $L^2$-functional. More...
 
real normmax_tri2dp1 (pctri2dp1 dc, field(*u)(const real *x, void *fdata), void *fdata, pavector xs)
 Compute the vertex-wise maximum norm of the discretization error. More...
 
real norml2_tri2dp1 (pctri2dp1 dc, field(*f)(const real *x, void *fdata), void *fdata, pcavector xs, pcavector xf)
 Compute the $L^2$-norm of the discretization error. More...
 
pclustergeometry build_tri2dp1_clustergeometry (pctri2dp1 p1, uint *idx)
 Create a clustergeometry object for a FEM-discretisation with p1-functions. More...
 

Detailed Description

Piecewise linear space with nodal basis functions on a two-dimensional triangular mesh.

Function Documentation

void assemble_tri2dp1_dirichlet_avector ( pctri2dp1  dc,
field(*)(const real *x, void *fdata)  d,
void *  fdata,
pavector  dv 
)

Discretize Dirichlet boundary values.

For each fixed vertex, the function $f$ is evaluated and the result is written to the corresponding entry in the result. In the standard case, this provides us with a coefficient vector corresponding to the piecewise linear interpolation of the Dirichlet boundary values. Subtracting $A_f d$ from the right-hand side of our equation, where $A_f$ is the interaction matrix, yields the right-hand side of the problem with homogeneous Dirichlet boundary conditions.

Parameters
dctri2p1 object describing the trial space.
dDirichlet boundary values.
fdataAdditional data for f.
dvTarget vector of dimension dc->nfix.
void assemble_tri2dp1_functional_avector ( ptri2dp1  dc,
field(*)(const real *x, void *fdata)  f,
void *  fdata,
pavector  fv 
)

Discretize an $L^2$-functional.

For each triangle, the element vector is computed by applying the edge-midpoint quadrature. Its components are then added to the corresponding entries in $b$. Since $b$ is cleared before this step, the result is given by $b_i = \int f(x) \varphi_i(x) \,dx$.

Parameters
dctri2p1 object describing the trial space.
fRight-hand side function.
fdataAdditional data for f.
fvTarget vector of dimension dc->ndof.
void assemble_tri2dp1_laplace_sparsematrix ( pctri2dp1  dc,
psparsematrix  A,
psparsematrix  Af 
)

Assemble stiffness matrix.

Element matrices for all triangles are computed and added to the corresponding entries in A and Af.

Parameters
dctri2p1 object describing the trial space.
ATarget matrix for degrees of freedom.
AfTarget matrix for interactions between fixed vertices and degrees of freedom.
void assemble_tri2dp1_mass_sparsematrix ( pctri2dp1  dc,
psparsematrix  M,
psparsematrix  Mf 
)

Assemble mass matrix.

Element matrices for all triangles are computed and added to the corresponding entries in M and Mf.

Parameters
dctri2p1 object describing the trial space.
MTarget matrix for degrees of freedom.
MfTarget matrix for interactions between fixed vertices and degrees of freedom.
pclustergeometry build_tri2dp1_clustergeometry ( pctri2dp1  p1,
uint idx 
)

Create a clustergeometry object for a FEM-discretisation with p1-functions.

Create a clustergeometry object basing on a triangular tri2d mesh and linear nodal basis function.

Parameters
p1tri2dp1 object.
idxArray of indices.
Returns
Clustergeometry object.
psparsematrix build_tri2dp1_interaction_sparsematrix ( pctri2dp1  dc)

Create a sparsematrix with a sparsity pattern matching the nodal basis functions representing the interaction matrix.

Creates a sparse matrix matching the nodal basis functions: if the supports of basis functions $\varphi_i$ and $\varphi_j$ share at least one edge, the entry $a_{ij}$ appears in the graph of the matrix.

Here, only $i$ refers to a degree of freedom, while $j$ is the index of a fixed vertex, i.e., has to be between 0 and nfix-1.

Parameters
dctri2p1 object describing the space.
Returns
Sparse matrix with dc->ndof rows and dc->nfix columns.
psparsematrix build_tri2dp1_prolongation_sparsematrix ( pctri2dp1  dfine,
pctri2dp1  dcoarse,
pctri2dref  rf 
)

Create a prolongation matrix.

dcoarse and dfine have to correspond to a coarse mesh and its refinement created by refine_tri2d. The refinement relationship is described by rf.

This function not only creates the matrix, but also fills it with correct coefficients.

Parameters
dfinetri2p1 object corresponding to the refined mesh.
dcoarsetri2p1 object corresponding to the coarse mesh.
rfRefinement relationship.
Returns
sparsematrix containing the prolongation matrix.
psparsematrix build_tri2dp1_sparsematrix ( pctri2dp1  dc)

Create a sparsematrix with a sparsity pattern matching the nodal basis functions representing the system matrix.

Creates a sparse matrix matching the nodal basis functions: if the supports of basis functions $\varphi_i$ and $\varphi_j$ share at least one edge, the entry $a_{ij}$ appears in the graph of the matrix.

Here, both $i$ and $j$ refer to degrees of freedom, i.e., there indices are between 0 and ndof-1.

Parameters
dctri2p1 object describing the space.
Returns
Sparse matrix with dc->ndof rows and columns.
void del_tri2dp1 ( ptri2dp1  dc)

Delete a tri2p1 object.

Parameters
dcObject to be deleted.
ptri2dp1 new_tri2dp1 ( pctri2d  gr)

Create a tri2p1 object using a tri2d mesh.

The boundary flags gr->xb are used to decide whether a vertex corresponds to a degree of freedom or is fixed.

Parameters
grMesh
Returns
tri2p1 object matching gr.
real norml2_tri2dp1 ( pctri2dp1  dc,
field(*)(const real *x, void *fdata)  f,
void *  fdata,
pcavector  xs,
pcavector  xf 
)

Compute the $L^2$-norm of the discretization error.

Compare the function f to the discrete function described by the vector xs (for the degrees of freedom) and xf (for the fixed vertices). Measure the difference in the $L^2$-norm.

Parameters
dctri2p1 object describing the trial space.
fFunction.
fdataAdditional data for f.
xsCoefficients of discrete function.
xfCoefficients of fixed part of discrete function
Returns
$L^2$-norm of discretization error.
real normmax_tri2dp1 ( pctri2dp1  dc,
field(*)(const real *x, void *fdata)  u,
void *  fdata,
pavector  xs 
)

Compute the vertex-wise maximum norm of the discretization error.

Evaluate f in all non-fixed vertices and compute the difference with the corresponding component of xs. The maximum of the absolute values gives the vertex-wise $\ell^\infty$-norm of the discretization error.

Parameters
dctri2p1 object describing the trial space.
uFunction.
fdataAdditional data for f.
xsCoefficients of discrete function.
Returns
$\ell^\infty$-norm of discretization error.