• R/O
  • HTTP
  • SSH
  • HTTPS

fermisurfer: Commit

fermisurfer Git


Commit MetaInfo

Revisionbec189d8b68f0a23765be9de145da468644bd588 (tree)
Zeit2019-06-04 14:28:41
Autormitsuaki1987 <kawamitsuaki@gmai...>
Commitermitsuaki1987

Log Message

Using wxtext for terminal

Ändern Zusammenfassung

Diff

--- a/src/bz_lines.cpp
+++ b/src/bz_lines.cpp
@@ -131,7 +131,7 @@ static void check_bragg() {
131131
132132 }/*for (ii = 0; ii < 2; ii++)*/
133133 }/*for (ibzl = 0; ibzl < nbzl; ibzl++)*/
134- printf(" Number of corners of 1st BZ : %d\n", nbzcorner);
134+ *terminal << wxString::Format(wxT(" Number of corners of 1st BZ : %d\n"), nbzcorner);
135135 /**@brief
136136 Then, compute real number Bragg plane of 1st BZ (::nbragg),
137137 Re-order ::bragg and ::brnrm
@@ -150,7 +150,7 @@ static void check_bragg() {
150150 nbragg += 1;
151151 }
152152 }
153- printf(" Number of plane of 1st BZ : %d\n", nbragg);
153+ *terminal << wxString::Format(wxT(" Number of plane of 1st BZ : %d\n"), nbragg);
154154 }/*static void check_bragg*/
155155 /**
156156 @brief Compute Brillouin zone boundariy lines
--- a/src/calc_nodeline.cpp
+++ b/src/calc_nodeline.cpp
@@ -113,9 +113,9 @@ void calc_nodeline() {
113113 }
114114 ntri_th[ib][0] = 0;
115115 }/*for (ib = 0; ib < nb; ib++)*/
116- printf(" band # of nodeline\n");
116+ *terminal << wxT(" band # of nodeline\n");
117117 for (ib = 0; ib < nb; ib++) {
118- printf(" %d %d\n", ib + 1, nnl[ib]);
118+ *terminal << wxString::Format(wxT(" %d %d\n"), ib + 1, nnl[ib]);
119119 }/*for (ib = 0; ib < nb; ib++)*/
120120 /*
121121 Allocation of nodeline
--- a/src/draw.cpp
+++ b/src/draw.cpp
@@ -499,6 +499,8 @@ void TestGLCanvas::OnPaint(wxPaintEvent& WXUNUSED(event))
499499 int ierr;
500500 char command_name[256];
501501
502+ if (draw_band == NULL) return;
503+
502504 // This is a dummy, to avoid an endless succession of paint messages.
503505 // OnPaint handlers must always create a wxPaintDC.
504506 wxPaintDC dc(this);
--- a/src/equator.cpp
+++ b/src/equator.cpp
@@ -116,9 +116,9 @@ void equator() {
116116 }
117117 ntri_th[ib][0] = 0;
118118 }/*for (ib = 0; ib < nb; ib++)*/
119- printf(" band # of nodeline\n");
119+ *terminal << wxT(" band # of nodeline\n");
120120 for (ib = 0; ib < nb; ib++) {
121- printf(" %d %d\n", ib + 1, nequator[ib]);
121+ *terminal << wxString::Format(wxT(" %d %d\n"), ib + 1, nequator[ib]);
122122 }/*for (ib = 0; ib < nb; ib++)*/
123123 /*
124124 Allocation of nodeline
--- a/src/fermi_patch.cpp
+++ b/src/fermi_patch.cpp
@@ -436,8 +436,8 @@ void fermi_patch()
436436 /**/
437437 if (fbz == 1) {
438438 if (query == 1) {
439- printf("\n");
440- printf(" ## First Brillouin zone mode #######\n");
439+ *terminal << wxT("\n");
440+ *terminal << wxT(" ## First Brillouin zone mode #######\n");
441441 }
442442 for (i0 = 0; i0 < 3; ++i0) {
443443 start[i0] = ng[i0] / 2 - ng[i0];
@@ -446,15 +446,15 @@ void fermi_patch()
446446 }
447447 else {
448448 if (query == 1) {
449- printf("\n");
450- printf(" ## Premitive Brillouin zone mode #######\n");
449+ *terminal << wxT("\n");
450+ *terminal << wxT(" ## Premitive Brillouin zone mode #######\n");
451451 }
452452 for (i0 = 0; i0 < 3; ++i0) {
453453 start[i0] = 0;
454454 last[i0] = ng[i0];
455455 }
456456 }
457- if (query == 1) printf(" Computing patch ...\n");
457+ if (query == 1)* terminal << wxT(" Computing patch ...\n");
458458 /**/
459459 #pragma omp parallel default(none) \
460460 shared(nb,ntri,ntri_th,start,last,ng,ng0,eig,vf,EF,mat,shiftk,query) \
@@ -573,9 +573,9 @@ void fermi_patch()
573573 ntri_th[ib][0] = 0;
574574 }
575575 /**/
576- printf(" band # of patchs\n");
576+ *terminal << wxT(" band # of patchs\n");
577577 for (ib = 0; ib < nb; ib++) {
578- printf(" %d %d\n", ib + 1, ntri[ib]);
578+ *terminal << wxString::Format(wxT(" %d %d\n"), ib + 1, ntri[ib]);
579579 }
580580 /*
581581 Allocation of triangler patches
@@ -606,6 +606,6 @@ void fermi_patch()
606606 }/*for (ib = 0; ib < nb; ++ib)*/
607607 }/*if (query == 1)*/
608608 else {
609- printf(" ... Done\n");
609+ *terminal << wxT(" ... Done\n");
610610 }
611611 } /* fermi_patch */
--- a/src/fermisurfer.cpp
+++ b/src/fermisurfer.cpp
@@ -226,6 +226,9 @@ wxString window_name;
226226 wxString batch_name;
227227 wxString frmsf_file_name;
228228 int lbatch;
229+
230+wxTextCtrl* terminal;
231+
229232 /**
230233 @brief Glut Display function
231234 called by glutDisplayFunc
@@ -274,13 +277,15 @@ bool MyApp::OnInit()
274277
275278 if (!wxApp::OnInit()) return false;
276279
277- printf("\n");
278- printf("###########################################\n");
279- printf("## ##\n");
280- printf("## Welocome to FermiSurfer ver. %s ##\n", VERSION);
281- printf("## ##\n");
282- printf("###########################################\n");
283- printf("\n");
280+ new MyFrame(NULL, argv[1]);
281+
282+ *terminal << wxT("###########################################\n");
283+ *terminal << wxT("## ##\n");
284+ *terminal << wxT("## Welocome to FermiSurfer ver. ") <<
285+ wxT(VERSION) << wxT(" ##\n");
286+ *terminal << wxT("## ##\n");
287+ *terminal << wxT("###########################################\n");
288+ *terminal << wxT("\n");
284289 if (argc < 2) {
285290 printf("\n");
286291 printf(" Input file is not specified !\n");
@@ -296,10 +301,10 @@ bool MyApp::OnInit()
296301 #else
297302 nthreads = 1;
298303 #endif
299- printf(" Number of threads : %d\n", nthreads);
300- printf("\n");
301- printf(" Initialize variables ...\n");
302- printf("\n");
304+ *terminal << wxT(" Number of threads : ") << nthreads << wxT("\n");
305+ *terminal << wxT("\n");
306+ *terminal << wxT(" Initialize variables ...\n");
307+ *terminal << wxT("\n");
303308 /**/
304309 color_scale = read_file();
305310 if (color_scale == 0)color_scale = 4;
@@ -318,17 +323,16 @@ bool MyApp::OnInit()
318323 /*
319324 Description
320325 */
321- printf("\n");
322- printf(" ## How to handle ###################\n");
323- printf("\n");
324- printf(" mouse drag : Rotate objects\n");
325- printf(" mousewheel : Resize objects\n");
326- printf(" cursorkey : Move objects\n");
327- printf(" mouse right button : Menu\n");
328- printf("\n");
326+ *terminal << wxT("\n");
327+ *terminal << wxT(" ## How to handle ###################\n");
328+ *terminal << wxT("\n");
329+ *terminal << wxT(" mouse drag : Rotate objects\n");
330+ *terminal << wxT(" mousewheel : Resize objects\n");
331+ *terminal << wxT(" cursorkey : Move objects\n");
332+ *terminal << wxT(" mouse right button : Menu\n");
333+ *terminal << wxT("\n");
329334 /**/
330335 //if (argc > 4)glutInitWindowSize(atoi(argv[3]), atoi(argv[4]));
331- new MyFrame(NULL, argv[1]);
332336 lbatch = 0;
333337 if (argc > 2) {
334338 lbatch = 1;
@@ -336,7 +340,6 @@ bool MyApp::OnInit()
336340 batch_name = argv[2];
337341 batch_draw();
338342 }
339- //MyFrame::m_canvas->PostSizeEventToParent();
340343 return true;
341344 } /* main */
342345
--- a/src/free_patch.cpp
+++ b/src/free_patch.cpp
@@ -134,14 +134,14 @@ void max_and_min()
134134 min_th[ithread] = new GLfloat[3];
135135 }
136136
137- printf("\n");
138- if (color_scale == 1) printf(" ## Color Scale as Input Quantity (Real) #############\n");
139- else if (color_scale == 2) printf(" ## Color Scale as Input Quantity (Complex) #############\n");
140- else if (color_scale == 3) printf(" ## Color Scale as Fermi Velocity #############\n");
141- else if (color_scale == 4) printf(" ## Color Scale as Band Index #############\n");
142- else if (color_scale == 5) printf(" ## Gray Scale as Input Quantity (Real) #############\n");
143- else if (color_scale == 6) printf(" ## Gray Scale as Fermi Velocity #############\n");
144- printf("\n");
137+ *terminal << wxT("\n");
138+ if (color_scale == 1) *terminal << wxT(" ## Color Scale as Input Quantity (Real) #############\n");
139+ else if (color_scale == 2) *terminal << wxT(" ## Color Scale as Input Quantity (Complex) #############\n");
140+ else if (color_scale == 3) *terminal << wxT(" ## Color Scale as Fermi Velocity #############\n");
141+ else if (color_scale == 4) *terminal << wxT(" ## Color Scale as Band Index #############\n");
142+ else if (color_scale == 5) *terminal << wxT(" ## Gray Scale as Input Quantity (Real) #############\n");
143+ else if (color_scale == 6) *terminal << wxT(" ## Gray Scale as Fermi Velocity #############\n");
144+ *terminal << wxT("\n");
145145 /*
146146 Search max and min.
147147 */
@@ -273,14 +273,14 @@ shared(nb,ntri,nmlp,max_th,min_th) private(itri,ithread)
273273
274274 if (color_scale == 1 || color_scale == 4
275275 || color_scale == 6 || color_scale == 7) {
276- printf(" Min. and Max. value : %f %f\n", patch_min[0], patch_max[0]);
276+ *terminal << wxString::Format(wxT(" Min. and Max. value : %f %f\n"), patch_min[0], patch_max[0]);
277277 }
278278 else if (color_scale == 2) {
279- printf(" Max. absolute value : %f\n", patch_max[0]);
279+ *terminal << wxString::Format(wxT(" Max. absolute value : %f\n"), patch_max[0]);
280280 }
281281 else if (color_scale == 3) {
282282 for (itri = 0; itri < 3; ++itri) {
283- printf(" Min. and Max. value for axis %d : %f %f\n",
283+ *terminal << wxString::Format(wxT(" Min. and Max. value for axis %d : %f %f\n"),
284284 itri, patch_min[itri], patch_max[itri]);
285285 }
286286 }
--- a/src/initialize.cpp
+++ b/src/initialize.cpp
@@ -229,7 +229,7 @@ void bragg_vector() {
229229 for (ibr = 1; ibr < 26; ibr++) {
230230 if (brnrm_min > brnrm[ibr]) brnrm_min = brnrm[ibr];
231231 }
232- printf(" Minimum Bragg norm : %f\n", brnrm_min);
232+ *terminal << wxString::Format(wxT(" Minimum Bragg norm : %f\n"), brnrm_min);
233233 }/* bragg_vector */
234234 /**
235235 @brief Print max and minimum @f$\varepsilon_{n k}, \Delta_{n k}@f$
@@ -239,10 +239,10 @@ void max_and_min_bz() {
239239 int ib, i0, i1, i2;
240240 GLfloat eigmin, eigmax, matmin, matmax;
241241 /**/
242- printf("\n");
243- printf(" ## Max. and Min. of each bands #######################\n");
244- printf("\n");
245- printf(" Band Eig_Min. Eig_Max Mat_Min Mat_Max\n");
242+ *terminal << wxT("\n");
243+ *terminal << wxT(" ## Max. and Min. of each bands #######################\n");
244+ *terminal << wxT("\n");
245+ *terminal << wxT(" Band Eig_Min. Eig_Max Mat_Min Mat_Max\n");
246246 for (ib = 0; ib < nb; ib++) {
247247 eigmax = eig0[0][0][0][0];
248248 eigmin = eig0[0][0][0][0];
@@ -258,6 +258,7 @@ void max_and_min_bz() {
258258 }/*for (i2 = 0; i2 < ng0[2]; ++i2)*/
259259 }/*for (i1 = 0; i1 < ng0[1]; ++i1)*/
260260 }/*for (i0 = 0; i0 < ng0[0]; ++i0)*/
261- printf(" %d %f %f %f %f\n", ib + 1, eigmin, eigmax, matmin, matmax);
261+ *terminal << wxString::Format(wxT(" %d %f %f %f %f\n"),
262+ ib + 1, eigmin, eigmax, matmin, matmax);
262263 }/*for (ib = 0; ib < nb; ib++)*/
263264 }/* max_and_min_bz */
--- a/src/kumo.cpp
+++ b/src/kumo.cpp
@@ -65,7 +65,7 @@ static void kumo_coef(
6565 void interpol_energy() {
6666 int ib, i0, i1, i2, ii;
6767
68- printf(" Interpolating ... ");
68+ *terminal << wxT(" Interpolating ... ");
6969 /*
7070 Reallocate
7171 */
@@ -224,5 +224,5 @@ void interpol_energy() {
224224 }/*for (i0 = 0; i0 < ng[0]; i0++)*/
225225 }/*for (ib = 0; ib < nb; ib++)*/
226226 }/*End of parallel region*/
227- printf("Done\n\n");
227+ *terminal << wxT("Done\n\n");
228228 }/*void interpol_energy() */
--- a/src/menu.cpp
+++ b/src/menu.cpp
@@ -589,6 +589,7 @@ MyFrame::MyFrame(wxFrame* frame, const wxString& title, const wxPoint& pos,
589589 Bind(wxEVT_COMMAND_MENU_SELECTED, &MyFrame::menu_background, this, menu_background_radio2);
590590 imenu_background->AppendRadioItem(menu_background_radio2, wxT("White"));
591591
592+ nb = 10;// debug
592593 wxMenu* imenu_band = new wxMenu;
593594 for (ib = 0; ib < nb; ib++) {
594595 Bind(wxEVT_COMMAND_MENU_SELECTED, &MyFrame::menu_band, this, menu_band_check + ib);
@@ -719,6 +720,23 @@ MyFrame::MyFrame(wxFrame* frame, const wxString& title, const wxPoint& pos,
719720
720721 m_canvas = new TestGLCanvas(this, wxID_ANY, gl_attrib);
721722
723+ wxBoxSizer* insizer = new wxBoxSizer(wxVERTICAL);
724+ insizer->Add(m_canvas, 1, wxEXPAND, 1);
725+
726+ terminal = new wxTextCtrl(this, wxID_ANY, wxT(""),
727+ wxPoint(0, 250), wxSize(100, 50), wxTE_MULTILINE);
728+ insizer->Add(terminal, 1, wxEXPAND, 1);
729+
730+ wxBoxSizer* outsizer = new wxBoxSizer(wxHORIZONTAL);
731+ outsizer->Add(insizer, 1, wxEXPAND, 1);
732+
733+ wxPanel* panel = new wxPanel(this);
734+ wxButton* select_two = new wxButton(panel, menu_nodeline_check, wxT("Select #&2"));
735+
736+ outsizer->Add(panel, 1, wxEXPAND, 1);
737+ SetSizer(outsizer);
738+ SetAutoLayout(true);
739+
722740 // Show the frame
723741 Show(true);
724742 Raise();
--- a/src/read_file.cpp
+++ b/src/read_file.cpp
@@ -54,41 +54,42 @@ int read_file()
5454 /*
5555 Open input file.
5656 */
57- printf(" Openning %s ...\n", frmsf_file_name.mb_str());
57+ *terminal << wxT(" Openning ") << frmsf_file_name << wxT(" ...\n");
5858 if ((fp = fopen(frmsf_file_name.mb_str(), "r")) == NULL) {
59- printf("file open error!!\n");
60- printf(" Press any key to exit.\n");
59+ *terminal << wxT("file open error!!\n");
60+ *terminal << wxT(" Press any key to exit.\n");
6161 ierr = getchar();
6262 exit(EXIT_FAILURE);
6363 }
64- printf("\n");
65- printf(" ## Brillouin zone informations ###########\n");
66- printf("\n");
64+ *terminal << wxT("\n");
65+ *terminal << wxT(" ## Brillouin zone informations ###########\n");
66+ *terminal << wxT("\n");
6767 /*
6868 k-point grid
6969 */
7070 ctemp1 = fgets(ctemp2, 256, fp);
7171 ierr = sscanf(ctemp2, "%d%d%d", &ng0[0], &ng0[1], &ng0[2]);
7272
73- if (ierr == 0) printf("error ! reading ng");
74- printf(" k point grid : %d %d %d \n", ng0[0], ng0[1], ng0[2]);
73+ if (ierr == 0) *terminal << wxT("error ! reading ng\n");
74+ *terminal << wxString::Format(wxT(" k point grid : %d %d %d\n"),
75+ ng0[0], ng0[1], ng0[2]);
7576 for (i = 0; i < 3; i++) ng[i] = ng0[i];
7677 /*
7778 Shift of k-point grid
7879 */
7980 ierr = fscanf(fp, "%d", &lshift);
80- if (ierr == 0) printf("error ! reading lshift");
81+ if (ierr == 0) *terminal << wxT("error ! reading lshift\n");
8182
8283 if (lshift == 0) {
83- printf(" k point grid is the Monkhorst-Pack grid. \n");
84+ *terminal << wxT(" k point grid is the Monkhorst-Pack grid.\n");
8485 for (i = 0; i < 3; i++) shiftk[i] = (ng0[i] + 1) % 2;
8586 }
8687 else if (lshift == 1) {
87- printf(" k point grid starts from Gamma. \n");
88+ *terminal << wxT(" k point grid starts from Gamma.\n");
8889 for (i = 0; i < 3; i++) shiftk[i] = 0;
8990 }
9091 else if (lshift == 2) {
91- printf(" k point grid starts from Gamma + a half grid. \n");
92+ *terminal << wxT(" k point grid starts from Gamma + a half grid.\n");
9293 for (i = 0; i < 3; i++) shiftk[i] = 1;
9394 }
9495 else {
@@ -98,8 +99,8 @@ int read_file()
9899 # of bands
99100 */
100101 ierr = fscanf(fp, "%d", &nb);
101- if (ierr == 0) printf("error ! reading nb");
102- printf(" # of bands : %d\n", nb);
102+ if (ierr == 0) *terminal << wxT("error ! reading nb\n");
103+ *terminal << wxString::Format(wxT(" # of bands : %d\n"), nb);
103104 ntri = new int[nb];
104105 ntri_th = new int*[nb];
105106 for (ib = 0; ib < nb; ib++) ntri_th[ib] = new int[nthreads];
@@ -113,8 +114,8 @@ int read_file()
113114 */
114115 for (i = 0; i < 3; ++i) {
115116 ierr = fscanf(fp, "%e%e%e", &bvec[i][0], &bvec[i][1], &bvec[i][2]);
116- if (ierr == 0) printf("error ! reading bvec");
117- printf(" bvec %d : %f %f %f \n", i + 1, bvec[i][0], bvec[i][1], bvec[i][2]);
117+ if (ierr == 0) *terminal << wxT("error ! reading bvec\n");
118+ *terminal << wxString::Format(wxT(" bvec %d : %f %f %f \n"), i + 1, bvec[i][0], bvec[i][1], bvec[i][2]);
118119 }/*for (i = 0; i < 3; ++i)*/
119120 scl /= sqrtf(bvec[0][0] * bvec[0][0] + bvec[0][1] * bvec[0][1] + bvec[0][2] * bvec[0][2]);
120121 linewidth /= scl;
@@ -125,7 +126,8 @@ int read_file()
125126 for (j = 0; j < 3; ++j) avec[i][j] = 0.0f;
126127 avec[i][i] = 1.0f;
127128 solve3(bvec, avec[i]);
128- printf(" avec %d : %f %f %f \n", i + 1, avec[i][0], avec[i][1], avec[i][2]);
129+ *terminal << wxString::Format(wxT(" avec %d : %f %f %f \n"),
130+ i + 1, avec[i][0], avec[i][1], avec[i][2]);
129131 }/*for (i = 0; i < 3; ++i)*/
130132 for (i = 0; i < 3; ++i) {
131133 secvec[i] = bvec[2][i];
--- a/src/section.cpp
+++ b/src/section.cpp
@@ -357,9 +357,9 @@ void calc_section() {
357357 }
358358 ntri_th[ib][0] = 0;
359359 }
360- printf(" band # of Fermi-line\n");
360+ *terminal << wxT(" band # of Fermi-line\n");
361361 for (ib = 0; ib < nb; ib++) {
362- printf(" %d %d\n", ib + 1, n2d[ib]);
362+ *terminal << wxString::Format(wxT(" %d %d\n"), ib + 1, n2d[ib]);
363363 }
364364 /*
365365 Allocation of Fermi-lines
--- a/src/variable.hpp
+++ b/src/variable.hpp
@@ -172,4 +172,6 @@ extern wxString batch_name;
172172 extern wxString frmsf_file_name;
173173 extern int lbatch;
174174
175+extern wxTextCtrl* terminal;
176+
175177 #endif
Show on old repository browser