The outage for Sunday 24th November has been cancelled.
Bioplib
Protein Structure C Library
 All Data Structures Files Functions Variables Typedefs Macros Pages
Macros | Functions
array3.c File Reference

Allocate and free 3D arrays. More...

#include <stdlib.h>
#include "array.h"

Go to the source code of this file.

Macros

#define NULL   ((void *)0)
 

Functions

char *** blArray3D (int size, int dim1, int dim2, int dim3)
 
void blFreeArray3D (char ***array, int dim1, int dim2, int dim3)
 

Detailed Description

Allocate and free 3D arrays.

Version
V1.1
Date
07.07.14
Author
Dr. Andrew C. R. Martin
Institute of Structural & Molecular Biology, University College London, Gower Street, London. WC1E 6BT.
andre.nosp@m.w@bi.nosp@m.oinf..nosp@m.org..nosp@m.uk andre.nosp@m.w.ma.nosp@m.rtin@.nosp@m.ucl..nosp@m.ac.uk

This code is NOT IN THE PUBLIC DOMAIN, but it may be copied according to the conditions laid out in the accompanying file COPYING.DOC.

The code may be modified as required, but any modifications must be documented so that the person responsible can be identified.

The code may not be sold commercially or included as part of a commercial product except as described in the file COPYING.DOC.

Description:

Creates a 3D array where the first dimension is a set of pointers. This is better for passing into subroutines than the conventional C method of simply declaring:

TYPE matrix[10][10][10];

which, when passed to a fuunction, loses the concept of dimensions unless the matrix is explicitly defined with these dimension in the function.

This routine creates an array of pointers to 1-D arrays and can thus be passed to functions successfully.

Usage:

matrix = (TYPE ***)Array3D(sizeof(TYPE), nrows, ncolumns, nplanes);

matrix = (float **)Array3D(sizeof(float), 10, 10, 10);

Returns NULL (having freed any allocated memory) if there is a problem.

Revision History:

Definition in file array3.c.

Macro Definition Documentation

#define NULL   ((void *)0)

Definition at line 96 of file array3.c.

Function Documentation

char*** blArray3D ( int  size,
int  dim1,
int  dim2,
int  dim3 
)
Parameters
[in]sizeSize of an array element
[in]dim1First dimension (number of rows)
[in]dim2Second dimension (number of columns)
[in]dim3Third dimension (number of planes)
Returns
Array of pointers. Must be cast to required type

Create a 3D array of elements of size `size' with dimensions `dim1' rows by `dim2' columns by `dim3' planes

  • 30.05.02 Original
  • 07.07.14 Use bl prefix for functions By: CTP

Definition at line 127 of file array3.c.

void blFreeArray3D ( char ***  array,
int  dim1,
int  dim2,
int  dim3 
)
Parameters
[in]arrayArray of pointers to be freed
[in]dim1First dimension (number of rows)
[in]dim2Second dimension (number of columns)
[in]dim3Third dimension (number of planes)

Frees a 3D array with dimensions `dim1' rows by `dim2' columns by `dim3' planes.

  • 30.05.02 Original
  • 07.07.14 Use bl prefix for functions By: CTP

Definition at line 182 of file array3.c.