MPI_mgparc
Functions
jacsolve.cpp File Reference
#include <iostream>
#include <cmath>
#include <mpi.h>
#include "header.h"

Functions

void JacobiSolve (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[])
 
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[])
 

Function Documentation

void JacobiSolve ( 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[] 
)

Solves linear system of equations K u = f via the Jacobi iteration. We use a distributed symmetric CSR matrix K(sk,id, ik) and initial guess of the solution is set to 0.

Parameters
[in]nxnumber of discretization intervals in x-direction
[in]nynumber of discretization intervals in y-direction
[in]neighvector of 4 elements containing the ranks of neighbouring processes, -1 indicates a boundary in this direction
[in]colorred/black coloring of subdomains (0/1)
[in]icommcommunicator
[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
[in]fdistributed local vector storing the right hand side
[out]uaccumulated local vector storing the solution.
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).

Parameters
[in]nxnumber of discretization intervals in x-direction
[in]nynumber of discretization intervals in y-direction
[in]neighvector of 4 elements containing the ranks of neighbouring processes, -1 indicates a boundary in this direction
[in]colorred/black coloring of subdomains (0/1)
[in]icommcommunicator
[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
[in]fdistributed local vector storing the right hand side
[in,out]uaccumulated local vector storing the solution.
[in]ddaccumualted diagonal of striffness matrix
[out]auxauxilliary vector used for the intermediate residuum in the iteration