43 std::vector<std::reference_wrapper<Cell>>
haloCells;
84 ContainerType::iterator
begin();
91 ContainerType::iterator
end();
117 ContainerType::const_iterator
begin()
const;
124 ContainerType::const_iterator
end()
const;
130 std::vector<std::reference_wrapper<Cell>>::iterator
outerIt;
132 std::vector<std::reference_wrapper<Cell>>::iterator
outerEnd;
134 std::forward_list<std::reference_wrapper<Particle>>::iterator
innerIt;
136 std::forward_list<std::reference_wrapper<Particle>>::iterator
innerEnd;
150 std::vector<std::reference_wrapper<Cell>>::iterator
end);
365 int direction)
const;
Utility functions for Cell and CellContainer objects.
HaloLocation
Enum containing the possible corner and edge directions of halo cells.
Definition CellUtils.h:22
BorderLocation
Enum containing the possible corner and edge directions of border cells.
Definition CellUtils.h:24
A single Cell in a CellContainer, for use with the linked cells method.
General class used to read and parse file input into some container.
Helper class for systems that may not have OpenMP functionality.
Class for encapsulating and iterating over multiple Particle objects.
Model of a single particle.
Factory class for creating different types of file output generators.
A special iterator for iterating over the boundary and halo cell containers.
Definition CellContainer.h:127
void advance()
Helper function to move to the next Cell which contains at least one particle. Stops when no further ...
std::vector< std::reference_wrapper< Cell > >::iterator outerEnd
The end of the outer iterator, iterating over each Cell pointer.
Definition CellContainer.h:132
std::vector< std::reference_wrapper< Cell > >::iterator outerIt
The outer iterator, iterating over each Cell pointer.
Definition CellContainer.h:130
SpecialParticleIterator(std::vector< std::reference_wrapper< Cell > >::iterator start, std::vector< std::reference_wrapper< Cell > >::iterator end)
Construct a new special iterator.
SpecialParticleIterator & operator++()
Overload of the preincrement operator.
std::forward_list< std::reference_wrapper< Particle > >::iterator innerIt
The inner iterator, iterating over each Particle pointer in a Cell.
Definition CellContainer.h:134
bool operator!=(const SpecialParticleIterator &other) const
Overload of the inequality operator.
std::forward_list< std::reference_wrapper< Particle > >::iterator innerEnd
The end of the inner iterator, iterating over each Particle pointer in a Cell.
Definition CellContainer.h:136
bool operator==(const SpecialParticleIterator &other) const
Overload of the equality operator.
Particle & operator*()
Overload of the dereference operator.
Cell encapsulation class for implementing the linked cell method.
Definition CellContainer.h:31
const Cell & operator[](size_t index) const
Dereference of the [] operator (const).
void removeHaloCellParticles()
Removes the active halo Cell Particle objects.
std::array< BoundaryCondition, 6 > conditions
An array of boundary conditions to be applied at each boundary (North, South, West,...
Definition CellContainer.h:53
std::array< size_t, 3 > numCells
The number of cells in each dimension (default: 1, 1, 1).
Definition CellContainer.h:51
int getCellIndex(const std::array< double, 3 > &position)
Gets the 1D index in the Cell container based on the given position.
bool moveParticle(Particle &p)
Moves a particle from one Cell to another.
size_t dim
The number of dimensions (2/3)
Definition CellContainer.h:57
ParticleContainer::PairIterator endPairs()
Direct access to the end of the ParticleContainer's PairIterator.
ContainerType::iterator begin()
Standard library iterator function for marking the beginning of the iteration process.
int getOppositeNeighbor(int cellIndex, HaloLocation direction) const
Gets the index of the opposing Cell in the specified direction.
double getCutoff() const
Gets the cutoff radius used for calculating the cell size.
bool anyPeriodic
Determines if there are any periodic halo cells.
Definition CellContainer.h:59
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.
const std::vector< std::reference_wrapper< Cell > > & getHaloCells() const
Gets a const reference to the halo Cell container.
SpecialParticleIterator boundaryBegin()
Gets a SpecialParticleIterator pointing to the beginning of the boundary Cell pointer container.
void printCellContents() const
Debug function to print the contents of each cell.
ContainerType::const_iterator end() const
Standard library iterator function for marking the end of the iteration process of a const CellContai...
const std::array< BoundaryCondition, 6 > & getConditions() const
Gets the boundary conditions at each boundary.
std::vector< omp_lock_t > cellLocks
Container of mutual exclusion locks for each cell.
Definition CellContainer.h:39
const std::vector< std::reference_wrapper< Cell > > & getIterableCells() const
Gets a const reference to the iterable Cell container.
ParticleContainer & getParticles()
Gets a reference to the primary ParticleContainer.
SpecialParticleIterator haloBegin()
Gets a SpecialParticleIterator pointing to the beginning of the halo Cell pointer container.
size_t activeSize() const
Gets the amount of active Particle objects in the ParticleContainer.
std::array< double, 3 > cellSize
The size of each cell in each dimension (default: 0, 0, 0).
Definition CellContainer.h:49
std::vector< std::reference_wrapper< Cell > > & getBorderCells()
Gets a reference to the border Cell container.
std::vector< std::reference_wrapper< Cell > > getNeighborCells(int cellIndex)
std::vector< std::reference_wrapper< Cell > > iterableCells
Container of references to cells to iterate over when calculating the forces between particles.
Definition CellContainer.h:45
void deleteParticle(Particle &p)
Removes a Particle from a Cell and marks it inactive.
ContainerType cells
The container of Cell objects itself.
Definition CellContainer.h:37
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.
const ParticleContainer & getParticles() const
Gets a const reference to the primary ParticleContainer.
std::vector< Cell > ContainerType
Typedef for the underlying Cell container type.
Definition CellContainer.h:33
size_t size() const
Gets the size of the ParticleContainer, including all inactive Cells.
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.
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.
double cutoff
The cutoff radius.
Definition CellContainer.h:55
std::vector< std::vector< BorderLocation > > getBorderCombinations(std::vector< BorderLocation > &locations)
For a collection of border locations, returns all unique pairs.
ContainerType::const_iterator begin() const
Standard library iterator function for marking the beginning of the iteration process of a const Cell...
std::vector< std::reference_wrapper< Cell > > & getHaloCells()
Gets a reference to the halo Cell container.
const std::vector< int > & getNeighbors(int cellIndex) const
Gets a vector of neighbouring Cell indices, including the Cell itself.
size_t getDim() const
Gets the number of dimensions of the linked cells.
std::vector< std::reference_wrapper< Cell > > & getIterableCells()
Gets a reference to the iterable Cell container.
const std::array< double, 3 > & getDomainSize() const
Gets a const reference to the CellContainer's domain size.
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 std::array< double, 3 > & getCellSize() const
Gets a const reference to the CellContainer's cell size.
bool getAnyPeriodic() const
Checks if any boundary condition is periodic.
ContainerType::iterator end()
Standard library iterator function for marking the end of the iteration process.
ParticleContainer & particles
A reference to the overarching ParticleContainer.
Definition CellContainer.h:61
void calculateNeighbors(int cellIndex)
Computes the vector of neighbouring Cell indices, including the Cell itself.
std::vector< Cell > & getCells()
Gets a reference to the Cell container.
bool addParticle(Particle &p)
Adds a Particle to the Cell container.
std::vector< std::reference_wrapper< Cell > > haloCells
Container of references to halo cells.
Definition CellContainer.h:43
SpecialParticleIterator boundaryEnd()
Gets a SpecialParticleIterator pointing to the end of the boundary Cell pointer container.
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.
const std::vector< Cell > & getCells() const
Gets a const reference to the Cell container.
std::array< int, 3 > getVirtualCellCoordinates(int index) const
Gets the coordinates of a Cell from its index.
std::vector< std::reference_wrapper< Cell > > borderCells
Container of references to border cells.
Definition CellContainer.h:41
const std::vector< std::reference_wrapper< Cell > > & getBorderCells() const
Gets a const reference to the border Cell container.
~CellContainer()
Destroys the CellContainer object and frees the reserved locks.
const std::array< size_t, 3 > & getNumCells() const
Gets a const reference to the CellContainer's cell count in each dimension.
void printCellIndices() const
Debug function to print the indices of all cells for a 2D container.
std::array< double, 3 > domainSize
The size of the domain in each dimension.
Definition CellContainer.h:47
ParticleContainer::PairIterator beginPairs()
Direct access to the beginning of the ParticleContainer's PairIterator.
Class for storing data of a single Cell in a domain split into cells.
Definition Cell.h:23
Custom pair iterator for iterating through all possible pairs of Particle objects.
Definition ParticleContainer.h:50
Class for encapsulating multiple Particle objects..
Definition ParticleContainer.h:17
Particle class modeling a particle's position, velocity, force, mass and type.
Definition Particle.h:46