Basilisk CFD
Adaptive Cartesian mesh PDE framework
Loading...
Searching...
No Matches
linear.h File Reference
#include <stdio.h>
#include <assert.h>
Include dependency graph for linear.h:

Go to the source code of this file.

Data Structures

struct  Point
 

Macros

#define GRIDNAME   "Linear quadtree"
 
#define _I   (quad_x(point.i))
 
#define _J   (quad_y(point.i))
 
#define data(k, l)   point.d[quad_neighbor(point.i, k, l)]
 
#define quad(n, d)   ((((n|quad_bottom)+(d&quad_left))&quad_left)|(((n|quad_left)+(d&quad_bottom))&quad_bottom))
 
#define STACKSIZE   20
 
#define _push(c, d)    { _s++; stack[_s].i = c; stack[_s].stage = d; }
 
#define _pop(c, d)    { c = stack[_s].i; d = stack[_s].stage; _s--; }
 
#define foreach(grid)
 
#define end_foreach()
 

Functions

static int size (int l)
 
int level (int p)
 
int code (int p, int l)
 
int index (int code, int l)
 
int quad_x (int p)
 
int quad_y (int p)
 
int repeat (int a)
 
int quad_neighbor (int p, int i, int j)
 
int quad_neighbor_finest (int p, int i, int j)
 
voidquadtree (int r, size_t s)
 
voidinit_grid (int n)
 
void free_grid (void *m)
 

Variables

static int quad_r
 
static int quad_left
 
static int quad_right = 1
 
static int quad_top = 2
 
static int quad_bottom
 
static int quad_id [3][3]
 

Macro Definition Documentation

◆ _I

#define _I   (quad_x(point.i))

Definition at line 18 of file linear.h.

◆ _J

#define _J   (quad_y(point.i))

Definition at line 19 of file linear.h.

◆ _pop

#define _pop (   c,
  d 
)     { c = stack[_s].i; d = stack[_s].stage; _s--; }

Definition at line 141 of file linear.h.

◆ _push

#define _push (   c,
  d 
)     { _s++; stack[_s].i = c; stack[_s].stage = d; }

Definition at line 139 of file linear.h.

◆ data

#define data (   k,
  l 
)    point.d[quad_neighbor(point.i, k, l)]

Definition at line 26 of file linear.h.

◆ end_foreach

#define end_foreach ( )
Value:
} \
} \
else { \
if (stage < 3) \
_push (point.i, stage + 1); \
_push (4*point.i + stage + 1, 0); \
} \
} \
}
int x
Definition common.h:76
Point point
Definition conserving.h:86
int i
Definition linear.h:23

Definition at line 164 of file linear.h.

◆ foreach

#define foreach (   grid)
Value:
{ \
struct { int i, stage; } stack[STACKSIZE]; int _s = -1; /* the stack */ \
point.d = grid; \
_push (0, 0); /* the root cell */ \
while (_s >= 0) { \
int stage; \
if (!stage) { \
_push (point.i, 1); \
_push (4*point.i + 1, 0); \
} \
else { \
/* do something */
Grid * grid
Definition common.h:32
scalar int i
Definition embed.h:74
int stack
Definition include.c:991
static int quad_r
Definition linear.h:29
#define STACKSIZE
Definition linear.h:138
int int int level
Definition linear.h:21
Data * d
Definition linear.h:22
int level
Definition linear.h:23
int depth
Definition linear.h:23
macro VARIABLES(Point point=point, int _ig=ig, int _jg=jg, int _kg=kg)
Definition variables.h:3

Definition at line 144 of file linear.h.

◆ GRIDNAME

#define GRIDNAME   "Linear quadtree"

Definition at line 13 of file linear.h.

◆ quad

#define quad (   n,
  d 
)    ((((n|quad_bottom)+(d&quad_left))&quad_left)|(((n|quad_left)+(d&quad_bottom))&quad_bottom))

Definition at line 80 of file linear.h.

◆ STACKSIZE

#define STACKSIZE   20

Definition at line 138 of file linear.h.

Function Documentation

◆ code()

int code ( int  p,
int  l 
)

Definition at line 44 of file linear.h.

References l, p, quad_r, and size.

Referenced by index(), py_register_event(), quad_neighbor(), quad_x(), and quad_y().

Here is the caller graph for this function:

◆ free_grid()

void free_grid ( void m)

Definition at line 133 of file linear.h.

References free(), and m().

Here is the call graph for this function:

◆ index()

int index ( int  code,
int  l 
)

Definition at line 49 of file linear.h.

References code(), l, quad_r, and size.

Here is the call graph for this function:

◆ init_grid()

void * init_grid ( int  n)

Definition at line 118 of file linear.h.

References depth, n, q, quadtree(), and x.

Here is the call graph for this function:

◆ level()

int level ( int  p)

Definition at line 36 of file linear.h.

References l, and p.

◆ quad_neighbor()

int quad_neighbor ( int  p,
int  i,
int  j 
)

Definition at line 84 of file linear.h.

References code(), d, i, index, j, l, level, n, p, quad, quad_id, and quad_r.

Here is the call graph for this function:

◆ quad_neighbor_finest()

int quad_neighbor_finest ( int  p,
int  i,
int  j 
)

Definition at line 94 of file linear.h.

References d, i, j, n, p, quad, quad_id, quad_r, s, and size.

◆ quad_x()

int quad_x ( int  p)

Definition at line 54 of file linear.h.

References a, b, code(), i, level, m(), n, p, and quad_r.

Here is the call graph for this function:

◆ quad_y()

int quad_y ( int  p)

Definition at line 62 of file linear.h.

References a, b, code(), i, level, m(), n, p, and quad_r.

Here is the call graph for this function:

◆ quadtree()

void * quadtree ( int  r,
size_t  s 
)

Definition at line 103 of file linear.h.

References q, quad_bottom, quad_id, quad_left, quad_r, quad_right, quad_top, repeat(), s, size, and x.

Referenced by init_grid().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ repeat()

int repeat ( int  a)

Definition at line 70 of file linear.h.

References a, i, quad_r, and s.

Referenced by quadtree().

Here is the caller graph for this function:

◆ size()

static int size ( int  l)
static

Definition at line 31 of file linear.h.

References l.

Variable Documentation

◆ quad_bottom

int quad_bottom
static

Definition at line 78 of file linear.h.

Referenced by quadtree().

◆ quad_id

int quad_id[3][3]
static

Definition at line 82 of file linear.h.

Referenced by quad_neighbor(), quad_neighbor_finest(), and quadtree().

◆ quad_left

int quad_left
static

Definition at line 78 of file linear.h.

Referenced by quadtree().

◆ quad_r

int quad_r
static

Definition at line 29 of file linear.h.

Referenced by code(), index(), quad_neighbor(), quad_neighbor_finest(), quad_x(), quad_y(), quadtree(), and repeat().

◆ quad_right

int quad_right = 1
static

Definition at line 78 of file linear.h.

Referenced by quadtree().

◆ quad_top

int quad_top = 2
static

Definition at line 78 of file linear.h.

Referenced by quadtree().