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,7 +70,7 @@ source_group(QtUI FILES ${SRC_UI}) | ||
70 | cuda_add_executable(IMie ${SRC_CPP} ${SRC_H} ${UI_H} ${UI_MOC} ${ALL_RCC} ${SRC_CU}) | 70 | cuda_add_executable(IMie ${SRC_CPP} ${SRC_H} ${UI_H} ${UI_MOC} ${ALL_RCC} ${SRC_CU}) |
71 | 71 | ||
72 | #set the link libraries | 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
@@ -110,6 +110,7 @@ void SaveN(string fileName) | @@ -110,6 +110,7 @@ void SaveN(string fileName) | ||
110 | void SaveSimulation(string fileName) | 110 | void SaveSimulation(string fileName) |
111 | { | 111 | { |
112 | ofstream outFile(fileName.c_str()); | 112 | ofstream outFile(fileName.c_str()); |
113 | + outFile.precision(10); | ||
113 | for(unsigned int i=0; i<SimSpectrum.size(); i++) | 114 | for(unsigned int i=0; i<SimSpectrum.size(); i++) |
114 | { | 115 | { |
115 | outFile<<SimSpectrum[i].nu<<" "; | 116 | outFile<<SimSpectrum[i].nu<<" "; |
PerformanceData.h
1 | // add the following to a cpp file: | 1 | // add the following to a cpp file: |
2 | // PerformanceData PD; | 2 | // PerformanceData PD; |
3 | 3 | ||
4 | + | ||
4 | #pragma once | 5 | #pragma once |
5 | #include <ostream> | 6 | #include <ostream> |
6 | using namespace std; | 7 | using namespace std; |
@@ -34,17 +35,7 @@ static char PDTypeNames[][255] = { | @@ -34,17 +35,7 @@ static char PDTypeNames[][255] = { | ||
34 | //end my stuff | 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 | #include <stdio.h> | 39 | #include <stdio.h> |
49 | #include <windows.h> | 40 | #include <windows.h> |
50 | #include <float.h> | 41 | #include <float.h> |
@@ -72,7 +63,7 @@ public: | @@ -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 | void EndTimer( int type ) { | 67 | void EndTimer( int type ) { |
77 | LARGE_INTEGER endTime; | 68 | LARGE_INTEGER endTime; |
78 | QueryPerformanceCounter( &endTime ); | 69 | QueryPerformanceCounter( &endTime ); |
@@ -122,7 +113,7 @@ private: | @@ -122,7 +113,7 @@ private: | ||
122 | }; | 113 | }; |
123 | 114 | ||
124 | //------------------------------------------------------------------------------- | 115 | //------------------------------------------------------------------------------- |
125 | -/*#else | 116 | +#else |
126 | 117 | ||
127 | class PerformanceData{ | 118 | class PerformanceData{ |
128 | public: | 119 | public: |
@@ -141,7 +132,7 @@ public: | @@ -141,7 +132,7 @@ public: | ||
141 | 132 | ||
142 | #endif | 133 | #endif |
143 | //------------------------------------------------------------------------------- | 134 | //------------------------------------------------------------------------------- |
144 | -*/ | 135 | + |
145 | extern PerformanceData PD; | 136 | extern PerformanceData PD; |
146 | 137 | ||
147 | //------------------------------------------------------------------------------- | 138 | //------------------------------------------------------------------------------- |
SimulateSpectrum.cpp
@@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
3 | #include <iostream> | 3 | #include <iostream> |
4 | #include <fstream> | 4 | #include <fstream> |
5 | #include "globals.h" | 5 | #include "globals.h" |
6 | +#include <stdlib.h> | ||
6 | //#include "cufft.h" | 7 | //#include "cufft.h" |
7 | using namespace std; | 8 | using namespace std; |
8 | 9 | ||
@@ -10,9 +11,9 @@ using namespace std; | @@ -10,9 +11,9 @@ using namespace std; | ||
10 | 11 | ||
11 | typedef complex<double> scComplex; | 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 | complex<double>*cyv,complex<double>*cjvp,complex<double>*cyvp); | 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 | double *djv,double *dyv); | 17 | double *djv,double *dyv); |
17 | 18 | ||
18 | complex<double> Jl_neg(complex<double> x) | 19 | complex<double> Jl_neg(complex<double> x) |
globals.h
@@ -17,7 +17,7 @@ struct SpecPair{ | @@ -17,7 +17,7 @@ struct SpecPair{ | ||
17 | 17 | ||
18 | struct Material{ | 18 | struct Material{ |
19 | vector<double> nu; | 19 | vector<double> nu; |
20 | - vector<complex<double>> eta; | 20 | + vector<complex<double> > eta; |
21 | string name; | 21 | string name; |
22 | }; | 22 | }; |
23 | 23 | ||
@@ -27,7 +27,7 @@ enum OpticsType {TransmissionOpticsType, ReflectionOpticsType}; | @@ -27,7 +27,7 @@ enum OpticsType {TransmissionOpticsType, ReflectionOpticsType}; | ||
27 | extern PerformanceData PD; | 27 | extern PerformanceData PD; |
28 | 28 | ||
29 | 29 | ||
30 | -extern vector<vector<SpecPair>> RefSpectrum; | 30 | +extern vector<vector<SpecPair> > RefSpectrum; |
31 | extern int currentSpec; | 31 | extern int currentSpec; |
32 | extern vector<SpecPair> SimSpectrum; | 32 | extern vector<SpecPair> SimSpectrum; |
33 | 33 |
interactivemie.h
@@ -134,7 +134,7 @@ public slots: | @@ -134,7 +134,7 @@ public slots: | ||
134 | SimulateSpectrum(); | 134 | SimulateSpectrum(); |
135 | UpdateDisplay(); | 135 | UpdateDisplay(); |
136 | } | 136 | } |
137 | - void on_radDisplayIntensity_clicked(bool b){ | 137 | + void on_radDisplayIntensity_toggled(bool b){ |
138 | dispSimType = IntensitySpecType; | 138 | dispSimType = IntensitySpecType; |
139 | SimulateSpectrum(); | 139 | SimulateSpectrum(); |
140 | UpdateDisplay(); | 140 | UpdateDisplay(); |
@@ -214,6 +214,8 @@ public slots: | @@ -214,6 +214,8 @@ public slots: | ||
214 | void on_radReflectionOptics_clicked(bool d){ | 214 | void on_radReflectionOptics_clicked(bool d){ |
215 | ui.spinCondNAi->setEnabled(false); | 215 | ui.spinCondNAi->setEnabled(false); |
216 | ui.spinCondNAo->setEnabled(false); | 216 | ui.spinCondNAo->setEnabled(false); |
217 | + ui.radDisplayAbsorbance->setEnabled(false); | ||
218 | + ui.radDisplayIntensity->setChecked(true); | ||
217 | opticsMode = ReflectionOpticsType; | 219 | opticsMode = ReflectionOpticsType; |
218 | SimulateSpectrum(); | 220 | SimulateSpectrum(); |
219 | UpdateDisplay(); | 221 | UpdateDisplay(); |
interactivemie.ui
@@ -357,7 +357,7 @@ | @@ -357,7 +357,7 @@ | ||
357 | <double>-9999.000000000000000</double> | 357 | <double>-9999.000000000000000</double> |
358 | </property> | 358 | </property> |
359 | <property name="maximum"> | 359 | <property name="maximum"> |
360 | - <double>3.000000000000000</double> | 360 | + <double>9999.000000000000000</double> |
361 | </property> | 361 | </property> |
362 | <property name="singleStep"> | 362 | <property name="singleStep"> |
363 | <double>0.100000000000000</double> | 363 | <double>0.100000000000000</double> |
@@ -379,7 +379,7 @@ | @@ -379,7 +379,7 @@ | ||
379 | <number>1</number> | 379 | <number>1</number> |
380 | </property> | 380 | </property> |
381 | <property name="maximum"> | 381 | <property name="maximum"> |
382 | - <number>4000</number> | 382 | + <number>100000</number> |
383 | </property> | 383 | </property> |
384 | <property name="singleStep"> | 384 | <property name="singleStep"> |
385 | <number>10</number> | 385 | <number>10</number> |
main.cpp
@@ -7,13 +7,13 @@ using namespace std; | @@ -7,13 +7,13 @@ using namespace std; | ||
7 | #include "rtsGUIConsole.h" | 7 | #include "rtsGUIConsole.h" |
8 | #include "PerformanceData.h" | 8 | #include "PerformanceData.h" |
9 | #include <complex> | 9 | #include <complex> |
10 | -#include <direct.h> | 10 | +//#include <direct.h> |
11 | 11 | ||
12 | PerformanceData PD; | 12 | PerformanceData PD; |
13 | 13 | ||
14 | qtSpectrumDisplay* gpSpectrumDisplay; | 14 | qtSpectrumDisplay* gpSpectrumDisplay; |
15 | 15 | ||
16 | -vector<vector<SpecPair>> RefSpectrum; | 16 | +vector<vector<SpecPair> > RefSpectrum; |
17 | vector<SpecPair> SimSpectrum; | 17 | vector<SpecPair> SimSpectrum; |
18 | vector<SpecPair> EtaK; | 18 | vector<SpecPair> EtaK; |
19 | vector<SpecPair> EtaN; | 19 | vector<SpecPair> EtaN; |
@@ -254,15 +254,23 @@ void SetMaterial() | @@ -254,15 +254,23 @@ void SetMaterial() | ||
254 | int nSamples = MaterialList[currentMaterial].eta.size(); | 254 | int nSamples = MaterialList[currentMaterial].eta.size(); |
255 | double nu; | 255 | double nu; |
256 | SpecPair temp; | 256 | SpecPair temp; |
257 | + | ||
258 | + //initialize the current nuMin and nuMax values | ||
259 | + nuMin = MaterialList[currentMaterial].nu[0]; | ||
260 | + nuMax = nuMin; | ||
257 | for(int i=0; i<nSamples; i++){ | 261 | for(int i=0; i<nSamples; i++){ |
258 | nu = MaterialList[currentMaterial].nu[i]; | 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 | temp.nu = nu; | 269 | temp.nu = nu; |
261 | temp.A = MaterialList[currentMaterial].eta[i].imag(); | 270 | temp.A = MaterialList[currentMaterial].eta[i].imag(); |
262 | EtaK.push_back(temp); | 271 | EtaK.push_back(temp); |
263 | temp.A = MaterialList[currentMaterial].eta[i].real(); | 272 | temp.A = MaterialList[currentMaterial].eta[i].real(); |
264 | EtaN.push_back(temp); | 273 | EtaN.push_back(temp); |
265 | - } | ||
266 | } | 274 | } |
267 | cA = 1.0; | 275 | cA = 1.0; |
268 | 276 |
qtSpectrumDisplay.cpp
rtsGUIConsole.cpp
1 | +#ifdef WIN32 | ||
1 | #include <windows.h> | 2 | #include <windows.h> |
2 | - | ||
3 | #include <stdio.h> | 3 | #include <stdio.h> |
4 | - | ||
5 | #include <fcntl.h> | 4 | #include <fcntl.h> |
6 | - | ||
7 | #include <io.h> | 5 | #include <io.h> |
8 | - | ||
9 | #include <iostream> | 6 | #include <iostream> |
10 | - | ||
11 | #include <fstream> | 7 | #include <fstream> |
12 | 8 | ||
13 | #ifndef _USE_OLD_IOSTREAMS | 9 | #ifndef _USE_OLD_IOSTREAMS |
14 | 10 | ||
15 | using namespace std; | 11 | using namespace std; |
16 | - | ||
17 | #endif | 12 | #endif |
18 | 13 | ||
19 | // maximum mumber of lines the output console should have | 14 | // maximum mumber of lines the output console should have |
20 | 15 | ||
21 | static const WORD MAX_CONSOLE_LINES = 500; | 16 | static const WORD MAX_CONSOLE_LINES = 500; |
22 | - | ||
23 | //#ifdef _DEBUG | 17 | //#ifdef _DEBUG |
24 | 18 | ||
25 | void RedirectIOToConsole(int Xpos, int Ypos, int Width, int Height) | 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 | //End of File | 65 | //End of File |
102 | \ No newline at end of file | 66 | \ No newline at end of file |