Go to the documentation of this file.
13 int *x_ptr = (
int*) malloc(nr * nz * ny * nx *
sizeof(
int));
15 fprintf(
stderr,
"-E- %s line %d: Memory allocation of data block failed.n", __FILE__, __LINE__);
18 int **y_ptr = (
int**) malloc(nr * nz * ny *
sizeof(
int*));
20 fprintf(
stderr,
"-E- %s line %d: Memory allocation of y array failed.n", __FILE__, __LINE__);
23 int ***z_ptr = (
int***) malloc(nr * nz *
sizeof(
int**));
25 fprintf(
stderr,
"-E- %s line %d: Memory allocation of z array failed.n", __FILE__, __LINE__);
28 int ****r_ptr = (
int****) malloc(nr *
sizeof(
int***));
30 fprintf(
stderr,
"-E- %s line %d: Memory allocation of r array failed.n", __FILE__, __LINE__);
34 for(
size_t r=0;
r<nr;
r++) {
35 for(
size_t z=0; z<nz; z++) {
36 for(
size_t y=0;
y<ny;
y++) {
57 float *x_ptr = (
float*) malloc(nr * nz * ny * nx *
sizeof(
float));
59 fprintf(
stderr,
"-E- %s line %d: Memory allocation of data block failed.n", __FILE__, __LINE__);
62 float **y_ptr = (
float**) malloc(nr * nz * ny *
sizeof(
float*));
64 fprintf(
stderr,
"-E- %s line %d: Memory allocation of y array failed.n", __FILE__, __LINE__);
67 float ***z_ptr = (
float***) malloc(nr * nz *
sizeof(
float**));
69 fprintf(
stderr,
"-E- %s line %d: Memory allocation of z array failed.n", __FILE__, __LINE__);
72 float ****r_ptr = (
float****) malloc(nr *
sizeof(
float***));
74 fprintf(
stderr,
"-E- %s line %d: Memory allocation of r array failed.n", __FILE__, __LINE__);
78 for(
size_t r=0;
r<nr;
r++) {
79 for(
size_t z=0; z<nz; z++) {
80 for(
size_t y=0;
y<ny;
y++) {
101 double *x_ptr = (
double*) malloc(nr * nz * ny * nx *
sizeof(
double));
103 fprintf(
stderr,
"-E- %s line %d: Memory allocation of data block failed.n", __FILE__, __LINE__);
106 double **y_ptr = (
double**) malloc(nr * nz * ny *
sizeof(
double*));
108 fprintf(
stderr,
"-E- %s line %d: Memory allocation of y array failed.n", __FILE__, __LINE__);
111 double ***z_ptr = (
double***) malloc(nr * nz *
sizeof(
double**));
113 fprintf(
stderr,
"-E- %s line %d: Memory allocation of z array failed.n", __FILE__, __LINE__);
116 double ****r_ptr = (
double****) malloc(nr *
sizeof(
double***));
118 fprintf(
stderr,
"-E- %s line %d: Memory allocation of r array failed.n", __FILE__, __LINE__);
122 for(
size_t r=0;
r<nr;
r++) {
123 for(
size_t z=0; z<nz; z++) {
124 for(
size_t y=0;
y<ny;
y++) {
float **** allocate4d_float(size_t nr, size_t nz, size_t ny, size_t nx)
Allocate a four-dimensional array of type float of a given size.
void free4d_double(double ****p)
Free a four-dimensional array created by allocate4d_double.
void free4d_int(int ****p)
Free a four-dimensional array created by allocate4d_int.
int **** allocate4d_int(size_t nr, size_t nz, size_t ny, size_t nx)
Allocate a four-dimensional array of type int of a given size.
Utility functions for allocating and freeing four-dimensional arrays of various types.
void free4d_float(float ****p)
Free a four-dimensional array created by allocate4d_float.
double **** allocate4d_double(size_t nr, size_t nz, size_t ny, size_t nx)
Allocate a four-dimensional array of type double of a given size.