Basilisk CFD
Adaptive Cartesian mesh PDE framework
Loading...
Searching...
No Matches
stencils.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _External
 
struct  ForeachData
 

Typedefs

typedef struct _External External
 

Enumerations

enum  {
  s_centered = 1 << 0 , s_face = 1 << 1 , s_restriction = 1 << 2 , s_input = 1 << 3 ,
  s_output = 1 << 4 , s_nowarning = 1 << 5
}
 

Functions

 for (int _i=0;_i< _N;_i++)
 
static void set_dirty_stencil (scalar s)
 
static bool scalar_is_dirty (scalar s)
 
static bool scalar_depends_from (scalar a, scalar b)
 Does the boundary conditions on a depend on those on b?
 
void boundary_internal (scalar *list, const char *fname, int line)
 There are two types of boundary conditions: "full" boundary conditions, done by boundary_internal() and "flux" boundary conditions (i.e.
 
void check_stencil (ForeachData *loop)
 This function is called after the stencil access detection, just before the (real) foreach loop is executed.
 
void boundary_stencil (ForeachData *loop)
 This functions applies the boundary conditions, as defined by check_stencil().
 
macro2 foreach_stencil (char flags, Reduce reductions)
 
macro2 foreach_vertex_stencil (char flags, Reduce reductions)
 
macro2 foreach_face_stencil (char flags, Reduce reductions, const char *order)
 
macro2 foreach_level_stencil (int l, char flags, Reduce reductions)
 
macro2 foreach_coarse_level_stencil (int l, char flags, Reduce reductions)
 
macro2 foreach_level_or_leaf_stencil (int l, char flags, Reduce reductions)
 
macro2 foreach_point_stencil (double xp, double yp, double zp, char flags, Reduce reductions)
 
macro2 foreach_region_stencil (coord p, coord box[2], coord n, char flags, Reduce reductions)
 
macro2 _stencil_is_face_x (ForeachData l=_loop)
 
macro2 _stencil_is_face_y (ForeachData l=_loop)
 
macro2 _stencil_is_face_z (ForeachData l=_loop)
 
void stencil_val (Point p, scalar s, int i, int j, int k, const char *file, int line, bool overflow)
 
void stencil_val_a (Point p, scalar s, int i, int j, int k, bool input, const char *file, int line)
 
def _stencil_val (a, _i, _j, _k) stencil_val(point
 
def false def _stencil_val_o (a, _i, _j, _k) stencil_val(point
 
def false def true def _stencil_val_a (a, _i, _j, _k) stencil_val_a(point
 
def false def true def S_LINENO def _stencil_val_r (a, _i, _j, _k) stencil_val_a(point
 
def false def true def S_LINENO def S_LINENO define _stencil_fine (a, _i, _j, _k) _stencil_val(a
 
def false def true def S_LINENO def S_LINENO define _k define _k define _stencil_fine_a (a, _i, _j, _k) _stencil_val_a(a
 
def false def true def S_LINENO def S_LINENO define _k define _k define _k define _stencil_fine_r (a, _i, _j, _k) _stencil_val_r(a
 
def false def true def S_LINENO def S_LINENO define _k define _k define _k define _k define _stencil_coarse (a, _i, _j, _k) _stencil_val(a
 
def false def true def S_LINENO def S_LINENO define _k define _k define _k define _k define _k define _stencil_coarse_a (a, _i, _j, _k) _stencil_val_a(a
 
def false def true def S_LINENO def S_LINENO define _k define _k define _k define _k define _k define _k define _stencil_coarse_r (a, _i, _j, _k) _stencil_val_r(a
 
def false def true def S_LINENO def S_LINENO define _k define _k define _k define _k define _k define _k define _k define r_assign (x) @define _assign(x) @define _stencil_neighbor(i
 
def false def true def S_LINENO def S_LINENO define _k define _k define _k define _k define _k define _k define _k define k define _stencil_child (i, j, k) @define _stencil_aparent(i
 
def false def true def S_LINENO def S_LINENO define _k define _k define _k define _k define _k define _k define _k define k define k define _stencil_aparent_a (i, j, k) @define _stencil_aparent_r(i
 
def false def true def S_LINENO def S_LINENO define _k define _k define _k define _k define _k define _k define _k define k define k define k define _stencil_allocated (i, j, k) true @define _stencil_neighborp(i
 
def false def true def S_LINENO def S_LINENO define _k define _k define _k define _k define _k define _k define _k define k define k define k define k neighborp (i, j, k) int _stencil_nop
 
define _stencil_val_higher_dimension (_stencil_nop=1) @define _stencil__val_constant(a
 
define _k (_stencil_nop=1) @define _stencil_val_diagonal(a
 

Variables

before each foreach loop
 
before each foreach a minimal version of the loop body The flags indicate the status of boundary conditions and whether the field is used as input or output within a given loop The width is the width of the access stencil *enum { ... }  StencilFlags
 
 attribute
 
void(* boundary_face )(vectorl)
 
def a
 
def _i
 
def _j
 
def _k
 
def S__FILE__
 
def S_LINENO
 
def false def true def false
 
def false def true def S_LINENO def true
 
def false def true def S_LINENO def S_LINENO define _k define _k define _k define _k define _k define _k define _k define j
 

Typedef Documentation

◆ External

Definition at line 39 of file stencils.h.

Enumeration Type Documentation

◆ anonymous enum

Enumerator
s_centered 
s_face 
s_restriction 
s_input 
s_output 
s_nowarning 

Definition at line 18 of file stencils.h.

Function Documentation

◆ _k()

define _k ( _stencil_nop  = 1)

◆ _stencil_allocated()

◆ _stencil_aparent_a()

◆ _stencil_child()

◆ _stencil_coarse()

def false def true def S_LINENO def S_LINENO define _k define _k define _k define _k define _stencil_coarse ( a  ,
_i  ,
_j  ,
_k   
)

◆ _stencil_coarse_a()

def false def true def S_LINENO def S_LINENO define _k define _k define _k define _k define _k define _stencil_coarse_a ( a  ,
_i  ,
_j  ,
_k   
)

◆ _stencil_coarse_r()

◆ _stencil_fine()

def false def true def S_LINENO def S_LINENO define _k define _stencil_fine ( a  ,
_i  ,
_j  ,
_k   
)

◆ _stencil_fine_a()

def false def true def S_LINENO def S_LINENO define _k define _k define _stencil_fine_a ( a  ,
_i  ,
_j  ,
_k   
)

◆ _stencil_fine_r()

def false def true def S_LINENO def S_LINENO define _k define _k define _k define _stencil_fine_r ( a  ,
_i  ,
_j  ,
_k   
)

◆ _stencil_is_face_x()

macro2 _stencil_is_face_x ( ForeachData  l = _loop)

Definition at line 395 of file stencils.h.

References l.

◆ _stencil_is_face_y()

macro2 _stencil_is_face_y ( ForeachData  l = _loop)

Definition at line 396 of file stencils.h.

References l.

◆ _stencil_is_face_z()

macro2 _stencil_is_face_z ( ForeachData  l = _loop)

Definition at line 397 of file stencils.h.

References l.

◆ _stencil_val()

def _stencil_val ( a  ,
_i  ,
_j  ,
_k   
)

◆ _stencil_val_a()

def false def true def _stencil_val_a ( a  ,
_i  ,
_j  ,
_k   
)

◆ _stencil_val_higher_dimension()

define _stencil_val_higher_dimension ( _stencil_nop  = 1)

◆ _stencil_val_o()

def false def _stencil_val_o ( a  ,
_i  ,
_j  ,
_k   
)

◆ _stencil_val_r()

def false def true def S_LINENO def _stencil_val_r ( a  ,
_i  ,
_j  ,
_k   
)

◆ boundary_internal()

void boundary_internal ( scalar list,
const char fname,
int  line 
)

There are two types of boundary conditions: "full" boundary conditions, done by boundary_internal() and "flux" boundary conditions (i.e.

normal components on faces only) done by boundary_face().

Definition at line 541 of file cartesian-common.h.

References boundary_face, boundary_level, cm, dimension, flux, free(), scalar::i, i, list, list_add(), list_add_depends(), s, s_centered, s_face, scalar_is_dirty(), vectorl::x, and x.

Referenced by boundary_stencil().

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

◆ boundary_stencil()

void boundary_stencil ( ForeachData loop)

This functions applies the boundary conditions, as defined by check_stencil().

We apply "full" boundary conditions.

We update the dirty status of fields which will be write-accessed by the foreach loop.

Definition at line 274 of file stencils.h.

References boundary_face, boundary_internal(), dimension, flux, free(), scalar::i, i, loop, s, set_dirty_stencil(), and x.

Referenced by cartesian_init_scalar(), cartesian_scalar_clone(), and foreach_stencil().

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

◆ check_stencil()

void check_stencil ( ForeachData loop)

This function is called after the stencil access detection, just before the (real) foreach loop is executed.

This is where we use the stencil access pattern to see whether boundary conditions need to be applied.

We check the accesses for each field...

If the field is read and dirty, we need to check if boundary conditions need to be applied.

If this is a face field, we check whether "full" BCs need to be applied, or whether "face" BCs are sufficient.

For dirty, centered fields BCs need to be applied if the stencil is wider than zero.

Write accesses need to be consistent with the declared field type (i.e. face or vertex).

If the field is write-accessed, we add it to the 'dirty' list.

Definition at line 112 of file stencils.h.

References _layer, d, dimension, free(), scalar::i, i, init_face_vector, init_vertex_scalar, input(), left, list_append(), list_lookup(), loop, right, s, s_face, s_input, s_nowarning, s_output, scalar_depends_from(), scalar_is_dirty(), strdup(), v, vertex, x, y, and z.

Referenced by foreach_stencil(), and foreach_stencil_generic().

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

◆ for()

for ( )

◆ foreach_coarse_level_stencil()

macro2 foreach_coarse_level_stencil ( int  l,
char  flags,
Reduce  reductions 
)

Definition at line 373 of file stencils.h.

References flags, foreach_level_stencil(), l, and reductions.

Here is the call graph for this function:

◆ foreach_face_stencil()

macro2 foreach_face_stencil ( char  flags,
Reduce  reductions,
const char order 
)

Definition at line 359 of file stencils.h.

References flags, foreach_stencil(), and reductions.

Here is the call graph for this function:

◆ foreach_level_or_leaf_stencil()

macro2 foreach_level_or_leaf_stencil ( int  l,
char  flags,
Reduce  reductions 
)

Definition at line 378 of file stencils.h.

References flags, foreach_level_stencil(), l, and reductions.

Here is the call graph for this function:

◆ foreach_level_stencil()

macro2 foreach_level_stencil ( int  l,
char  flags,
Reduce  reductions 
)

Definition at line 364 of file stencils.h.

References point, and x.

Referenced by foreach_coarse_level_stencil(), and foreach_level_or_leaf_stencil().

Here is the caller graph for this function:

◆ foreach_point_stencil()

macro2 foreach_point_stencil ( double  xp,
double  yp,
double  zp,
char  flags,
Reduce  reductions 
)

Definition at line 383 of file stencils.h.

References flags, foreach_stencil(), and reductions.

Here is the call graph for this function:

◆ foreach_region_stencil()

macro2 foreach_region_stencil ( coord  p,
coord  box[2],
coord  n,
char  flags,
Reduce  reductions 
)

Definition at line 389 of file stencils.h.

References flags, foreach_stencil(), and reductions.

Here is the call graph for this function:

◆ foreach_stencil()

macro2 foreach_stencil ( char  flags,
Reduce  reductions 
)

Definition at line 329 of file stencils.h.

References _attribute, baseblock, boundary_stencil(), check_stencil(), ForeachData::fname, scalar::i, i, point, s, S__FILE__, S_LINENO, and x.

Referenced by foreach_face_stencil(), foreach_point_stencil(), foreach_region_stencil(), and foreach_vertex_stencil().

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

◆ foreach_vertex_stencil()

macro2 foreach_vertex_stencil ( char  flags,
Reduce  reductions 
)

Definition at line 352 of file stencils.h.

References flags, foreach_stencil(), reductions, and x.

Here is the call graph for this function:

◆ neighborp()

◆ r_assign()

◆ scalar_depends_from()

static bool scalar_depends_from ( scalar  a,
scalar  b 
)
inlinestatic

Does the boundary conditions on a depend on those on b?

Definition at line 88 of file stencils.h.

References a, b, scalar::i, s, and x.

Referenced by check_stencil().

Here is the caller graph for this function:

◆ scalar_is_dirty()

static bool scalar_is_dirty ( scalar  s)
inlinestatic

Automatic boundary conditions

Boundary conditions need to be applied if s is dirty, or if any of the field d it depends on is dirty.

Definition at line 74 of file stencils.h.

References d, s, s_centered, and x.

Referenced by boundary_internal(), and check_stencil().

Here is the caller graph for this function:

◆ set_dirty_stencil()

static void set_dirty_stencil ( scalar  s)
static

Definition at line 34 of file stencils.h.

References s.

Referenced by boundary_stencil(), input_gfs(), mpi_boundary_refine(), mpi_boundary_update(), set_prolongation(), and set_restriction().

Here is the caller graph for this function:

◆ stencil_val()

void stencil_val ( Point  p,
scalar  s,
int  i,
int  j,
int  k,
const char file,
int  line,
bool  overflow 
)

Definition at line 1107 of file cartesian-common.h.

References d, dimension, fflush(), file, scalar::i, i, index, j, k, line, p, s, s_input, s_output, write_stencil_index(), and x.

Here is the call graph for this function:

◆ stencil_val_a()

void stencil_val_a ( Point  p,
scalar  s,
int  i,
int  j,
int  k,
bool  input,
const char file,
int  line 
)

Definition at line 1154 of file cartesian-common.h.

References d, dimension, fflush(), file, scalar::i, i, index, input(), j, k, line, p, s, s_input, s_output, write_stencil_index(), and x.

Here is the call graph for this function:

Variable Documentation

◆ _i

define _i

Definition at line 405 of file stencils.h.

Referenced by adapt_wavelet(), advance_generic(), advance_saint_venant(), advect(), advection(), advection_centered(), advection_upwind(), axistream(), balance(), centered_gradient(), check_flags(), check_two_one(), column_propagation(), compile_expression(), constant_NNT(), correct_qz(), correction(), curvature(), debug_mpi(), dphidt(), equilibrium_tide(), event_acceleration(), event_adapt(), event_advance(), event_advection_term(), event_defaults(), event_end_timestep(), event_face_fields(), event_init(), event_metric(), event_pressure(), event_properties(), event_stability(), event_tracer_advection(), event_tracer_diffusion(), event_update_eta(), event_velocity(), event_viscous_term(), event_vof(), face_fraction(), fault(), flag_border_cells(), foreach_boundary_dir(), foreach_child(), foreach_mem(), foreach_neighbor(), foreach_segment(), foreach_tree(), foreach_visible(), fraction(), fractions_cleanup(), gradients(), h_relax(), h_residual(), horizontal_diffusion(), if(), implicit_horizontal_diffusion(), input_gfs(), input_pgm(), lambda2(), levelset_to_vof(), mg_cycle(), momentum(), mpi_boundary_coarsen(), mpi_boundary_refine(), mpi_boundary_update_buffers(), msolve(), neighborhood(), no_coalescence(), ohmic_flux(), output_tree(), prediction(), project(), reconstruction(), refine(), refine_level(), relax(), relax_diffusion(), relax_GN(), relax_hydro(), relax_nh(), relax_nh(), relax_nh1(), relax_psi(), relax_thermal(), relax_viscosity(), remove_droplets(), residual(), residual_diffusion(), residual_hydro(), residual_nh(), residual_psi(), residual_thermal(), residual_viscosity(), restore_mpi(), RPE(), run(), runge_kutta(), solid(), solve(), subtree_size(), tag(), timestep(), tracer_fluxes(), tree_boundary_level(), tree_check(), unrefine(), update(), update_cache_f(), update_conservation(), update_green_naghdi(), update_saint_venant(), update_tracer(), vertical_fluxes(), vertical_remapping(), vertical_velocity(), viscosity(), viscosity_explicit(), vof_advection(), vorticity(), and z_indexing().

◆ _j

define _j

Definition at line 405 of file stencils.h.

Referenced by foreach_child(), and foreach_neighbor().

◆ _k

◆ a

Definition at line 405 of file stencils.h.

Referenced by scalar_depends_from().

◆ attribute

attribute
Initial value:
{
struct {
int bc, io, width;
int x
Definition common.h:76
scalar scalar coord coord double bc
Definition embed.h:378

Definition at line 28 of file stencils.h.

◆ boundary_face

void(* boundary_face) (vectorl) ( vectorl  )

Definition at line 104 of file stencils.h.

Referenced by boundary_stencil().

◆ false

def false def true def false

Definition at line 411 of file stencils.h.

◆ j

◆ loop

Definition at line 11 of file stencils.h.

Referenced by boundary_stencil(), check_stencil(), and residual_viscosity().

◆ S__FILE__

Definition at line 405 of file stencils.h.

Referenced by BEGIN_FOREACH(), foreach_stencil(), and foreach_stencil_generic().

◆ S_LINENO

def false def S_LINENO

Definition at line 405 of file stencils.h.

Referenced by BEGIN_FOREACH(), foreach_stencil(), and foreach_stencil_generic().

◆ []

before each foreach a minimal version of the loop body The flags indicate the status of boundary conditions and whether the field is used as input or output within a given loop The width is the width of the access stencil* enum { ... } StencilFlags

◆ true

def false def true def S_LINENO def true

Definition at line 414 of file stencils.h.