Closed jeff-cohere closed 2 years ago
Merging #233 (43ebbd4) into master (e4a0200) will not change coverage. The diff coverage is
n/a
.
@@ Coverage Diff @@
## master #233 +/- ##
=======================================
Coverage 51.57% 51.57%
=======================================
Files 4 4
Lines 764 764
=======================================
Hits 394 394
Misses 370 370
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update e4a0200...43ebbd4. Read the comment docs.
This PR introduces three functions (some are actually macros):
TDyAlloc
, which allocates memory of a given number of bytes, setting all bytes to zero. This macro replaces calls tomalloc
,PetscMalloc
,PetscMalloc1
,PetscCalloc
, andPetscCalloc1
.TDyRealloc
, which resizes an existing block of memory efficiently. This replaces calls torealloc
andPetscRealloc
.TDyFree
, which frees an allocated block of memory. This replaces calls tofree
andPetscFree
.With this, we don't have to remember which of the several different functions to call to allocate or free memory. Just call the appropriate one of these three. :-)
Multidimensional Arrays
I've also added some macros to allow us to declare multidimensional arrays that are contiguous in memory, instead of the "jagged" arrays we currently create using the
TDyAllocate_IntegerArray_ND
functions and friends. We should definitely switch from using our jagged arrays to these contiguous multidimensional arrays, but that should be done in another PR. The macros, each of which declares a variable pointing to a multidimensional array given a slab of memory, are:TDY_DECLARE_2D_ARRAY(type, array_var, storage, dim1, dim2)
TDY_DECLARE_3D_ARRAY(type, array_var, storage, dim1, dim2, dim3)
TDY_DECLARE_4D_ARRAY(type, array_var, storage, dim1, dim2, dim3, dim4)
TDY_DECLARE_5D_ARRAY(type, array_var, storage, dim1, dim2, dim3, dim4, dim5)
TDY_DECLARE_6D_ARRAY(type, array_var, storage, dim1, dim2, dim3, dim4, dim5, dim6)
TDY_DECLARE_7D_ARRAY(type, array_var, storage, dim1, dim2, dim3, dim4, dim5, dim6, dim7)
Fixes #229