Nek5000
SEM for Incompressible NS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Classes | Macros | Typedefs | Functions
mem.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  array
 

Macros

#define PRINT_MALLOCS   0
 
#define tmalloc(type, count)   ((type*) smalloc((count)*sizeof(type),__FILE__,__LINE__) )
 
#define tcalloc(type, count)   ((type*) scalloc((count),sizeof(type),__FILE__,__LINE__) )
 
#define trealloc(type, ptr, count)   ((type*) srealloc((ptr),(count)*sizeof(type),__FILE__,__LINE__) )
 
#define null_array   {0,0,0}
 
#define array_free(a)   (free((a)->ptr))
 
#define array_init(T, a, max)   array_init_(a,max,sizeof(T),__FILE__,__LINE__)
 
#define array_resize(T, a, max)   array_resize_(a,max,sizeof(T),__FILE__,__LINE__)
 
#define array_reserve(T, a, min)   array_reserve_(a,min,sizeof(T),__FILE__,__LINE__)
 
#define array_cat(T, d, s, n)   array_cat_(sizeof(T),d,s,n,__FILE__,__LINE__)
 
#define null_buffer   null_array
 
#define buffer_init(b, max)   array_init(char,b,max)
 
#define buffer_resize(b, max)   array_resize(char,b,max)
 
#define buffer_reserve(b, max)   array_reserve(char,b,max)
 
#define buffer_free(b)   array_free(b)
 
#define ALIGNOF(T)   offsetof(struct { char c; T x; }, x)
 
#define align_as(T, n)   align_as_(ALIGNOF(T),n)
 
#define align_ptr(T, base, offset)   ((T*)((char*)(base)+align_as(T,offset)))
 

Typedefs

typedef struct array buffer
 

Functions

static void * smalloc (size_t size, const char *file, unsigned line)
 
static void * scalloc (size_t nmemb, size_t size, const char *file, unsigned line)
 
static void * srealloc (void *restrict ptr, size_t size, const char *file, unsigned line)
 
static void array_init_ (struct array *a, size_t max, size_t size, const char *file, unsigned line)
 
static void array_resize_ (struct array *a, size_t max, size_t size, const char *file, unsigned line)
 
static void * array_reserve_ (struct array *a, size_t min, size_t size, const char *file, unsigned line)
 
static void array_cat_ (size_t size, struct array *d, const void *s, size_t n, const char *file, unsigned line)
 
static size_t align_as_ (size_t a, size_t n)
 

Macro Definition Documentation

#define align_as (   T,
  n 
)    align_as_(ALIGNOF(T),n)

Definition at line 165 of file mem.h.

Referenced by sortp(), and sortv().

#define align_ptr (   T,
  base,
  offset 
)    ((T*)((char*)(base)+align_as(T,offset)))

Definition at line 166 of file mem.h.

#define ALIGNOF (   T)    offsetof(struct { char c; T x; }, x)

Definition at line 163 of file mem.h.

Referenced by fcrystal_ituple_sort(), and fcrystal_tuple_sort().

#define array_cat (   T,
  d,
  s,
  n 
)    array_cat_(sizeof(T),d,s,n,__FILE__,__LINE__)

Definition at line 148 of file mem.h.

Referenced by main().

#define array_free (   a)    (free((a)->ptr))
#define array_init (   T,
  a,
  max 
)    array_init_(a,max,sizeof(T),__FILE__,__LINE__)
#define array_reserve (   T,
  a,
  min 
)    array_reserve_(a,min,sizeof(T),__FILE__,__LINE__)

Definition at line 138 of file mem.h.

Referenced by cr_learn(), fgs_fields(), make_topology_unique(), map_points_to_els(), and shared_ids().

#define array_resize (   T,
  a,
  max 
)    array_resize_(a,max,sizeof(T),__FILE__,__LINE__)

Definition at line 137 of file mem.h.

Referenced by nonzero_ids().

#define buffer_free (   b)    array_free(b)

Definition at line 158 of file mem.h.

Referenced by crs_setup(), crystal_free(), findpts_local_free(), and main().

#define buffer_init (   b,
  max 
)    array_init(char,b,max)

Definition at line 155 of file mem.h.

Referenced by crs_setup(), crystal_init(), fcrystal_setup(), ffindpts_setup(), and main().

#define buffer_reserve (   b,
  max 
)    array_reserve(char,b,max)
#define buffer_resize (   b,
  max 
)    array_resize(char,b,max)

Definition at line 156 of file mem.h.

#define null_array   {0,0,0}

Definition at line 112 of file mem.h.

Referenced by cr_setup_aux(), and main().

#define null_buffer   null_array

Definition at line 154 of file mem.h.

Referenced by main().

#define PRINT_MALLOCS   0

Definition at line 30 of file mem.h.

#define tcalloc (   type,
  count 
)    ((type*) scalloc((count),sizeof(type),__FILE__,__LINE__) )

Definition at line 93 of file mem.h.

Referenced by hash_build().

#define tmalloc (   type,
  count 
)    ((type*) smalloc((count)*sizeof(type),__FILE__,__LINE__) )
#define trealloc (   type,
  ptr,
  count 
)    ((type*) srealloc((ptr),(count)*sizeof(type),__FILE__,__LINE__) )

Definition at line 95 of file mem.h.

Referenced by fcrs_setup(), fcrystal_setup(), ffindpts_setup(), and fgs_setup_pick().

Typedef Documentation

typedef struct array buffer

Definition at line 153 of file mem.h.

Function Documentation

static size_t align_as_ ( size_t  a,
size_t  n 
)
static

Definition at line 164 of file mem.h.

Referenced by sarray_permute_buf_().

+ Here is the caller graph for this function:

static void array_cat_ ( size_t  size,
struct array d,
const void *  s,
size_t  n,
const char *  file,
unsigned  line 
)
static

Definition at line 140 of file mem.h.

References array_reserve_(), n, array::n, and out.

+ Here is the call graph for this function:

static void array_init_ ( struct array a,
size_t  max,
size_t  size,
const char *  file,
unsigned  line 
)
static

Definition at line 113 of file mem.h.

References array::max, array::n, array::ptr, and smalloc().

+ Here is the call graph for this function:

static void* array_reserve_ ( struct array a,
size_t  min,
size_t  size,
const char *  file,
unsigned  line 
)
static

Definition at line 123 of file mem.h.

References array_resize_(), array::max, and array::ptr.

Referenced by array_cat_(), and sarray_transfer_many().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void array_resize_ ( struct array a,
size_t  max,
size_t  size,
const char *  file,
unsigned  line 
)
static

Definition at line 118 of file mem.h.

References array::max, array::ptr, and srealloc().

Referenced by array_reserve_().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void* scalloc ( size_t  nmemb,
size_t  size,
const char *  file,
unsigned  line 
)
inlinestatic

Definition at line 57 of file mem.h.

References comm_gbl_id, fail(), and restrict.

+ Here is the call graph for this function:

static void* smalloc ( size_t  size,
const char *  file,
unsigned  line 
)
inlinestatic

Definition at line 45 of file mem.h.

References comm_gbl_id, fail(), and restrict.

Referenced by array_init_().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void* srealloc ( void *restrict  ptr,
size_t  size,
const char *  file,
unsigned  line 
)
inlinestatic

Definition at line 71 of file mem.h.

References comm_gbl_id, fail(), and restrict.

Referenced by array_resize_().

+ Here is the call graph for this function:

+ Here is the caller graph for this function: