|
MolSim
|
Cell encapsulation class for implementing the linked cell method. More...
#include <CellContainer.h>
Classes | |
| class | SpecialParticleIterator |
| A special iterator for iterating over the boundary and halo cell containers. More... | |
Public Member Functions | |
| CellContainer (const std::array< double, 3 > &domainSize, const std::array< BoundaryCondition, 6 > &conditions, double cutoff, ParticleContainer &particles, size_t dim=3) | |
| Constructs a new CellContainer and initializes all Cell objects and locks. | |
| ~CellContainer () | |
| Destroys the CellContainer object and frees the reserved locks. | |
| ContainerType::iterator | begin () |
| Standard library iterator function for marking the beginning of the iteration process. | |
| ContainerType::iterator | end () |
| Standard library iterator function for marking the end of the iteration process. | |
| ParticleContainer::PairIterator | beginPairs () |
| Direct access to the beginning of the ParticleContainer's PairIterator. | |
| ParticleContainer::PairIterator | endPairs () |
| Direct access to the end of the ParticleContainer's PairIterator. | |
| ContainerType::const_iterator | begin () const |
| Standard library iterator function for marking the beginning of the iteration process of a const CellContainer. | |
| ContainerType::const_iterator | end () const |
| Standard library iterator function for marking the end of the iteration process of a const CellContainer. | |
| SpecialParticleIterator | boundaryBegin () |
| Gets a SpecialParticleIterator pointing to the beginning of the boundary Cell pointer container. | |
| SpecialParticleIterator | boundaryEnd () |
| Gets a SpecialParticleIterator pointing to the end of the boundary Cell pointer container. | |
| SpecialParticleIterator | haloBegin () |
| Gets a SpecialParticleIterator pointing to the beginning of the halo Cell pointer container. | |
| SpecialParticleIterator | haloEnd () |
| Gets a SpecialParticleIterator pointing to the end of the halo Cell pointer container. | |
| Cell & | operator[] (size_t index) |
| Dereference of the [] operator. | |
| const Cell & | operator[] (size_t index) const |
| Dereference of the [] operator (const). | |
| std::vector< Cell > & | getCells () |
| Gets a reference to the Cell container. | |
| const std::vector< Cell > & | getCells () const |
| Gets a const reference to the Cell container. | |
| std::vector< std::reference_wrapper< Cell > > & | getBorderCells () |
| Gets a reference to the border Cell container. | |
| const std::vector< std::reference_wrapper< Cell > > & | getBorderCells () const |
| Gets a const reference to the border Cell container. | |
| std::vector< std::reference_wrapper< Cell > > & | getHaloCells () |
| Gets a reference to the halo Cell container. | |
| const std::vector< std::reference_wrapper< Cell > > & | getHaloCells () const |
| Gets a const reference to the halo Cell container. | |
| std::vector< std::reference_wrapper< Cell > > & | getIterableCells () |
| Gets a reference to the iterable Cell container. | |
| const std::vector< std::reference_wrapper< Cell > > & | getIterableCells () const |
| Gets a const reference to the iterable Cell container. | |
| void | removeHaloCellParticles () |
| Removes the active halo Cell Particle objects. | |
| int | getCellIndex (const std::array< double, 3 > &position) |
| Gets the 1D index in the Cell container based on the given position. | |
| void | deleteParticle (Particle &p) |
| Removes a Particle from a Cell and marks it inactive. | |
| bool | addParticle (Particle &p) |
| Adds a Particle to the Cell container. | |
| bool | moveParticle (Particle &p) |
| Moves a particle from one Cell to another. | |
| std::array< int, 3 > | getVirtualCellCoordinates (int index) const |
| Gets the coordinates of a Cell from its index. | |
| std::array< double, 3 > | getMirrorPosition (const std::array< double, 3 > &position, const Cell &from, const Cell &to, int direction) const |
| Mirrors a position from a source Cell to a destination Cell. | |
| int | getOppositeNeighbor (int cellIndex, HaloLocation direction) const |
| Gets the index of the opposing Cell in the specified direction. | |
| void | calculateNeighbors (int cellIndex) |
| Computes the vector of neighbouring Cell indices, including the Cell itself. | |
| const std::vector< int > & | getNeighbors (int cellIndex) const |
| Gets a vector of neighbouring Cell indices, including the Cell itself. | |
| std::vector< std::reference_wrapper< Cell > > | getNeighborCells (int cellIndex) |
| int | getOppositeOfHalo (const Cell &from, HaloLocation location) |
| For a halo cell returns the index of the border cell on the opposite side of the domain. | |
| int | getOppositeOfBorder (const Cell &from, BorderLocation location) |
| For a border cell returns the index of the halo cell on the opposite side of the domain. | |
| std::vector< int > | getOppositeOfBorderCorner (const Cell &from, std::vector< BorderLocation > &locations) |
| For a border cell returns the indices of the corner cells on the opposite sides of the domain. | |
| std::vector< std::vector< BorderLocation > > | getBorderCombinations (std::vector< BorderLocation > &locations) |
| For a collection of border locations, returns all unique pairs. | |
| const std::array< double, 3 > & | getDomainSize () const |
| Gets a const reference to the CellContainer's domain size. | |
| const std::array< double, 3 > & | getCellSize () const |
| Gets a const reference to the CellContainer's cell size. | |
| const std::array< size_t, 3 > & | getNumCells () const |
| Gets a const reference to the CellContainer's cell count in each dimension. | |
| const std::array< BoundaryCondition, 6 > & | getConditions () const |
| Gets the boundary conditions at each boundary. | |
| double | getCutoff () const |
| Gets the cutoff radius used for calculating the cell size. | |
| size_t | getDim () const |
| Gets the number of dimensions of the linked cells. | |
| bool | getAnyPeriodic () const |
| Checks if any boundary condition is periodic. | |
| ParticleContainer & | getParticles () |
| Gets a reference to the primary ParticleContainer. | |
| const ParticleContainer & | getParticles () const |
| Gets a const reference to the primary ParticleContainer. | |
| size_t | size () const |
| Gets the size of the ParticleContainer, including all inactive Cells. | |
| size_t | activeSize () const |
| Gets the amount of active Particle objects in the ParticleContainer. | |
| void | printCellIndices () const |
| Debug function to print the indices of all cells for a 2D container. | |
| void | printCellContents () const |
| Debug function to print the contents of each cell. | |
Private Types | |
| using | ContainerType = std::vector< Cell > |
| Typedef for the underlying Cell container type. | |
Private Attributes | |
| ContainerType | cells |
| The container of Cell objects itself. | |
| std::vector< omp_lock_t > | cellLocks |
| Container of mutual exclusion locks for each cell. | |
| std::vector< std::reference_wrapper< Cell > > | borderCells |
| Container of references to border cells. | |
| std::vector< std::reference_wrapper< Cell > > | haloCells |
| Container of references to halo cells. | |
| std::vector< std::reference_wrapper< Cell > > | iterableCells |
| Container of references to cells to iterate over when calculating the forces between particles. | |
| std::array< double, 3 > | domainSize |
| The size of the domain in each dimension. | |
| std::array< double, 3 > | cellSize {0, 0, 0} |
| The size of each cell in each dimension (default: 0, 0, 0). | |
| std::array< size_t, 3 > | numCells {1, 1, 1} |
| The number of cells in each dimension (default: 1, 1, 1). | |
| std::array< BoundaryCondition, 6 > | conditions |
| An array of boundary conditions to be applied at each boundary (North, South, West, East, Above, Below). | |
| double | cutoff |
| The cutoff radius. | |
| size_t | dim |
| The number of dimensions (2/3) | |
| bool | anyPeriodic {false} |
| Determines if there are any periodic halo cells. | |
| ParticleContainer & | particles |
| A reference to the overarching ParticleContainer. | |
Cell encapsulation class for implementing the linked cell method.
|
private |
Typedef for the underlying Cell container type.
| CellContainer::CellContainer | ( | const std::array< double, 3 > & | domainSize, |
| const std::array< BoundaryCondition, 6 > & | conditions, | ||
| double | cutoff, | ||
| ParticleContainer & | particles, | ||
| size_t | dim = 3 |
||
| ) |
Constructs a new CellContainer and initializes all Cell objects and locks.
| domainSize | The size of the domain. |
| conditions | The boundary conditions to be applied at each boundary. |
| cutoff | The cutoff radius. |
| particles | The main ParticleContainer. |
| dim | The dimension of the container. May either be two- (2) or three-dimensional (3). |
| CellContainer::~CellContainer | ( | ) |
Destroys the CellContainer object and frees the reserved locks.
| size_t CellContainer::activeSize | ( | ) | const |
Gets the amount of active Particle objects in the ParticleContainer.
| bool CellContainer::addParticle | ( | Particle & | p | ) |
| ContainerType::iterator CellContainer::begin | ( | ) |
Standard library iterator function for marking the beginning of the iteration process.
| ContainerType::const_iterator CellContainer::begin | ( | ) | const |
Standard library iterator function for marking the beginning of the iteration process of a const CellContainer.
| ParticleContainer::PairIterator CellContainer::beginPairs | ( | ) |
Direct access to the beginning of the ParticleContainer's PairIterator.
Use this to iterate over all distinct pairs of Particle objects in the domain.
| SpecialParticleIterator CellContainer::boundaryBegin | ( | ) |
Gets a SpecialParticleIterator pointing to the beginning of the boundary Cell pointer container.
| SpecialParticleIterator CellContainer::boundaryEnd | ( | ) |
Gets a SpecialParticleIterator pointing to the end of the boundary Cell pointer container.
| void CellContainer::calculateNeighbors | ( | int | cellIndex | ) |
| void CellContainer::deleteParticle | ( | Particle & | p | ) |
Removes a Particle from a Cell and marks it inactive.
First, the function finds the 1D index of the Particle's Cell. From there, it is removed, then marked as inactive. Note that, in order for this function to work, the Particle must have its correct index stored, and the index must be valid (i.e. not -1).
| p | The Particle to remove. |
| ContainerType::iterator CellContainer::end | ( | ) |
Standard library iterator function for marking the end of the iteration process.
| ContainerType::const_iterator CellContainer::end | ( | ) | const |
Standard library iterator function for marking the end of the iteration process of a const CellContainer.
| ParticleContainer::PairIterator CellContainer::endPairs | ( | ) |
Direct access to the end of the ParticleContainer's PairIterator.
Use this to iterate over all distinct pairs of Particle objects in the domain.
| bool CellContainer::getAnyPeriodic | ( | ) | const |
Checks if any boundary condition is periodic.
| std::vector< std::reference_wrapper< Cell > > & CellContainer::getBorderCells | ( | ) |
| const std::vector< std::reference_wrapper< Cell > > & CellContainer::getBorderCells | ( | ) | const |
| std::vector< std::vector< BorderLocation > > CellContainer::getBorderCombinations | ( | std::vector< BorderLocation > & | locations | ) |
For a collection of border locations, returns all unique pairs.
| locations | The border locations/directions which form the pairs |
| int CellContainer::getCellIndex | ( | const std::array< double, 3 > & | position | ) |
| std::vector< Cell > & CellContainer::getCells | ( | ) |
| const std::vector< Cell > & CellContainer::getCells | ( | ) | const |
| const std::array< double, 3 > & CellContainer::getCellSize | ( | ) | const |
Gets a const reference to the CellContainer's cell size.
| const std::array< BoundaryCondition, 6 > & CellContainer::getConditions | ( | ) | const |
Gets the boundary conditions at each boundary.
| double CellContainer::getCutoff | ( | ) | const |
Gets the cutoff radius used for calculating the cell size.
| size_t CellContainer::getDim | ( | ) | const |
Gets the number of dimensions of the linked cells.
| const std::array< double, 3 > & CellContainer::getDomainSize | ( | ) | const |
Gets a const reference to the CellContainer's domain size.
| std::vector< std::reference_wrapper< Cell > > & CellContainer::getHaloCells | ( | ) |
| const std::vector< std::reference_wrapper< Cell > > & CellContainer::getHaloCells | ( | ) | const |
| std::vector< std::reference_wrapper< Cell > > & CellContainer::getIterableCells | ( | ) |
| const std::vector< std::reference_wrapper< Cell > > & CellContainer::getIterableCells | ( | ) | const |
| std::array< double, 3 > CellContainer::getMirrorPosition | ( | const std::array< double, 3 > & | position, |
| const Cell & | from, | ||
| const Cell & | to, | ||
| int | direction | ||
| ) | const |
Mirrors a position from a source Cell to a destination Cell.
To be used primarily when incorporating reflective boundaries.
| position | The position in the source Cell. |
| from | The source Cell. |
| to | The destination Cell. |
| direction | The direction(s) in which to mirror the coordinates. |
| std::vector< std::reference_wrapper< Cell > > CellContainer::getNeighborCells | ( | int | cellIndex | ) |
| const std::vector< int > & CellContainer::getNeighbors | ( | int | cellIndex | ) | const |
| const std::array< size_t, 3 > & CellContainer::getNumCells | ( | ) | const |
Gets a const reference to the CellContainer's cell count in each dimension.
| int CellContainer::getOppositeNeighbor | ( | int | cellIndex, |
| HaloLocation | direction | ||
| ) | const |
Gets the index of the opposing Cell in the specified direction.
For example, if the direction is NORTH, this function will return the southern neighbor.
| cellIndex | The Cell from which to get the opposing Cell index. |
| direction | The opposite direction of the desired neighbor Cell. |
| int CellContainer::getOppositeOfBorder | ( | const Cell & | from, |
| BorderLocation | location | ||
| ) |
| std::vector< int > CellContainer::getOppositeOfBorderCorner | ( | const Cell & | from, |
| std::vector< BorderLocation > & | locations | ||
| ) |
| int CellContainer::getOppositeOfHalo | ( | const Cell & | from, |
| HaloLocation | location | ||
| ) |
| ParticleContainer & CellContainer::getParticles | ( | ) |
Gets a reference to the primary ParticleContainer.
| const ParticleContainer & CellContainer::getParticles | ( | ) | const |
Gets a const reference to the primary ParticleContainer.
| std::array< int, 3 > CellContainer::getVirtualCellCoordinates | ( | int | index | ) | const |
| SpecialParticleIterator CellContainer::haloBegin | ( | ) |
Gets a SpecialParticleIterator pointing to the beginning of the halo Cell pointer container.
| SpecialParticleIterator CellContainer::haloEnd | ( | ) |
Gets a SpecialParticleIterator pointing to the end of the halo Cell pointer container.
| bool CellContainer::moveParticle | ( | Particle & | p | ) |
| Cell & CellContainer::operator[] | ( | size_t | index | ) |
| const Cell & CellContainer::operator[] | ( | size_t | index | ) | const |
| void CellContainer::printCellContents | ( | ) | const |
Debug function to print the contents of each cell.
| void CellContainer::printCellIndices | ( | ) | const |
Debug function to print the indices of all cells for a 2D container.
Halo cells are marked red, border cells are marked yellow, inner cells are marked green.
| void CellContainer::removeHaloCellParticles | ( | ) |
| size_t CellContainer::size | ( | ) | const |
Gets the size of the ParticleContainer, including all inactive Cells.
|
private |
Determines if there are any periodic halo cells.
|
private |
Container of references to border cells.
|
private |
Container of mutual exclusion locks for each cell.
|
private |
The container of Cell objects itself.
|
private |
The size of each cell in each dimension (default: 0, 0, 0).
|
private |
An array of boundary conditions to be applied at each boundary (North, South, West, East, Above, Below).
|
private |
The cutoff radius.
|
private |
The number of dimensions (2/3)
|
private |
The size of the domain in each dimension.
|
private |
Container of references to halo cells.
|
private |
Container of references to cells to iterate over when calculating the forces between particles.
|
private |
The number of cells in each dimension (default: 1, 1, 1).
|
private |
A reference to the overarching ParticleContainer.