#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include <mpi.h>
#include "allvars.h"
#include "proto.h"
Go to the source code of this file.
Defines | |
#define | boxSize_X boxSize |
#define | boxHalf_X boxHalf |
#define | boxSize_Y boxSize |
#define | boxHalf_Y boxHalf |
#define | boxSize_Z boxSize |
#define | boxHalf_Z boxHalf |
#define | NGB_PERIODIC_X(x) (xtmp=(x),(xtmp>boxHalf_X)?(xtmp-boxSize_X):((xtmp<-boxHalf_X)?(xtmp+boxSize_X):xtmp)) |
#define | NGB_PERIODIC_Y(x) (xtmp=(x),(xtmp>boxHalf_Y)?(xtmp-boxSize_Y):((xtmp<-boxHalf_Y)?(xtmp+boxSize_Y):xtmp)) |
#define | NGB_PERIODIC_Z(x) (xtmp=(x),(xtmp>boxHalf_Z)?(xtmp-boxSize_Z):((xtmp<-boxHalf_Z)?(xtmp+boxSize_Z):xtmp)) |
Functions | |
int | ngb_treefind_pairs (float searchcenter[3], float hsml, int *startnode) |
int | ngb_treefind_variable (float searchcenter[3], float hsml, int *startnode) |
int | ngb_clear_buf (float searchcenter[3], float hsml, int numngb) |
void | ngb_treeallocate (int npart) |
void | ngb_treefree (void) |
void | ngb_treebuild (void) |
This file contains routines for neighbour finding. We use the gravity-tree and a range-searching technique to find neighbours.
Definition in file ngb.c.
|
|
|
|
|
|
|
|
|
|
|
|
|
these macros maps a coordinate difference to the nearest periodic image Definition at line 47 of file ngb.c. Referenced by ngb_clear_buf(), ngb_treefind_pairs(), and ngb_treefind_variable(). |
|
Definition at line 48 of file ngb.c. Referenced by ngb_clear_buf(), ngb_treefind_pairs(), and ngb_treefind_variable(). |
|
Definition at line 49 of file ngb.c. Referenced by ngb_clear_buf(), ngb_treefind_pairs(), and ngb_treefind_variable(). |
|
The buffer for the neighbour list has a finite length MAX_NGB. For a large search region, this buffer can get full, in which case this routine can be called to eliminate some of the superfluous particles in the "corners" of the search box - only the ones in the inscribed sphere need to be kept. Definition at line 320 of file ngb.c. References FLOAT, NGB_PERIODIC_X, NGB_PERIODIC_Y, NGB_PERIODIC_Z, Ngblist, P, and particle_data::Pos. Referenced by ngb_treefind_variable(). |
|
Allocates memory for the neighbour list buffer. Definition at line 358 of file ngb.c. References All, boxHalf_X, boxHalf_Y, boxHalf_Z, global_data_all_processes::BoxSize, boxSize_X, boxSize_Y, boxSize_Z, endrun(), Ngblist, and ThisTask. |
|
This function constructs the neighbour tree. To this end, we actually need to construct the gravitational tree, because we use it now for the neighbour search. Definition at line 403 of file ngb.c. References force_treebuild(), N_gas, and ThisTask. Referenced by init(). |
|
This routine finds all neighbours `j' that can interact with the particle `i' in the communication buffer. Note that an interaction can take place if OR if . In the range-search this is taken into account, i.e. it is guaranteed that all particles are found that fulfil this condition, including the (more difficult) second part of it. For this purpose, each node knows the maximum h occuring among the particles it represents. < defines maximum length of neighbour list Definition at line 64 of file ngb.c. References All, DomainTask, Exportflag, Extnodes, FLOAT, extNODE::hmax, sph_particle_data::Hsml, global_data_all_processes::MaxPart, Nextnode, NGB_PERIODIC_X, NGB_PERIODIC_Y, NGB_PERIODIC_Z, Ngblist, Nodes, P, particle_data::Pos, SphP, and particle_data::Type. Referenced by hydro_evaluate(). |
|
This function returns neighbours with distance <= hsml and returns them in Ngblist. Actually, particles in a box of half side length hsml are returned, i.e. the reduction to a sphere still needs to be done in the calling routine. < defines maximum length of neighbour list < defines maximum length of neighbour list Definition at line 194 of file ngb.c. References All, NODE::d, DomainTask, Exportflag, FLOAT, global_data_all_processes::MaxPart, Nextnode, NODE::nextnode, ngb_clear_buf(), NGB_PERIODIC_X, NGB_PERIODIC_Y, NGB_PERIODIC_Z, Ngblist, Nodes, P, particle_data::Pos, NODE::sibling, ThisTask, and particle_data::Type. Referenced by density_evaluate(). |
|
free memory allocated for neighbour list buffer. Definition at line 394 of file ngb.c. References Ngblist. |