Langmuir
Simulation
|
A class to hold Agents, calculate their positions, and store the background potential. More...
#include <cubicgrid.h>
Public Types | |
enum | CubeFace { Left = 0, Right = 1, Top = 2, Bottom = 3, Front = 4, Back = 5, NoFace = 6 } |
A way to indicate the faces of a cube. More... | |
Public Member Functions | |
Grid (World &world, QObject *parent=0) | |
Create a grid. More... | |
~Grid () | |
Destroy the grid. More... | |
int | xSize () |
Get the number of sites along the x-direction. More... | |
int | ySize () |
Get the number of sites along the y-direction. More... | |
int | zSize () |
Get the number of sites along the z-direction. More... | |
int | xyPlaneArea () |
Get the number of sites in the xy-plane. More... | |
int | volume () |
Get the total number of sites. More... | |
double | totalDistance (int site1, int site2) |
Get the distance between two sites. More... | |
double | xDistance (int site1, int site2) |
Get the distance along the x-direction between two sites. More... | |
double | yDistance (int site1, int site2) |
Get the distance along the y-direction between two sites. More... | |
double | zDistance (int site1, int site2) |
Get the distance along the z-direction between two sites. More... | |
double | xImageDistance (int site1, int site2) |
Get the image distance along the x-direction between two sites. More... | |
double | yImageDistance (int site1, int site2) |
Get the image distance along the y-direction between two sites. More... | |
double | zImageDistance (int site1, int site2) |
Get the image distance along the z-direction between two sites. More... | |
int | xDistancei (int site1, int site2) |
Get the integer distance along the x-direction between two sites. More... | |
int | yDistancei (int site1, int site2) |
Get the integer distance along the y-direction between two sites. More... | |
int | zDistancei (int site1, int site2) |
Get the integer distance along the z-direction between two sites. More... | |
int | xImageDistancei (int site1, int site2) |
Get the integer image distance along the x-direction between two sites. More... | |
int | yImageDistancei (int site1, int site2) |
Get the integer image distance along the y-direction between two sites. More... | |
int | zImageDistancei (int site1, int site2) |
Get the integer image distance along the z-direction between two sites. More... | |
int | getIndexS (int xIndex, int yIndex, int zIndex=0) |
Get the serial site ID. More... | |
int | getIndexY (int site) |
Get the "y-site ID" from the "s-site ID". More... | |
int | getIndexX (int site) |
Get the "x-site ID" from the "s-site ID". More... | |
int | getIndexZ (int site) |
Get the "z-site ID" from the "s-site ID". More... | |
double | getPositionY (int site) |
Get the y-position from the "s-site ID". More... | |
double | getPositionX (int site) |
Get the x-position from the "s-site ID". More... | |
double | getPositionZ (int site) |
Get the z-position from the "s-site ID". More... | |
Agent * | agentAddress (int site) |
Get a pointer to the Agent at a site. More... | |
Agent::Type | agentType (int site) |
Get the type of Agent at a site. More... | |
void | addToPotential (int site, double potential) |
Add some value to the background potential at a site. More... | |
void | setPotential (int site, double potential) |
Set the background potential at a site to some value. More... | |
double | potential (int site) |
Get the background potential at some site. More... | |
QVector< int > | neighborsSite (int site, int hoppingRange=1) |
Calculate the neighboring sites of a given site. More... | |
QVector< int > | neighborsFace (Grid::CubeFace cubeFace) |
Calculate the neighboring sites of a given face of the Grid. More... | |
QVector< int > | sliceIndex (int xi, int xf, int yi, int yf, int zi, int zf) |
Calculate the list of sites occupying a given range. More... | |
void | registerAgent (Agent *agent) |
Assign an Agent to a site in the Grid. More... | |
void | registerSpecialAgent (Agent *agent, Grid::CubeFace cubeFace) |
Assign an Agent to a special location. More... | |
void | unregisterAgent (Agent *agent) |
Remove an Agent from the Grid. More... | |
void | unregisterSpecialAgent (Agent *agent, Grid::CubeFace cubeFace) |
Remove an Agent from the special list of Agents in the Grid. More... | |
void | unregisterDefect (int site) |
Remove a defect from the Grid. More... | |
void | registerDefect (int site) |
Assign a site to be Agent::Defect. More... | |
int | specialAgentCount () |
The total number of special Agents. More... | |
QList< Agent * > & | getSpecialAgentList (Grid::CubeFace cubeFace) |
Get a list of special Agents assigned to a specific Grid::CubeFace. More... | |
Static Public Member Functions | |
static QString | toQString (const Grid::CubeFace e) |
Protected Attributes | |
World & | m_world |
Reference to the World object. More... | |
QVector< Agent * > | m_agents |
1D list of Agent pointers, the size of which is the volume of the Grid + the max number of special Agents. More... | |
QVector< double > | m_potentials |
1D list of site potentials, the size of which is the volume of the Grid + the max number of special Agents. More... | |
QVector< Agent::Type > | m_agentType |
1D list of Agent types, the size of which is the volume of the Grid + the max number of special Agents. More... | |
QList< QList< Agent * > > | m_specialAgents |
A list of lists of special agents, where each sub-list is for a different Grid::CubeFace. More... | |
int | m_specialAgentReserve |
The max number of special Agents allowed. More... | |
int | m_specialAgentCount |
The current number of special Agents registered with the Grid. More... | |
int | m_xSize |
The number of sites along the x-direction. More... | |
int | m_ySize |
The number of sites along the y-direction. More... | |
int | m_zSize |
The number of sites along the z-direction. More... | |
int | m_xyPlaneArea |
The number of sites in the xy-plane. More... | |
int | m_yzPlaneArea |
The number of sites in the yz-plane. More... | |
int | m_xzPlaneArea |
The number of sites in the xz-plane. More... | |
int | m_volume |
The total number of sites. More... | |
A class to hold Agents, calculate their positions, and store the background potential.
The x-direction
The y-direction
The z-direction
LangmuirCore::Grid::Grid | ( | World & | world, |
QObject * | parent = 0 |
||
) |
Create a grid.
world | reference to the world object |
parent | QObject this belongs to |
LangmuirCore::Grid::~Grid | ( | ) |
Destroy the grid.
void LangmuirCore::Grid::addToPotential | ( | int | site, |
double | potential | ||
) |
Add some value to the background potential at a site.
site | the "s-site ID" |
potential | the value to add |
Agent* LangmuirCore::Grid::agentAddress | ( | int | site | ) |
Agent::Type LangmuirCore::Grid::agentType | ( | int | site | ) |
Get the type of Agent at a site.
site | the "s-site ID" |
int LangmuirCore::Grid::getIndexS | ( | int | xIndex, |
int | yIndex, | ||
int | zIndex = 0 |
||
) |
Get the serial site ID.
xIndex | x site ID |
yIndex | y site ID |
zIndex | z site ID |
The position of a particle in the Grid can be thought of as a 3-tuple of (x, y, z) site IDs. However, this 3-tuple can be mapped/hashed into a single number using the dimension of the grid, called the "serial site ID", the "s-site ID", or just the "site".
int LangmuirCore::Grid::getIndexX | ( | int | site | ) |
int LangmuirCore::Grid::getIndexY | ( | int | site | ) |
int LangmuirCore::Grid::getIndexZ | ( | int | site | ) |
double LangmuirCore::Grid::getPositionX | ( | int | site | ) |
Get the x-position from the "s-site ID".
site | the "s-site ID" |
Particles are considered to reside in the "center" of Grid sites. The x-position is therefore the "x-site ID" plus 0.5 in reduced units.
double LangmuirCore::Grid::getPositionY | ( | int | site | ) |
Get the y-position from the "s-site ID".
site | the "s-site ID" |
Particles are considered to reside in the "center" of Grid sites. The y-position is therefore the "y-site ID" plus 0.5 in reduced units.
double LangmuirCore::Grid::getPositionZ | ( | int | site | ) |
Get the z-position from the "s-site ID".
site | the "s-site ID" |
Particles are considered to reside in the "center" of Grid sites. The z-position is therefore the "z-site ID" plus 0.5 in reduced units.
QList<Agent *>& LangmuirCore::Grid::getSpecialAgentList | ( | Grid::CubeFace | cubeFace | ) |
Get a list of special Agents assigned to a specific Grid::CubeFace.
cubeFace | the face of the Grid |
QVector<int> LangmuirCore::Grid::neighborsFace | ( | Grid::CubeFace | cubeFace | ) |
QVector<int> LangmuirCore::Grid::neighborsSite | ( | int | site, |
int | hoppingRange = 1 |
||
) |
Calculate the neighboring sites of a given site.
site | the "s-site ID" |
hoppingRange | the number of adjacent sites to consider in the calculation |
double LangmuirCore::Grid::potential | ( | int | site | ) |
Get the background potential at some site.
site | the "s-site ID" |
void LangmuirCore::Grid::registerAgent | ( | Agent * | agent | ) |
Assign an Agent to a site in the Grid.
agent | a pointer to the Agent |
Makes sure the site is empty first. After assigning the Agent to the site, calculates and assigns the neighbors to the Agent.
void LangmuirCore::Grid::registerDefect | ( | int | site | ) |
Assign a site to be Agent::Defect.
site |
void LangmuirCore::Grid::registerSpecialAgent | ( | Agent * | agent, |
Grid::CubeFace | cubeFace | ||
) |
void LangmuirCore::Grid::setPotential | ( | int | site, |
double | potential | ||
) |
Set the background potential at a site to some value.
site | the "s-site ID" |
potential | the value to set |
QVector<int> LangmuirCore::Grid::sliceIndex | ( | int | xi, |
int | xf, | ||
int | yi, | ||
int | yf, | ||
int | zi, | ||
int | zf | ||
) |
Calculate the list of sites occupying a given range.
xi | starting x-site ID |
xf | stopping x-site ID |
yi | starting y-site ID |
yf | stopping y-site ID |
zi | starting z-site ID |
zf | stopping z-site ID |
int LangmuirCore::Grid::specialAgentCount | ( | ) |
The total number of special Agents.
|
static |
double LangmuirCore::Grid::totalDistance | ( | int | site1, |
int | site2 | ||
) |
Get the distance between two sites.
site1 | the first site |
site2 | the second site |
void LangmuirCore::Grid::unregisterAgent | ( | Agent * | agent | ) |
void LangmuirCore::Grid::unregisterDefect | ( | int | site | ) |
Remove a defect from the Grid.
site | the "s-site ID" |
void LangmuirCore::Grid::unregisterSpecialAgent | ( | Agent * | agent, |
Grid::CubeFace | cubeFace | ||
) |
int LangmuirCore::Grid::volume | ( | ) |
Get the total number of sites.
double LangmuirCore::Grid::xDistance | ( | int | site1, |
int | site2 | ||
) |
Get the distance along the x-direction between two sites.
site1 | the first site |
site2 | the second site |
int LangmuirCore::Grid::xDistancei | ( | int | site1, |
int | site2 | ||
) |
Get the integer distance along the x-direction between two sites.
site1 | the first site |
site2 | the second site |
double LangmuirCore::Grid::xImageDistance | ( | int | site1, |
int | site2 | ||
) |
Get the image distance along the x-direction between two sites.
site1 | the first site |
site2 | the second site (reflected) |
The second site's x-position is taken to be the negative of its x-value (i.e., the particle is reflected through the yz-plane).
int LangmuirCore::Grid::xImageDistancei | ( | int | site1, |
int | site2 | ||
) |
Get the integer image distance along the x-direction between two sites.
site1 | the first site |
site2 | the second site (reflected) |
The second site's x-position is taken to be the negative of its x-value (i.e., the particle is reflected through the yz-plane).
int LangmuirCore::Grid::xSize | ( | ) |
Get the number of sites along the x-direction.
int LangmuirCore::Grid::xyPlaneArea | ( | ) |
Get the number of sites in the xy-plane.
double LangmuirCore::Grid::yDistance | ( | int | site1, |
int | site2 | ||
) |
Get the distance along the y-direction between two sites.
site1 | the first site |
site2 | the second site |
int LangmuirCore::Grid::yDistancei | ( | int | site1, |
int | site2 | ||
) |
Get the integer distance along the y-direction between two sites.
site1 | the first site |
site2 | the second site |
double LangmuirCore::Grid::yImageDistance | ( | int | site1, |
int | site2 | ||
) |
Get the image distance along the y-direction between two sites.
site1 | the first site |
site2 | the second site (reflected) |
The second site's y-position is taken to be the negative of its y-value (i.e., the particle is reflected through the xz-plane).
int LangmuirCore::Grid::yImageDistancei | ( | int | site1, |
int | site2 | ||
) |
Get the integer image distance along the y-direction between two sites.
site1 | the first site |
site2 | the second site (reflected) |
The second site's y-position is taken to be the negative of its y-value (i.e., the particle is reflected through the xz-plane).
int LangmuirCore::Grid::ySize | ( | ) |
Get the number of sites along the y-direction.
double LangmuirCore::Grid::zDistance | ( | int | site1, |
int | site2 | ||
) |
Get the distance along the z-direction between two sites.
site1 | the first site |
site2 | the second site |
int LangmuirCore::Grid::zDistancei | ( | int | site1, |
int | site2 | ||
) |
Get the integer distance along the z-direction between two sites.
site1 | the first site |
site2 | the second site |
double LangmuirCore::Grid::zImageDistance | ( | int | site1, |
int | site2 | ||
) |
Get the image distance along the z-direction between two sites.
site1 | the first site |
site2 | the second site (reflected) |
The second site's z-position is taken to be the negative of its z-value (i.e., the particle is reflected through the xy-plane).
int LangmuirCore::Grid::zImageDistancei | ( | int | site1, |
int | site2 | ||
) |
Get the integer image distance along the z-direction between two sites.
site1 | the first site |
site2 | the second site (reflected) |
The second site's z-position is taken to be the negative of its z-value (i.e., the particle is reflected through the xy-plane).
int LangmuirCore::Grid::zSize | ( | ) |
Get the number of sites along the z-direction.
|
protected |
1D list of Agent pointers, the size of which is the volume of the Grid + the max number of special Agents.
Each position in the list is mapped to a position in the Grid. Use getIndexS() to calculate the serial site ID needed to index this list.
|
protected |
1D list of Agent types, the size of which is the volume of the Grid + the max number of special Agents.
Each position in the list is mapped to a position in the Grid. Use getIndexS() to calculate the serial site ID needed to index this list.
|
protected |
1D list of site potentials, the size of which is the volume of the Grid + the max number of special Agents.
Each position in the list is mapped to a position in the Grid. Use getIndexS() to calculate the serial site ID needed to index this list.
|
protected |
The current number of special Agents registered with the Grid.
|
protected |
The max number of special Agents allowed.
|
protected |
A list of lists of special agents, where each sub-list is for a different Grid::CubeFace.
|
protected |
The total number of sites.
|
protected |
The number of sites along the x-direction.
|
protected |
The number of sites in the xy-plane.
|
protected |
The number of sites in the xz-plane.
|
protected |
The number of sites along the y-direction.
|
protected |
The number of sites in the yz-plane.
|
protected |
The number of sites along the z-direction.