Molecular Dynamics Simulation  1.0
Public Types | Public Member Functions | Private Attributes | List of all members
Cell Class Reference

Class representing a cell in the linked cells algorithm. More...

#include <Cell.h>

Collaboration diagram for Cell:
Collaboration graph

Public Types

enum class  CellType { INNER , BOUNDARY , HALO }
 Enum representing the type of a cell. More...
 

Public Member Functions

 Cell (CellType cell_type)
 Construct a new Cell object. More...
 
CellType getCellType () const
 Get the type of the cell. More...
 
std::vector< Particle * > & getParticleReferences ()
 Get the reference vector for the particles the cell contains. More...
 
std::vector< Cell * > & getNeighbourReferences ()
 Get the reference vector for the neighbouring cells. More...
 
void addParticleReference (Particle *p)
 Adds a particle reference to the cell. More...
 
void clearParticleReferences ()
 Removes all particle references from the cell. More...
 
void addNeighbourReference (Cell *c)
 Adds a neighbour reference to the cell. More...
 

Private Attributes

CellType cell_type
 Type of the cell. More...
 
std::vector< Particle * > particle_references
 References to the particles the cell contains. More...
 
std::vector< Cell * > neighbour_references
 References to the neighbouring cells. More...
 

Detailed Description

Class representing a cell in the linked cells algorithm.

Definition at line 12 of file Cell.h.

Member Enumeration Documentation

◆ CellType

enum Cell::CellType
strong

Enum representing the type of a cell.

Enumerator
INNER 
BOUNDARY 
HALO 

Definition at line 17 of file Cell.h.

17 { INNER, BOUNDARY, HALO };

Constructor & Destructor Documentation

◆ Cell()

Cell::Cell ( CellType  cell_type)
explicit

Construct a new Cell object.

Parameters
cell_typeType of the cell

Definition at line 3 of file Cell.cpp.

3 : cell_type(cell_type) { neighbour_references.reserve(26); }
std::vector< Cell * > neighbour_references
References to the neighbouring cells.
Definition: Cell.h:33
CellType cell_type
Type of the cell.
Definition: Cell.h:23

Member Function Documentation

◆ addNeighbourReference()

void Cell::addNeighbourReference ( Cell c)

Adds a neighbour reference to the cell.

Parameters
cCell reference to be added

Definition at line 15 of file Cell.cpp.

15 { neighbour_references.push_back(c); }

◆ addParticleReference()

void Cell::addParticleReference ( Particle p)

Adds a particle reference to the cell.

Parameters
pParticle reference to be added

Definition at line 11 of file Cell.cpp.

11 { particle_references.push_back(p); }
std::vector< Particle * > particle_references
References to the particles the cell contains.
Definition: Cell.h:28

◆ clearParticleReferences()

void Cell::clearParticleReferences ( )

Removes all particle references from the cell.

Definition at line 13 of file Cell.cpp.

13 { particle_references.clear(); }

◆ getCellType()

Cell::CellType Cell::getCellType ( ) const

Get the type of the cell.

Returns
Type of the cell

Definition at line 5 of file Cell.cpp.

5 { return cell_type; }

◆ getNeighbourReferences()

std::vector< Cell * > & Cell::getNeighbourReferences ( )

Get the reference vector for the neighbouring cells.

Returns
Vector of references to the neighbouring cells

Definition at line 9 of file Cell.cpp.

9 { return neighbour_references; }

◆ getParticleReferences()

std::vector< Particle * > & Cell::getParticleReferences ( )

Get the reference vector for the particles the cell contains.

Returns
Vector of references to the particles the cell contains

Definition at line 7 of file Cell.cpp.

7 { return particle_references; }

Member Data Documentation

◆ cell_type

CellType Cell::cell_type
private

Type of the cell.

Definition at line 23 of file Cell.h.

◆ neighbour_references

std::vector<Cell*> Cell::neighbour_references
private

References to the neighbouring cells.

Definition at line 33 of file Cell.h.

◆ particle_references

std::vector<Particle*> Cell::particle_references
private

References to the particles the cell contains.

Definition at line 28 of file Cell.h.


The documentation for this class was generated from the following files: