Basilisk CFD
Adaptive Cartesian mesh PDE framework
Loading...
Searching...
No Matches
boundaries.h
Go to the documentation of this file.
1/** @file boundaries.h
2 */
3// Generic boundaries
4
5typedef struct _Boundary Boundary;
6
7struct _Boundary {
9 void (* level) (const Boundary * b, scalar * list, int l);
10 // only used with MPI
11 void (* restriction) (const Boundary * b, scalar * list, int l);
12};
13
14static Boundary ** boundaries = NULL; // list of all boundaries
15
17 int len = 0;
18 if (boundaries) {
20 while (*i++) len++;
21 }
22 qrealloc (boundaries, len + 2, Boundary *);
23 boundaries[len] = b;
24 boundaries[len+1] = NULL;
25}
26
28 if (!boundaries)
29 return;
30 Boundary ** i = boundaries, * b;
31 while ((b = *i++))
32 if (b->destroy)
33 b->destroy (b);
34 else
35 free (b);
38}
39
40#define boundary_iterate(type,...) { \
41 Boundary ** _i = boundaries, * _b; \
42 while (_i && (_b = *_i++)) \
43 if (_b->type) \
44 _b->type (_b, __VA_ARGS__); \
45}
46
47/* Box boundaries */
48
49typedef struct {
51 int d;
void add_boundary(Boundary *b)
Definition boundaries.h:16
static Boundary ** boundaries
Definition boundaries.h:14
void free_boundaries()
Definition boundaries.h:27
define l
free(list1)
define VT _attribute[s.i] v y scalar * list
Definition cartesian.h:276
int x
Definition common.h:76
scalar int i
Definition embed.h:74
size *double * b
Boundary parent
Definition boundaries.h:50
void(* destroy)(Boundary *b)
Definition boundaries.h:8
void(* restriction)(const Boundary *b, scalar *list, int l)
Definition boundaries.h:11
void(* level)(const Boundary *b, scalar *list, int l)
Definition boundaries.h:9