Streamer fluid modeling - An overview of ARCoS  1.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Functions
grid.c File Reference

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"
Include dependency graph for grid.c:

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_tgrid_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_tgrid_get_child (grid_t *grid, int n)
 Finds child number n of the given grid.
 

Detailed Description

General grid functions common for cdr and poisson grids.

Definition in file grid.c.

Function Documentation

int grid_max_depth_r ( grid_t grid)

Gets the maximum depth of a tree (the level of its deepest node)

Definition at line 15 of file grid.c.

Here is the call graph for this function:

Here is the caller graph for this function:

double grid_rmin_r ( grid_t grid)

Gets the minimum r of a grid and all its descendants.

Definition at line 30 of file grid.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void grid_print_r ( grid_t grid,
int  indent 
)

Recursively prints one grid and all its descendants.

Definition at line 48 of file grid.c.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Here is the caller graph for this function:

void grid_inherit_ext_bound ( grid_t grid)

Makes a grid inherit the ext_bound field of its parent,.

with the appropiate modifications.

Definition at line 205 of file grid.c.

Here is the caller graph for this function:

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.

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.

Here is the call graph for this function:

Here is the caller graph for this function:

int grid_howmany_children ( grid_t grid)

How many children does one grid have?

Definition at line 267 of file grid.c.

Here is the caller graph for this function:

grid_t* grid_get_child ( grid_t grid,
int  n 
)

Finds child number n of the given grid.

If it doesn't have enough children just returns NULL

Definition at line 284 of file grid.c.

Here is the caller graph for this function: