grid.cppΒΆ

An implementation cpp file containing functions for constructing the projection grid and for performing the smoothing operation of particle properties on to the grid.

Functions

bool compActive(pair< int, bool > a, pair< int, bool > b)

Comparison function for use in sort, arranges particles so active particles are first.

Return
boolean for use in sort function
Parameters
  • a -

    pair containing particle ID and active state

  • b -

    pair containing particle ID and active state

double dX(double X0, double X1)

Function returns difference in positions in arbitrary dimension, non-periodic.

Return
distance between coordinates
Parameters
  • X0 -

    position for differencing

  • X1 -

    position for differencing

int dBin(int dbin, int NDim)

Function which simply returns inputted number of bins/cells between points since non-periodic.

Return
number of bins between two points
Parameters
  • dbin -

    number of bins/cells between points

  • NDim -

    number of bins/cells in relevant dimension

int grid_index(int index, int bmin, int bsize)

Function which simply returns inputted index since non-periodic.

Return
bin index
Parameters
  • index -

    number of bins/cells between points

  • bmin -

    index of (hypothetical) grid cell at siimulation lower limit in relevant dimension

  • bsize -

    length of bin/cell in relevant direction

double calc_r2(ParticleData * p, GridVertex * g, int i, int j, int k)

Function which calculates the 2D radial distance between a particle and grid point.

Return
radial distance
Parameters
  • p -

    particle under consideration

  • g -

    grid point/cell under consideration

  • i -

    3D grid z index (unused in this function version)

  • j -

    3D grid y index (unused in this function version)

  • k -

    3D grid x index (unused in this function version)

void grid_construct(void)

Function which constructs the grid onto which particle properties are smoothed.

void bin_parts(void)

Function calculates which bin/cell particles lie in by assuming cells are evenly spaced.

int check_active_parts(DynamicArray< pair< int, bool > > & order)

Function calculates which bin/cell particles lie in by assuming cells are evenly spaced.

void eval_lims(int * lXBin, int * uXBin, int NDim, int bmin, int bsize)
void tabulate_hsml_r(double hMax, int clean)
void prop_assignment(void)
void data_write(const char * fname)

Variables

ThreeDGrid< GridVertex > grid

main 3D array of grid data on to which particle properties are smoothed

int active_type_map[6]

if type is active in calc stores index where 0<=index<N_types_active

int N_types_active

number of particle types active in calculations

int BoxSize_bx

simulation x-dimension side length measured in dx_grid

int BoxSize_by

simulation y-dimension side length measured in dy_grid

int BoxSize_bz

simulation z-dimension side length measured in dz_grid

ThreeDGrid< double > dr2Tab

tabulated r^2 values

int hMax_Nx

number of cells spanned in x dir. by largest smoothing length

int hMax_Ny

number of cells spanned in y dir. by largest smoothing length

int hMax_Nz

number of cells spanned in z dir. by largest smoothing length

double hMax2

largest particle smoothing length ^2