Commit bfe3f56bcc5ad1300be55c79dc345fbdf740aab4
1 parent
52a5fe9d
Fixed Linux compatibility issues.
Showing
11 changed files
with
73 additions
and
105 deletions
Show diff stats
CMakeLists.txt
... | ... | @@ -70,7 +70,7 @@ source_group(QtUI FILES ${SRC_UI}) |
70 | 70 | cuda_add_executable(IMie ${SRC_CPP} ${SRC_H} ${UI_H} ${UI_MOC} ${ALL_RCC} ${SRC_CU}) |
71 | 71 | |
72 | 72 | #set the link libraries |
73 | -target_link_libraries(IMie ${QT_LIBRARIES} ${QT_QTOPENGL_LIBRARY} ${OPENGL_LIBRARIES} ${GLEW_LIBRARY}) | |
73 | +target_link_libraries(IMie ${QT_LIBRARIES} ${QT_QTOPENGL_LIBRARY} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${GLEW_LIBRARY}) | |
74 | 74 | |
75 | 75 | |
76 | 76 | ... | ... |
EstimateMaterial.cpp
FileIO.cpp
PerformanceData.h
1 | 1 | // add the following to a cpp file: |
2 | 2 | // PerformanceData PD; |
3 | 3 | |
4 | + | |
4 | 5 | #pragma once |
5 | 6 | #include <ostream> |
6 | 7 | using namespace std; |
... | ... | @@ -34,17 +35,7 @@ static char PDTypeNames[][255] = { |
34 | 35 | //end my stuff |
35 | 36 | |
36 | 37 | }; |
37 | - | |
38 | -//------------------------------------------------------------------------------- | |
39 | - | |
40 | -//#ifdef DISPLAY | |
41 | -// #define PERFORMANCE_DATA_MEASUE_ENABLE | |
42 | -//#endif | |
43 | - | |
44 | -//#ifdef PERFORMANCE_DATA_MEASUE_ENABLE | |
45 | - | |
46 | -//------------------------------------------------------------------------------- | |
47 | - | |
38 | +#ifdef WIN32 | |
48 | 39 | #include <stdio.h> |
49 | 40 | #include <windows.h> |
50 | 41 | #include <float.h> |
... | ... | @@ -72,7 +63,7 @@ public: |
72 | 63 | } |
73 | 64 | } |
74 | 65 | |
75 | - void StartTimer( int type ) { QueryPerformanceCounter( &startTime[type] ); /*startTime[type] = GetTickCount();*/ } | |
66 | + void StartTimer( int type ) { QueryPerformanceCounter( &startTime[type] );} | |
76 | 67 | void EndTimer( int type ) { |
77 | 68 | LARGE_INTEGER endTime; |
78 | 69 | QueryPerformanceCounter( &endTime ); |
... | ... | @@ -122,7 +113,7 @@ private: |
122 | 113 | }; |
123 | 114 | |
124 | 115 | //------------------------------------------------------------------------------- |
125 | -/*#else | |
116 | +#else | |
126 | 117 | |
127 | 118 | class PerformanceData{ |
128 | 119 | public: |
... | ... | @@ -141,7 +132,7 @@ public: |
141 | 132 | |
142 | 133 | #endif |
143 | 134 | //------------------------------------------------------------------------------- |
144 | -*/ | |
135 | + | |
145 | 136 | extern PerformanceData PD; |
146 | 137 | |
147 | 138 | //------------------------------------------------------------------------------- | ... | ... |
SimulateSpectrum.cpp
... | ... | @@ -3,6 +3,7 @@ |
3 | 3 | #include <iostream> |
4 | 4 | #include <fstream> |
5 | 5 | #include "globals.h" |
6 | +#include <stdlib.h> | |
6 | 7 | //#include "cufft.h" |
7 | 8 | using namespace std; |
8 | 9 | |
... | ... | @@ -10,9 +11,9 @@ using namespace std; |
10 | 11 | |
11 | 12 | typedef complex<double> scComplex; |
12 | 13 | |
13 | -int cbessjyva(double v,complex<double> z,double &vm,complex<double>*cjv, | |
14 | +extern int cbessjyva(double v,complex<double> z,double &vm,complex<double>*cjv, | |
14 | 15 | complex<double>*cyv,complex<double>*cjvp,complex<double>*cyvp); |
15 | -int bessjyv(double v,double x,double &vm,double *jv,double *yv, | |
16 | +extern int bessjyv(double v,double x,double &vm,double *jv,double *yv, | |
16 | 17 | double *djv,double *dyv); |
17 | 18 | |
18 | 19 | complex<double> Jl_neg(complex<double> x) | ... | ... |
globals.h
... | ... | @@ -17,7 +17,7 @@ struct SpecPair{ |
17 | 17 | |
18 | 18 | struct Material{ |
19 | 19 | vector<double> nu; |
20 | - vector<complex<double>> eta; | |
20 | + vector<complex<double> > eta; | |
21 | 21 | string name; |
22 | 22 | }; |
23 | 23 | |
... | ... | @@ -27,7 +27,7 @@ enum OpticsType {TransmissionOpticsType, ReflectionOpticsType}; |
27 | 27 | extern PerformanceData PD; |
28 | 28 | |
29 | 29 | |
30 | -extern vector<vector<SpecPair>> RefSpectrum; | |
30 | +extern vector<vector<SpecPair> > RefSpectrum; | |
31 | 31 | extern int currentSpec; |
32 | 32 | extern vector<SpecPair> SimSpectrum; |
33 | 33 | ... | ... |
interactivemie.h
... | ... | @@ -134,7 +134,7 @@ public slots: |
134 | 134 | SimulateSpectrum(); |
135 | 135 | UpdateDisplay(); |
136 | 136 | } |
137 | - void on_radDisplayIntensity_clicked(bool b){ | |
137 | + void on_radDisplayIntensity_toggled(bool b){ | |
138 | 138 | dispSimType = IntensitySpecType; |
139 | 139 | SimulateSpectrum(); |
140 | 140 | UpdateDisplay(); |
... | ... | @@ -214,6 +214,8 @@ public slots: |
214 | 214 | void on_radReflectionOptics_clicked(bool d){ |
215 | 215 | ui.spinCondNAi->setEnabled(false); |
216 | 216 | ui.spinCondNAo->setEnabled(false); |
217 | + ui.radDisplayAbsorbance->setEnabled(false); | |
218 | + ui.radDisplayIntensity->setChecked(true); | |
217 | 219 | opticsMode = ReflectionOpticsType; |
218 | 220 | SimulateSpectrum(); |
219 | 221 | UpdateDisplay(); | ... | ... |
interactivemie.ui
... | ... | @@ -357,7 +357,7 @@ |
357 | 357 | <double>-9999.000000000000000</double> |
358 | 358 | </property> |
359 | 359 | <property name="maximum"> |
360 | - <double>3.000000000000000</double> | |
360 | + <double>9999.000000000000000</double> | |
361 | 361 | </property> |
362 | 362 | <property name="singleStep"> |
363 | 363 | <double>0.100000000000000</double> |
... | ... | @@ -379,7 +379,7 @@ |
379 | 379 | <number>1</number> |
380 | 380 | </property> |
381 | 381 | <property name="maximum"> |
382 | - <number>4000</number> | |
382 | + <number>100000</number> | |
383 | 383 | </property> |
384 | 384 | <property name="singleStep"> |
385 | 385 | <number>10</number> | ... | ... |
main.cpp
... | ... | @@ -7,13 +7,13 @@ using namespace std; |
7 | 7 | #include "rtsGUIConsole.h" |
8 | 8 | #include "PerformanceData.h" |
9 | 9 | #include <complex> |
10 | -#include <direct.h> | |
10 | +//#include <direct.h> | |
11 | 11 | |
12 | 12 | PerformanceData PD; |
13 | 13 | |
14 | 14 | qtSpectrumDisplay* gpSpectrumDisplay; |
15 | 15 | |
16 | -vector<vector<SpecPair>> RefSpectrum; | |
16 | +vector<vector<SpecPair> > RefSpectrum; | |
17 | 17 | vector<SpecPair> SimSpectrum; |
18 | 18 | vector<SpecPair> EtaK; |
19 | 19 | vector<SpecPair> EtaN; |
... | ... | @@ -254,15 +254,23 @@ void SetMaterial() |
254 | 254 | int nSamples = MaterialList[currentMaterial].eta.size(); |
255 | 255 | double nu; |
256 | 256 | SpecPair temp; |
257 | + | |
258 | + //initialize the current nuMin and nuMax values | |
259 | + nuMin = MaterialList[currentMaterial].nu[0]; | |
260 | + nuMax = nuMin; | |
257 | 261 | for(int i=0; i<nSamples; i++){ |
258 | 262 | nu = MaterialList[currentMaterial].nu[i]; |
259 | - if(nu >= nuMin && nu <= nuMax){ | |
263 | + //if(nu >= nuMin && nu <= nuMax){ | |
264 | + | |
265 | + //update the min and max values for display | |
266 | + if(nu < nuMin) nuMin = nu; | |
267 | + if(nu > nuMax) nuMax = nu; | |
268 | + | |
260 | 269 | temp.nu = nu; |
261 | 270 | temp.A = MaterialList[currentMaterial].eta[i].imag(); |
262 | 271 | EtaK.push_back(temp); |
263 | 272 | temp.A = MaterialList[currentMaterial].eta[i].real(); |
264 | 273 | EtaN.push_back(temp); |
265 | - } | |
266 | 274 | } |
267 | 275 | cA = 1.0; |
268 | 276 | ... | ... |
qtSpectrumDisplay.cpp
rtsGUIConsole.cpp
1 | +#ifdef WIN32 | |
1 | 2 | #include <windows.h> |
2 | - | |
3 | 3 | #include <stdio.h> |
4 | - | |
5 | 4 | #include <fcntl.h> |
6 | - | |
7 | 5 | #include <io.h> |
8 | - | |
9 | 6 | #include <iostream> |
10 | - | |
11 | 7 | #include <fstream> |
12 | 8 | |
13 | 9 | #ifndef _USE_OLD_IOSTREAMS |
14 | 10 | |
15 | 11 | using namespace std; |
16 | - | |
17 | 12 | #endif |
18 | 13 | |
19 | 14 | // maximum mumber of lines the output console should have |
20 | 15 | |
21 | 16 | static const WORD MAX_CONSOLE_LINES = 500; |
22 | - | |
23 | 17 | //#ifdef _DEBUG |
24 | 18 | |
25 | 19 | void RedirectIOToConsole(int Xpos, int Ypos, int Width, int Height) |
26 | - | |
27 | 20 | { |
28 | - | |
29 | -int hConHandle; | |
30 | - | |
31 | -long lStdHandle; | |
32 | - | |
33 | -CONSOLE_SCREEN_BUFFER_INFO coninfo; | |
34 | - | |
35 | -FILE *fp; | |
36 | - | |
37 | -// allocate a console for this app | |
38 | - | |
39 | -AllocConsole(); | |
40 | - | |
41 | -// set the screen buffer to be big enough to let us scroll text | |
42 | - | |
43 | -GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &coninfo); | |
44 | - | |
45 | -coninfo.dwSize.Y = MAX_CONSOLE_LINES; | |
46 | - | |
47 | -SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE), | |
48 | - | |
49 | -coninfo.dwSize); | |
50 | - | |
51 | -// redirect unbuffered STDOUT to the console | |
52 | - | |
53 | -lStdHandle = (long)GetStdHandle(STD_OUTPUT_HANDLE); | |
54 | - | |
55 | -hConHandle = _open_osfhandle(lStdHandle, _O_TEXT); | |
56 | - | |
57 | -fp = _fdopen( hConHandle, "w" ); | |
58 | - | |
59 | -*stdout = *fp; | |
60 | - | |
61 | -setvbuf( stdout, NULL, _IONBF, 0 ); | |
62 | - | |
63 | -// redirect unbuffered STDIN to the console | |
64 | - | |
65 | -lStdHandle = (long)GetStdHandle(STD_INPUT_HANDLE); | |
66 | - | |
67 | -hConHandle = _open_osfhandle(lStdHandle, _O_TEXT); | |
68 | - | |
69 | -fp = _fdopen( hConHandle, "r" ); | |
70 | - | |
71 | -*stdin = *fp; | |
72 | - | |
73 | -setvbuf( stdin, NULL, _IONBF, 0 ); | |
74 | - | |
75 | -// redirect unbuffered STDERR to the console | |
76 | - | |
77 | -lStdHandle = (long)GetStdHandle(STD_ERROR_HANDLE); | |
78 | - | |
79 | -hConHandle = _open_osfhandle(lStdHandle, _O_TEXT); | |
80 | - | |
81 | -fp = _fdopen( hConHandle, "w" ); | |
82 | - | |
83 | -*stderr = *fp; | |
84 | - | |
85 | -setvbuf( stderr, NULL, _IONBF, 0 ); | |
86 | - | |
87 | -// make cout, wcout, cin, wcin, wcerr, cerr, wclog and clog | |
88 | - | |
89 | -// point to console as well | |
90 | - | |
91 | -ios::sync_with_stdio(); | |
92 | - | |
93 | -//position | |
94 | - | |
95 | -MoveWindow(GetConsoleWindow(), Xpos, Ypos, Width, Height, true); | |
96 | - | |
21 | + int hConHandle; | |
22 | + long lStdHandle; | |
23 | + CONSOLE_SCREEN_BUFFER_INFO coninfo; | |
24 | + FILE *fp; | |
25 | + // allocate a console for this app | |
26 | + AllocConsole(); | |
27 | + // set the screen buffer to be big enough to let us scroll text | |
28 | + GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &coninfo); | |
29 | + coninfo.dwSize.Y = MAX_CONSOLE_LINES; | |
30 | + SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE), | |
31 | + coninfo.dwSize); | |
32 | + // redirect unbuffered STDOUT to the console | |
33 | + lStdHandle = (long)GetStdHandle(STD_OUTPUT_HANDLE); | |
34 | + hConHandle = _open_osfhandle(lStdHandle, _O_TEXT); | |
35 | + fp = _fdopen( hConHandle, "w" ); | |
36 | + *stdout = *fp; | |
37 | + setvbuf( stdout, NULL, _IONBF, 0 ); | |
38 | + // redirect unbuffered STDIN to the console | |
39 | + lStdHandle = (long)GetStdHandle(STD_INPUT_HANDLE); | |
40 | + hConHandle = _open_osfhandle(lStdHandle, _O_TEXT); | |
41 | + fp = _fdopen( hConHandle, "r" ); | |
42 | + *stdin = *fp; | |
43 | + setvbuf( stdin, NULL, _IONBF, 0 ); | |
44 | + | |
45 | + // redirect unbuffered STDERR to the console | |
46 | + lStdHandle = (long)GetStdHandle(STD_ERROR_HANDLE); | |
47 | + hConHandle = _open_osfhandle(lStdHandle, _O_TEXT); | |
48 | + fp = _fdopen( hConHandle, "w" ); | |
49 | + *stderr = *fp; | |
50 | + setvbuf( stderr, NULL, _IONBF, 0 ); | |
51 | + | |
52 | + // make cout, wcout, cin, wcin, wcerr, cerr, wclog and clog | |
53 | + // point to console as well | |
54 | + ios::sync_with_stdio(); | |
55 | + //position | |
56 | + MoveWindow(GetConsoleWindow(), Xpos, Ypos, Width, Height, true); | |
97 | 57 | } |
98 | 58 | |
99 | -//#endif | |
59 | +#else | |
60 | +void RedirectIOToConsole(int Xpos, int Ypos, int Width, int Height) | |
61 | +{ | |
62 | +} | |
63 | +#endif | |
100 | 64 | |
101 | 65 | //End of File |
102 | 66 | \ No newline at end of file | ... | ... |