MolSim
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
Cuboid Class Reference

Cuboid class storing meta-data about the given cuboids. More...

#include <Cuboid.h>

Inheritance diagram for Cuboid:
Cluster

Public Member Functions

 Cuboid (ParticleContainer &particles, const std::array< double, 3 > &x, const std::array< size_t, 3 > &N, const std::array< double, 3 > &v, double h, double m, int type=TYPE_DEFAULT, double epsilon=EPSILON_DEFAULT, double sigma=SIGMA_DEFAULT, double k=K_DEFAULT, double r_0=R0_DEFAULT, double fzup=FZUP_DEFAULT)
 Constructs a new Cuboid object with all the needed meta-data.
 
std::array< size_t, 3 > & getN ()
 Gets the dimensions \( N \) of this cuboid.
 
const std::array< size_t, 3 > & getN () const
 Gets the dimensions \( N \) of this cuboid (const).
 
std::vector< std::array< int, 3 > > & getSpecialCases ()
 Get the vector containing position indices for particles where the constant upward force should be applied.
 
const std::vector< std::array< int, 3 > > & getSpecialCases () const
 Get the vector containing position indices for particles where the constant upward force should be applied (const).
 
bool operator== (const Cuboid &other) const
 Overload of the equality operator for Cuboid objects.
 
bool operator!= (const Cuboid &other) const
 Overload of the inequality operator for Cuboid objects.
 
void initialize (size_t dimensions=2) override
 Main function of Cuboid class, initializes the particles based on the cuboid meta-data and adds them to the given ParticleContainer.
 
void initializeNeighbours ()
 Cuboid function for membranes, adds every particle's neighbours to the particle, based on the index in the ParticleContainer.
 
bool specialCase (int x, int y, int z)
 Determines, whether Particle objects with the given coordinate indices should have a special upward force applied to them, for membrane simulations.
 
std::string toString () const
 Returns a string representation of this Cuboid.
 
- Public Member Functions inherited from Cluster
 Cluster (ParticleContainer &particles, const std::array< double, 3 > &x, const std::array< double, 3 > &v, double h, double m, int type, double epsilon, double sigma)
 Constructs a new Cluster.
 
virtual ~Cluster ()
 Destroys the current Cluster.
 
std::array< double, 3 > & getX ()
 Gets the position \( x \) of this Cluster.
 
const std::array< double, 3 > & getX () const
 Gets the position \( x \) of this Cluster (const).
 
double getH () const
 Gets the distance \( h \) between the particles of this Cluster.
 
double getM () const
 Gets the mass \( m \) of the particles of this Cluster.
 
std::array< double, 3 > & getV ()
 Gets the starting velocity \( v \) of the particles of this Cluster.
 
const std::array< double, 3 > & getV () const
 Gets the starting velocity \( v \) of the particles of this Cluster (const).
 
double getMeanVelocity () const
 Gets the mean velocity for the Maxwell-Boltzmann distribution.
 
ParticleContainergetParticles ()
 Gets the reference to the central ParticleContainer.
 
const ParticleContainergetParticles () const
 Gets the reference to the central ParticleContainer (const).
 

Private Attributes

std::array< size_t, 3 > N
 3D Dimensions \( N \) of the cuboid.
 
double k
 The stiffness constant \( k \) for membrane simulations.
 
double r_0
 The average bond length \( r_0 \) for membrane simulations.
 
double fzup
 The constant upward force \( F_{Z-UP} \) for membrane simulations.
 
std::vector< std::array< int, 3 > > specialCases
 Vector containing position indices for particles where the constant upward force should be applied, for membrane simulations.
 

Additional Inherited Members

- Protected Attributes inherited from Cluster
std::array< double, 3 > x
 Starting coordinate \( x \) of the Cluster.
 
double h
 Distance \( h \) between the particles in the Cluster.
 
double m
 Mass \( m \) of the particles in the Cluster.
 
int type
 Type of the particles in the Cluster.
 
double epsilon
 Depth \( \epsilon \) of the potential well of the particles in the Cluster.
 
double sigma
 Distance \( \sigma \) where the Lennard-Jones potential reaches zero of the particles in the Cluster.
 
std::array< double, 3 > v
 Starting velocity \( v \) of the particles in the Cluster (before adding Maxwell-Boltzmann perturbations).
 
double mean_velocity
 Mean velocity for the Maxwell-Boltzmann distribution.
 
ParticleContainerparticles
 Reference to the ParticleContainer object from the Simulation.
 

Detailed Description

Cuboid class storing meta-data about the given cuboids.

Constructor & Destructor Documentation

◆ Cuboid()

Cuboid::Cuboid ( ParticleContainer particles,
const std::array< double, 3 > &  x,
const std::array< size_t, 3 > &  N,
const std::array< double, 3 > &  v,
double  h,
double  m,
int  type = TYPE_DEFAULT,
double  epsilon = EPSILON_DEFAULT,
double  sigma = SIGMA_DEFAULT,
double  k = K_DEFAULT,
double  r_0 = R0_DEFAULT,
double  fzup = FZUP_DEFAULT 
)

Constructs a new Cuboid object with all the needed meta-data.

Parameters
particlesA reference to the central ParticleContainer.
xA reference to the array containing data for the cuboid position \( x \).
NA reference to the array containing data for the dimensions \( N \) of the cuboid.
vA reference to the array containing data for the starting speed \( v \) of the particles in the cuboid.
hThe distance \( h \) between the particles in the cuboid.
mThe mass \( m \) of the particles in the cuboid.
typeThe type of the particle. 1 if wall, 0 otherwise
epsilonThe Lennard-Jones parameter \( \epsilon \) of the particle.
sigmaThe Lennard-Jones parameter \( \sigma \) of the particle.
kThe stiffness constant \( k \), used for membrane simulations.
r_0The average bond length \( r_0 \), used for membrane simulations.
fzupThe constant upward force \( F_{Z-UP} \), used for membrane simulations.

Member Function Documentation

◆ getN() [1/2]

std::array< size_t, 3 > & Cuboid::getN ( )

Gets the dimensions \( N \) of this cuboid.

Returns
A reference to the dimensions array of this cuboid.

◆ getN() [2/2]

const std::array< size_t, 3 > & Cuboid::getN ( ) const

Gets the dimensions \( N \) of this cuboid (const).

Returns
A const reference to the dimensions array of this cuboid.

◆ getSpecialCases() [1/2]

std::vector< std::array< int, 3 > > & Cuboid::getSpecialCases ( )

Get the vector containing position indices for particles where the constant upward force should be applied.

Returns
A reference to the vector containing position indices for particles where the constant upward force should be applied.

◆ getSpecialCases() [2/2]

const std::vector< std::array< int, 3 > > & Cuboid::getSpecialCases ( ) const

Get the vector containing position indices for particles where the constant upward force should be applied (const).

Returns
A const reference to the vector containing position indices for particles where the constant upward force should be applied.

◆ initialize()

void Cuboid::initialize ( size_t  dimensions = 2)
overridevirtual

Main function of Cuboid class, initializes the particles based on the cuboid meta-data and adds them to the given ParticleContainer.

Parameters
dimensionsThe number of dimensions for which to perform the simulation. Must be either 1 or 2.

Implements Cluster.

◆ initializeNeighbours()

void Cuboid::initializeNeighbours ( )

Cuboid function for membranes, adds every particle's neighbours to the particle, based on the index in the ParticleContainer.

◆ operator!=()

bool Cuboid::operator!= ( const Cuboid other) const

Overload of the inequality operator for Cuboid objects.

Parameters
otherA reference to the Cuboid object to compare the current object with.
Returns
true if both particles have at least one differing attribute.
false if both particles' data (attributes) contain the same values.

◆ operator==()

bool Cuboid::operator== ( const Cuboid other) const

Overload of the equality operator for Cuboid objects.

Parameters
otherA reference to the Cuboid object to compare the current object with.
Returns
true if both cuboids' data (attributes) contain the same values.
false if both cuboids have at least one differing attribute.

◆ specialCase()

bool Cuboid::specialCase ( int  x,
int  y,
int  z 
)

Determines, whether Particle objects with the given coordinate indices should have a special upward force applied to them, for membrane simulations.

Note that the parameters are NOT the coordinates themselves; rather, they are indices in the cuboid starting from the origin. This cross-references the entries in specialCases.

Parameters
xThe x-index.
yThe y-index.
zThe z-index.
Returns
true if the Particle with the given indices should have a special force applied to it.
false if the Particle with the given indices should not have a special force applied to it.

◆ toString()

std::string Cuboid::toString ( ) const

Returns a string representation of this Cuboid.

Returns
The formatted Cuboid data as a std::string.

Member Data Documentation

◆ fzup

double Cuboid::fzup
private

The constant upward force \( F_{Z-UP} \) for membrane simulations.

◆ k

double Cuboid::k
private

The stiffness constant \( k \) for membrane simulations.

◆ N

std::array<size_t, 3> Cuboid::N
private

3D Dimensions \( N \) of the cuboid.

◆ r_0

double Cuboid::r_0
private

The average bond length \( r_0 \) for membrane simulations.

◆ specialCases

std::vector<std::array<int, 3> > Cuboid::specialCases
private

Vector containing position indices for particles where the constant upward force should be applied, for membrane simulations.


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