PLplot  5.15.0
plmem.c File Reference
#include "plplotP.h"

Go to the source code of this file.

Functions

void plStatic2dGrid (PLFLT_NC_MATRIX zIliffe, PLFLT_VECTOR zStatic, PLINT nx, PLINT ny)
 
void plAlloc2dGrid (PLFLT ***f, PLINT nx, PLINT ny)
 
void plFree2dGrid (PLFLT **f, PLINT nx, PLINT PL_UNUSED(ny))
 
void plMinMax2dGrid (PLFLT_MATRIX f, PLINT nx, PLINT ny, PLFLT *fnmax, PLFLT *fnmin)
 

Detailed Description

These functions provide allocation and deallocation of two-dimensional arrays.

Definition in file plmem.c.

Function Documentation

◆ plAlloc2dGrid()

void plAlloc2dGrid ( PLFLT ***  f,
PLINT  nx,
PLINT  ny 
)

Allocate a block of memory for use as a matrix of type PLFLT_MATRIX (organized as an Iliffe column vector of pointers to row vectors). As a result the matrix can be accessed using C/C++ syntax like *f[i][j]. The memory associated with this matrix must be freed by calling plFree2dGrid once it is no longer required. Example usage:

PLFLT **z;

plAlloc2dGrid(&z, XPTS, YPTS);

Parameters
fLocation of the storage (address of a **).
nxSize of the grid in x.
nySize of the grid in y.

Definition at line 91 of file plmem.c.

◆ plFree2dGrid()

void plFree2dGrid ( PLFLT **  f,
PLINT  nx,
PLINT   PL_UNUSEDny 
)

Frees a block of memory allocated with plAlloc2dGrid().

Parameters
fThe [][] to the storage.
nxSize of the grid in x.
PL_UNUSED(ny) Not used.

Definition at line 116 of file plmem.c.

◆ plMinMax2dGrid()

void plMinMax2dGrid ( PLFLT_MATRIX  f,
PLINT  nx,
PLINT  ny,
PLFLT fnmax,
PLFLT fnmin 
)

Finds the maximum and minimum of a 2d matrix allocated with plAlloc2dGrid(). NaN and +/- infinity values are ignored.

param f 2d matrix pointer. param nx Size of the grid in x. param ny Size of the grid in y. param fnmax Maximum value in the matrix. param fnmin Minimum value in the matrix.

Definition at line 141 of file plmem.c.

◆ plStatic2dGrid()

void plStatic2dGrid ( PLFLT_NC_MATRIX  zIliffe,
PLFLT_VECTOR  zStatic,
PLINT  nx,
PLINT  ny 
)

Determine the Iliffe column vector of pointers to PLFLT row vectors corresponding to a 2D matrix of PLFLT's that is statically allocated. As a result the matrix can be accessed using C/C++ syntax like zIliffe[i][j]. Example usage:

PLFLT zStatic[XPTS][YPTS]; PLFLT_NC_VECTOR zIliffe[XPTS];

plStatic2dGrid((PLFLT_NC_MATRIX)zIliffe, (PLFLT_VECTOR)(&zStatic[0][0]), XPTS, YPTS); plshade((PLFLT_NC_MATRIX)zIliffe,....);

Parameters
zIliffePre-existing location of the storage for the Iliffe column vectors.
zStaticPre-existing location of the storage for the 2D z array that is statically allocated.
nxSize of the grid in x = length of the (Iliffe) column vectors.
nySize of the grid in y = length of the row vectors.

Definition at line 61 of file plmem.c.