fermisurfer Git
Revision | 1fff391816c6aa58b51693ce03495dc49e7b13f2 (tree) |
---|---|
Zeit | 2020-03-13 01:08:42 |
Autor | Mitsuaki Kawamura <kawamitsuaki@gmai...> |
Commiter | Mitsuaki Kawamura |
Use global variables again.
Output 2D Fermi lines
Display reciplocal lattice vectors
Universal design (color: RGB, CMY, MCY)
@@ -25,6 +25,7 @@ THE SOFTWARE. | ||
25 | 25 | @brief Compute lines of BZ boundary |
26 | 26 | */ |
27 | 27 | #include "basic_math.hpp" |
28 | +#include "variable.hpp" | |
28 | 29 | #include <wx/wx.h> |
29 | 30 | #if defined(HAVE_CONFIG_H) |
30 | 31 | #include <config.h> |
@@ -107,14 +108,8 @@ static int bragg_vert( | ||
107 | 108 | /** |
108 | 109 | @brief Compute real number of Bragg plane at 1st BZ |
109 | 110 | */ |
110 | -static void check_bragg( | |
111 | - wxTextCtrl *terminal, | |
112 | - int nbzl, | |
113 | - GLfloat bzl[676][2][3], | |
114 | - GLfloat bragg[26][3], | |
115 | - GLfloat brnrm[26], | |
116 | - int *nbragg | |
117 | -) { | |
111 | +static void check_bragg() | |
112 | +{ | |
118 | 113 | int ibr, ibzl, ibzc; |
119 | 114 | int ii, kk, bzflag, nbzcorner, nn; |
120 | 115 | GLfloat thr = (GLfloat)0.0001, prod, bzc[676][3]; |
@@ -144,7 +139,7 @@ static void check_bragg( | ||
144 | 139 | Then, compute real number Bragg plane of 1st BZ (::nbragg), |
145 | 140 | Re-order ::bragg and ::brnrm |
146 | 141 | */ |
147 | - *nbragg = 0; | |
142 | + nbragg = 0; | |
148 | 143 | for (ibr = 0; ibr < 26; ibr++) { |
149 | 144 | nn = 0; |
150 | 145 |
@@ -153,31 +148,25 @@ static void check_bragg( | ||
153 | 148 | if (fabsf(prod - brnrm[ibr]) < thr) nn += 1; |
154 | 149 | } |
155 | 150 | if (nn >= 3) { |
156 | - for (kk = 0; kk < 3; kk++) bragg[*nbragg][kk] = bragg[ibr][kk]; | |
157 | - brnrm[*nbragg] = brnrm[ibr]; | |
158 | - *nbragg += 1; | |
151 | + for (kk = 0; kk < 3; kk++) bragg[nbragg][kk] = bragg[ibr][kk]; | |
152 | + brnrm[nbragg] = brnrm[ibr]; | |
153 | + nbragg += 1; | |
159 | 154 | } |
160 | 155 | } |
161 | - *terminal << wxString::Format(wxT(" Number of plane of 1st BZ : %d\n"), *nbragg); | |
156 | + *terminal << wxString::Format(wxT(" Number of plane of 1st BZ : %d\n"), nbragg); | |
162 | 157 | }/*static void check_bragg*/ |
163 | 158 | /** |
164 | 159 | @brief Compute Brillouin zone boundariy lines |
165 | 160 | |
166 | 161 | Modify : ::nbzl, ::bzl |
167 | 162 | */ |
168 | -void bz_lines( | |
169 | - wxTextCtrl* terminal, | |
170 | - GLfloat bragg[26][3], | |
171 | - GLfloat brnrm[26], | |
172 | - int *nbzl, | |
173 | - GLfloat bzl[676][2][3], | |
174 | - int *nbragg | |
175 | -) { | |
163 | +void bz_lines() | |
164 | +{ | |
176 | 165 | /**/ |
177 | 166 | int ibr, jbr, nbr, i, j, lvert; |
178 | 167 | GLfloat vert[2][3]; |
179 | 168 | /**/ |
180 | - *nbzl = 0; | |
169 | + nbzl = 0; | |
181 | 170 | /**/ |
182 | 171 | for (ibr = 0; ibr < 26; ++ibr) { |
183 | 172 | for (jbr = 0; jbr < 26; ++jbr) { |
@@ -191,12 +180,12 @@ void bz_lines( | ||
191 | 180 | lvert = bragg_vert(bragg, brnrm, ibr, jbr, nbr, vert[1], vert[0]); |
192 | 181 | if (lvert == 0) continue; |
193 | 182 | /**/ |
194 | - for (i = 0; i < 2; ++i) for (j = 0; j < 3; ++j) bzl[*nbzl][i][j] = vert[i][j]; | |
195 | - *nbzl = *nbzl + 1; | |
183 | + for (i = 0; i < 2; ++i) for (j = 0; j < 3; ++j) bzl[nbzl][i][j] = vert[i][j]; | |
184 | + nbzl = nbzl + 1; | |
196 | 185 | |
197 | 186 | }/*for (jbr = 0; jbr < 26; ++jbr)*/ |
198 | 187 | }/*for (ibr = 0; ibr < 26; ++ibr)*/ |
199 | 188 | |
200 | - check_bragg(terminal, *nbzl, bzl, bragg, brnrm, nbragg); | |
189 | + check_bragg(); | |
201 | 190 | |
202 | 191 | }/*bz_lines*/ |
@@ -22,4 +22,4 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
22 | 22 | THE SOFTWARE. |
23 | 23 | */ |
24 | 24 | |
25 | -void bz_lines(wxTextCtrl* terminal, GLfloat bragg[26][3], GLfloat brnrm[26], int* nbzl, GLfloat bzl[676][2][3], int* nbragg); | |
25 | +void bz_lines(); |
@@ -38,24 +38,15 @@ THE SOFTWARE. | ||
38 | 38 | #include <cmath> |
39 | 39 | #include <vector> |
40 | 40 | #include "basic_math.hpp" |
41 | - | |
41 | +#include "variable.hpp" | |
42 | 42 | /** |
43 | 43 | @brief Compute node-line where \f$\Delta_{n k} = 0\f$ |
44 | 44 | |
45 | 45 | Modify : ::nnl, ::kvnl, ::kvnl_rot |
46 | 46 | |
47 | 47 | */ |
48 | -void calc_nodeline( | |
49 | -int nb, | |
50 | -int *ntri, | |
51 | -GLfloat ****matp, | |
52 | -GLfloat ****kvp, | |
53 | -int nthreads, | |
54 | -wxTextCtrl *terminal, | |
55 | -int* nnl, | |
56 | -GLfloat**** kvnl, | |
57 | -GLfloat** kvnl_rot | |
58 | -) { | |
48 | +void calc_nodeline() | |
49 | +{ | |
59 | 50 | int ib, itri, i, j, ithread, nnl0; |
60 | 51 | std::vector<std::vector<std::vector<std::vector<GLfloat>>>> kvnl_v; |
61 | 52 |
@@ -21,15 +21,4 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
21 | 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
22 | 22 | THE SOFTWARE. |
23 | 23 | */ |
24 | -#if defined(HAVE_CONFIG_H) | |
25 | -#include <config.h> | |
26 | -#endif | |
27 | -#if defined(HAVE_GL_GL_H) | |
28 | -#include <GL/gl.h> | |
29 | -#elif defined(HAVE_OPENGL_GL_H) | |
30 | -#include <OpenGL/gl.h> | |
31 | -#endif | |
32 | -#include <wx/wx.h> | |
33 | - | |
34 | -void calc_nodeline(int nb, int* ntri, GLfloat**** matp, GLfloat**** kvp, int nthreads, | |
35 | - wxTextCtrl* terminal, int* nnl, GLfloat**** kvnl, GLfloat** kvnl_rot); | |
24 | +void calc_nodeline(); |
@@ -53,8 +53,8 @@ static void draw_fermi() { | ||
53 | 53 | First, rotate k-vector and normal vector |
54 | 54 | */ |
55 | 55 | #pragma omp parallel default(none) \ |
56 | - shared(nb,draw_band,ntri,rot,nmlp,arw,nmlp_rot,kvp,kvp_rot,arw_rot,trans,side) \ | |
57 | - private(ib) | |
56 | +shared(nb,draw_band,ntri,rot,nmlp,arw,nmlp_rot,kvp,kvp_rot,arw_rot,trans,side) \ | |
57 | +private(ib) | |
58 | 58 | { |
59 | 59 | int i, j, l, itri; |
60 | 60 |
@@ -104,12 +104,11 @@ static void draw_fermi() { | ||
104 | 104 | /* |
105 | 105 | Arrow for 3D value |
106 | 106 | */ |
107 | - if (blackback == 1) glColor3fv(white); | |
108 | - else glColor3fv(black); | |
109 | 107 | glNormal3f(0.0f, 0.0f, 1.0f); |
110 | 108 | if (color_scale == 3) { |
111 | 109 | for (ib = 0; ib < nb; ib++) { |
112 | 110 | if (draw_band[ib] == 1) { |
111 | + glColor3f(1.0 - clr[ib][0], 1.0 - clr[ib][1], 1.0 - clr[ib][2]); | |
113 | 112 | glVertexPointer(3, GL_FLOAT, 0, arw_rot[ib]); |
114 | 113 | glDrawArrays(GL_LINES, 0, ntri[ib] * 3 * 2); |
115 | 114 | } |
@@ -214,10 +213,7 @@ static void draw_bz_lines() { | ||
214 | 213 | /* |
215 | 214 | Line color is oposit of BG color |
216 | 215 | */ |
217 | - if (blackback == 1) | |
218 | - for (i = 0; i<4; i++) linecolor[i] = white[i]; | |
219 | - else | |
220 | - for (i = 0; i<4; i++) linecolor[i] = black[i]; | |
216 | + for (i = 0; i < 4; i++) linecolor[i] = LineColor[i]; | |
221 | 217 | /**/ |
222 | 218 | glLineWidth(linewidth); |
223 | 219 | /* |
@@ -301,20 +297,45 @@ static void draw_bz_lines() { | ||
301 | 297 | static void draw_colorbar() |
302 | 298 | { |
303 | 299 | int i, j, k; |
304 | - GLfloat mat2, vertices[366], colors[488]; | |
305 | - /**/ | |
300 | + GLfloat mat2, vertices[366], colors[488], vector[18], vector_color[24], | |
301 | + norm; | |
302 | + | |
306 | 303 | glEnableClientState(GL_COLOR_ARRAY); |
304 | + /* | |
305 | + Reciplocal lattice vectors | |
306 | + */ | |
307 | + for (i = 0; i < 6; i++) { | |
308 | + vector[3 * i] = -1.2f; | |
309 | + vector[3 * i + 1] = -1.05f; | |
310 | + vector[3 * i + 2] = 0.0f; | |
311 | + } | |
312 | + for (i = 0; i < 3; i++) { | |
313 | + norm = sqrtf(bvec[i][0] * bvec[i][0]+ bvec[i][1] * bvec[i][1]+ bvec[i][2] * bvec[i][2]); | |
314 | + for (j = 0; j < 3; j++) { | |
315 | + vector[j + 6 * i] | |
316 | + += (rot[j][0] * bvec[i][0] | |
317 | + + rot[j][1] * bvec[i][1] | |
318 | + + rot[j][2] * bvec[i][2]) * 0.2f / norm; | |
319 | + } | |
320 | + for (j = 0; j < 4; j++) { | |
321 | + vector_color[j + 8 * i] = BarColor[i * 2][j]; | |
322 | + vector_color[j + 8 * i + 4] = BarColor[i * 2][j]; | |
323 | + } | |
324 | + } | |
325 | + glNormal3f(0.0f, 0.0f, 1.0f); | |
326 | + glVertexPointer(3, GL_FLOAT, 0, vector); | |
327 | + glColorPointer(4, GL_FLOAT, 0, vector_color); | |
328 | + glDrawArrays(GL_LINES, 0, 6); | |
329 | + /* | |
330 | + Color bar/circle/cube | |
331 | + */ | |
307 | 332 | if (color_scale == 1 || color_scale == 4) { |
308 | 333 | for (i = 0; i < 5; i++) { |
309 | 334 | for (j = 0; j < 2; j++) { |
310 | 335 | vertices[0 + j * 3 + i * 6] = -1.0f + 0.5f*(GLfloat)i; |
311 | 336 | vertices[1 + j * 3 + i * 6] = -1.0f - 0.1f*(GLfloat)j; |
312 | 337 | vertices[2 + j * 3 + i * 6] = 0.0f; |
313 | - if ( i == 0) for (k = 0; k < 4; k++) colors[k + 4 * j + 8 * i] = blue[k]; | |
314 | - else if (i == 1) for (k = 0; k < 4; k++) colors[k + 4 * j + 8 * i] = cyan[k]; | |
315 | - else if (i == 2) for (k = 0; k < 4; k++) colors[k + 4 * j + 8 * i] = green[k]; | |
316 | - else if (i == 3) for (k = 0; k < 4; k++) colors[k + 4 * j + 8 * i] = yellow[k]; | |
317 | - else if (i == 4) for (k = 0; k < 4; k++) colors[k + 4 * j + 8 * i] = red[k]; | |
338 | + for (k = 0; k < 4; k++) colors[k + 4 * j + 8 * i] = BarColor[i][k]; | |
318 | 339 | } |
319 | 340 | }/*for (i = 0; i < 10; i++)*/ |
320 | 341 | glNormal3f(0.0f, 0.0f, 1.0f); |
@@ -329,10 +350,7 @@ static void draw_colorbar() | ||
329 | 350 | vertices[0] = 0.0f; |
330 | 351 | vertices[1] = -1.0f; |
331 | 352 | vertices[2] = 0.0f; |
332 | - if (blackback == 1) | |
333 | - for (j = 0; j < 4; j++) colors[j] = wgray[j]; | |
334 | - else | |
335 | - for (j = 0; j < 4; j++) colors[j] = bgray[j]; | |
353 | + for (j = 0; j < 4; j++) colors[j] = 1.0f - BackGroundColor[j]; | |
336 | 354 | /**/ |
337 | 355 | for (i = 0; i <= 60; i++) { |
338 | 356 | /**/ |
@@ -408,8 +426,7 @@ static void draw_circles( | ||
408 | 426 | vertices[2 + (i + 1) * 3] = 0.0f; |
409 | 427 | }/*for (i = 0; i <= 20; i++)*/ |
410 | 428 | glNormal3f(0.0f, 0.0f, 1.0f); |
411 | - if (blackback == 1) glColor3fv(white); | |
412 | - else glColor3fv(black); | |
429 | + glColor3fv(LineColor); | |
413 | 430 | glVertexPointer(3, GL_FLOAT, 0, vertices); |
414 | 431 | glDrawArrays(GL_TRIANGLE_FAN, 0, 22); |
415 | 432 | /**/ |
@@ -431,8 +448,7 @@ static void draw_fermi_line() { | ||
431 | 448 | for (i = 0; i < 3; i++) vertices[i + 3 * ibzl] = bzl2d_proj[ibzl][i]; |
432 | 449 | }/*for (ibzl = 0; ibzl < nbzl2d; ++ibzl)*/ |
433 | 450 | glNormal3f(0.0f, 0.0f, 1.0f); |
434 | - if (blackback == 1)glColor3fv(white); | |
435 | - else glColor3fv(black); | |
451 | + glColor3fv(LineColor); | |
436 | 452 | glVertexPointer(3, GL_FLOAT, 0, vertices); |
437 | 453 | glDrawArrays(GL_LINE_LOOP, 0, nbzl2d); |
438 | 454 | /* |
@@ -38,23 +38,13 @@ THE SOFTWARE. | ||
38 | 38 | #include <cstdlib> |
39 | 39 | #include <cmath> |
40 | 40 | #include "basic_math.hpp" |
41 | +#include "variable.hpp" | |
41 | 42 | /** |
42 | 43 | @brief Compute equator \f$\{\bf v}_{n k} \cdot {\bf k} = 0\f$ |
43 | 44 | |
44 | 45 | Modify : ::nequator, ::kveq, ::kveq_rot |
45 | 46 | */ |
46 | -void equator( | |
47 | -int nb, | |
48 | -int nthreads, | |
49 | -GLfloat eqvec[3], | |
50 | -int *ntri, | |
51 | -GLfloat ****kvp, | |
52 | -GLfloat ****nmlp, | |
53 | -wxTextCtrl* terminal, | |
54 | -int *nequator, | |
55 | -GLfloat ****kveq, | |
56 | -GLfloat **kveq_rot | |
57 | -) { | |
47 | +void equator() { | |
58 | 48 | int ib, itri, i, j, ithread, nequator0; |
59 | 49 | std::vector<std::vector<std::vector<std::vector<GLfloat>>>> kveq_v; |
60 | 50 |
@@ -21,14 +21,4 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
21 | 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
22 | 22 | THE SOFTWARE. |
23 | 23 | */ |
24 | -#if defined(HAVE_CONFIG_H) | |
25 | -#include <config.h> | |
26 | -#endif | |
27 | -#if defined(HAVE_GL_GL_H) | |
28 | -#include <GL/gl.h> | |
29 | -#elif defined(HAVE_OPENGL_GL_H) | |
30 | -#include <OpenGL/gl.h> | |
31 | -#endif | |
32 | -#include <wx/wx.h> | |
33 | -void equator(int nb, int nthreads, GLfloat eqvec[3], int* ntri, GLfloat**** kvp, | |
34 | - GLfloat**** nmlp, wxTextCtrl* terminal, int* nequator, GLfloat**** kveq, GLfloat** kveq_rot); | |
24 | +void equator(); |
@@ -38,6 +38,7 @@ THE SOFTWARE. | ||
38 | 38 | #include <cstdio> |
39 | 39 | #include <cmath> |
40 | 40 | #include "basic_math.hpp" |
41 | +#include "variable.hpp" | |
41 | 42 | /** |
42 | 43 | @brief Store triangle patch |
43 | 44 |
@@ -77,11 +78,6 @@ static void triangle( | ||
77 | 78 | GLfloat mat1[3][3], //!<[in] The matrix element |
78 | 79 | GLfloat kvec1[3][3], //!<[in] @f$k@f$-vector of corners |
79 | 80 | GLfloat vf1[3][3], //!<[in] @f$v_f@f$-vector of corners |
80 | - int fbz, | |
81 | - int nbragg, | |
82 | - GLfloat bragg[26][3], | |
83 | - GLfloat brnrm[26], | |
84 | - GLfloat brnrm_min, | |
85 | 81 | std::vector<std::vector<std::vector<GLfloat> > > &kvp_v, |
86 | 82 | std::vector<std::vector<std::vector<GLfloat> > > &matp_v, |
87 | 83 | std::vector<std::vector<std::vector<GLfloat> > > &nmlp_v |
@@ -147,8 +143,7 @@ static void triangle( | ||
147 | 143 | vf2[i][j] = vf1[sw[i]][j]; |
148 | 144 | } |
149 | 145 | } |
150 | - triangle(ibr + 1, mat2, kvec2, vf2, fbz, nbragg, | |
151 | - bragg, brnrm, brnrm_min, kvp_v, matp_v, nmlp_v); | |
146 | + triangle(ibr + 1, mat2, kvec2, vf2, kvp_v, matp_v, nmlp_v); | |
152 | 147 | return; |
153 | 148 | } |
154 | 149 | else if (brnrm[ibr] < prod[sw[1]]) { |
@@ -168,8 +163,7 @@ static void triangle( | ||
168 | 163 | vf2[1][i] = vf1[sw[0]][i] * a[0][1] + vf1[sw[1]][i] * a[1][0]; |
169 | 164 | vf2[2][i] = vf1[sw[0]][i] * a[0][2] + vf1[sw[2]][i] * a[2][0]; |
170 | 165 | }/*for (i = 0; i < 3; ++i)*/ |
171 | - triangle(ibr + 1, mat2, kvec2, vf2, fbz, nbragg, | |
172 | - bragg, brnrm, brnrm_min, kvp_v, matp_v, nmlp_v); | |
166 | + triangle(ibr + 1, mat2, kvec2, vf2, kvp_v, matp_v, nmlp_v); | |
173 | 167 | |
174 | 168 | for (i = 0; i < 3; ++i) { |
175 | 169 | kvec2[0][i] = kvec1[sw[0]][i] * a[0][1] + kvec1[sw[1]][i] * a[1][0]; |
@@ -186,8 +180,7 @@ static void triangle( | ||
186 | 180 | }/*for (i = 0; i < 3; ++i)*/ |
187 | 181 | for (i = 0; i < 3; ++i) for (j = 0; j < 3; ++j) |
188 | 182 | kvec2[i][j] += bshift * bragg[ibr][j]; |
189 | - triangle(ibr + 1, mat2, kvec2, vf2, fbz, nbragg, | |
190 | - bragg, brnrm, brnrm_min, kvp_v, matp_v, nmlp_v); | |
183 | + triangle(ibr + 1, mat2, kvec2, vf2, kvp_v, matp_v, nmlp_v); | |
191 | 184 | |
192 | 185 | for (i = 0; i < 3; ++i) { |
193 | 186 | kvec2[0][i] = kvec1[sw[2]][i]; |
@@ -204,8 +197,7 @@ static void triangle( | ||
204 | 197 | }/*for (i = 0; i < 3; ++i)*/ |
205 | 198 | for (i = 0; i < 3; ++i) for (j = 0; j < 3; ++j) |
206 | 199 | kvec2[i][j] += bshift * bragg[ibr][j]; |
207 | - triangle(ibr + 1, mat2, kvec2, vf2, fbz, nbragg, | |
208 | - bragg, brnrm, brnrm_min, kvp_v, matp_v, nmlp_v); | |
200 | + triangle(ibr + 1, mat2, kvec2, vf2, kvp_v, matp_v, nmlp_v); | |
209 | 201 | return; |
210 | 202 | } |
211 | 203 | else if (brnrm[ibr] < prod[sw[2]]) { |
@@ -227,8 +219,7 @@ static void triangle( | ||
227 | 219 | }/*for (i = 0; i < 3; ++i)*/ |
228 | 220 | for (i = 0; i < 3; ++i) for (j = 0; j < 3; ++j) |
229 | 221 | kvec2[i][j] += bshift * bragg[ibr][j]; |
230 | - triangle(ibr + 1, mat2, kvec2, vf2, fbz, nbragg, | |
231 | - bragg, brnrm, brnrm_min, kvp_v, matp_v, nmlp_v); | |
222 | + triangle(ibr + 1, mat2, kvec2, vf2, kvp_v, matp_v, nmlp_v); | |
232 | 223 | |
233 | 224 | for (i = 0; i < 3; ++i) { |
234 | 225 | kvec2[0][i] = kvec1[sw[0]][i]; |
@@ -243,8 +234,7 @@ static void triangle( | ||
243 | 234 | vf2[1][i] = vf1[sw[1]][i]; |
244 | 235 | vf2[2][i] = vf1[sw[0]][i] * a[0][2] + vf1[sw[2]][i] * a[2][0]; |
245 | 236 | }/*for (i = 0; i < 3; ++i)*/ |
246 | - triangle(ibr + 1, mat2, kvec2, vf2, fbz, nbragg, | |
247 | - bragg, brnrm, brnrm_min, kvp_v, matp_v, nmlp_v); | |
237 | + triangle(ibr + 1, mat2, kvec2, vf2, kvp_v, matp_v, nmlp_v); | |
248 | 238 | |
249 | 239 | for (i = 0; i < 3; ++i) { |
250 | 240 | kvec2[0][i] = kvec1[sw[1]][i] * a[1][2] + kvec1[sw[2]][i] * a[2][1]; |
@@ -259,8 +249,7 @@ static void triangle( | ||
259 | 249 | vf2[1][i] = vf1[sw[1]][i]; |
260 | 250 | vf2[2][i] = vf1[sw[0]][i] * a[0][2] + vf1[sw[2]][i] * a[2][0]; |
261 | 251 | }/*for (i = 0; i < 3; ++i)*/ |
262 | - triangle(ibr + 1, mat2, kvec2, vf2, fbz, nbragg, | |
263 | - bragg, brnrm, brnrm_min, kvp_v, matp_v, nmlp_v); | |
252 | + triangle(ibr + 1, mat2, kvec2, vf2, kvp_v, matp_v, nmlp_v); | |
264 | 253 | return; |
265 | 254 | } |
266 | 255 | else { |
@@ -332,13 +321,6 @@ static void tetrahedron( | ||
332 | 321 | GLfloat mat1[8][3], //!< [in] Matrix elements @f$\Delta_{n k}@f$ |
333 | 322 | GLfloat kvec1[8][3], //!< [in] @f$k@f$-vectors |
334 | 323 | GLfloat vf1[8][3], //!< [in] @f$v_f@f$-vectors |
335 | - int corner[6][4], | |
336 | - GLfloat bvec[3][3], | |
337 | - int fbz, | |
338 | - int nbragg, | |
339 | - GLfloat bragg[26][3], | |
340 | - GLfloat brnrm[26], | |
341 | - GLfloat brnrm_min, | |
342 | 324 | std::vector<std::vector<std::vector<GLfloat> > > &kvp_v, |
343 | 325 | std::vector<std::vector<std::vector<GLfloat> > > &matp_v, |
344 | 326 | std::vector<std::vector<std::vector<GLfloat> > > &nmlp_v |
@@ -392,8 +374,7 @@ static void tetrahedron( | ||
392 | 374 | } |
393 | 375 | |
394 | 376 | vol = a[1][0] * a[2][0] * a[3][0]; |
395 | - triangle(0, mat3, kvec3, vf3, fbz, nbragg, | |
396 | - bragg, brnrm, brnrm_min, kvp_v, matp_v, nmlp_v); | |
377 | + triangle(0, mat3, kvec3, vf3, kvp_v, matp_v, nmlp_v); | |
397 | 378 | } |
398 | 379 | else if (eig2[sw[1]] <= 0.0 && 0.0 < eig2[sw[2]]) { |
399 | 380 | for (i = 0; i < 3; ++i) { |
@@ -411,8 +392,7 @@ static void tetrahedron( | ||
411 | 392 | } |
412 | 393 | |
413 | 394 | vol = a[1][2] * a[2][0] * a[3][0]; |
414 | - triangle(0, mat3, kvec3, vf3, fbz, nbragg, | |
415 | - bragg, brnrm, brnrm_min, kvp_v, matp_v, nmlp_v); | |
395 | + triangle(0, mat3, kvec3, vf3, kvp_v, matp_v, nmlp_v); | |
416 | 396 | /**/ |
417 | 397 | for (i = 0; i < 3; ++i) { |
418 | 398 | kvec3[0][i] = kvec2[sw[1]][i] * a[1][3] + kvec2[sw[3]][i] * a[3][1]; |
@@ -429,8 +409,7 @@ static void tetrahedron( | ||
429 | 409 | } |
430 | 410 | |
431 | 411 | vol = a[1][3] * a[3][0] * a[2][1]; |
432 | - triangle(0, mat3, kvec3, vf3, fbz, nbragg, | |
433 | - bragg, brnrm, brnrm_min, kvp_v, matp_v, nmlp_v); | |
412 | + triangle(0, mat3, kvec3, vf3, kvp_v, matp_v, nmlp_v); | |
434 | 413 | } |
435 | 414 | else if (eig2[sw[2]] <= 0.0 && 0.0 < eig2[sw[3]]) { |
436 | 415 | for (i = 0; i < 3; ++i) { |
@@ -448,8 +427,7 @@ static void tetrahedron( | ||
448 | 427 | } |
449 | 428 | |
450 | 429 | vol = a[0][3] * a[1][3] * a[2][3]; |
451 | - triangle(0, mat3, kvec3, vf3, fbz, nbragg, | |
452 | - bragg, brnrm, brnrm_min, kvp_v, matp_v, nmlp_v); | |
430 | + triangle(0, mat3, kvec3, vf3, kvp_v, matp_v, nmlp_v); | |
453 | 431 | } |
454 | 432 | else { |
455 | 433 | } |
@@ -460,34 +438,7 @@ static void tetrahedron( | ||
460 | 438 | |
461 | 439 | Modify : ::ntri, nmlp, ::matp, ::kvp, ::clr, ::nmlp_rot, ::kvp_rot |
462 | 440 | */ |
463 | -void fermi_patch( | |
464 | - int nb, | |
465 | - int nthreads, | |
466 | - int ng[3], | |
467 | - int ng0[3], | |
468 | - int shiftk[3], | |
469 | - int fbz, | |
470 | - GLfloat ****eig, | |
471 | - GLfloat EF, | |
472 | - GLfloat *****mat, | |
473 | - GLfloat *****vf, | |
474 | - int corner[6][4], | |
475 | - GLfloat bvec[3][3], | |
476 | - int nbragg, | |
477 | - GLfloat bragg[26][3], | |
478 | - GLfloat brnrm[26], | |
479 | - GLfloat brnrm_min, | |
480 | - wxTextCtrl* terminal, | |
481 | - int *ntri, | |
482 | - GLfloat ****kvp, | |
483 | - GLfloat ****matp, | |
484 | - GLfloat **clr, | |
485 | - GLfloat *****arw, | |
486 | - GLfloat ****nmlp, | |
487 | - GLfloat **kvp_rot, | |
488 | - GLfloat **nmlp_rot, | |
489 | - GLfloat **arw_rot | |
490 | - ) | |
441 | +void fermi_patch() | |
491 | 442 | { |
492 | 443 | int ntri0, ib, i0, i1, j0, start[3], last[3]; |
493 | 444 | int ithread; |
@@ -610,8 +561,7 @@ private(j0,i0,i1,ithread) | ||
610 | 561 | vf1[7][j] = vf[ib][ii0][ii1][ii2][j]; |
611 | 562 | }/*for (j = 0; j < 3; j++)*/ |
612 | 563 | /**/ |
613 | - tetrahedron(eig1, mat1, kvec1, vf1, corner, | |
614 | - bvec, fbz, nbragg, bragg, brnrm, brnrm_min, | |
564 | + tetrahedron(eig1, mat1, kvec1, vf1, | |
615 | 565 | kvp_v.at(ithread), matp_v.at(ithread), nmlp_v.at(ithread)); |
616 | 566 | }/*for (j0 = start[0]; j0 < ng[0]; ++j0)*/ |
617 | 567 | }/*for (j1 = start[1]; j1 < ng[1]; ++j1)*/ |
@@ -21,17 +21,4 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
21 | 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
22 | 22 | THE SOFTWARE. |
23 | 23 | */ |
24 | -#if defined(HAVE_CONFIG_H) | |
25 | -#include <config.h> | |
26 | -#endif | |
27 | -#if defined(HAVE_GL_GL_H) | |
28 | -#include <GL/gl.h> | |
29 | -#elif defined(HAVE_OPENGL_GL_H) | |
30 | -#include <OpenGL/gl.h> | |
31 | -#endif | |
32 | -#include <wx/wx.h> | |
33 | - | |
34 | -void fermi_patch(int nb, int nthreads, int ng[3], int ng0[3], int shiftk[3], | |
35 | - int fbz, GLfloat**** eig, GLfloat EF, GLfloat***** mat, GLfloat***** vf, int corner[6][4], GLfloat bvec[3][3], int nbragg, | |
36 | - GLfloat bragg[26][3], GLfloat brnrm[26], GLfloat brnrm_min, wxTextCtrl* terminal, int* ntri, GLfloat**** kvp, GLfloat**** matp, | |
37 | - GLfloat** clr, GLfloat***** arw, GLfloat**** nmlp, GLfloat** kvp_rot, GLfloat** nmlp_rot, GLfloat** arw_rot); | |
24 | +void fermi_patch(); |
@@ -112,7 +112,6 @@ int interpol = 1; //!< Ratio of interpolation | ||
112 | 112 | /* |
113 | 113 | Switch for some modes |
114 | 114 | */ |
115 | -int blackback = 1; //!< Switch for black background | |
116 | 115 | int color_scale = 1; //!< Switch for full color scale mode |
117 | 116 | int fbz = 1; //!< Switch for 1st Brillouin zone mode |
118 | 117 | int nodeline = 0; //!< Switch for node lines |
@@ -204,6 +203,10 @@ GLfloat yellow[4] = { 1.0, 1.0, 0.0, 1.0 }; //!< Yellow color code | ||
204 | 203 | GLfloat red[4] = { 1.0, 0.0, 0.0, 1.0 }; //!< Red color code |
205 | 204 | GLfloat green[4] = { 0.0, 1.0, 0.0, 1.0 }; //!< Green color code |
206 | 205 | GLfloat blue[4] = { 0.0, 0.0, 1.0, 1.0 }; //!< Blue color code |
206 | +GLfloat BackGroundColor[4] = { 0.0, 0.0, 0.0, 1.0 };//!< BackGround color code | |
207 | +GLfloat LineColor[4] = { 1.0, 1.0, 1.0, 1.0 };//!< Line color code | |
208 | +GLfloat BarColor[5][4] = { { 0.0, 0.0, 1.0, 1.0 } , { 0.0, 1.0, 1.0, 1.0 } , | |
209 | +{ 0.0, 1.0, 0.0, 1.0 } ,{ 1.0, 1.0, 0.0, 1.0 } ,{ 1.0, 0.0, 0.0, 1.0 } }; | |
207 | 210 | /* |
208 | 211 | Others |
209 | 212 | */ |
@@ -311,19 +314,17 @@ bool MyApp::OnInit() | ||
311 | 314 | kveq = new GLfloat *** [nb]; |
312 | 315 | kveq_rot = new GLfloat *[nb]; |
313 | 316 | /**/ |
314 | - interpol_energy(avec, nb, interpol, ng0, ng, | |
315 | - terminal, eig, vf, mat, eig0, mat0); | |
316 | - init_corner(itet, corner); | |
317 | - bragg_vector(terminal, bvec, bragg, brnrm, &brnrm_min); | |
317 | + interpol_energy(); | |
318 | + init_corner(); | |
319 | + bragg_vector(); | |
318 | 320 | myf->modify_band(); |
319 | 321 | /* |
320 | 322 | Brillouin zone |
321 | 323 | */ |
322 | - bz_lines(terminal, bragg, brnrm, &nbzl, bzl, &nbragg); | |
323 | - calc_2dbz(fbz, secvec, secscale, axis2d, | |
324 | - &nbzl2d, nbragg, bragg, brnrm, bzl2d, bzl2d_proj); | |
324 | + bz_lines(); | |
325 | + calc_2dbz(); | |
325 | 326 | /**/ |
326 | - max_and_min_bz(terminal, nb, ng0, eig0, mat0); | |
327 | + max_and_min_bz(); | |
327 | 328 | /**/ |
328 | 329 | compute_patch_segment(); |
329 | 330 | /* |
@@ -44,36 +44,15 @@ THE SOFTWARE. | ||
44 | 44 | #include <cstdio> |
45 | 45 | #include "basic_math.hpp" |
46 | 46 | #include "menu.hpp" |
47 | +#include "variable.hpp" | |
47 | 48 | /** |
48 | 49 | @brief Free variables for patch before new patch is computed |
49 | 50 | |
50 | 51 | Free : ::nmlp, ::matp, ::clr, ::kvp, ::nmlp_rot, ::kvp_rot, |
51 | 52 | ::kvnl, ::kvnl_rot, ::kv2d, ::clr2d |
52 | 53 | */ |
53 | -void free_patch( | |
54 | - int nb, | |
55 | - int refresh_patch, | |
56 | - int *ntri, | |
57 | - GLfloat ****kvp, | |
58 | - GLfloat **kvp_rot, | |
59 | - GLfloat ****matp, | |
60 | - GLfloat** clr, | |
61 | - GLfloat ****nmlp, | |
62 | - GLfloat **nmlp_rot, | |
63 | - GLfloat *****arw, | |
64 | - GLfloat **arw_rot, | |
65 | - int refresh_nodeline, | |
66 | - int *nnl, | |
67 | - GLfloat ****kvnl, | |
68 | - GLfloat **kvnl_rot, | |
69 | - int refresh_section, | |
70 | - GLfloat **kv2d, | |
71 | - GLfloat **clr2d, | |
72 | - int refresh_equator, | |
73 | - int *nequator, | |
74 | - GLfloat ****kveq, | |
75 | - GLfloat **kveq_rot | |
76 | -) { | |
54 | +void free_patch() | |
55 | +{ | |
77 | 56 | int ib, i0, i1, i2; |
78 | 57 | /* |
79 | 58 | Fermi patch |
@@ -150,18 +129,7 @@ void free_patch( | ||
150 | 129 | |
151 | 130 | Modify : ::clr |
152 | 131 | */ |
153 | -void max_and_min( | |
154 | - int nb, | |
155 | - int nthreads, | |
156 | - wxTextCtrl *terminal, | |
157 | - MyFrame *myf, | |
158 | - int color_scale, | |
159 | - int *ntri, | |
160 | - GLfloat ****matp, | |
161 | - GLfloat *patch_min, | |
162 | - GLfloat *patch_max, | |
163 | - GLfloat ****nmlp | |
164 | -) | |
132 | +void max_and_min() | |
165 | 133 | { |
166 | 134 | int itri, ithread; |
167 | 135 | GLfloat *max_th, *min_th; |
@@ -201,11 +169,11 @@ shared(nb,ntri,matp,max_th,min_th) private(itri,ithread) | ||
201 | 169 | }/*for (ib = 0; ib < nb; ib++)*/ |
202 | 170 | }/*End of parallel region*/ |
203 | 171 | /**/ |
204 | - *patch_max = max_th[0]; | |
205 | - *patch_min = min_th[0]; | |
172 | + patch_max = max_th[0]; | |
173 | + patch_min = min_th[0]; | |
206 | 174 | for (ithread = 1; ithread < nthreads; ithread++) { |
207 | - if (max_th[ithread] > *patch_max) *patch_max = max_th[ithread]; | |
208 | - if (min_th[ithread] < *patch_min) *patch_min = min_th[ithread]; | |
175 | + if (max_th[ithread] > patch_max) patch_max = max_th[ithread]; | |
176 | + if (min_th[ithread] < patch_min) patch_min = min_th[ithread]; | |
209 | 177 | } |
210 | 178 | }/*if (color_scale == 0 || color_scale == 4)*/ |
211 | 179 | else if (color_scale == 2) { |
@@ -232,11 +200,11 @@ shared(nb,ntri,matp,max_th,min_th) private(itri,ithread) | ||
232 | 200 | }/*for (ib = 0; ib < nb; ib++)*/ |
233 | 201 | }/*End of parallel region*/ |
234 | 202 | /**/ |
235 | - *patch_min = min_th[0]; | |
236 | - *patch_max = max_th[0]; | |
203 | + patch_min = min_th[0]; | |
204 | + patch_max = max_th[0]; | |
237 | 205 | for (ithread = 1; ithread < nthreads; ithread++) { |
238 | - if (max_th[ithread] < *patch_min) *patch_min = max_th[ithread]; | |
239 | - if (max_th[ithread] > *patch_max) *patch_max = max_th[ithread]; | |
206 | + if (max_th[ithread] < patch_min) patch_min = max_th[ithread]; | |
207 | + if (max_th[ithread] > patch_max) patch_max = max_th[ithread]; | |
240 | 208 | } |
241 | 209 | }/*if (color_scale == 2)*/ |
242 | 210 | else if (color_scale == 3) { |
@@ -264,11 +232,11 @@ shared(nb,ntri,matp,min_th,max_th) private(itri,ithread) | ||
264 | 232 | }/*for (ib = 0; ib < nb; ib++)*/ |
265 | 233 | }/*End of parallel region*/ |
266 | 234 | /**/ |
267 | - *patch_max = max_th[0]; | |
268 | - *patch_min = min_th[0]; | |
235 | + patch_max = max_th[0]; | |
236 | + patch_min = min_th[0]; | |
269 | 237 | for (ithread = 1; ithread < nthreads; ithread++) { |
270 | - if (max_th[ithread] > *patch_max) *patch_max = max_th[ithread]; | |
271 | - if (min_th[ithread] < *patch_min) *patch_min = min_th[ithread]; | |
238 | + if (max_th[ithread] > patch_max) patch_max = max_th[ithread]; | |
239 | + if (min_th[ithread] < patch_min) patch_min = min_th[ithread]; | |
272 | 240 | } |
273 | 241 | }/*if (color_scale == 3)*/ |
274 | 242 | else if (color_scale == 4 || color_scale == 7) { |
@@ -297,19 +265,19 @@ shared(nb,ntri,nmlp,max_th,min_th) private(itri,ithread) | ||
297 | 265 | }/*for (ib = 0; ib < nb; ib++)*/ |
298 | 266 | }/*End of parallel region*/ |
299 | 267 | /**/ |
300 | - *patch_max = max_th[0]; | |
301 | - *patch_min = min_th[0]; | |
268 | + patch_max = max_th[0]; | |
269 | + patch_min = min_th[0]; | |
302 | 270 | for (ithread = 1; ithread < nthreads; ithread++) { |
303 | - if (max_th[ithread] > *patch_max) *patch_max = max_th[ithread]; | |
304 | - if (min_th[ithread] < *patch_min) *patch_min = min_th[ithread]; | |
271 | + if (max_th[ithread] > patch_max) patch_max = max_th[ithread]; | |
272 | + if (min_th[ithread] < patch_min) patch_min = min_th[ithread]; | |
305 | 273 | } |
306 | 274 | }/*if (color_scale == 5 || color_scale == 6)*/ |
307 | 275 | |
308 | 276 | delete[] max_th; |
309 | 277 | delete[] min_th; |
310 | 278 | |
311 | - myf->textbox_min->ChangeValue(wxString::Format(wxT("%f"), *patch_min)); | |
312 | - myf->textbox_max->ChangeValue(wxString::Format(wxT("%f"), *patch_max)); | |
279 | + myf->textbox_min->ChangeValue(wxString::Format(wxT("%f"), patch_min)); | |
280 | + myf->textbox_max->ChangeValue(wxString::Format(wxT("%f"), patch_max)); | |
313 | 281 | }/* max_and_min */ |
314 | 282 | /** |
315 | 283 | @brief Compute Max. & Min. of matrix elements. |
@@ -317,34 +285,14 @@ shared(nb,ntri,nmlp,max_th,min_th) private(itri,ithread) | ||
317 | 285 | |
318 | 286 | Modify : ::clr |
319 | 287 | */ |
320 | -void paint( | |
321 | - int nb, | |
322 | - int color_scale, | |
323 | - int blackback, | |
324 | - int *ntri, | |
325 | - GLfloat patch_min, | |
326 | - GLfloat patch_max, | |
327 | - GLfloat ****kvp, | |
328 | - GLfloat ****matp, | |
329 | - GLfloat **clr, | |
330 | - GLfloat ****nmlp, | |
331 | - GLfloat *****arw, | |
332 | - GLfloat red[4], | |
333 | - GLfloat green[4], | |
334 | - GLfloat blue[4], | |
335 | - GLfloat cyan[4], | |
336 | - GLfloat magenta[4], | |
337 | - GLfloat yellow[4], | |
338 | - GLfloat wgray[4], | |
339 | - GLfloat bgray[4] | |
340 | -) | |
288 | +void paint() | |
341 | 289 | { |
342 | 290 | int itri, j; |
343 | 291 | GLfloat origin[4]; |
344 | 292 | |
345 | 293 | if (color_scale == 1) { |
346 | 294 | #pragma omp parallel default(none) \ |
347 | -shared(nb,ntri,matp,clr,cyan,blue,green,yellow,red,patch_max,patch_min) \ | |
295 | +shared(nb,ntri,matp,clr,BarColor,patch_max,patch_min) \ | |
348 | 296 | private(itri, j) |
349 | 297 | { |
350 | 298 | int i, ib; |
@@ -359,19 +307,23 @@ private(itri, j) | ||
359 | 307 | mat2 = mat2 * 4.0f; |
360 | 308 | /**/ |
361 | 309 | if (mat2 <= 1.0) { |
362 | - for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri] = cyan[j] * mat2 + blue[j] * (1.0f - mat2); | |
310 | + for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri] | |
311 | + = BarColor[1][j] * mat2 + BarColor[0][j] * (1.0f - mat2); | |
363 | 312 | } |
364 | 313 | else if (mat2 <= 2.0) { |
365 | 314 | mat2 = mat2 - 1.0f; |
366 | - for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri] = green[j] * mat2 + cyan[j] * (1.0f - mat2); | |
315 | + for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri] | |
316 | + = BarColor[2][j] * mat2 + BarColor[1][j] * (1.0f - mat2); | |
367 | 317 | } |
368 | 318 | else if (mat2 <= 3.0) { |
369 | 319 | mat2 = mat2 - 2.0f; |
370 | - for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri] = yellow[j] * mat2 + green[j] * (1.0f - mat2); | |
320 | + for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri] | |
321 | + = BarColor[3][j] * mat2 + BarColor[2][j] * (1.0f - mat2); | |
371 | 322 | } |
372 | 323 | else { |
373 | 324 | mat2 = mat2 - 3.0f; |
374 | - for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri] = red[j] * mat2 + yellow[j] * (1.0f - mat2); | |
325 | + for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri] | |
326 | + = BarColor[4][j] * mat2 + BarColor[3][j] * (1.0f - mat2); | |
375 | 327 | } |
376 | 328 | }/*for (i = 0; i < 3; ++i)*/ |
377 | 329 | }/*for (itri = 0; itri < ntri[ib]; ++itri)*/ |
@@ -380,11 +332,10 @@ private(itri, j) | ||
380 | 332 | }/*if (color_scale == 1 || color_scale == 2)*/ |
381 | 333 | else if (color_scale == 2) { |
382 | 334 | |
383 | - if (blackback == 1) for (j = 0; j < 4; ++j) origin[j] = wgray[j]; | |
384 | - else for (j = 0; j < 4; ++j) origin[j] = bgray[j]; | |
335 | + for (j = 0; j < 4; ++j) origin[j] = 1.0f - BackGroundColor[j]; | |
385 | 336 | |
386 | 337 | #pragma omp parallel default(none) \ |
387 | -shared(nb,ntri,matp,clr,cyan,blue,green,yellow,red,magenta,bgray,wgray,blackback,patch_max,origin) \ | |
338 | +shared(nb,ntri,matp,clr,cyan,blue,green,yellow,red,magenta,bgray,wgray,patch_max,origin) \ | |
388 | 339 | private(itri, j) |
389 | 340 | { |
390 | 341 | int i, ib; |
@@ -441,7 +392,7 @@ private(itri, j) | ||
441 | 392 | }/*if (color_scale == 2)*/ |
442 | 393 | else if (color_scale == 4) { |
443 | 394 | #pragma omp parallel default(none) \ |
444 | -shared(nb,ntri,nmlp,clr,cyan,blue,green,yellow,red,patch_max,patch_min) \ | |
395 | +shared(nb,ntri,nmlp,clr,BarColor,patch_max,patch_min) \ | |
445 | 396 | private(itri, j) |
446 | 397 | { |
447 | 398 | int i, ib; |
@@ -459,19 +410,23 @@ private(itri, j) | ||
459 | 410 | mat2 = mat2 * 4.0f; |
460 | 411 | /**/ |
461 | 412 | if (mat2 <= 1.0) { |
462 | - for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri] = cyan[j] * mat2 + blue[j] * (1.0f - mat2); | |
413 | + for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri] | |
414 | + = BarColor[1][j] * mat2 + BarColor[0][j] * (1.0f - mat2); | |
463 | 415 | } |
464 | 416 | else if (mat2 <= 2.0) { |
465 | 417 | mat2 = mat2 - 1.0f; |
466 | - for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri] = green[j] * mat2 + cyan[j] * (1.0f - mat2); | |
418 | + for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri] | |
419 | + = BarColor[2][j] * mat2 + BarColor[1][j] * (1.0f - mat2); | |
467 | 420 | } |
468 | 421 | else if (mat2 <= 3.0) { |
469 | 422 | mat2 = mat2 - 2.0f; |
470 | - for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri] = yellow[j] * mat2 + green[j] * (1.0f - mat2); | |
423 | + for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri] | |
424 | + = BarColor[3][j] * mat2 + BarColor[2][j] * (1.0f - mat2); | |
471 | 425 | } |
472 | 426 | else { |
473 | 427 | mat2 = mat2 - 3.0f; |
474 | - for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri] = red[j] * mat2 + yellow[j] * (1.0f - mat2); | |
428 | + for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri] | |
429 | + = BarColor[4][j] * mat2 + BarColor[3][j] * (1.0f - mat2); | |
475 | 430 | } |
476 | 431 | }/*for (i = 0; i < 3; ++i)*/ |
477 | 432 | }/*for (itri = 0; itri < ntri[ib]; ++itri)*/ |
@@ -480,7 +435,7 @@ private(itri, j) | ||
480 | 435 | }/*if (color_scale == 4)*/ |
481 | 436 | else if (color_scale == 3 || color_scale == 5) { |
482 | 437 | #pragma omp parallel default(none) \ |
483 | -shared(nb,ntri,matp,clr,cyan,blue,green,yellow,red,color_scale,kvp,arw,patch_max) \ | |
438 | +shared(nb,ntri,matp,clr,BarColor,color_scale,kvp,arw,patch_max) \ | |
484 | 439 | private(itri, j) |
485 | 440 | { |
486 | 441 | int i, ib; |
@@ -496,7 +451,8 @@ private(itri, j) | ||
496 | 451 | #pragma omp for nowait |
497 | 452 | for (itri = 0; itri < ntri[ib]; ++itri) { |
498 | 453 | for (i = 0; i < 3; ++i) { |
499 | - for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri] = cyan[j] * mat2 + blue[j] * (1.0f - mat2); | |
454 | + for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri] | |
455 | + = BarColor[1][j] * mat2 + BarColor[0][j] * (1.0f - mat2); | |
500 | 456 | } |
501 | 457 | } |
502 | 458 | } |
@@ -505,7 +461,8 @@ private(itri, j) | ||
505 | 461 | #pragma omp for nowait |
506 | 462 | for (itri = 0; itri < ntri[ib]; ++itri) { |
507 | 463 | for (i = 0; i < 3; ++i) { |
508 | - for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri] = green[j] * mat2 + cyan[j] * (1.0f - mat2); | |
464 | + for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri] | |
465 | + = BarColor[2][j] * mat2 + BarColor[1][j] * (1.0f - mat2); | |
509 | 466 | } |
510 | 467 | } |
511 | 468 | } |
@@ -514,7 +471,8 @@ private(itri, j) | ||
514 | 471 | #pragma omp for nowait |
515 | 472 | for (itri = 0; itri < ntri[ib]; ++itri) { |
516 | 473 | for (i = 0; i < 3; ++i) { |
517 | - for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri] = yellow[j] * mat2 + green[j] * (1.0f - mat2); | |
474 | + for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri] | |
475 | + = BarColor[3][j] * mat2 + BarColor[2][j] * (1.0f - mat2); | |
518 | 476 | } |
519 | 477 | } |
520 | 478 | } |
@@ -523,7 +481,8 @@ private(itri, j) | ||
523 | 481 | #pragma omp for nowait |
524 | 482 | for (itri = 0; itri < ntri[ib]; ++itri) { |
525 | 483 | for (i = 0; i < 3; ++i) { |
526 | - for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri] = red[j] * mat2 + yellow[j] * (1.0f - mat2); | |
484 | + for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri] | |
485 | + = BarColor[4][j] * mat2 + BarColor[3][j] * (1.0f - mat2); | |
527 | 486 | } |
528 | 487 | } |
529 | 488 | } |
@@ -21,29 +21,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
21 | 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
22 | 22 | THE SOFTWARE. |
23 | 23 | */ |
24 | -#if defined(HAVE_CONFIG_H) | |
25 | -#include <config.h> | |
26 | -#endif | |
27 | -#if defined(HAVE_GL_GL_H) | |
28 | -#include <GL/gl.h> | |
29 | -#elif defined(HAVE_OPENGL_GL_H) | |
30 | -#include <OpenGL/gl.h> | |
31 | -#endif | |
32 | -#include "menu.hpp" | |
33 | -void free_patch(int nb, int refresh_patch, | |
34 | - int* ntri, GLfloat**** kvp, GLfloat** kvp_rot, GLfloat**** matp, | |
35 | - GLfloat** clr, GLfloat**** nmlp, GLfloat** nmlp_rot, GLfloat***** arw, | |
36 | - GLfloat** arw_rot, int refresh_nodeline, int* nnl, GLfloat**** kvnl, | |
37 | - GLfloat** kvnl_rot, int refresh_section, GLfloat** kv2d, GLfloat** clr2d, | |
38 | - int refresh_equator, int* nequator, GLfloat**** kveq, GLfloat** kveq_rot); | |
39 | -void max_and_min(int nb, int nthreads, wxTextCtrl* terminal, | |
40 | - MyFrame* myf, int color_scale, int* ntri, GLfloat**** matp, | |
41 | - GLfloat *patch_min, GLfloat *patch_max, GLfloat**** nmlp); | |
42 | -void paint(int nb, int color_scale, int blackback, | |
43 | - int* ntri, GLfloat patch_min, GLfloat patch_max, | |
44 | - GLfloat**** kvp, GLfloat**** matp, GLfloat** clr, | |
45 | - GLfloat**** nmlp, GLfloat***** arw, | |
46 | - GLfloat red[4], GLfloat green[4], GLfloat blue[4], | |
47 | - GLfloat cyan[4], GLfloat magenta[4], GLfloat yellow[4], | |
48 | - GLfloat wgray[4], GLfloat bgray[4]); | |
24 | +void free_patch(); | |
25 | +void max_and_min(); | |
26 | +void paint(); | |
49 | 27 |
@@ -33,16 +33,14 @@ THE SOFTWARE. | ||
33 | 33 | #elif defined(HAVE_OPENGL_GL_H) |
34 | 34 | #include <OpenGL/gl.h> |
35 | 35 | #endif |
36 | - | |
36 | +#include "variable.hpp" | |
37 | 37 | /** |
38 | 38 | @brief Specify corners of tetrahedron |
39 | 39 | |
40 | 40 | Modify : ::corner |
41 | 41 | */ |
42 | -void init_corner( | |
43 | - int itet, | |
44 | - int corner[6][4] | |
45 | -) { | |
42 | +void init_corner() | |
43 | +{ | |
46 | 44 | int i, j; |
47 | 45 | int corner1[16][6][4] = { |
48 | 46 | /* |
@@ -202,13 +200,8 @@ void init_corner( | ||
202 | 200 | |
203 | 201 | Modify : ::bragg, ::brnrm |
204 | 202 | */ |
205 | -void bragg_vector( | |
206 | - wxTextCtrl *terminal, | |
207 | - GLfloat bvec[3][3], | |
208 | - GLfloat bragg[26][3], | |
209 | - GLfloat brnrm[26], | |
210 | - GLfloat *brnrm_min | |
211 | -) { | |
203 | +void bragg_vector() | |
204 | +{ | |
212 | 205 | int i0, i1, i2, i, ibr; |
213 | 206 | /**/ |
214 | 207 | ibr = 0; |
@@ -241,23 +234,18 @@ void bragg_vector( | ||
241 | 234 | /* |
242 | 235 | Search min. of brnrm |
243 | 236 | */ |
244 | - *brnrm_min = brnrm[0]; | |
237 | + brnrm_min = brnrm[0]; | |
245 | 238 | for (ibr = 1; ibr < 26; ibr++) { |
246 | - if (*brnrm_min > brnrm[ibr]) *brnrm_min = brnrm[ibr]; | |
239 | + if (brnrm_min > brnrm[ibr]) brnrm_min = brnrm[ibr]; | |
247 | 240 | } |
248 | - *terminal << wxString::Format(wxT(" Minimum Bragg norm : %f\n"), *brnrm_min); | |
241 | + *terminal << wxString::Format(wxT(" Minimum Bragg norm : %f\n"), brnrm_min); | |
249 | 242 | }/* bragg_vector */ |
250 | 243 | /** |
251 | 244 | @brief Print max and minimum @f$\varepsilon_{n k}, \Delta_{n k}@f$ |
252 | 245 | in the whole Brillouine zone |
253 | 246 | */ |
254 | -void max_and_min_bz( | |
255 | - wxTextCtrl* terminal, | |
256 | - int nb, | |
257 | - int ng0[3], | |
258 | - GLfloat**** eig0, | |
259 | - GLfloat***** mat0 | |
260 | -) { | |
247 | +void max_and_min_bz() | |
248 | +{ | |
261 | 249 | int ib, i0, i1, i2; |
262 | 250 | GLfloat eigmin, eigmax, matmin, matmax; |
263 | 251 | /**/ |
@@ -21,16 +21,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
21 | 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
22 | 22 | THE SOFTWARE. |
23 | 23 | */ |
24 | -#include <wx/wx.h> | |
25 | -#if defined(HAVE_CONFIG_H) | |
26 | -#include <config.h> | |
27 | -#endif | |
28 | -#if defined(HAVE_GL_GL_H) | |
29 | -#include <GL/gl.h> | |
30 | -#elif defined(HAVE_OPENGL_GL_H) | |
31 | -#include <OpenGL/gl.h> | |
32 | -#endif | |
33 | - | |
34 | -void init_corner(int itet, int corner[6][4]); | |
35 | -void bragg_vector(wxTextCtrl* terminal, GLfloat bvec[3][3], GLfloat bragg[26][3], GLfloat brnrm[26], GLfloat *brnrm_min); | |
36 | -void max_and_min_bz(wxTextCtrl* terminal, int nb, int ng0[3], GLfloat ****eig0, GLfloat *****mat0); | |
24 | +void init_corner(); | |
25 | +void bragg_vector(); | |
26 | +void max_and_min_bz(); |
@@ -37,6 +37,7 @@ denser @f$k@f$-grid with French-curve (Kumo) interpolation | ||
37 | 37 | #include <cstdlib> |
38 | 38 | #include <cstdio> |
39 | 39 | #include "basic_math.hpp" |
40 | +#include "variable.hpp" | |
40 | 41 | /** |
41 | 42 | @brief Compute coefficient for the French-curve (Kumo) interpolation |
42 | 43 | @f[ |
@@ -62,19 +63,8 @@ static void kumo_coef( | ||
62 | 63 | |
63 | 64 | Modify : ::eig, ::mat |
64 | 65 | */ |
65 | -void interpol_energy( | |
66 | - GLfloat avec[3][3], | |
67 | - int nb, | |
68 | - int interpol, | |
69 | - int ng0[3], | |
70 | - int ng[3], | |
71 | - wxTextCtrl *terminal, | |
72 | - GLfloat ****eig, | |
73 | - GLfloat *****vf, | |
74 | - GLfloat *****mat, | |
75 | - GLfloat**** eig0, | |
76 | - GLfloat***** mat0 | |
77 | -) { | |
66 | +void interpol_energy() | |
67 | +{ | |
78 | 68 | int ib, i0, i1, i2, ii; |
79 | 69 | |
80 | 70 | *terminal << wxT(" Interpolating ... "); |
@@ -21,15 +21,4 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
21 | 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
22 | 22 | THE SOFTWARE. |
23 | 23 | */ |
24 | -#if defined(HAVE_CONFIG_H) | |
25 | -#include <config.h> | |
26 | -#endif | |
27 | -#if defined(HAVE_GL_GL_H) | |
28 | -#include <GL/gl.h> | |
29 | -#elif defined(HAVE_OPENGL_GL_H) | |
30 | -#include <OpenGL/gl.h> | |
31 | -#endif | |
32 | -#include <wx/wx.h> | |
33 | - | |
34 | -void interpol_energy(GLfloat avec[3][3], int nb, int interpol, int ng0[3], int ng[3], wxTextCtrl* terminal, | |
35 | - GLfloat**** eig, GLfloat***** vf, GLfloat***** mat, GLfloat**** eig0, GLfloat***** mat0); | |
24 | +void interpol_energy(); |
@@ -52,16 +52,12 @@ THE SOFTWARE. | ||
52 | 52 | |
53 | 53 | void compute_patch_segment() { |
54 | 54 | if (refresh_interpol == 1){ |
55 | - interpol_energy(avec, nb, interpol, ng0, ng, | |
56 | - terminal, eig, vf, mat, eig0, mat0); | |
55 | + interpol_energy(); | |
57 | 56 | refresh_patch = 1; |
58 | 57 | refresh_interpol = 0; |
59 | 58 | } |
60 | 59 | if (refresh_patch == 1) { |
61 | - fermi_patch(nb, nthreads, ng, ng0, shiftk, | |
62 | - fbz, eig, EF, mat, vf, corner, bvec, nbragg, | |
63 | - bragg, brnrm, brnrm_min, terminal, ntri, kvp, matp, | |
64 | - clr, arw, nmlp, kvp_rot, nmlp_rot, arw_rot); | |
60 | + fermi_patch(); | |
65 | 61 | refresh_color = 1; |
66 | 62 | refresh_section = 1; |
67 | 63 | refresh_equator = 1; |
@@ -70,37 +66,28 @@ void compute_patch_segment() { | ||
70 | 66 | } |
71 | 67 | if (refresh_color == 1) { |
72 | 68 | if (skip_minmax == 1) skip_minmax = 0; |
73 | - else max_and_min(nb, nthreads, terminal, myf, color_scale, ntri, matp, | |
74 | - &patch_min, &patch_max, nmlp); | |
75 | - paint(nb, color_scale, blackback, ntri, patch_min, patch_max, | |
76 | - kvp, matp, clr, nmlp, arw, red, green, blue, | |
77 | - cyan, magenta, yellow, wgray, bgray); | |
69 | + else max_and_min(); | |
70 | + paint(); | |
78 | 71 | refresh_section = 1; |
79 | 72 | refresh_color = 0; |
80 | 73 | } |
81 | 74 | if (refresh_nodeline == 1) { |
82 | - calc_nodeline(nb, ntri, matp, kvp, nthreads, terminal, nnl, kvnl, kvnl_rot); | |
75 | + calc_nodeline(); | |
83 | 76 | refresh_nodeline = 0; |
84 | 77 | } |
85 | 78 | if (refresh_section == 1) { |
86 | - calc_2dbz(fbz, secvec, secscale, axis2d, | |
87 | - &nbzl2d, nbragg, bragg, brnrm, bzl2d, bzl2d_proj); | |
88 | - calc_section(fbz, nb, nthreads, secvec, secscale, | |
89 | - axis2d, ntri, kvp, clr, terminal, n2d, kv2d, clr2d); | |
79 | + calc_2dbz(); | |
80 | + calc_section(); | |
90 | 81 | refresh_section = 0; |
91 | 82 | } |
92 | 83 | if (refresh_equator == 1) { |
93 | - equator(nb, nthreads, eqvec, ntri, kvp, | |
94 | - nmlp, terminal, nequator, kveq, kveq_rot); | |
84 | + equator(); | |
95 | 85 | refresh_equator = 0; |
96 | 86 | } |
97 | 87 | } |
98 | 88 | |
99 | 89 | void refresh_patch_segment() { |
100 | - free_patch(nb, refresh_patch, ntri, kvp, kvp_rot, matp, | |
101 | - clr, nmlp, nmlp_rot, arw, arw_rot, refresh_nodeline, nnl, kvnl, | |
102 | - kvnl_rot, refresh_section, kv2d, clr2d, | |
103 | - refresh_equator, nequator, kveq, kveq_rot); | |
90 | + free_patch(); | |
104 | 91 | compute_patch_segment(); |
105 | 92 | } |
106 | 93 |
@@ -138,7 +125,15 @@ enum | ||
138 | 125 | itext_roty, |
139 | 126 | itext_rotz, |
140 | 127 | ibutton_rotate, |
141 | - icheck_band | |
128 | + icheck_band, | |
129 | + itext_BackGroundR, | |
130 | + itext_BackGroundG, | |
131 | + itext_BackGroundB, | |
132 | + itext_LineColorR, | |
133 | + itext_LineColorG, | |
134 | + itext_LineColorB, | |
135 | + iradio_BarColor, | |
136 | + ibutton_section | |
142 | 137 | }; |
143 | 138 | |
144 | 139 | void MyFrame::button_refresh( |
@@ -150,32 +145,105 @@ void MyFrame::button_refresh( | ||
150 | 145 | void MyFrame::button_compute( |
151 | 146 | wxCommandEvent& event//!<[in] Selected menu |
152 | 147 | ) { |
153 | - free_patch(nb, refresh_patch, ntri, kvp, kvp_rot, matp, | |
154 | - clr, nmlp, nmlp_rot, arw, arw_rot, refresh_nodeline, nnl, kvnl, | |
155 | - kvnl_rot, refresh_section, kv2d, clr2d, | |
156 | - refresh_equator, nequator, kveq, kveq_rot); | |
148 | + free_patch(); | |
157 | 149 | compute_patch_segment(); |
158 | 150 | Refresh(false); |
159 | 151 | } |
152 | +void MyFrame::button_section( | |
153 | + wxCommandEvent& event//!<[in] Selected menu | |
154 | +) { | |
155 | + int ib, i2d, i, j; | |
156 | + FILE *fp; | |
157 | + fp = fopen("fermi_line.dat", "w"); | |
158 | + for (ib = 0; ib < nb; ib++) { | |
159 | + if (draw_band[ib] == 1) { | |
160 | + for (i2d = 0; i2d < n2d[ib]; i2d++) { | |
161 | + for (i = 0; i < 2; i++) { | |
162 | + fprintf(fp, "%15.5e %15.5e\n", | |
163 | + kv2d[ib][i * 3 + 6 * i2d], | |
164 | + kv2d[ib][1 + i * 3 + 6 * i2d]); | |
165 | + } | |
166 | + fprintf(fp, "\n\n"); | |
167 | + } | |
168 | + }/*if (draw_band[ib] == 1)*/ | |
169 | + }/* for (ib = 0; ib < nb; ib++)*/ | |
170 | + fclose(fp); | |
171 | + *terminal << wxT(" fermi_line.dat was written.\n"); | |
172 | + | |
173 | + fp = fopen("bz_line.dat", "w"); | |
174 | + for (i2d = 0; i2d < nbzl2d; i2d++) { | |
175 | + fprintf(fp, "%15.5e %15.5e\n", | |
176 | + bzl2d_proj[i2d][0], bzl2d_proj[i2d][1]); | |
177 | + } | |
178 | + fprintf(fp, "%15.5e %15.5e\n", | |
179 | + bzl2d_proj[0][0], bzl2d_proj[0][1]); | |
180 | + fclose(fp); | |
181 | + *terminal << wxT(" bz_line.dat was written.\n"); | |
182 | +} | |
183 | +/** | |
184 | +@brief Change Line color color (::blackback) | |
185 | +*/ | |
186 | +void MyFrame::textctrl_LineColor( | |
187 | + wxCommandEvent& event //!<[in] Selected menu | |
188 | +) | |
189 | +{ | |
190 | + int ierr; | |
191 | + double dvalue; | |
192 | + | |
193 | + if (event.GetId() == itext_LineColorR) { | |
194 | + if (event.GetString().ToDouble(&dvalue)) { | |
195 | + LineColor[0] = (GLfloat)dvalue; | |
196 | + Refresh(false); | |
197 | + } | |
198 | + } | |
199 | + else if (event.GetId() == itext_LineColorG) { | |
200 | + if (event.GetString().ToDouble(&dvalue)) { | |
201 | + LineColor[1] = (GLfloat)dvalue; | |
202 | + Refresh(false); | |
203 | + } | |
204 | + } | |
205 | + else if (event.GetId() == itext_LineColorB) { | |
206 | + if (event.GetString().ToDouble(&dvalue)) { | |
207 | + LineColor[2] = (GLfloat)dvalue; | |
208 | + Refresh(false); | |
209 | + } | |
210 | + } | |
211 | +} | |
160 | 212 | /** |
161 | 213 | @brief Change background color (::blackback) |
162 | 214 | */ |
163 | -void MyFrame::radio_background( | |
215 | +void MyFrame::textctrl_BackGround( | |
164 | 216 | wxCommandEvent& event //!<[in] Selected menu |
165 | 217 | ) |
166 | 218 | { |
167 | - if (event.GetString().Cmp(wxT("Black")) == 0 && blackback != 1) { | |
168 | - glClearColor(0.0, 0.0, 0.0, 0.0); | |
169 | - blackback = 1; | |
170 | - // debug if (color_scale == 2 || color_scale == 3) paint(); | |
219 | + int ierr; | |
220 | + double dvalue; | |
221 | + | |
222 | + if (event.GetId() == itext_BackGroundR) { | |
223 | + if (event.GetString().ToDouble(&dvalue)) { | |
224 | + BackGroundColor[0] = (GLfloat)dvalue; | |
225 | + glClearColor(BackGroundColor[0], BackGroundColor[1], | |
226 | + BackGroundColor[2], BackGroundColor[3]); | |
227 | + Refresh(false); | |
228 | + } | |
229 | + } | |
230 | + else if (event.GetId() == itext_BackGroundG) { | |
231 | + if (event.GetString().ToDouble(&dvalue)) { | |
232 | + BackGroundColor[1] = (GLfloat)dvalue; | |
233 | + glClearColor(BackGroundColor[0], BackGroundColor[1], | |
234 | + BackGroundColor[2], BackGroundColor[3]); | |
235 | + Refresh(false); | |
236 | + } | |
171 | 237 | } |
172 | - else if (event.GetString().Cmp(wxT("White")) == 0 && blackback != 0) { | |
173 | - glClearColor(1.0, 1.0, 1.0, 0.0); | |
174 | - blackback = 0; | |
175 | - // debug if (color_scale == 2 || color_scale == 3) paint(); | |
238 | + else if (event.GetId() == itext_BackGroundB) { | |
239 | + if (event.GetString().ToDouble(&dvalue)) { | |
240 | + BackGroundColor[2] = (GLfloat)dvalue; | |
241 | + glClearColor(BackGroundColor[0], BackGroundColor[1], | |
242 | + BackGroundColor[2], BackGroundColor[3]); | |
243 | + Refresh(false); | |
244 | + } | |
176 | 245 | } |
177 | - Refresh(false); | |
178 | -}/* bgcolor change*/ | |
246 | +} | |
179 | 247 | /** |
180 | 248 | @brief Toggle the appearance of each band (::draw_band) |
181 | 249 | */ |
@@ -208,6 +276,44 @@ void MyFrame::radio_brillouinzone( | ||
208 | 276 | refresh_patch = 1; |
209 | 277 | } /* menu_brillouinzone */ |
210 | 278 | /** |
279 | + @brief Change Brillouin zone (::fbz) | |
280 | +*/ | |
281 | +void MyFrame::radio_BarColor( | |
282 | + wxCommandEvent& event //!<[in] Selected menu | |
283 | +) | |
284 | +{ | |
285 | + int ii; | |
286 | + if (event.GetString().Cmp(wxT("BGR")) == 0) { | |
287 | + for (ii = 0; ii < 4; ii++) { | |
288 | + BarColor[0][ii] = blue[ii]; | |
289 | + BarColor[1][ii] = cyan[ii]; | |
290 | + BarColor[2][ii] = green[ii]; | |
291 | + BarColor[3][ii] = yellow[ii]; | |
292 | + BarColor[4][ii] = red[ii]; | |
293 | + } | |
294 | + } | |
295 | + else if (event.GetString().Cmp(wxT("CMY")) == 0) { | |
296 | + for (ii = 0; ii < 4; ii++) { | |
297 | + BarColor[0][ii] = cyan[ii]; | |
298 | + BarColor[1][ii] = blue[ii]; | |
299 | + BarColor[2][ii] = magenta[ii]; | |
300 | + BarColor[3][ii] = red[ii]; | |
301 | + BarColor[4][ii] = yellow[ii]; | |
302 | + } | |
303 | + } | |
304 | + else if (event.GetString().Cmp(wxT("MCY")) == 0) { | |
305 | + for (ii = 0; ii < 4; ii++) { | |
306 | + BarColor[0][ii] = magenta[ii]; | |
307 | + BarColor[1][ii] = blue[ii]; | |
308 | + BarColor[2][ii] = cyan[ii]; | |
309 | + BarColor[3][ii] = green[ii]; | |
310 | + BarColor[4][ii] = yellow[ii]; | |
311 | + } | |
312 | + } | |
313 | + paint(); | |
314 | + Refresh(false); | |
315 | +} /* menu_brillouinzone */ | |
316 | +/** | |
211 | 317 | @brief Toggle Colorbar (::lcolorbar) |
212 | 318 | */ |
213 | 319 | void MyFrame::check_colorbar( |
@@ -440,7 +546,7 @@ void MyFrame::radio_tetra( | ||
440 | 546 | ) |
441 | 547 | { |
442 | 548 | itet = wxAtoi(event.GetString()) - 1; |
443 | - init_corner(itet, corner); | |
549 | + init_corner(); | |
444 | 550 | refresh_patch = 1; |
445 | 551 | }/*menu_tetra*/ |
446 | 552 | /** |
@@ -659,7 +765,7 @@ wxT("8"), wxT("9"), wxT("10"), wxT("11"), wxT("12"), wxT("13"), wxT("14"), | ||
659 | 765 | gbsizer->Add(new wxRadioBox(panel, iradio_tetra, wxT("Tetrahedron"), |
660 | 766 | wxDefaultPosition, wxDefaultSize, |
661 | 767 | WXSIZEOF(choices_tetra), choices_tetra, |
662 | - 4, wxRA_SPECIFY_COLS), wxGBPosition(3,2), wxGBSpan(4, 2)); | |
768 | + 4, wxRA_SPECIFY_COLS), wxGBPosition(3,2), wxGBSpan(5, 2)); | |
663 | 769 | |
664 | 770 | wxString choices_colorscale[] = { wxT("Input (1D)"), wxT("Input (2D)"), |
665 | 771 | wxT("Input (3D)"), wxT("Fermi Velocity"), wxT("Band Index"), |
@@ -670,91 +776,125 @@ wxT("8"), wxT("9"), wxT("10"), wxT("11"), wxT("12"), wxT("13"), wxT("14"), | ||
670 | 776 | WXSIZEOF(choices_colorscale), choices_colorscale, |
671 | 777 | 1, wxRA_SPECIFY_COLS); |
672 | 778 | Bind(wxEVT_COMMAND_RADIOBOX_SELECTED, &MyFrame::radiovalue_colorscale, this, iradio_colorscale); |
673 | - gbsizer->Add(radiobox_color, wxGBPosition(7, 0), wxGBSpan(2, 2)); | |
779 | + gbsizer->Add(radiobox_color, wxGBPosition(7, 0), wxGBSpan(3, 2)); | |
674 | 780 | |
675 | 781 | wxString choices_bz[] = { wxT("First Brillouin zone"), wxT("Primitive Brillouin zone") }; |
676 | 782 | Bind(wxEVT_COMMAND_RADIOBOX_SELECTED, &MyFrame::radio_brillouinzone, this, iradio_brillouinzone); |
677 | 783 | gbsizer->Add(new wxRadioBox(panel, iradio_brillouinzone, wxT("Brillouin zone"), |
678 | 784 | wxDefaultPosition, wxDefaultSize, |
679 | 785 | WXSIZEOF(choices_bz), choices_bz, |
680 | - 1, wxRA_SPECIFY_COLS), wxGBPosition(7, 2), wxGBSpan(1, 2)); | |
786 | + 1, wxRA_SPECIFY_COLS), wxGBPosition(8, 2), wxGBSpan(1, 2)); | |
681 | 787 | |
682 | 788 | wxString choices_stereo[] = { wxT("None"), wxT("Parallel"), wxT("Cross") }; |
683 | 789 | Bind(wxEVT_COMMAND_RADIOBOX_SELECTED, &MyFrame::radio_stereo, this, iradio_stereo); |
684 | 790 | gbsizer->Add(new wxRadioBox(panel, iradio_stereo, wxT("Stereogram"), |
685 | 791 | wxDefaultPosition, wxDefaultSize, |
686 | 792 | WXSIZEOF(choices_stereo), choices_stereo, |
687 | - 1, wxRA_SPECIFY_COLS), wxGBPosition(8, 2), wxGBSpan(1, 1)); | |
793 | + 1, wxRA_SPECIFY_COLS), wxGBPosition(9, 2), wxGBSpan(1, 1)); | |
688 | 794 | |
689 | 795 | wxString choices_mouse[] = { wxT("Rotate"), wxT("Scale"), wxT("Translate") }; |
690 | 796 | Bind(wxEVT_COMMAND_RADIOBOX_SELECTED, &MyFrame::radio_mouse, this, iradio_mouse); |
691 | 797 | gbsizer->Add(new wxRadioBox(panel, iradio_mouse, wxT("Mouse Drag"), |
692 | 798 | wxDefaultPosition, wxDefaultSize, |
693 | 799 | WXSIZEOF(choices_mouse), choices_mouse, |
694 | - 1, wxRA_SPECIFY_COLS), wxGBPosition(8, 3), wxGBSpan(1, 1)); | |
800 | + 1, wxRA_SPECIFY_COLS), wxGBPosition(9, 3), wxGBSpan(1, 1)); | |
801 | + | |
802 | + gbsizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Background (RGB) : ")), | |
803 | + wxGBPosition(10, 0), wxGBSpan(1, 1), wxALIGN_RIGHT); | |
804 | + Bind(wxEVT_COMMAND_TEXT_UPDATED, &MyFrame::textctrl_BackGround, this, itext_BackGroundR); | |
805 | + textbox_BackGroundR = new wxTextCtrl(panel, itext_BackGroundR, wxT("")); | |
806 | + gbsizer->Add(textbox_BackGroundR, wxGBPosition(10, 1), wxGBSpan(1, 1)); | |
807 | + Bind(wxEVT_COMMAND_TEXT_UPDATED, &MyFrame::textctrl_BackGround, this, itext_BackGroundG); | |
808 | + textbox_BackGroundG = new wxTextCtrl(panel, itext_BackGroundG, wxT("")); | |
809 | + gbsizer->Add(textbox_BackGroundG, wxGBPosition(10, 2), wxGBSpan(1, 1)); | |
810 | + Bind(wxEVT_COMMAND_TEXT_UPDATED, &MyFrame::textctrl_BackGround, this, itext_BackGroundB); | |
811 | + textbox_BackGroundB = new wxTextCtrl(panel, itext_BackGroundB, wxT("")); | |
812 | + gbsizer->Add(textbox_BackGroundB, wxGBPosition(10, 3), wxGBSpan(1, 1)); | |
813 | + textbox_BackGroundR->ChangeValue(wxT("0")); | |
814 | + textbox_BackGroundG->ChangeValue(wxT("0")); | |
815 | + textbox_BackGroundB->ChangeValue(wxT("0")); | |
816 | + | |
817 | + gbsizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Line color (RGB) : ")), | |
818 | + wxGBPosition(11, 0), wxGBSpan(1, 1), wxALIGN_RIGHT); | |
819 | + Bind(wxEVT_COMMAND_TEXT_UPDATED, &MyFrame::textctrl_LineColor, this, itext_LineColorR); | |
820 | + textbox_LineColorR = new wxTextCtrl(panel, itext_LineColorR, wxT("")); | |
821 | + gbsizer->Add(textbox_LineColorR, wxGBPosition(11, 1), wxGBSpan(1, 1)); | |
822 | + Bind(wxEVT_COMMAND_TEXT_UPDATED, &MyFrame::textctrl_LineColor, this, itext_LineColorG); | |
823 | + textbox_LineColorG = new wxTextCtrl(panel, itext_LineColorG, wxT("")); | |
824 | + gbsizer->Add(textbox_LineColorG, wxGBPosition(11, 2), wxGBSpan(1, 1)); | |
825 | + Bind(wxEVT_COMMAND_TEXT_UPDATED, &MyFrame::textctrl_LineColor, this, itext_LineColorB); | |
826 | + textbox_LineColorB = new wxTextCtrl(panel, itext_LineColorB, wxT("")); | |
827 | + gbsizer->Add(textbox_LineColorB, wxGBPosition(11, 3), wxGBSpan(1, 1)); | |
828 | + textbox_LineColorR->ChangeValue(wxT("1")); | |
829 | + textbox_LineColorG->ChangeValue(wxT("1")); | |
830 | + textbox_LineColorB->ChangeValue(wxT("1")); | |
695 | 831 | |
696 | 832 | Bind(wxEVT_COMMAND_BUTTON_CLICKED, &MyFrame::textctrl_view, this, ibutton_rotate); |
697 | 833 | gbsizer->Add(new wxButton(panel, ibutton_rotate, wxT("Rotate")), |
698 | - wxGBPosition(9, 0), wxGBSpan(1, 1)); | |
834 | + wxGBPosition(12, 0), wxGBSpan(1, 1)); | |
699 | 835 | Bind(wxEVT_COMMAND_TEXT_UPDATED, &MyFrame::textctrl_view, this, itext_rotx); |
700 | 836 | textbox_rotatex = new wxTextCtrl(panel, itext_rotx, wxT("")); |
701 | - gbsizer->Add(textbox_rotatex, wxGBPosition(9, 1), wxGBSpan(1, 1)); | |
837 | + gbsizer->Add(textbox_rotatex, wxGBPosition(12, 1), wxGBSpan(1, 1)); | |
702 | 838 | Bind(wxEVT_COMMAND_TEXT_UPDATED, &MyFrame::textctrl_view, this, itext_roty); |
703 | 839 | textbox_rotatey = new wxTextCtrl(panel, itext_roty, wxT("")); |
704 | - gbsizer->Add(textbox_rotatey, wxGBPosition(9, 2), wxGBSpan(1, 1)); | |
840 | + gbsizer->Add(textbox_rotatey, wxGBPosition(12, 2), wxGBSpan(1, 1)); | |
705 | 841 | Bind(wxEVT_COMMAND_TEXT_UPDATED, &MyFrame::textctrl_view, this, itext_rotz); |
706 | 842 | textbox_rotatez = new wxTextCtrl(panel, itext_rotz, wxT("")); |
707 | - gbsizer->Add(textbox_rotatez, wxGBPosition(9, 3), wxGBSpan(1, 1)); | |
843 | + gbsizer->Add(textbox_rotatez, wxGBPosition(12, 3), wxGBSpan(1, 1)); | |
708 | 844 | textbox_rotatex->ChangeValue(wxT("0")); |
709 | 845 | textbox_rotatey->ChangeValue(wxT("0")); |
710 | 846 | textbox_rotatez->ChangeValue(wxT("0")); |
711 | 847 | |
712 | 848 | gbsizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Position : ")), |
713 | - wxGBPosition(10, 1), wxGBSpan(1, 1), wxALIGN_RIGHT); | |
849 | + wxGBPosition(13, 1), wxGBSpan(1, 1), wxALIGN_RIGHT); | |
714 | 850 | Bind(wxEVT_COMMAND_TEXT_UPDATED, &MyFrame::textctrl_view, this, itext_positionx); |
715 | 851 | textbox_positionx = new wxTextCtrl(panel, itext_positionx, wxT("")); |
716 | - gbsizer->Add(textbox_positionx, wxGBPosition(10, 2), wxGBSpan(1, 1)); | |
852 | + gbsizer->Add(textbox_positionx, wxGBPosition(13, 2), wxGBSpan(1, 1)); | |
717 | 853 | Bind(wxEVT_COMMAND_TEXT_UPDATED, &MyFrame::textctrl_view, this, itext_positiony); |
718 | 854 | textbox_positiony = new wxTextCtrl(panel, itext_positiony, wxT("")); |
719 | - gbsizer->Add(textbox_positiony, wxGBPosition(10, 3), wxGBSpan(1, 1)); | |
855 | + gbsizer->Add(textbox_positiony, wxGBPosition(13, 3), wxGBSpan(1, 1)); | |
720 | 856 | textbox_positionx->ChangeValue(wxT("0")); |
721 | 857 | textbox_positiony->ChangeValue(wxT("0")); |
722 | 858 | |
723 | 859 | gbsizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Scale : ")), |
724 | - wxGBPosition(11, 2), wxGBSpan(1, 1), wxALIGN_RIGHT); | |
860 | + wxGBPosition(14, 2), wxGBSpan(1, 1), wxALIGN_RIGHT); | |
725 | 861 | Bind(wxEVT_COMMAND_TEXT_UPDATED, &MyFrame::textctrl_view, this, itext_scale); |
726 | 862 | textbox_scale = new wxTextCtrl(panel, itext_scale, wxT("")); |
727 | - gbsizer->Add(textbox_scale, wxGBPosition(11, 3), wxGBSpan(1, 1)); | |
863 | + gbsizer->Add(textbox_scale, wxGBPosition(14, 3), wxGBSpan(1, 1)); | |
728 | 864 | textbox_scale->ChangeValue(wxString::Format(wxT("%f"), scl)); |
729 | 865 | |
730 | 866 | Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, &MyFrame::check_colorbar, this, icheck_colorbar); |
731 | 867 | wxCheckBox* check = new wxCheckBox(panel, icheck_colorbar, wxT("Color bar")); |
732 | - gbsizer->Add(check, wxGBPosition(11, 1), wxGBSpan(1, 1)); | |
868 | + gbsizer->Add(check, wxGBPosition(14, 1), wxGBSpan(1, 1)); | |
733 | 869 | check->SetValue(true); |
734 | 870 | // debug fileMenu->Check(menu_colorbar_check, true); |
735 | 871 | |
736 | 872 | Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, &MyFrame::checkvalue_equator, this, icheck_equator); |
737 | - gbsizer->Add(new wxCheckBox(panel, icheck_equator, wxT("Equator")), wxGBPosition(12, 1), wxGBSpan(1, 1)); | |
873 | + gbsizer->Add(new wxCheckBox(panel, icheck_equator, wxT("Equator")), wxGBPosition(15, 1), wxGBSpan(1, 1)); | |
738 | 874 | |
739 | 875 | Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, &MyFrame::check_nodeline, this, icheck_nodeline); |
740 | - gbsizer->Add(new wxCheckBox(panel, icheck_nodeline, wxT("Nodal line")), wxGBPosition(13, 1), wxGBSpan(1, 1)); | |
876 | + gbsizer->Add(new wxCheckBox(panel, icheck_nodeline, wxT("Nodal line")), wxGBPosition(16, 1), wxGBSpan(1, 1)); | |
741 | 877 | |
742 | 878 | Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, &MyFrame::radiovalue_section, this, icheck_section); |
743 | - gbsizer->Add(new wxCheckBox(panel, icheck_section, wxT("Section")), wxGBPosition(14, 1), wxGBSpan(1, 1)); | |
879 | + gbsizer->Add(new wxCheckBox(panel, icheck_section, wxT("Section")), wxGBPosition(17, 1), wxGBSpan(1, 1)); | |
880 | + | |
881 | + Bind(wxEVT_COMMAND_BUTTON_CLICKED, &MyFrame::button_section, this, ibutton_section); | |
882 | + gbsizer->Add(new wxButton(panel, ibutton_section, wxT("Section file")), | |
883 | + wxGBPosition(18, 1), wxGBSpan(1, 1)); | |
744 | 884 | |
745 | 885 | wxString choices_light[] = { wxT("Both"), wxT("Unoccupy"), wxT("Occupy") }; |
746 | 886 | Bind(wxEVT_COMMAND_RADIOBOX_SELECTED, &MyFrame::radio_lighting, this, iradio_lighting); |
747 | 887 | gbsizer->Add(new wxRadioBox(panel, iradio_lighting, wxT("Lighting"), |
748 | 888 | wxDefaultPosition, wxDefaultSize, |
749 | 889 | WXSIZEOF(choices_light), choices_light, |
750 | - 1, wxRA_SPECIFY_COLS), wxGBPosition(12, 2), wxGBSpan(3, 1)); | |
890 | + 1, wxRA_SPECIFY_COLS), wxGBPosition(15, 2), wxGBSpan(4, 1)); | |
751 | 891 | |
752 | - wxString choices_bg[] = { wxT("Black"), wxT("White") }; | |
753 | - Bind(wxEVT_COMMAND_RADIOBOX_SELECTED, &MyFrame::radio_background, this, iradio_background); | |
754 | - gbsizer->Add(new wxRadioBox(panel, iradio_background, wxT("Background color"), | |
892 | + wxString choices_BarColor[] = { wxT("BGR"), wxT("CMY"), wxT("MCY")}; | |
893 | + Bind(wxEVT_COMMAND_RADIOBOX_SELECTED, &MyFrame::radio_BarColor, this, iradio_BarColor); | |
894 | + gbsizer->Add(new wxRadioBox(panel, iradio_BarColor, wxT("Bar Color"), | |
755 | 895 | wxDefaultPosition, wxDefaultSize, |
756 | - WXSIZEOF(choices_bg), choices_bg, | |
757 | - 1, wxRA_SPECIFY_COLS), wxGBPosition(12, 3), wxGBSpan(3, 1)); | |
896 | + WXSIZEOF(choices_BarColor), choices_BarColor, | |
897 | + 1, wxRA_SPECIFY_COLS), wxGBPosition(15, 3), wxGBSpan(4, 1)); | |
758 | 898 | |
759 | 899 | SetSizer(sizermain); |
760 | 900 | SetAutoLayout(true); |
@@ -790,7 +930,7 @@ void MyFrame::modify_band() { | ||
790 | 930 | Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, &MyFrame::check_band, this, icheck_band + ib); |
791 | 931 | check[ib] = new wxCheckBox(panel, icheck_band + ib, |
792 | 932 | wxString::Format(wxT("Band %d"), ib)); |
793 | - gbsizer->Add(check[ib], wxGBPosition(10 + ib, 0), wxGBSpan(1, 1)); | |
933 | + gbsizer->Add(check[ib], wxGBPosition(13 + ib, 0), wxGBSpan(1, 1)); | |
794 | 934 | check[ib]->SetValue(true); |
795 | 935 | } |
796 | 936 | gbsizer->Layout(); |
@@ -62,12 +62,19 @@ public: | ||
62 | 62 | wxTextCtrl* textbox_min; |
63 | 63 | wxTextCtrl* textbox_max; |
64 | 64 | wxTextCtrl* textbox_linewidth; |
65 | + wxTextCtrl* textbox_BackGroundR; | |
66 | + wxTextCtrl* textbox_BackGroundG; | |
67 | + wxTextCtrl* textbox_BackGroundB; | |
68 | + wxTextCtrl* textbox_LineColorR; | |
69 | + wxTextCtrl* textbox_LineColorG; | |
70 | + wxTextCtrl* textbox_LineColorB; | |
65 | 71 | |
66 | 72 | private: |
67 | 73 | void OnExit(wxCommandEvent& event); |
68 | 74 | void check_band(wxCommandEvent& event); |
69 | 75 | void radio_brillouinzone(wxCommandEvent& event); |
70 | - void radio_background(wxCommandEvent& event); | |
76 | + void textctrl_BackGround(wxCommandEvent& event); | |
77 | + void textctrl_LineColor(wxCommandEvent& event); | |
71 | 78 | void check_colorbar(wxCommandEvent& event); |
72 | 79 | void radiovalue_colorscale(wxCommandEvent& event); |
73 | 80 | void checkvalue_equator(wxCommandEvent& event); |
@@ -83,6 +90,8 @@ private: | ||
83 | 90 | void textctrl_view(wxCommandEvent& event); |
84 | 91 | void button_refresh(wxCommandEvent& event); |
85 | 92 | void button_compute(wxCommandEvent& event); |
93 | + void radio_BarColor(wxCommandEvent& event); | |
94 | + void button_section(wxCommandEvent& event); | |
86 | 95 | //wxDECLARE_EVENT_TABLE(); |
87 | 96 | }; |
88 | 97 |
@@ -268,15 +268,8 @@ void read_batch() | ||
268 | 268 | continue; |
269 | 269 | } |
270 | 270 | |
271 | - if (strcmp(keyword, "background") == 0) { | |
272 | - ierr = fscanf(fp, "%s", value); | |
273 | - Text2Lower(value); | |
274 | - if (strcmp(value, "black") == 0) blackback = 1; | |
275 | - else if (strcmp(value, "white") == 0) blackback = 0; | |
276 | - else { | |
277 | - printf("Error! %s = %s", keyword, value); | |
278 | - exit(-1); | |
279 | - } | |
271 | + if (strcmp(keyword, "backgroundcolor") == 0) { | |
272 | + ierr = fscanf(fp, "%f%f%f", &BackGroundColor[0], &BackGroundColor[1], &BackGroundColor[2]); | |
280 | 273 | } |
281 | 274 | else if (strcmp(keyword, "band") == 0) { |
282 | 275 | for (ib = 0; ib < nb; ib++) |
@@ -321,6 +314,9 @@ void read_batch() | ||
321 | 314 | else if (strcmp(keyword, "interpol") == 0) { |
322 | 315 | ierr = fscanf(fp, "%d", &interpol); |
323 | 316 | } |
317 | + else if (strcmp(keyword, "linecolor") == 0) { | |
318 | + ierr = fscanf(fp, "%f%f%f", &LineColor[0], &LineColor[1], &LineColor[2]); | |
319 | + } | |
324 | 320 | else if (strcmp(keyword, "linewidth") == 0) { |
325 | 321 | ierr = fscanf(fp, "%f", &linewidth); |
326 | 322 | } |
@@ -388,8 +384,7 @@ void read_batch() | ||
388 | 384 | } |
389 | 385 | fclose(fp); |
390 | 386 | |
391 | - if (blackback == 1) glClearColor(0.0, 0.0, 0.0, 0.0); | |
392 | - else glClearColor(1.0, 1.0, 1.0, 0.0); | |
387 | + glClearColor(BackGroundColor[0], BackGroundColor[1], BackGroundColor[2], BackGroundColor[2]); | |
393 | 388 | |
394 | 389 | thetax = 3.14159265f / 180.0f * thetax; |
395 | 390 | thetay = 3.14159265f / 180.0f * thetay; |
@@ -21,16 +21,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
21 | 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
22 | 22 | THE SOFTWARE. |
23 | 23 | */ |
24 | -#if defined(HAVE_CONFIG_H) | |
25 | -#include <config.h> | |
26 | -#endif | |
27 | -#if defined(HAVE_GL_GL_H) | |
28 | -#include <GL/gl.h> | |
29 | -#elif defined(HAVE_OPENGL_GL_H) | |
30 | -#include <OpenGL/gl.h> | |
31 | -#endif | |
32 | -#include <wx/wx.h> | |
33 | - | |
34 | 24 | int read_file(); |
35 | 25 | void read_batch(); |
36 | 26 | void read_bxsf(); |
@@ -39,6 +39,7 @@ THE SOFTWARE. | ||
39 | 39 | #include <cstdlib> |
40 | 40 | #include <cmath> |
41 | 41 | #include "basic_math.hpp" |
42 | +#include "variable.hpp" | |
42 | 43 | /** |
43 | 44 | @brief Project 3D \f$k\f$-vector into 2D plane. |
44 | 45 |
@@ -177,18 +178,7 @@ int bragg_vert2d( | ||
177 | 178 | |
178 | 179 | Modify : ::nbzl2d, ::bzl2d_proj |
179 | 180 | */ |
180 | -void calc_2dbz( | |
181 | -int fbz, | |
182 | -GLfloat secvec[3], | |
183 | -GLfloat secscale, | |
184 | -GLfloat axis2d[2][3], | |
185 | -int *nbzl2d, | |
186 | -int nbragg, | |
187 | -GLfloat bragg[26][3], | |
188 | -GLfloat brnrm[26], | |
189 | -GLfloat bzl2d[26][3], | |
190 | -GLfloat bzl2d_proj[26][3] | |
191 | -) { | |
181 | +void calc_2dbz() { | |
192 | 182 | int jbr, nbr, i, j, lvert, ibzl; |
193 | 183 | GLfloat vert[2][3], vec[26][2][3], prod, thr; |
194 | 184 |
@@ -198,7 +188,7 @@ GLfloat bzl2d_proj[26][3] | ||
198 | 188 | */ |
199 | 189 | set2daxis(secvec, axis2d); |
200 | 190 | |
201 | - *nbzl2d = 0; | |
191 | + nbzl2d = 0; | |
202 | 192 | |
203 | 193 | for (jbr = 0; jbr < nbragg; ++jbr) { |
204 | 194 | /**/ |
@@ -211,15 +201,15 @@ GLfloat bzl2d_proj[26][3] | ||
211 | 201 | lvert = bragg_vert2d(nbragg, bragg, brnrm, secvec, secscale, jbr, nbr, vert[1], vert[0]); |
212 | 202 | if (lvert == 0) continue; |
213 | 203 | /**/ |
214 | - for (i = 0; i < 2; ++i) for (j = 0; j < 3; ++j) vec[*nbzl2d][i][j] = vert[i][j]; | |
215 | - *nbzl2d += 1; | |
204 | + for (i = 0; i < 2; ++i) for (j = 0; j < 3; ++j) vec[nbzl2d][i][j] = vert[i][j]; | |
205 | + nbzl2d += 1; | |
216 | 206 | }/*for (jbr = 0; jbr < nbragg; ++jbr)*/ |
217 | 207 | /* |
218 | 208 | Order bz lines |
219 | 209 | */ |
220 | 210 | for (i = 0; i < 3; i++) bzl2d[0][i] = vec[0][0][i]; |
221 | 211 | for (i = 0; i < 3; i++) bzl2d[1][i] = vec[0][1][i]; |
222 | - for (ibzl = 0; ibzl < *nbzl2d; ibzl++) { | |
212 | + for (ibzl = 0; ibzl < nbzl2d; ibzl++) { | |
223 | 213 | |
224 | 214 | thr = 0.0f; |
225 | 215 | for (j = 0; j < 2; j++) for (i = 0; i < 3; i++) thr += bzl2d[j][i] * bzl2d[j][i]; |
@@ -238,21 +228,21 @@ GLfloat bzl2d_proj[26][3] | ||
238 | 228 | for (j = 0; j < 2; j++) for (i = 0; i < 3; i++) vec[ibzl][j][i] = 0.0; |
239 | 229 | }/*for (ibzl = 1; ibzl < *nbzl2d; ibzl++)*/ |
240 | 230 | |
241 | - for (jbr = 1; jbr < *nbzl2d - 1; jbr++) { | |
231 | + for (jbr = 1; jbr < nbzl2d - 1; jbr++) { | |
242 | 232 | |
243 | 233 | thr = 0.0f; |
244 | 234 | for (j = 0; j < 2; j++) for (i = 0; i < 3; i++) thr += bzl2d[jbr][i] * bzl2d[jbr][i]; |
245 | 235 | thr *= 0.001f; |
246 | 236 | |
247 | 237 | prod = 0.0; |
248 | - for (ibzl = 0; ibzl < *nbzl2d; ibzl++) for (i = 0; i < 3; i++) | |
238 | + for (ibzl = 0; ibzl < nbzl2d; ibzl++) for (i = 0; i < 3; i++) | |
249 | 239 | prod += vec[ibzl][0][i] * vec[ibzl][0][i]; |
250 | 240 | if (prod < thr) { |
251 | - *nbzl2d = jbr + 1; | |
241 | + nbzl2d = jbr + 1; | |
252 | 242 | break; |
253 | 243 | } |
254 | 244 | |
255 | - for (ibzl = 1; ibzl < *nbzl2d; ibzl++) { | |
245 | + for (ibzl = 1; ibzl < nbzl2d; ibzl++) { | |
256 | 246 | prod = (bzl2d[jbr][0] - vec[ibzl][0][0]) * (bzl2d[jbr][0] - vec[ibzl][0][0]) |
257 | 247 | + (bzl2d[jbr][1] - vec[ibzl][0][1]) * (bzl2d[jbr][1] - vec[ibzl][0][1]) |
258 | 248 | + (bzl2d[jbr][2] - vec[ibzl][0][2]) * (bzl2d[jbr][2] - vec[ibzl][0][2]); |
@@ -273,7 +263,7 @@ GLfloat bzl2d_proj[26][3] | ||
273 | 263 | /* |
274 | 264 | Project into 2D plane |
275 | 265 | */ |
276 | - for (ibzl = 0; ibzl < *nbzl2d; ibzl++) { | |
266 | + for (ibzl = 0; ibzl < nbzl2d; ibzl++) { | |
277 | 267 | for (i = 0; i < 3; i++) bzl2d_proj[ibzl][i] = bzl2d[ibzl][i]; |
278 | 268 | proj_2d(axis2d, bzl2d_proj[ibzl]); |
279 | 269 | }/*for (ibzl = 0; ibzl < *nbzl2d; ibzl++)*/ |
@@ -283,21 +273,7 @@ GLfloat bzl2d_proj[26][3] | ||
283 | 273 | |
284 | 274 | Modify : ::n2d, ::clr2d, ::kv2d |
285 | 275 | */ |
286 | -void calc_section( | |
287 | -int fbz, | |
288 | -int nb, | |
289 | -int nthreads, | |
290 | -GLfloat secvec[3], | |
291 | -GLfloat secscale, | |
292 | -GLfloat axis2d[2][3], | |
293 | -int *ntri, | |
294 | -GLfloat ****kvp, | |
295 | -GLfloat ** clr, | |
296 | -wxTextCtrl *terminal, | |
297 | -int *n2d, | |
298 | -GLfloat **kv2d, | |
299 | -GLfloat **clr2d | |
300 | -) { | |
276 | +void calc_section() { | |
301 | 277 | int i, j, ib, itri, ithread, n2d0; |
302 | 278 | std::vector<std::vector<std::vector<std::vector<GLfloat>>>> kv2d_v, clr2d_v; |
303 | 279 |
@@ -21,19 +21,5 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
21 | 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
22 | 22 | THE SOFTWARE. |
23 | 23 | */ |
24 | -#if defined(HAVE_CONFIG_H) | |
25 | -#include <config.h> | |
26 | -#endif | |
27 | -#if defined(HAVE_GL_GL_H) | |
28 | -#include <GL/gl.h> | |
29 | -#elif defined(HAVE_OPENGL_GL_H) | |
30 | -#include <OpenGL/gl.h> | |
31 | -#endif | |
32 | -#include <wx/wx.h> | |
33 | - | |
34 | -void calc_2dbz(int fbz, GLfloat secvec[3], GLfloat secscale, GLfloat axis2d[2][3], | |
35 | - int *nbzl2d, int nbragg, GLfloat bragg[26][3], GLfloat brnrm[26], GLfloat bzl2d[26][3], | |
36 | - GLfloat bzl2d_proj[26][3]); | |
37 | -void calc_section(int fbz, int nb, int nthreads, GLfloat secvec[3], GLfloat secscale, | |
38 | - GLfloat axis2d[2][3], int* ntri, GLfloat**** kvp, GLfloat** clr, wxTextCtrl* terminal, | |
39 | - int* n2d, GLfloat** kv2d, GLfloat** clr2d); | |
24 | +void calc_2dbz(); | |
25 | +void calc_section(); |
@@ -60,7 +60,6 @@ extern int interpol; //!< Ratio of interpolation | ||
60 | 60 | /* |
61 | 61 | Switch for some modes |
62 | 62 | */ |
63 | -extern int blackback; //!< Switch for black background | |
64 | 63 | extern int color_scale; //!< Switch for full color scale mode |
65 | 64 | extern int fbz; //!< Switch for 1st Brillouin zone mode |
66 | 65 | extern int nodeline; //!< Switch for node lines |
@@ -150,6 +149,9 @@ extern GLfloat yellow[4]; //!< Yellow color code | ||
150 | 149 | extern GLfloat red[4]; //!< Red color code |
151 | 150 | extern GLfloat green[4]; //!< Green color code |
152 | 151 | extern GLfloat blue[4]; //!< Blue color code |
152 | +extern GLfloat BackGroundColor[4];//!< Background color code | |
153 | +extern GLfloat LineColor[4];//!< Line color code | |
154 | +extern GLfloat BarColor[5][4]; | |
153 | 155 | /* |
154 | 156 | Others |
155 | 157 | */ |