PLplot
5.15.0
|
#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) |
These functions provide allocation and deallocation of two-dimensional arrays.
Definition in file plmem.c.
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);
f | Location of the storage (address of a **). |
nx | Size of the grid in x. |
ny | Size of the grid in y. |
Frees a block of memory allocated with plAlloc2dGrid().
f | The [][] to the storage. |
nx | Size of the grid in x. |
PL_UNUSED( | ny) Not used. |
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.
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,....);
zIliffe | Pre-existing location of the storage for the Iliffe column vectors. |
zStatic | Pre-existing location of the storage for the 2D z array that is statically allocated. |
nx | Size of the grid in x = length of the (Iliffe) column vectors. |
ny | Size of the grid in y = length of the row vectors. |