MPI_mgparc
|
Go to the source code of this file.
Classes | |
struct | PointerStruct |
struct | ControlStruct |
Macros | |
#define | MAXLEVEL 20 |
Functions | |
void | ApplyDirichletBC1 (const int nx, const int ny, const int neigh[], const double u[], double sk[], const int id[], const int ik[], double f[]) |
int | AdrCRS (const int row, const int col, const int id[], const int ik[], const int nnode) |
int | AllocLevels (const int nlevels, const int nx, const int ny, PointerStruct *pp) |
int | IniLevels (const double xl, const double xr, const double yb, const double yt, const int neigh[], const int color, const int myid, const MPI::Intracomm &icomm, const int nlevels, const PointerStruct *pp) |
int | FreeLevels (const int nlevels, PointerStruct *pp) |
int | GlobalCoarse (const int neigh[], const int color, const int myid, const MPI::Intracomm &icomm, const int nlevels, PointerStruct *pp) |
void | Interpolate (const int nx, const int ny, double w[], const int nx_c, const int ny_c, const double w_c[], const int neigh[]) |
void | Restrict (const int nx, const int ny, const double w[], const int nx_c, const int ny_c, double w_c[], const int neigh[]) |
void | JacobiSmooth (const int nx, const int ny, const int neigh[], const int color, const int myid, const MPI::Intracomm &icomm, const double sk[], const int id[], const int ik[], const double f[], double u[], const double dd[], double aux[], const int maxiter) |
void | JacobiSolveGlob (const int myid, const MPI::Intracomm &icomm, const int nnode, const int nglob, const double sk[], const int id[], const int ik[], const int l2g[], const double f[], double u[]) |
void | JacobiSolve2 (const int nx, const int ny, const int neigh[], const int color, const MPI::Intracomm &icomm, const double sk[], const int id[], const int ik[], const double f[], double u[], const double dd[], double aux[]) |
void | MGM (const PointerStruct *const pp, const ControlStruct *const crtl, const int level, const int neigh[], const int color, const int myid, const MPI::Intracomm &icomm) |
void | MGMSolver (const PointerStruct *const pp, const ControlStruct *const crtl, const int level, const int neigh[], const int color, const int myid, const MPI::Intracomm &icomm) |
#define MAXLEVEL 20 |
int AdrCRS | ( | const int | row, |
const int | col, | ||
const int | id[], | ||
const int | ik[], | ||
const int | nnode | ||
) |
Determines for a symmetrix CSR matrix the index of element (row
, col
).
[in] | row | row index |
[in] | col | colum index |
[in] | id | index vector containing the last entry in a CSR row |
[in] | ik | column index vector of CSR matrix |
row
, col
). -1 indicates that this entry is not available. int AllocLevels | ( | const int | nlevels, |
const int | nx, | ||
const int | ny, | ||
PointerStruct * | pp | ||
) |
Allocates the memory for nlevels
levels for a rectangle discretized into nx
x ny
equidistant intervals on the coarsest grid at level 0. The geometric multigrid hierarchy assume bisection of intervals as refinement strategy.
[in] | nlevels | number of multigrid levels |
[in] | nx | number of discretization intervals in x-direction |
[in] | ny | number of discretization intervals in y-direction |
[out] | *pp | pointer to the structure performing the grid management |
void ApplyDirichletBC1 | ( | const int | nx, |
const int | ny, | ||
const int | neigh[], | ||
const double | u[], | ||
double | sk[], | ||
const int | id[], | ||
const int | ik[], | ||
double | f[] | ||
) |
Applies Dirichlet boundary conditions to symmetric CSR matrix (sk
,id
, ik
) and right hand side f
of a system of equations resulting from a FEM/FDM discretization. This is a special version function ApplyDirichletBC for parallel matrix generation taking into account distributed matrix and distributed rhs.
[in] | nx | number of discretization intervals in x-direction |
[in] | ny | number of discretization intervals in y-direction |
[in] | neigh | vector of 4 elements containing the ranks of neighbouring processes, -1 indicates a boundary in this direction |
[in] | u | local vector with appropriately initialized b.c. |
[in,out] | sk | vector non-zero entries of CSR matrix |
[in] | id | index vector containing the last entry in a CSR row |
[in] | ik | column index vector of CSR matrix |
[in,out] | f | right hand side |
int FreeLevels | ( | const int | nlevels, |
PointerStruct * | pp | ||
) |
Frees the memory allocated for the multigrid hierarchy.
[in] | nlevels | number of multigrid levels |
[out] | *pp | pointer to the structure performing the grid management |
int GlobalCoarse | ( | const int | neigh[], |
const int | color, | ||
const int | myid, | ||
const MPI::Intracomm & | icomm, | ||
const int | nlevels, | ||
PointerStruct * | pp | ||
) |
Creates a global coarse grid system with an accumulated sparse matrix on this discretization.
[in] | neigh | vector of 4 elements containing the ranks of neighbouring processes, -1 indicates a boundary in this direction |
[in] | color | red/black coloring of subdomains (0/1) |
[in] | myid | my rank |
[in] | icomm | communicator |
[in] | nlevels | number of multigrid levels |
[out] | *pp | pointer to the structure performing the grid management |
int IniLevels | ( | const double | xl, |
const double | xr, | ||
const double | yb, | ||
const double | yt, | ||
const int | neigh[], | ||
const int | color, | ||
const int | myid, | ||
const MPI::Intracomm & | icomm, | ||
const int | nlevels, | ||
const PointerStruct * | pp | ||
) |
Inializes the stiffness matrix, right hand side, and boundary conditions for the discretization on level nlevels
in the domain [xl
, xr
] x [yb
, yt
].
memory for nlevels
levels for a rectangle discretized into nx
x ny
equidistant intervals on the coarsest grid at level 0. The geometric multigrid hierarchy assume bisection of intervals as refinement strategy.
[in] | xl | x-coordinate of left boundary |
[in] | xr | x-coordinate of right boundary |
[in] | yb | y-coordinate of lower boundary |
[in] | yt | y-coordinate of upper boundary |
[in] | neigh | vector of 4 elements containing the ranks of neighbouring processes, -1 indicates a boundary in this direction |
[in] | color | red/black coloring of subdomains (0/1) |
[in] | myid | my rank |
[in] | icomm | communicator |
[in] | nlevels | number of multigrid levels |
[in] | *pp | pointer to the structure performing the grid management |
void Interpolate | ( | const int | nx, |
const int | ny, | ||
double | w[], | ||
const int | nx_c, | ||
const int | ny_c, | ||
const double | w_c[], | ||
const int | neigh[] | ||
) |
Bilinear interpolation of a coarse grid vector w_c
onto a fine grid vector w
. The underlying discretization is a tensor product grid.
[in] | nx | number of fine grid intervals in x-direction |
[in] | ny | number of fine grid intervals in y-direction |
[out] | w | interpolated vector on fine grid |
[in] | nx_c | number of fine grid intervals in x-direction |
[in] | ny_c | number of fine grid intervals in y-direction |
[in] | w_c | original vector on coarse grid |
[in] | neigh | vector of 4 elements containing the ranks of neighbouring processes, -1 indicates a Dirichlet boundary in this direction. Use other negative values for Neumann boundary |
void JacobiSmooth | ( | const int | nx, |
const int | ny, | ||
const int | neigh[], | ||
const int | color, | ||
const int | myid, | ||
const MPI::Intracomm & | icomm, | ||
const double | sk[], | ||
const int | id[], | ||
const int | ik[], | ||
const double | f[], | ||
double | u[], | ||
const double | dd[], | ||
double | aux[], | ||
const int | maxiter | ||
) |
Iterates maxiter
with the linear system of equations K u
= f
via the Jacobi iteration. We use a distributed symmetric CSR matrix K(sk
,id
, ik
).
[in] | nx | number of discretization intervals in x-direction |
[in] | ny | number of discretization intervals in y-direction |
[in] | neigh | vector of 4 elements containing the ranks of neighbouring processes, -1 indicates a boundary in this direction |
[in] | color | red/black coloring of subdomains (0/1) |
[in] | myid | rank of my process |
[in] | icomm | communicator |
[in] | sk | vector non-zero entries of CSR matrix |
[in] | id | index vector containing the last entry in a CSR row |
[in] | ik | column index vector of CSR matrix |
[in] | f | distributed local vector storing the right hand side |
[in,out] | u | accumulated local vector storing the solution. |
[in] | dd | accumualted diagonal of striffness matrix |
[out] | aux | auxilliary vector used for the intermediate residuum in the iteration |
[in] | maxiter | number of iterations / smoothing weeps |
void JacobiSolve2 | ( | const int | nx, |
const int | ny, | ||
const int | neigh[], | ||
const int | color, | ||
const MPI::Intracomm & | icomm, | ||
const double | sk[], | ||
const int | id[], | ||
const int | ik[], | ||
const double | f[], | ||
double | u[], | ||
const double | dd[], | ||
double | aux[] | ||
) |
Solves the global parallel system with Jacobi iterations until a predefined accuracy is reached. We use a distributed symmetric CSR matrix K(sk
,id
, ik
).
[in] | nx | number of discretization intervals in x-direction |
[in] | ny | number of discretization intervals in y-direction |
[in] | neigh | vector of 4 elements containing the ranks of neighbouring processes, -1 indicates a boundary in this direction |
[in] | color | red/black coloring of subdomains (0/1) |
[in] | icomm | communicator |
[in] | sk | vector non-zero entries of CSR matrix |
[in] | id | index vector containing the last entry in a CSR row |
[in] | ik | column index vector of CSR matrix |
[in] | f | distributed local vector storing the right hand side |
[in,out] | u | accumulated local vector storing the solution. |
[in] | dd | accumualted diagonal of striffness matrix |
[out] | aux | auxilliary vector used for the intermediate residuum in the iteration |
void JacobiSolveGlob | ( | const int | myid, |
const MPI::Intracomm & | icomm, | ||
const int | nnode, | ||
const int | nglob, | ||
const double | sk[], | ||
const int | id[], | ||
const int | ik[], | ||
const int | l2g[], | ||
const double | f[], | ||
double | u[] | ||
) |
Solves the global parallel system with Jacobi iterations until a predefined accuracy is reached. We use a distributed symmetric CSR matrix K(sk
,id
, ik
).
[in] | myid | rank of my process |
[in] | icomm | communicator |
[in] | nloc | local number of unknowns |
[in] | nglob | global number of unknowns |
[in] | sk | vector non-zero entries of CSR matrix |
[in] | id | index vector containing the last entry in a CSR row |
[in] | ik | column index vector of CSR matrix |
[in] | l2g | index vector containing global indices of local degrees of freedom |
[in] | f | distributed local vector storing the right hand side |
[out] | u | accumulated local vector storing the solution. |
void MGM | ( | const PointerStruct *const | pp, |
const ControlStruct *const | crtl, | ||
const int | level, | ||
const int | neigh[], | ||
const int | color, | ||
const int | myid, | ||
const MPI::Intracomm & | icomm | ||
) |
void MGMSolver | ( | const PointerStruct *const | pp, |
const ControlStruct *const | crtl, | ||
const int | level, | ||
const int | neigh[], | ||
const int | color, | ||
const int | myid, | ||
const MPI::Intracomm & | icomm | ||
) |
void Restrict | ( | const int | nx, |
const int | ny, | ||
const double | w[], | ||
const int | nx_c, | ||
const int | ny_c, | ||
double | w_c[], | ||
const int | neigh[] | ||
) |
Bilinear restriction of a fine grid vector w
onto a coarse grid vector w_c
. The underlying discretization is a tensor product grid.
[in] | nx | number of fine grid intervals in x-direction |
[in] | ny | number of fine grid intervals in y-direction |
[in] | w | interpolated vector on fine grid |
[in] | nx_c | number of fine grid intervals in x-direction |
[in] | ny_c | number of fine grid intervals in y-direction |
[out] | w_c | original vector on coarse grid |
[in] | neigh | vector of 4 elements containing the ranks of neighbouring processes, -1 indicates a Dirichlet boundary in this direction. Use other negative values for Neumann boundary |