HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
BandedMatrixPreallocate.c File Reference

Preallocate memory for a banded matrix object. More...

#include <stdlib.h>
#include <bandedmatrix.h>

Go to the source code of this file.

Functions

int BandedMatrixPreallocate (void *A, int nbands, int nrows_local, int BlockSize)
 

Detailed Description

Preallocate memory for a banded matrix object.

Author
Debojyoti Ghosh

Definition in file BandedMatrixPreallocate.c.

Function Documentation

◆ BandedMatrixPreallocate()

int BandedMatrixPreallocate ( void *  A,
int  nbands,
int  nrows_local,
int  BlockSize 
)

Preallocate memory for a banded matrix object.

Parameters
ABanded matrix object of the type BandedMatrix
nbandsNumber of bands
nrows_localLocal number of rows
BlockSizeBlock size

Definition at line 10 of file BandedMatrixPreallocate.c.

16 {
17  BandedMatrix *B = (BandedMatrix*) A;
18 
19  B->nbands = nbands;
20  B->nrows_local = nrows_local;
21  B->BlockSize = BlockSize;
22 
23  B->ncol = (int*) calloc (nrows_local*nbands, sizeof(int));
24  B->nrow = (int*) calloc (nrows_local, sizeof(int));
25  B->data = (double*) calloc (nrows_local*nbands*BlockSize*BlockSize, sizeof(double));
26 
27  return(0);
28 }
double * data
Definition: bandedmatrix.h:24
Structure for defining a banded block matrix.
Definition: bandedmatrix.h:18