Functions to maintain link cell structures for fast pair finding. More...
#include "mytype.h"

Go to the source code of this file.
Data Structures | |
| struct | LinkCellSt |
| Link cell data. More... | |
Macros | |
| #define | MAXATOMS 64 |
| The maximum number of atoms that can be stored in a link cell. More... | |
Typedefs | |
| typedef struct LinkCellSt | LinkCell |
| Link cell data. More... | |
Functions | |
| LinkCell * | initLinkCells (const struct DomainSt *domain, real_t cutoff) |
| void | destroyLinkCells (LinkCell **boxes) |
| int | getNeighborBoxes (LinkCell *boxes, int iBox, int *nbrBoxes) |
| void | putAtomInBox (LinkCell *boxes, struct AtomsSt *atoms, const int gid, const int iType, const real_t x, const real_t y, const real_t z, const real_t px, const real_t py, const real_t pz) |
| int | getBoxFromTuple (LinkCell *boxes, int x, int y, int z) |
| Calculates the link cell index from the grid coords. More... | |
| void | moveAtom (LinkCell *boxes, struct AtomsSt *atoms, int iId, int iBox, int jBox) |
| Move an atom from one link cell to another. More... | |
| void | updateLinkCells (LinkCell *boxes, struct AtomsSt *atoms) |
| Update link cell data structures when the atoms have moved. More... | |
| int | maxOccupancy (LinkCell *boxes) |
Functions to maintain link cell structures for fast pair finding.
Definition in file linkCells.h.
| #define MAXATOMS 64 |
The maximum number of atoms that can be stored in a link cell.
Definition at line 10 of file linkCells.h.
| typedef struct LinkCellSt LinkCell |
Link cell data.
For convenience, we keep a copy of the localMin and localMax coordinates that are also found in the DomainsSt.
| void destroyLinkCells | ( | LinkCell ** | boxes | ) |
Definition at line 112 of file linkCells.c.


| int getBoxFromTuple | ( | LinkCell * | boxes, |
| int | ix, | ||
| int | iy, | ||
| int | iz | ||
| ) |
Calculates the link cell index from the grid coords.
The valid coordinate range in direction ii is [-1, gridSize[ii]]. Any coordinate that involves a -1 or gridSize[ii] is a halo link cell. Because of the order in which the local and halo link cells are stored the indices of the halo cells are special cases.
Definition at line 189 of file linkCells.c.

| int getNeighborBoxes | ( | LinkCell * | boxes, |
| int | iBox, | ||
| int * | nbrBoxes | ||
| ) |
Populates the nbrBoxes array with the 27 boxes that are adjacent to iBox. The count is 27 instead of 26 because iBox is included in the list (as neighbor 13). Caller is responsible to alloc and free nbrBoxes.
Definition at line 130 of file linkCells.c.


| int maxOccupancy | ( | LinkCell * | boxes | ) |
Definition at line 293 of file linkCells.c.


Move an atom from one link cell to another.
| iId | [in] The index with box iBox of the atom to be moved. |
| iBox | [in] The index of the link cell the particle is moving from. |
| jBox | [in] The index of the link cell the particle is moving to. |
Definition at line 242 of file linkCells.c.


| void putAtomInBox | ( | LinkCell * | boxes, |
| Atoms * | atoms, | ||
| const int | gid, | ||
| const int | iType, | ||
| const real_t | x, | ||
| const real_t | y, | ||
| const real_t | z, | ||
| const real_t | px, | ||
| const real_t | py, | ||
| const real_t | pz | ||
| ) |
Finds the appropriate link cell for an atom based on the spatial coordinates and stores data in that link cell.
| [in] | gid | The global of the atom. |
| [in] | iType | The species index of the atom. |
| [in] | x | The x-coordinate of the atom. |
| [in] | y | The y-coordinate of the atom. |
| [in] | z | The z-coordinate of the atom. |
| [in] | px | The x-component of the atom's momentum. |
| [in] | py | The y-component of the atom's momentum. |
| [in] | pz | The z-component of the atom's momentum. |
Definition at line 155 of file linkCells.c.


Update link cell data structures when the atoms have moved.
This is the first step in returning data structures to a consistent state after the atoms move each time step. First we discard all atoms in the halo link cells. These are all atoms that are currently stored on other ranks and so any information we have about them is stale. Next, we move any atoms that have crossed link cell boundaries into their new link cells. It is likely that some atoms will be moved into halo link cells. Since we have deleted halo atoms from other tasks, it is clear that any atoms that are in halo cells at the end of this routine have just transitioned from local to halo atoms. Such atom must be sent to other tasks by a halo exchange to avoid being lost.
Definition at line 273 of file linkCells.c.

