Basilisk CFD
Adaptive Cartesian mesh PDE framework
Loading...
Searching...
No Matches
virtual.h File Reference
#include <sys/mman.h>
Include dependency graph for virtual.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _Memindex
 

Macros

#define Memindex   struct _Memindex *
 
#define mem_data(m, i, j)   ((m)->b[i][j])
 
#define mymap(len)   mmap (NULL, len*sizeof (char *), PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
 The mem_assign() function assigns a (pointer) value to a given index.
 

Functions

static const bool mem_allocated (const struct _Memindex *m, const int i, const int j)
 The mem_data() macros return the data stored at a specific (multidimensional) index.
 
struct _Memindexmem_new (int len)
 The mem_new() function returns a new (empty) Memindex.
 
void mem_destroy (struct _Memindex *m, int len)
 The mem_destroy() function frees all the memory allocated by a given Memindex.
 
void mem_assign (struct _Memindex *m, int i, int j, int len, void *b)
 
static bool mem_free1d (char **const b, const int i, int len)
 The mem_free() function frees a given index.
 
void mem_free (struct _Memindex *m, int i, int j, int len, void *b)
 
macro foreach_mem (struct _Memindex *index, int len, int _i)
 The foreach_mem() macro traverses every _i allocated elements of array _m taking into account a periodicity of _len (and ghost cells).
 

Macro Definition Documentation

◆ mem_data

#define mem_data (   m,
  i,
  j 
)    ((m)->b[i][j])

Definition at line 44 of file virtual.h.

◆ Memindex

#define Memindex   struct _Memindex *

Definition at line 25 of file virtual.h.

◆ mymap

#define mymap (   len)    mmap (NULL, len*sizeof (char *), PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)

The mem_assign() function assigns a (pointer) value to a given index.

Definition at line 89 of file virtual.h.

Function Documentation

◆ foreach_mem()

macro foreach_mem ( struct _Memindex index,
int  len,
int  _i 
)

The foreach_mem() macro traverses every _i allocated elements of array _m taking into account a periodicity of _len (and ghost cells).

Definition at line 176 of file virtual.h.

References _i, GHOSTS, Point::i, index, max, Memindex, min, Period, point, and x.

◆ mem_allocated()

static const bool mem_allocated ( const struct _Memindex m,
const int  i,
const int  j 
)
inlinestatic

The mem_data() macros return the data stored at a specific (multidimensional) index.

It assumes that the index is allocated. This can be checked with mem_allocated().

Definition at line 40 of file virtual.h.

References i, j, m(), and x.

Here is the call graph for this function:

◆ mem_assign()

void mem_assign ( struct _Memindex m,
int  i,
int  j,
int  len,
void b 
)

Definition at line 101 of file virtual.h.

References assert, b, i, j, m(), mem_data, mymap, and x.

Here is the call graph for this function:

◆ mem_destroy()

void mem_destroy ( struct _Memindex m,
int  len 
)

The mem_destroy() function frees all the memory allocated by a given Memindex.

Definition at line 68 of file virtual.h.

References free(), i, j, m(), sizeof(), and x.

Here is the call graph for this function:

◆ mem_free()

void mem_free ( struct _Memindex m,
int  i,
int  j,
int  len,
void b 
)

Definition at line 151 of file virtual.h.

References i, j, m(), mem_free1d(), and x.

Here is the call graph for this function:

◆ mem_free1d()

static bool mem_free1d ( char **const  b,
const int  i,
int  len 
)
static

The mem_free() function frees a given index.

Definition at line 130 of file virtual.h.

References b, i, j, min, and x.

Referenced by mem_free().

Here is the caller graph for this function:

◆ mem_new()

struct _Memindex * mem_new ( int  len)

The mem_new() function returns a new (empty) Memindex.

Definition at line 58 of file virtual.h.

References calloc(), m(), and Memindex.

Here is the call graph for this function: