Langmuir
Simulation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
writer.h
Go to the documentation of this file.
1 #ifndef WRITER_H
2 #define WRITER_H
3 
4 #include <QObject>
5 #include <QPainter>
6 #include <QColor>
7 #include <QImage>
8 
9 #include "output.h"
10 
11 namespace LangmuirCore
12 {
13 
14 class ChargeAgent;
15 class FluxAgent;
16 class World;
17 class Grid;
18 
20 class XYZWriter : public QObject
21 {
22  Q_OBJECT
23 public:
25  XYZWriter(World &world,
26  const QString& name,
27  QObject *parent = 0);
28 
30  void write();
31 protected:
34 
37 
39  void writeVMDInitFile();
40 };
41 
43 class FluxWriter : public QObject
44 {
45  Q_OBJECT
46 public:
48  FluxWriter(World &world,
49  const QString& name,
50  QObject *parent = 0);
51 
53  void write();
54 protected:
57 
60 };
61 
63 class CarrierWriter : public QObject
64 {
65  Q_OBJECT
66 public:
68  CarrierWriter(World &world,
69  const QString& name,
70  QObject *parent = 0);
71 
73  void write(ChargeAgent &charge);
74 protected:
77 
80 };
81 
83 class ExcitonWriter : public QObject
84 {
85  Q_OBJECT
86 public:
88  ExcitonWriter(World &world,
89  const QString& name,
90  QObject *parent = 0);
91 
93  void write(ChargeAgent &charge1, ChargeAgent &charge2, bool recombined = false);
94 protected:
97 
100 };
101 
103 class GridImage : public QObject
104 {
105  Q_OBJECT
106 public:
108 
113  GridImage(World &world, QColor bg = Qt::black, QObject *parent=0);
114 
116 
123  void drawSites(QList<int> &sites, QColor color, int layer);
124 
126 
133  void drawCharges(QList<ChargeAgent *> &charges, QColor color, int layer);
134 
136 
140  void save(QString name, int scale=3);
141 private:
143  QPainter m_painter;
144 
146  QImage m_image;
147 
150 };
151 
156 class Logger : public QObject
157 {
158  Q_OBJECT
159 public:
161  Logger(World &world, QObject *parent = 0);
162 
164  virtual void saveTrapImage(const QString& name = "%stub-traps.png");
165 
167  virtual void saveHoleImage(const QString& name = "%stub-%step-holes.png");
168 
170  virtual void saveElectronImage(const QString& name = "%stub-%step-electrons.png");
171 
173  virtual void saveCarriersImage(const QString& name = "%stub-%step-carriers.png");
174 
176  virtual void saveDefectImage(const QString& name = "%stub-defects.png");
177 
179  virtual void saveImage(const QString& name = "%stub-%step-all.png");
180 
182  virtual void saveGridPotential(const QString& name = "%stub.grid");
183 
185  virtual void saveCoulombEnergy(const QString& name = "%stub-%step.coulomb");
186 
188  virtual void reportFluxStream();
189 
191  virtual void reportXYZStream();
192 
194  virtual void reportCarrier(ChargeAgent &charge);
195 
197  virtual void reportExciton(ChargeAgent &charge1, ChargeAgent &charge2, bool recombined = false);
198 
200  virtual void initialize();
201 
202 protected:
205 
208 
211 
214 
217 };
218 
219 }
220 #endif // WRITER_H
void writeVMDInitFile()
write a VMD script useful for opening the XYZ file
XYZWriter * m_xyzWriter
writer in charge of writing xyz files
Definition: writer.h:207
OutputStream m_stream
output file stream
Definition: writer.h:79
ExcitonWriter * m_excitonWriter
writer in charge of writing multiple carrier's information (excitons)
Definition: writer.h:216
OutputStream m_stream
output file stream
Definition: writer.h:36
ExcitonWriter(World &world, const QString &name, QObject *parent=0)
constructs the writer, has the same parameters as OutputInfo
QImage m_image
the image we draw onto
Definition: writer.h:146
virtual void saveCoulombEnergy(const QString &name="%stub-%step.coulomb")
output the Coulomb potential as (x, y, z, v) to a file; requires the use of the GPU ...
A class to output carrier stats (lifetime and pathlength)
Definition: writer.h:63
FluxWriter * m_fluxWriter
writer in charge of writing source & drain information
Definition: writer.h:210
virtual void reportXYZStream()
output xyz information (at the current step) to the xyz file
World & m_world
reference to world
Definition: writer.h:204
World & m_world
reference to the world object
Definition: writer.h:96
virtual void reportExciton(ChargeAgent &charge1, ChargeAgent &charge2, bool recombined=false)
output carrier information (for example pathlength) on two carriers at once to the exciton file ...
GridImage(World &world, QColor bg=Qt::black, QObject *parent=0)
create the image and painter, setting the background and size
void write()
Write XYZ of the current step to the stream.
A class that organizes output.
Definition: writer.h:156
void write(ChargeAgent &charge1, ChargeAgent &charge2, bool recombined=false)
write the exciton statistics to the stream
World & m_world
reference to the world object
Definition: writer.h:149
A class to hold all objects in a simulation.
Definition: world.h:51
virtual void initialize()
open the various output streams if they are turned on
World & m_world
reference to the world object
Definition: writer.h:76
virtual void saveDefectImage(const QString &name="%stub-defects.png")
save an image of defects as png
virtual void saveGridPotential(const QString &name="%stub.grid")
output the grid potential as (x, y, z, v) to a file
OutputStream m_stream
output file stream
Definition: writer.h:99
virtual void saveElectronImage(const QString &name="%stub-%step-electrons.png")
save an image of electrons (at the current step) as png
A class to output exciton stats (lifetime and pathlength)
Definition: writer.h:83
World & m_world
reference to the world object
Definition: writer.h:56
void write()
write the flux statistics of the current step to the stream
void drawCharges(QList< ChargeAgent * > &charges, QColor color, int layer)
draw some sites
virtual void reportFluxStream()
output information about Sources and Drains (at the current step) to the main output file ...
CarrierWriter(World &world, const QString &name, QObject *parent=0)
constructs the writer, has the same parameters as OutputInfo
A class to represent moving charged particles.
Definition: chargeagent.h:13
void write(ChargeAgent &charge)
write the charge carrier statistics to the stream
Definition: agent.h:12
void drawSites(QList< int > &sites, QColor color, int layer)
draw some sites
virtual void reportCarrier(ChargeAgent &charge)
output carrier information (for example pathlength) to the carrier file
A class to output xyz files.
Definition: writer.h:20
FluxWriter(World &world, const QString &name, QObject *parent=0)
constructs the writer, has the same parameters as OutputInfo
OutputStream m_stream
output file stream
Definition: writer.h:59
virtual void saveHoleImage(const QString &name="%stub-%step-holes.png")
save an image of holes (at the current step) as png
A class to draw images of the grid.
Definition: writer.h:103
Logger(World &world, QObject *parent=0)
create Logger
QPainter m_painter
the painter that paints the image
Definition: writer.h:143
virtual void saveTrapImage(const QString &name="%stub-traps.png")
save an image of trap sites as png
World & m_world
reference to the world object
Definition: writer.h:33
A class to output source and drain info.
Definition: writer.h:43
virtual void saveCarriersImage(const QString &name="%stub-%step-carriers.png")
save an image of holes and electrons (at the current step) as png
XYZWriter(World &world, const QString &name, QObject *parent=0)
constructs the writer, has the same parameters as OutputInfo
void save(QString name, int scale=3)
save the image to a file
A class to combine QFile, QTextStream and OutputInfo (QFileInfo).
Definition: output.h:69
virtual void saveImage(const QString &name="%stub-%step-all.png")
save an image of electrons, holes, defects, and traps (at current step) as png
CarrierWriter * m_carrierWriter
writer in charge of writing carrier information
Definition: writer.h:213