MPI_mgparc
Functions
getmatrix.cpp File Reference
#include <iostream>
#include <cmath>
#include <cassert>
#include "header.h"

Functions

void GetCoordsInRectangle (const int nx, const int ny, const double &xl, const double &xr, const double &yb, const double &yt, double xc[])
 
void GetConnectivityInRectangle (const int nx, const int ny, int ia[])
 
void GetMatrixpointersInRectangle (const int nx, const int ny, int id[], int ik[])
 
void CalcElem (const int ial[3], const double xc[], double ske[3][3], double fe[3])
 
void AddElem (const int ial[3], const double ske[3][3], const double fe[3], double sk[], const int id[], const int ik[], double f[])
 
void DebugMatrix (const int nnode, const double sk[], const int id[], const int ik[])
 
void GetMatrix (const int nx, const int ny, const double &xl, const double &xr, const double &yb, const double &yt, double sk[], int id[], int ik[], double f[])
 

Function Documentation

void AddElem ( const int  ial[3],
const double  ske[3][3],
const double  fe[3],
double  sk[],
const int  id[],
const int  ik[],
double  f[] 
)

Adds the element stiffness matrix ske and the element load vector fe of one triangular element with linear shape functions to the appropriate positions in the symmetric stiffness matrix, stored as CSR matrix K(sk,id, ik)

Parameters
[in]ianode indices of the three element vertices
[in]skeelement stiffness matrix
[in]feelement load vector
[out]skvector non-zero entries of CSR matrix
[in]idindex vector containing the last entry in a CSR row
[in]ikcolumn index vector of CSR matrix
[out]fdistributed local vector storing the right hand side
void CalcElem ( const int  ial[3],
const double  xc[],
double  ske[3][3],
double  fe[3] 
)

Calculates the element stiffness matrix ske and the element load vector fe of one triangular element with linear shape functions.

Parameters
[in]ianode indices of the three element vertices
[in]xcvector of node coordinates with x(2*k,2*k+1) as coodinates of node k
[out]skeelement stiffness matrix
[out]feelement load vector
void DebugMatrix ( const int  nnode,
const double  sk[],
const int  id[],
const int  ik[] 
)

Print entries of the CSR matrix K(sk,id, ik).

Parameters
[in]nnodenumber of rows
[in]skvector non-zero entries of CSR matrix
[in]idindex vector containing the last entry in a CSR row
[in]ikcolumn index vector of CSR matrix
void GetConnectivityInRectangle ( const int  nx,
const int  ny,
int  ia[] 
)

Determines the element connectivity of linear triangular elements of a FEM discretization of a rectangle using nx x ny equidistant intervals for discretization.

Parameters
[in]nxnumber of discretization intervals in x-direction
[in]nynumber of discretization intervals in y-direction
[out]iaelement connectivity matrix with ia(3*s,3*s+1,3*s+2) as node numbers od element s
void GetCoordsInRectangle ( const int  nx,
const int  ny,
const double &  xl,
const double &  xr,
const double &  yb,
const double &  yt,
double  xc[] 
)

Determines the coordinates of the dicretization nodes of the domain [xl, xr] x [yb, yt] which is discretized into nx x ny intervals.

Parameters
[in]nxnumber of discretization intervals in x-direction
[in]nynumber of discretization intervals in y-direction
[in]xlx-coordinate of left boundary
[in]xrx-coordinate of right boundary
[in]yby-coordinate of lower boundary
[in]yty-coordinate of upper boundary
[out]xccoordinate vector of length 2n with x(2*k,2*k+1) as coodinates of node k
void GetMatrix ( const int  nx,
const int  ny,
const double &  xl,
const double &  xr,
const double &  yb,
const double &  yt,
double  sk[],
int  id[],
int  ik[],
double  f[] 
)

Computes the stiffness matrix K(sk,id, ik) and load vector f for the Poisson problem without incorporating the boundary conditions in a domain [xl, xr] x [yb, yt] which is discretized into nx x ny intervals. The matrix pattern is generated and the matrix is stored as CSR matrix(sk,id, ik).

Parameters
[in]nxnumber of discretization intervals in x-direction
[in]nynumber of discretization intervals in y-direction
[in]xlx-coordinate of left boundary
[in]xrx-coordinate of right boundary
[in]yby-coordinate of lower boundary
[in]yty-coordinate of upper boundary
[out]skvector non-zero entries of CSR matrix
[out]idindex vector containing the last entry in a CSR row
[out]ikcolumn index vector of CSR matrix
[out]fdistributed local vector storing the right hand side
void GetMatrixpointersInRectangle ( const int  nx,
const int  ny,
int  id[],
int  ik[] 
)

Determines the sparsity pattern (id, ik) of a symmetric sparse CSR matrix assuming linear triangular elements in a rectangle using nx x ny equidistant intervals for discretization.

Parameters
[in]nxnumber of discretization intervals in x-direction
[in]nynumber of discretization intervals in y-direction
[out]idindex vector containing the last entry in a CSR row
[out]ikcolumn index vector of CSR matrix