Repository navigation
Expand file tree
/
Copy pathREADME
More file actions
38 lines (27 loc) · 1.33 KB
/
Copy pathREADME
File metadata and controls
38 lines (27 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
--- Contiguous:
--- A 2D & 3D dynamic contiguous array allocator in C.
-------------------------------------------------------------------------
Introduction:
The current program is a 2D & 3D dynamic array allocator that allocates
contiguous arrays in memory. Contiguous arrays are useful, not only
for better cache memory access, but also for MPI applications that
need contiguous memory for sending and receiving data between processes.
Arrays are created so that elements can be accessed using indices according
to the dimensions. For example, a[i][j] for 2D and a[i][j][k] for 3D.
The current program allocates a 2D / 3D array of doubles; changing this to
whatever type the user may need is trivial.
The functions have been checked with Valgrind for memory leaks and were
found to be free of leaks.
-------------------------------------------------------------------------
Functions:
2D
- array2D_contiguous_double: allocates 2D of given dimensions and initializes
to zero.
- free_array2D_contiguous_double: frees memory allocated by
array2D_contiguous_double.
3D
- array3D_contiguous_double: allocates 3D of given dimensions and initializes
to zero.
- free_array3D_contiguous_double: frees memory allocated by
array3D_contiguous_double.
-------------------------------------------------------------------------