Langmuir
Simulation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
world.h
Go to the documentation of this file.
1 #ifndef WORLD_H
2 #define WORLD_H
3 #define BOOST_DISABLE_ASSERTS
4 
5 #include <QtCore>
6 #include <QtGui>
7 
8 #ifndef Q_MOC_RUN
9 
10 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
11 #pragma GCC diagnostic push
12 #pragma GCC system_header
13 #endif
14 
15 #include "boost/multi_array.hpp"
16 
17 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
18 #pragma GCC diagnostic pop
19 #endif
20 
21 #endif
22 
23 namespace LangmuirCore
24 {
25 
26 class Grid;
27 class Agent;
28 class Random;
29 class Logger;
30 class KeyValueParser;
31 class Potential;
32 class FluxAgent;
33 class DrainAgent;
34 class HoleDrainAgent;
35 class ElectronDrainAgent;
36 class RecombinationAgent;
37 class Simulation;
38 class ChargeAgent;
39 class SourceAgent;
40 class HoleSourceAgent;
41 class ExcitonSourceAgent;
42 class ElectronSourceAgent;
43 class CheckPointer;
44 class OpenClHelper;
45 struct SimulationParameters;
46 struct ConfigurationInfo;
47 
51 class World : public QObject
52 {
53 private:
54  Q_OBJECT
55  Q_DISABLE_COPY(World)
56 
57 public:
67  World(const QString& fileName, int cores=-1, int gpuID=-1, QObject *parent = 0);
68  World(SimulationParameters &parameters, int cores=-1, int gpuID=-1, QObject *parent = 0);
69  World(SimulationParameters &parameters, ConfigurationInfo &configInfo, int cores=-1, int gpuID=-1, QObject *parent = 0);
70 
74  ~World();
75 
80 
85 
89  Grid& electronGrid();
90 
94  Grid& holeGrid();
95 
100 
105 
110 
114  Logger& logger();
115 
119  OpenClHelper& opencl();
120 
124  QList<SourceAgent*>& sources();
125 
129  QList<SourceAgent*>& eSources();
130 
134  QList<SourceAgent*>& hSources();
135 
139  QList<SourceAgent*>& xSources();
140 
144  QList<DrainAgent*>& drains();
145 
149  QList<DrainAgent*>& eDrains();
150 
154  QList<DrainAgent*>& hDrains();
155 
159  QList<DrainAgent*>& xDrains();
160 
164  QList<FluxAgent*>& fluxes();
165 
170 
175 
180 
185 
190 
195 
200 
205 
210 
215 
219  QList<ChargeAgent*>& electrons();
220 
224  QList<ChargeAgent*>& holes();
225 
229  QList<int>& defectSiteIDs();
230 
234  QList<int>& trapSiteIDs();
235 
239  QList<double>& trapSitePotentials();
240 
244  boost::multi_array<double,3>& R1();
245 
249  boost::multi_array<double,3>& R2();
250 
254  boost::multi_array<double,3>& iR();
255 
259  boost::multi_array<double,3>& eR();
260 
264  boost::multi_array<double, 3>& sI();
265 
269  boost::multi_array<double,3>& couplingConstants();
270 
274  int maxElectronAgents();
275 
279  int maxHoleAgents();
280 
284  int maxChargeAgents();
285 
290 
294  int maxDefects();
295 
299  int maxTraps();
300 
304  int numElectronAgents();
305 
309  int numHoleAgents();
310 
314  int numChargeAgents();
315 
319  int electronsMinusHoles();
320 
324  int holesMinusElectrons();
325 
329  bool chargesAreBalanced();
330 
335 
339  int numDefects();
340 
344  int numTraps();
345 
349  double reachedChargeAgents();
350 
354  double reachedElectronAgents();
355 
359  double reachedHoleAgents();
360 
364  double percentHoleAgents();
365 
369  double percentElectronAgents();
370 
374  bool atMaxElectrons();
375 
379  bool atMaxHoles();
380 
384  bool atMaxCharges();
385 
386 private:
391 
396 
400  QList<SourceAgent*> m_sources;
401 
405  QList<SourceAgent*> m_eSources;
406 
410  QList<SourceAgent*> m_hSources;
411 
415  QList<SourceAgent*> m_xSources;
416 
420  QList<DrainAgent*> m_drains;
421 
425  QList<DrainAgent*> m_eDrains;
426 
430  QList<DrainAgent*> m_hDrains;
431 
435  QList<DrainAgent*> m_xDrains;
436 
440  QList<FluxAgent*> m_fluxAgents;
441 
446 
451 
456 
461 
466 
471 
476 
481 
486 
491 
496 
501 
506 
511 
516 
521 
526 
530  QList<ChargeAgent*> m_electrons;
531 
535  QList<ChargeAgent*> m_holes;
536 
540  QList<int> m_defectSiteIDs;
541 
545  QList<int> m_trapSiteIDs;
546 
550  QList<double> m_trapSitePotentials;
551 
557  boost::multi_array<double,3> m_R2;
558 
564  boost::multi_array<double,3> m_R1;
565 
571  boost::multi_array<double,3> m_iR;
572 
578  boost::multi_array<double,3> m_eR;
579 
586  boost::multi_array<double, 3> m_sI;
587 
593  boost::multi_array<double,3> m_couplingConstants;
594 
599 
604 
609 
614 
623  void placeDefects(const QList<int>& siteIDs = QList<int>());
624 
633  void placeElectrons(const QList<int>& siteIDs = QList<int>());
634 
643  void placeHoles(const QList<int>& siteIDs = QList<int>());
644 
648  void createSources();
649 
653  void createDrains();
654 
658  void setFluxInfo(const QList<quint64> &fluxInfo);
659 
664  void alterMaxThreads(int cores = -1);
665 
678  void initialize(const QString& fileName = "", SimulationParameters *pparameters = NULL, ConfigurationInfo *pconfigInfo = NULL,
679  int cores = -1, int gpuID = -1);
680 };
681 
682 }
683 #endif // WORLD_H
ElectronSourceAgent * m_electronSourceAgentRight
pointer to right ElectronDrainAgent
Definition: world.h:445
boost::multi_array< double, 3 > m_couplingConstants
array of coupling constants
Definition: world.h:593
bool atMaxElectrons()
check if the maximum number of electrons has been reached
int maxChargeAgents()
get the max number of ChargeAgents allowed
double percentHoleAgents()
get the percent of HoleAgents reached, of the total grid volume
void createDrains()
create DrainAgents
Grid & holeGrid()
get the hole Grid, used for holding HoleAgents
int m_maxTraps
max number of traps
Definition: world.h:613
Grid * m_holeGrid
pointer to hole Grid, used for keeping track of HoleAgents
Definition: world.h:500
bool atMaxHoles()
check if the maximum number of holes has been reached
bool atMaxCharges()
check if the maximum number of charges has been reached
int numChargeAgents()
get the current number of ChargeAgents
QList< SourceAgent * > & xSources()
get a list of all ElectronSourceAgents
A class to generate random numbers.
Definition: rand.h:31
A class to inject HoleAgents.
Definition: sourceagent.h:134
SimulationParameters & parameters()
get the SimulationParameters, a struct used for holding simulation parameters.
double percentElectronAgents()
get the percent of ElectronAgents reached, of the total grid volume
void setFluxInfo(const QList< quint64 > &fluxInfo)
set attempts / successes for sources / drains
int m_maxElectrons
max number of electrons
Definition: world.h:598
HoleSourceAgent * m_holeSourceAgentRight
pointer to right HoleDrainAgent
Definition: world.h:455
boost::multi_array< double, 3 > & iR()
get the array of precomputed inverse-r values
A class to remove HoleAgents.
Definition: drainagent.h:62
A class to read and write checkpoint files.
Definition: checkpointer.h:20
RecombinationAgent & recombinationAgent()
get the RecombinationAgent
QList< int > & trapSiteIDs()
get a list of all trap sites
QList< SourceAgent * > & sources()
get a list of all SourceAgents
int maxDefects()
get the max number of Defects allowed
HoleSourceAgent & holeSourceAgentLeft()
get the left HoleSourceAgent
QList< DrainAgent * > m_eDrains
list of ElectronSourceAgents
Definition: world.h:425
A class to hold Agents, calculate their positions, and store the background potential.
Definition: cubicgrid.h:35
A class to remove Excitons.
Definition: drainagent.h:93
ElectronSourceAgent & electronSourceAgentLeft()
get the left ElectronSourceAgent
KeyValueParser * m_keyValueParser
pointer to KeyValueParser, used for parsing key=value pairs
Definition: world.h:390
KeyValueParser & keyValueParser()
get the KeyValueParser, used for parsing input files.
QList< DrainAgent * > m_hDrains
list of HoleSourceAgents
Definition: world.h:430
~World()
destroys the entire World, and everything in it...including you.
boost::multi_array< double, 3 > & sI()
get the self interactions
A class to inject Excitons.
Definition: sourceagent.h:166
QList< DrainAgent * > & xDrains()
get a list of all ElectronSourceAgents
Grid & electronGrid()
get the Grid used, used for holding ElectronAgents
A class that organizes output.
Definition: writer.h:156
QList< SourceAgent * > m_xSources
list of ExcitonSourceAgents
Definition: world.h:415
CheckPointer * m_checkPointer
pointer to CheckPointer, used for reading/writing input(checkpoint) files
Definition: world.h:395
QList< FluxAgent * > & fluxes()
get a list of all FluxAgents
void placeDefects(const QList< int > &siteIDs=QList< int >())
places defects
Logger & logger()
get the Logger, used for writing output
int m_maxHoles
max number of holes
Definition: world.h:603
A class to remove ElectronAgents.
Definition: drainagent.h:36
QList< int > & defectSiteIDs()
get a list of all defect sites
bool chargesAreBalanced()
true when electrons and holes are balanced
void createSources()
create SourceAgents
void placeHoles(const QList< int > &siteIDs=QList< int >())
places holes
ElectronDrainAgent & electronDrainAgentRight()
get the right ElectronDrainAgent
A class to hold all objects in a simulation.
Definition: world.h:51
QList< SourceAgent * > & eSources()
get a list of all ElectronSourceAgents
QList< SourceAgent * > m_hSources
list of HoleSourceAgents
Definition: world.h:410
boost::multi_array< double, 3 > m_R2
array of precomputed r-squared values
Definition: world.h:557
QList< int > m_defectSiteIDs
list of defect sites
Definition: world.h:540
boost::multi_array< double, 3 > & R1()
get the array of precomputed r-squared values
QList< ChargeAgent * > m_holes
list of holes
Definition: world.h:535
World(const QString &fileName, int cores=-1, int gpuID=-1, QObject *parent=0)
create a world to simulate in
void placeElectrons(const QList< int > &siteIDs=QList< int >())
places electrons
Random * m_rand
pointer to Random, used for generating random numbers
Definition: world.h:505
ElectronDrainAgent * m_electronDrainAgentLeft
pointer to left ElectronDrainAgent
Definition: world.h:475
QList< SourceAgent * > m_sources
list of SourceAgents
Definition: world.h:400
boost::multi_array< double, 3 > & eR()
get the array of precomputed erf(r/(sqrt(2)*sigma))
HoleDrainAgent * m_holeDrainAgentRight
pointer to right HoleDrainAgent
Definition: world.h:480
QList< ChargeAgent * > m_electrons
list of electrons
Definition: world.h:530
boost::multi_array< double, 3 > & couplingConstants()
get the coupling constants
ExcitonSourceAgent * m_excitonSourceAgent
pointer to ExcitonSourceAgent, used for injecting Excitons
Definition: world.h:465
QList< DrainAgent * > & hDrains()
get a list of all ElectronSourceAgents
int m_maxDefects
max number of defects
Definition: world.h:608
ExcitonSourceAgent & excitonSourceAgent()
get the RecombinationAgent
QList< double > m_trapSitePotentials
list of trap potentials
Definition: world.h:550
HoleDrainAgent * m_holeDrainAgentLeft
pointer to left HoleDrainAgent
Definition: world.h:485
boost::multi_array< double, 3 > m_iR
array of precomputed inverse-r values
Definition: world.h:571
int numDefects()
get the current number of Defects
A struct to temporarily store site IDs.
Definition: parameters.h:14
boost::multi_array< double, 3 > m_R1
array of precomputed r values
Definition: world.h:564
Potential & potential()
get the Potential, a calculator used for...calculating the potential.
RecombinationAgent * m_recombinationAgent
pointer to electron/hole RecombinationAgent, used for removing Excitons
Definition: world.h:490
int maxTraps()
get the max number of Traps allowed
Random & randomNumberGenerator()
get the Random, used for creating random numbers
OpenClHelper & opencl()
get the OpenClHelper, used for calculating Coulomb interactions with a Graphics Card ...
double reachedChargeAgents()
get the percent of ChargeAgents reached, of the max allowed
A struct to store all simulation options.
Definition: parameters.h:46
ElectronSourceAgent * m_electronSourceAgentLeft
pointer to left ElectronDrainAgent
Definition: world.h:450
OpenClHelper * m_ocl
pointer to OpenClHelper, used for Graphics Card calculations
Definition: world.h:525
A class to run OpenCL calculations.
Definition: openclhelper.h:21
QList< ChargeAgent * > & holes()
get a list of all HoleAgents
Definition: agent.h:12
QList< DrainAgent * > m_xDrains
list of ExcitonSourceAgents
Definition: world.h:435
double reachedHoleAgents()
get the percent of HoleAgents reached, of the max allowed
int numTraps()
get the current number of Traps
int maxElectronAgents()
get the max number of ElectronAgents allowed
QList< DrainAgent * > & eDrains()
get a list of all ElectronSourceAgents
int numElectronAgents()
get the current number of ElectronAgents
ElectronDrainAgent & electronDrainAgentLeft()
get the left ElectronDrainAgent
Grid * m_electronGrid
pointer to electron Grid, used for keeping track of ElectronAgents
Definition: world.h:495
CheckPointer & checkPointer()
get the CheckPointer, used for reading and writing input files.
void initialize(const QString &fileName="", SimulationParameters *pparameters=NULL, ConfigurationInfo *pconfigInfo=NULL, int cores=-1, int gpuID=-1)
initialize all objects
QList< DrainAgent * > & drains()
get a list of all DrainAgents
ElectronSourceAgent & electronSourceAgentRight()
get the right ElectronSourceAgent
QList< SourceAgent * > m_eSources
list of ElectronSourceAgents
Definition: world.h:405
double reachedElectronAgents()
get the percent of ElectronAgents reached, of the max allowed
void alterMaxThreads(int cores=-1)
Change the number of cores used.
boost::multi_array< double, 3 > m_sI
self interaction, which is 1/(4 pi e e0 r), with r=1 grid unit When a charge at it's future site inte...
Definition: world.h:586
HoleSourceAgent & holeSourceAgentRight()
get the right HoleSourceAgent
int numHoleAgents()
get the current number of HoleAgents
QList< FluxAgent * > m_fluxAgents
list of all FluxAgents, such as SoureAgents, DrainAgents, etc.
Definition: world.h:440
int maxHoleAgents()
get the max number of HoleAgents allowed
QList< SourceAgent * > & hSources()
get a list of all ElectronSourceAgents
A class to calculate the potential.
Definition: potential.h:31
QList< double > & trapSitePotentials()
get a list of all trap potentials
Logger * m_logger
pointer to Logger, used for output
Definition: world.h:520
ElectronDrainAgent * m_electronDrainAgentRight
pointer to right ElectronDrainAgent
Definition: world.h:470
boost::multi_array< double, 3 > & R2()
get the array of precomputed r values
int electronsMinusHoles()
The number of electrons - holes.
QList< DrainAgent * > m_drains
list of DrainAgents
Definition: world.h:420
int maxChargeAgentsAndChargedDefects()
get the max number of ChargeAgents & charged defects
QList< ChargeAgent * > & electrons()
get a list of all ElectronAgents
int numChargeAgentsAndChargedDefects()
get the current number of ChargeAgents & charged defects
A class to read the parameters and store them in the correct place.
Definition: keyvalueparser.h:27
HoleSourceAgent * m_holeSourceAgentLeft
pointer to left HoleDrainAgent
Definition: world.h:460
QList< int > m_trapSiteIDs
list of trap sites
Definition: world.h:545
SimulationParameters * m_parameters
pointer to SimulationParameters
Definition: world.h:515
int holesMinusElectrons()
The number of holes - electrons.
boost::multi_array< double, 3 > m_eR
array of precomputed erf(r/(s*sqrt(2)) values
Definition: world.h:578
A class to inject ElectronAgents.
Definition: sourceagent.h:102
Potential * m_potential
pointer to Potential, used for calculating the potential
Definition: world.h:510
HoleDrainAgent & holeDrainAgentLeft()
get the left HoleDrainAgent
HoleDrainAgent & holeDrainAgentRight()
get the right HoleDrainAgent