OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
allocate3d.h File Reference
#include <stddef.h>
Include dependency graph for allocate3d.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

short *** allocate3d_short (size_t nz, size_t ny, size_t nx)
 
void free3d_short (short ***p)
 
int *** allocate3d_int (size_t nz, size_t ny, size_t nx)
 
void free3d_int (int ***p)
 
float *** allocate3d_float (size_t nz, size_t ny, size_t nx)
 
void free3d_float (float ***p)
 
double *** allocate3d_double (size_t nz, size_t ny, size_t nx)
 
void free3d_double (double ***p)
 

Detailed Description

Utility functions for allocating and freeing three-dimensional arrays of various types.

This file was created by allocate3d.pl and should not be edited manually.

Definition in file allocate3d.h.

Function Documentation

◆ allocate3d_double()

double*** allocate3d_double ( size_t  nz,
size_t  ny,
size_t  nx 
)

Allocate a three-dimensional array of type double of a given size.

The order of the parameters are (now) the same as when the data is being accessed. E.g., this is valid (ignoring the printf type specifier):

double ***array = allocate3d_double(7, 5, 1); printf("%d\n", array[6][4][0]);

Parameters
[in]nzslowest incrimenting dimension of array in memory.
[in]nymiddle dimension of array.
[in]nxfastest incrimenting dimension of array.
Returns
A malloc'd array or NULL if any malloc fails.

Definition at line 109 of file allocate3d.c.

◆ allocate3d_float()

float*** allocate3d_float ( size_t  nz,
size_t  ny,
size_t  nx 
)

Allocate a three-dimensional array of type float of a given size.

The order of the parameters are (now) the same as when the data is being accessed. E.g., this is valid (ignoring the printf type specifier):

float ***array = allocate3d_float(7, 5, 1); printf("%d\n", array[6][4][0]);

Parameters
[in]nzslowest incrimenting dimension of array in memory.
[in]nymiddle dimension of array.
[in]nxfastest incrimenting dimension of array.
Returns
A malloc'd array or NULL if any malloc fails.

Definition at line 77 of file allocate3d.c.

◆ allocate3d_int()

int*** allocate3d_int ( size_t  nz,
size_t  ny,
size_t  nx 
)

Allocate a three-dimensional array of type int of a given size.

The order of the parameters are (now) the same as when the data is being accessed. E.g., this is valid (ignoring the printf type specifier):

int ***array = allocate3d_int(7, 5, 1); printf("%d\n", array[6][4][0]);

Parameters
[in]nzslowest incrimenting dimension of array in memory.
[in]nymiddle dimension of array.
[in]nxfastest incrimenting dimension of array.
Returns
A malloc'd array or NULL if any malloc fails.

Definition at line 45 of file allocate3d.c.

◆ allocate3d_short()

short*** allocate3d_short ( size_t  nz,
size_t  ny,
size_t  nx 
)

Allocate a three-dimensional array of type short of a given size.

The order of the parameters are (now) the same as when the data is being accessed. E.g., this is valid (ignoring the printf type specifier):

short ***array = allocate3d_short(7, 5, 1); printf("%d\n", array[6][4][0]);

Parameters
[in]nzslowest incrimenting dimension of array in memory.
[in]nymiddle dimension of array.
[in]nxfastest incrimenting dimension of array.
Returns
A malloc'd array or NULL if any malloc fails.

Definition at line 13 of file allocate3d.c.

◆ free3d_double()

void free3d_double ( double ***  p)

Free a three-dimensional array created by allocate3d_double.

Parameters
[in]pPointer to array created by allocate3d_double.

Definition at line 135 of file allocate3d.c.

◆ free3d_float()

void free3d_float ( float ***  p)

Free a three-dimensional array created by allocate3d_float.

Parameters
[in]pPointer to array created by allocate3d_float.

Definition at line 103 of file allocate3d.c.

◆ free3d_int()

void free3d_int ( int ***  p)

Free a three-dimensional array created by allocate3d_int.

Parameters
[in]pPointer to array created by allocate3d_int.

Definition at line 71 of file allocate3d.c.

◆ free3d_short()

void free3d_short ( short ***  p)

Free a three-dimensional array created by allocate3d_short.

Parameters
[in]pPointer to array created by allocate3d_short.

Definition at line 39 of file allocate3d.c.