Streamer fluid modeling - An overview of ARCoS
1.0
|
General grid functions common for cdr and poisson grids. More...
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "grid.h"
#include "parameters.h"
#include "proto.h"
#include "species.h"
Go to the source code of this file.
Functions | |
int | grid_max_depth_r (grid_t *grid) |
Gets the maximum depth of a tree (the level of its deepest node) | |
double | grid_rmin_r (grid_t *grid) |
Gets the minimum r of a grid and all its descendants. | |
void | grid_print_r (grid_t *grid, int indent) |
Recursively prints one grid and all its descendants. | |
int | grid_contains (grid_t *grid, int i, int j, int check) |
Checks whether a point is in the interior or on a given boundary of a grid. | |
int | grid_overlap (grid_t *grid1, grid_t *grid2, int buff1, int buff2, int *left, int *bottom, int *right, int *top, int *level_diff) |
Checks whether two grids overlap and return the rectangle that they in common. | |
int | grid_overlap_with_shifts (grid_t *grid1, grid_t *grid2, int buff1, int buff2, int *left, int *bottom, int *right, int *top, int *level_diff, int shift_r, int shift_z) |
Checks the overlap between two grids. | |
void | grid_inherit_ext_bound (grid_t *grid) |
Makes a grid inherit the ext_bound field of its parent,. | |
grid_t * | grid_finest_containing_r (grid_t *grid, double r, double z) |
Finds the finest descendant of grid that contains the point given by the (r, z) coordinates. | |
int | grid_howmany_children (grid_t *grid) |
How many children does one grid have? | |
grid_t * | grid_get_child (grid_t *grid, int n) |
Finds child number n of the given grid. | |
General grid functions common for cdr and poisson grids.
Definition in file grid.c.
int grid_max_depth_r | ( | grid_t * | grid | ) |
double grid_rmin_r | ( | grid_t * | grid | ) |
void grid_print_r | ( | grid_t * | grid, |
int | indent | ||
) |
int grid_contains | ( | grid_t * | grid, |
int | i, | ||
int | j, | ||
int | check | ||
) |
Checks whether a point is in the interior or on a given boundary of a grid.
Does the grid contain the point (i, j) (in its own coordinates)?
check has the following meaning:
GRID_INSIDE : Checks if the point is in the interior of the grid
BND_MASK_* : Checks if it is on the given boundary (BND_MASK_ALL checks for any boundary).
Definition at line 73 of file grid.c.
int grid_overlap | ( | grid_t * | grid1, |
grid_t * | grid2, | ||
int | buff1, | ||
int | buff2, | ||
int * | left, | ||
int * | bottom, | ||
int * | right, | ||
int * | top, | ||
int * | level_diff | ||
) |
Checks whether two grids overlap and return the rectangle that they in common.
Checks whether two grids overlap and return the rectangle that they have in common in the coordinates of the finest grid in (*left, *bottom) - (*right, *top)
Note that *left, *bottom... can be modified even if the two grids do not overlap. buff1 and buff2 are integers that specify the numbers of cells that are taken as buffer in the boundaries for grid1 and grid2.
Definition at line 124 of file grid.c.
int grid_overlap_with_shifts | ( | grid_t * | grid1, |
grid_t * | grid2, | ||
int | buff1, | ||
int | buff2, | ||
int * | left, | ||
int * | bottom, | ||
int * | right, | ||
int * | top, | ||
int * | level_diff, | ||
int | shift_r, | ||
int | shift_z | ||
) |
Checks the overlap between two grids.
Checks the overlap between two grids before it shifts the coarser grid by (shift_r << (level_diff - 1), shift_z << (level_diff - 1) (in finer grid coordinates).
Q: WTF! WHY!!!?
A: We use this to implement the mapping between electric fields. Since The electric field is evaluated not in the cell centers but in the borders, when we interpolate we have to take a shift into account. See mapper.c and mapper.h for more info.
Definition at line 145 of file grid.c.
void grid_inherit_ext_bound | ( | grid_t * | grid | ) |
Finds the finest descendant of grid that contains the point given by the (r, z) coordinates.
Or NULL if the point is not contained in grid. We assume that only ONE sub-grid can contain a given point.
Definition at line 245 of file grid.c.
int grid_howmany_children | ( | grid_t * | grid | ) |