main.cpp
1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#include "sphere.h"
#include "rts/optics/material.h"
#include <vector>
//#include "rts/complex.h"
#include "nearfield.h"
//nearfieldStruct* NF;
#include "microscope.h"
microscopeStruct* SCOPE;
#include "fieldslice.h"
#include "fileout.h"
//#include "options.h"
#include "arguments.h"
#include "rts/tools/arguments.h"
#include "montecarlo.h"
#include "rts/math/point.h"
#include "rts/math/spherical_bessel.h"
#include "rts/math/matrix.h"
#include "rts/math/quaternion.h"
#include "rts/envi/envi.h"
#include "warnings.h"
#include "planewave.h"
//user interface
#include "qtMainDialog.h"
bool gui = false;
#ifdef _WIN32
bool ansi = false;
#else
bool ansi = true;
#endif
fileoutStruct gFileOut;
bool verbose = false;
using namespace std;
int cbessjyva(double v,complex<double> z,double &vm,complex<double>*cjv,
complex<double>*cyv,complex<double>*cjvp,complex<double>*cyvp);
int main(int argc, char *argv[])
{
//arguments test
rts::arglist args;
SetArguments(args);
//parse the input arguments
args.parse(argc, argv);
SCOPE = new microscopeStruct();
//load the user specified parameters into the simulation
LoadParameters(args);
//activate ansi output if specified
args.set_ansi(ansi);
//display help and exit
if(args("help"))
{
cout<<args.toStr()<<endl;
exit(1);
}
//initialize GPU memory for fields
SCOPE->init();
if(gui)
{
QApplication app(argc, argv);
qtMainDialog bsDialog;
//populate the user interface with the default and command-line values
bsDialog.populateUi();
bsDialog.show();
return app.exec();
}
else
{
gFileOut.Save(SCOPE);
if(verbose)
OutputOptions();
SCOPE->destroy();
}
}