Langmuir
Simulation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
chargeagent.h
Go to the documentation of this file.
1 #ifndef CHARGEAGENT_H
2 #define CHARGEAGENT_H
3 
4 #include "agent.h"
5 
6 namespace LangmuirCore
7 {
8 
9 class Grid;
10 struct SimulationParameters;
11 
13 class ChargeAgent : public Agent
14 {
15 public:
17 
25  ChargeAgent(Agent::Type getType, World &world, Grid &grid, int site, QObject *parent=0);
26 
28  virtual ~ChargeAgent();
29 
31  int charge();
32 
34  void chooseFuture();
35 
37  void decideFuture();
38 
40  void completeTick();
41 
43  bool removed();
44 
46  int lifetime();
47 
49  int pathlength();
50 
52 
55  void setOpenCLID(int id);
56 
58 
61  int getOpenCLID();
62 
64 
68  double coulombInteraction();
69 
71 
74  void coulombCPU();
75 
77 
83  void coulombGPU();
84 
86  void compareCoulomb();
87 
89  Grid& getGrid();
90 
92 
95  void setRemoved(const bool &status = true);
96 
98 
101  virtual Agent::Type otherType() = 0;
102 
104 
107  virtual Grid& otherGrid() = 0;
108 
109 protected:
110 
112 
118  virtual double bindingPotential(int site)= 0;
119 
121  int m_charge;
122 
124  bool m_removed;
125 
128 
131 
134 
137 
139  double m_de;
140 };
141 
144 {
145 public:
147  ElectronAgent(World &world, int site, QObject *parent=0);
148 protected:
150 
156  virtual double bindingPotential(int site);
157 
159 
162  virtual Agent::Type otherType();
163 
165 
168  virtual Grid& otherGrid();
169 };
170 
172 class HoleAgent : public ChargeAgent
173 {
174 public:
176  HoleAgent(World &world, int site, QObject *parent=0);
177 protected:
179 
185  virtual double bindingPotential(int site);
186 
188 
191  virtual Agent::Type otherType();
192 
194 
197  virtual Grid& otherGrid();
198 };
199 
200 }
201 #endif
void completeTick()
Perform action, called after decideFuture.
void chooseFuture()
Propose a random site to move to.
A class that abstractly represents an object that can occupy grid sites.
Definition: agent.h:24
ChargeAgent(Agent::Type getType, World &world, Grid &grid, int site, QObject *parent=0)
Construct charge.
bool m_removed
Removed status of ChargeAgent.
Definition: chargeagent.h:124
int m_lifetime
Number of steps ChargeAgent as been in existance.
Definition: chargeagent.h:127
A class to represent moving negative charges.
Definition: chargeagent.h:143
Grid & getGrid()
Get the grid this ChargeAgent exists in.
virtual Grid & otherGrid()
Return other Grid.
A class to hold Agents, calculate their positions, and store the background potential.
Definition: cubicgrid.h:35
double coulombInteraction()
Perform coulombCPU() or coulombGPU()
virtual Grid & otherGrid()
Return other Grid.
Type
An identifier for the type of Agent.
Definition: agent.h:33
void compareCoulomb()
compare results for CPU and GPU Coulomb (assumes kernel was called)
int m_charge
Charge of ChargeAgent (in units of e)
Definition: chargeagent.h:121
virtual double bindingPotential(int site)=0
Calculate the exciton binding energy.
void coulombGPU()
Retrieve the Coulomb potential from the GPU
virtual ~ChargeAgent()
Destroy charge.
int charge()
Get the charge of the ChargeAgent.
A class to hold all objects in a simulation.
Definition: world.h:51
Type getType() const
Get Agent::Type enum.
Definition: agent.h:153
int lifetime()
Number of steps ChargeAgent has existed.
HoleAgent(World &world, int site, QObject *parent=0)
Construct HoleAgent.
void decideFuture()
Decide what should happen, called after chooseFuture.
virtual double bindingPotential(int site)
Calculate Exciton Binding Energy.
void setRemoved(const bool &status=true)
Set the removed status of this ChargeAgent.
A class to represent moving charged particles.
Definition: chargeagent.h:13
A class to represent moving positive charges.
Definition: chargeagent.h:172
int pathlength()
Number of sites ChargeAgent has traversed.
Grid & m_grid
The Grid the ChargeAgent lives in.
Definition: chargeagent.h:133
virtual Agent::Type otherType()
Return other Agent::Type.
Definition: agent.h:12
bool removed()
True if decideFuture removed the charge from the grid.
int getOpenCLID()
Get the ChargeAgent OpenCL identifier.
ElectronAgent(World &world, int site, QObject *parent=0)
Construct ElectronAgent.
void setOpenCLID(int id)
Set the ChargeAgent OpenCL identifier.
void coulombCPU()
Calculate the Coulomb potential on the CPU.
int m_openClID
The index of the Charge in the OpenCL vectors (see OpenClHelper)
Definition: chargeagent.h:136
virtual double bindingPotential(int site)
Calculate Exciton Binding Energy.
virtual Grid & otherGrid()=0
Return the opposite Grid relative to this ChargeAgent's Agent::Type.
virtual Agent::Type otherType()=0
Return the opposite ChargeAgent type relative to this ChargeAgent.
virtual Agent::Type otherType()
Return other Agent::Type.
int m_pathlength
Number of grid spaces ChargeAgent has moved.
Definition: chargeagent.h:130
double m_de
The difference in Coulomb potential between ChargeAgent::m_site and ChargeAgent::m_fSite.
Definition: chargeagent.h:139