MPI_mgparc
Functions
allocati.cpp File Reference
#include <malloc.h>
#include <cstdlib>
#include <cassert>
#include <mpi.h>
#include "mg.h"
#include "header.h"

Functions

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, const MPI::Intracomm &icomm, const int nlevels, const PointerStruct *pp)
 
int FreeLevels (const int nlevels, PointerStruct *pp)
 
int Comp (const void *ii, const void *jj)
 
void MergePatterns (const int numprocs, const int nsk, const int id1, const int id2, const int hh[], int cik[], int kk[], const int)
 
int GlobalCoarse (const int neigh[], const int color, const int myid, const MPI::Intracomm &icomm, const int, PointerStruct *pp)
 

Function Documentation

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.

Parameters
[in]nlevelsnumber of multigrid levels
[in]nxnumber of discretization intervals in x-direction
[in]nynumber of discretization intervals in y-direction
[out]*pppointer to the structure performing the grid management
Returns
-1 indicates an error.
int Comp ( const void *  ii,
const void *  jj 
)
int FreeLevels ( const int  nlevels,
PointerStruct pp 
)

Frees the memory allocated for the multigrid hierarchy.

Parameters
[in]nlevelsnumber of multigrid levels
[out]*pppointer to the structure performing the grid management
Returns
-1 indicates an error.
See also
AllocLevels
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.

Parameters
[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]myidmy rank
[in]icommcommunicator
[in]nlevelsnumber of multigrid levels
[out]*pppointer to the structure performing the grid management
Returns
-1 indicates an error.
See also
AllocLevels
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.

Parameters
[in]xlx-coordinate of left boundary
[in]xrx-coordinate of right boundary
[in]yby-coordinate of lower boundary
[in]yty-coordinate of upper boundary
[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]myidmy rank
[in]icommcommunicator
[in]nlevelsnumber of multigrid levels
[in]*pppointer to the structure performing the grid management
Returns
-1 indicates an error.
void MergePatterns ( const int  numprocs,
const int  nsk,
const int  id1,
const int  id2,
const int  hh[],
int  cik[],
int  kk[],
const int   
)