Basilisk CFD
Adaptive Cartesian mesh PDE framework
Loading...
Searching...
No Matches
layers.h
Go to the documentation of this file.
1
/** @file layers.h
2
*/
3
/**
4
# Multiple "layers"
5
6
This adds support for multiple "layers" i.e. a constant number `nl` of
7
contiguous scalar fields. */
8
9
int
nl
= 1;
10
11
/**
12
We redefine two types of block traversals. An "outer" traversal,
13
usable outside for (int _i = 0; _i < _N; _i++) /* foreach */
loops
,
which
uses
a
global `
_layer
`
index
... */
14
15
int
_layer
= 0;
16
17
#undef foreach_block
18
macro
/* foreach_block */
{
19
for
(
_layer
= 0;
_layer
<
nl
;
_layer
++)
20
{...}
21
_layer
= 0;
22
}
23
24
/**
25
... and an "inner" traversal, usable within for (int _i = 0; _i < _N; _i++) /* foreach */
loops
,
which
26
uses
the
`
point
.l`
index
as
local
layer
index
. */
27
28
#undef foreach_block_inner
29
macro
foreach_block_inner
(
Point
p
=
point
) {
30
for
(
p
.l = 0;
p
.l <
nl
;
p
.l++)
31
{...}
32
p
.l = 0;
33
}
34
35
/**
36
We also redefine the "per field" (inner) traversal. */
37
38
#undef foreach_blockf
39
macro
/* foreach_blockf */
{
40
for
(
p
.l = 0;
p
.l <
_attribute
[
_f
.i].
block
;
p
.l++)
41
{...}
42
p
.l = 0;
43
}
44
45
/**
46
The two indices are combined to access field values. In practice only
47
one of the indices is used. */
48
49
@
undef
_index
50
@
def
_index
(
a
,
m
)
51
(
a
.i + (
_layer
+
point
.l +
m
<
_attribute
[
a
.i].
block
?
52
_layer
+
point
.l +
m
: 0))
53
@
54
55
@
undef
val
56
@
define
val
(
a
,
k
,
p
,
m
)
data
(
k
,
p
,
m
)[
_index
(
a
,
m
)]
57
58
/**
59
foreach_layer() is just an alias for /* foreach_block */
. */
60
61
#define foreach_layer()
/* foreach_block */
a
const vector a
Definition
all-mach.h:59
val
if TRASH define &&NewPid *& val(newpid, 0, 0, 0)) -> pid > 0) @else @ define is_newpid()(((NewPid *)&val(newpid, 0, 0, 0)) ->pid > 0) @endif Array *linear_tree(size_t size, scalar newpid)
Definition
balance.h:13
k
define k
Definition
cartesian-common.h:8
m
define m((k)==0 &&(l)==0 &&(m)==0) macro2 foreach_point(double _x=0.
define
#define define
x
int x
Definition
common.h:76
_attribute
static _Attributes * _attribute
Definition
common.h:165
p
#define p
Definition
tree.h:320
_index
define _index(a, m)(a.i) @define val(a
point
Point point
Definition
conserving.h:86
nl
int nl
Definition
layers.h:9
_layer
which uses a global _layer index *int _layer
Definition
layers.h:15
foreach_block_inner
which uses the point l index as local layer index *macro foreach_block_inner(Point p=point)
Definition
layers.h:29
loops
loops
We redefine two types of block traversals.
Definition
layers.h:13
macro
macro
We also redefine the "per field" (inner) traversal.
Definition
layers.h:18
data
#define data(k, l)
Definition
linear.h:26
layer
double * layer
Definition
multilayer.h:44
which
static bool which(const char *command)
Definition
output.h:389
Point
Definition
linear.h:21
_Attributes::block
int block
Definition
common.h:161
index
Array * index
Definition
vertexbuffer.h:18
grid
layers.h
Generated by
1.9.8