cctw  0.2.1
cctwapplication.h
Go to the documentation of this file.
1 #ifndef CCTWAPPLICATION_H
2 #define CCTWAPPLICATION_H
3 
4 #include <QApplication>
5 #include <QDateTime>
6 #ifndef NO_GUI
7 #include "cctwqtmainwindow.h"
8 #endif
9 #include "cctwchunkeddata.h"
10 #include "cctwtransformer.h"
13 #include "qcepsettingssaver-ptr.h"
14 #include "qcepsettingssaver.h"
15 #include "qcepobjectnamer.h"
16 #include "cctwpeingresscommand.h"
17 
18 #ifdef WANT_IMPORT_COMMANDS
19 #include "cctwimporter.h"
20 #endif
21 
22 #include "cctwcomparer.h"
23 
24 class CctwqtMainWindow;
25 class CctwScriptEngine;
26 
27 #ifndef NO_GUI
28 class QwtPlot;
29 class QwtPlotCurve;
30 #endif
31 
33 #ifdef NO_GUI
34  : public QCoreApplication
35 #else
36  : public QApplication
37 #endif
38 {
39  Q_OBJECT
40 public:
41  explicit CctwApplication(int &argc, char *argv[]);
42  void initialize(int &argc, char *argv[]);
43 
44 signals:
45 
46 public slots:
47  void printLine(QString line);
48  void printMessage(QString msg, QDateTime dt=QDateTime::currentDateTime());
49  void wait(QString msg);
50  void evaluateStartupCommand(QString cmd);
51  void evaluateCommand(QString cmd);
52  void executeScriptFile(QString path);
53 
54  void execute();
55  void executeTransform();
56  void executeMerge();
57  void executeNorm();
58  void executeProject();
59 
60  void showHelp(QString about);
61  void showVersion();
62 
63  void setThreads(QString desc);
64 
65  void clearWriteSettings();
66  void writeSettings();
67  void readSettings();
68  void writeSettings(QString path);
69  void readSettings(QString path);
70 
71  QString settingsScript();
72 
73  void setInputData(QString data);
74  void setInputChunks(QString data);
75  void setInputDataset(QString data);
76 
77  void setMaskData(QString data);
78  void setMaskDataset(QString data);
79 
80  void setAnglesData(QString data);
81  void setAnglesDataset(QString data);
82 
83  void setOutputData(QString data);
84  void setOutputDims(QString data);
85  void setOutputChunks(QString data);
86  void setOutputDataset(QString data);
87 
88  void setOmega(QString data);
89  void setTwoTheta(QString data);
90  void setChi(QString data);
91  void setPhi(QString data);
92 
93  void setSubset(QString desc);
94  void transform(QString desc);
95  void partialDependencies(QString desc);
96  void noDependencies();
97 
98  void mergeInput(QString path);
99  void mergeOutput(QString path);
100 
101  void runTransform();
102  void runMerge();
103  void runNorm();
104  void runProject();
105 
106 // void transform();
107 
108  void setNormalization(QString data);
109  void setCompression(QString data);
110 
111  void inputProject(int axes);
112  void outputProject(int axes);
113  void setProjectOutput(QString dir);
114 
115  void calculateDependencies();
116  void calculateChunkDependencies(int n);
117 
118  void saveDependencies(QString path);
119  void loadDependencies(QString path);
120 
121  void reportDependencies();
122 
123  void doAboutToQuit();
124 
127 
130 
131  void reportInputChunkCounts();
133 
134  void analyzePEMetaData(QString path);
135  void analyzeSpecDataFile(QString path);
136 
138 
139  void addWorkOutstanding(int amt);
140  void workCompleted(int amt);
141  void waitCompleted();
142  int workOutstanding();
143 
144  int inputChunkCount();
145  int outputChunkCount();
146 
147  QcepIntList dependencies(int chunkId);
148  QList<CctwIntVector3D> dependencies(int cx, int cy, int cz);
149 
150  void testing();
151 
152 public:
153 #ifndef NO_GUI
154  void plotCurves(QwtPlotCurve *c1, QwtPlotCurve *c2, QwtPlotCurve *c3, QwtPlotCurve *c4);
155 #endif
156 
157  QcepSettingsSaverWPtr saver() const;
158 
159  QScriptValue evaluate(QString cmd);
160  void printHDF5errors();
161 
162  static QString addSlashes(QString str);
163 
164 private slots:
165  void onDebugChanged(int dbg);
166  void onProgress(int prg);
167 
168 private:
169  void startupCommand(QString cmd);
170  void preStartup();
171  void postStartup();
172 
173  void readSettings(QSettings *settings);
174  void writeSettings(QSettings *settings);
175 
176  void decodeCommandLineArgs(int &argc, char *argv[]);
177  void decodeCommandLineArgsForUnix(int &argc, char *argv[]);
178  void decodeCommandLineArgsForWindows(int &argc, char *argv[]);
179 
181 
182  void pushInputFile(QString path);
183  void autoChunkSizes();
184  void autoOutputFile(QString suffix);
185 
186 public:
187  QcepObjectNamer m_ObjectNamer;
188 #ifndef NO_GUI
190 #endif
192 #ifdef WANT_IMPORT_COMMANDS
193  CctwImporter *m_ImportData;
194 #endif
202  QcepSettingsSaverPtr m_Saver;
203 
204 // QStringList m_MergeInputs;
205 // QString m_MergeOutput;
206 
207 private:
209  QAtomicInt m_WorkOutstanding;
210  QAtomicInt m_LastProgress;
211 
212 public:
213  Q_PROPERTY(bool guiWanted READ get_GuiWanted WRITE set_GuiWanted STORED false)
214  QCEP_BOOLEAN_PROPERTY(GuiWanted)
215 
216  Q_PROPERTY(int mode READ get_Mode WRITE set_Mode STORED false)
217  QCEP_INTEGER_PROPERTY(Mode)
218 
219  Q_PROPERTY(QcepStringList startupCommands READ get_StartupCommands WRITE set_StartupCommands STORED false)
220  QCEP_STRING_LIST_PROPERTY(StartupCommands)
221 
222  Q_PROPERTY(QcepStringList inputFiles READ get_InputFiles WRITE set_InputFiles STORED false)
223  QCEP_STRING_LIST_PROPERTY(InputFiles)
224 
225  Q_PROPERTY(QString outputFile READ get_OutputFile WRITE set_OutputFile STORED false)
226  QCEP_STRING_PROPERTY(OutputFile)
227 
228  Q_PROPERTY(QString maskFile READ get_MaskFile WRITE set_MaskFile STORED false)
229  QCEP_STRING_PROPERTY(MaskFile)
230 
231  Q_PROPERTY(QString anglesFile READ get_AnglesFile WRITE set_AnglesFile STORED false)
232  QCEP_STRING_PROPERTY(AnglesFile)
233 
234  Q_PROPERTY(QString weightsFile READ get_WeightsFile WRITE set_WeightsFile STORED false)
235  QCEP_STRING_PROPERTY(WeightsFile)
236 
237  Q_PROPERTY(int debug READ get_Debug WRITE set_Debug)
238  QCEP_INTEGER_PROPERTY(Debug)
239 
240  Q_PROPERTY(bool halting READ get_Halting WRITE set_Halting STORED false)
241  QCEP_BOOLEAN_PROPERTY(Halting)
242 
243  Q_PROPERTY(int progress READ get_Progress WRITE set_Progress STORED false)
244  QCEP_INTEGER_PROPERTY(Progress)
245 
246  Q_PROPERTY(int progressLimit READ get_ProgressLimit WRITE set_ProgressLimit STORED false)
247  QCEP_INTEGER_PROPERTY(ProgressLimit)
248 
249  Q_PROPERTY(QString dependenciesPath READ get_DependenciesPath WRITE set_DependenciesPath)
250  QCEP_STRING_PROPERTY(DependenciesPath)
251 
252  Q_PROPERTY(QString settingsPath READ get_SettingsPath WRITE set_SettingsPath)
253  QCEP_STRING_PROPERTY(SettingsPath)
254 
255  Q_PROPERTY(QString scriptPath READ get_ScriptPath WRITE set_ScriptPath)
256  QCEP_STRING_PROPERTY(ScriptPath)
257 
258  Q_PROPERTY(QString specDataFilePath READ get_SpecDataFilePath WRITE set_SpecDataFilePath)
259  QCEP_STRING_PROPERTY(SpecDataFilePath)
260 
261  Q_PROPERTY(int mpiRank READ get_MpiRank WRITE set_MpiRank STORED false)
262  QCEP_INTEGER_PROPERTY(MpiRank)
263 
264  Q_PROPERTY(int mpiSize READ get_MpiSize WRITE set_MpiSize STORED false)
265  QCEP_INTEGER_PROPERTY(MpiSize)
266 
267  Q_PROPERTY(int verbosity READ get_Verbosity WRITE set_Verbosity STORED false)
268  QCEP_INTEGER_PROPERTY(Verbosity)
269 
270  Q_PROPERTY(int exitStatus READ get_ExitStatus WRITE set_ExitStatus STORED false)
271  QCEP_INTEGER_PROPERTY(ExitStatus)
272 };
273 
274 extern QcepSettingsSaverPtr g_Saver;
275 
276 #endif // CCTWAPPLICATION_H
CctwChunkedData * m_OutputData
void outputProject(int axes)
void decodeCommandLineArgs(int &argc, char *argv[])
void calculateChunkDependencies(int n)
void inputProject(int axes)
void setOmega(QString data)
void setMaskDataset(QString data)
CctwChunkedData * m_InputData
static QString addSlashes(QString str)
void setOutputChunks(QString data)
void startupCommand(QString cmd)
void setProjectOutput(QString dir)
CctwCrystalCoordinateParameters * m_Parameters
QcepSettingsSaverPtr g_Saver
void setCompression(QString data)
void onDebugChanged(int dbg)
QAtomicInt m_WorkOutstanding
void onProgress(int prg)
void executeScriptFile(QString path)
void setOutputDims(QString data)
QString dependenciesPath
void analyzeSpecDataFile(QString path)
QcepStringList startupCommands
QString specDataFilePath
QcepSettingsSaverPtr m_Saver
CctwTransformer * m_Transformer
void setPhi(QString data)
void transform(QString desc)
void setOutputData(QString data)
QcepIntList dependencies(int chunkId)
void setNormalization(QString data)
void addWorkOutstanding(int amt)
void autoOutputFile(QString suffix)
void initialize(int &argc, char *argv[])
void setSubset(QString desc)
QScriptValue evaluate(QString cmd)
void setThreads(QString desc)
CctwScriptEngine * m_ScriptEngine
QcepStringList inputFiles
CctwPEIngressCommand * m_PEIngressCommand
QAtomicInt m_LastProgress
void mergeInput(QString path)
void printLine(QString line)
void analyzePEMetaData(QString path)
void setTwoTheta(QString data)
CctwComparer * m_CompareData
void workCompleted(int amt)
void setOutputDataset(QString data)
void evaluateStartupCommand(QString cmd)
CctwqtMainWindow * m_Window
void saveDependencies(QString path)
void loadDependencies(QString path)
void setChi(QString data)
void pushInputFile(QString path)
QcepObjectNamer m_ObjectNamer
void decodeCommandLineArgsForUnix(int &argc, char *argv[])
void setAnglesDataset(QString data)
void installHDF5ErrorHandler()
QAtomicInt m_DependencyCounter
QcepSettingsSaverWPtr saver() const
void decodeCommandLineArgsForWindows(int &argc, char *argv[])
void setInputDataset(QString data)
void showHelp(QString about)
void plotCurves(QwtPlotCurve *c1, QwtPlotCurve *c2, QwtPlotCurve *c3, QwtPlotCurve *c4)
void mergeOutput(QString path)
void partialDependencies(QString desc)
void evaluateCommand(QString cmd)
void setMaskData(QString data)
void wait(QString msg)
void setAnglesData(QString data)
CctwApplication(int &argc, char *argv[])
CctwCrystalCoordinateTransform * m_Transform
CctwCrystalCoordinateParameters * parameters() const
void setInputData(QString data)
void setInputChunks(QString data)
void printMessage(QString msg, QDateTime dt=QDateTime::currentDateTime())