@@ -95,7 +95,7 @@ def __init__(self):
95
95
self .triangulation_region_dict = None
96
96
# Other
97
97
GUIStatics .CANVAS_SCALE_FACTOR = 100
98
- self .elemcounter = 0 # Callbackvariable for parsing elements calculated from class CalcFEM to class GUI
98
+ self .calc_info = { 'step' : None , 'n' : None , 'other' : None } # Callbackvariable for parsing elements calculated from class CalcFEM to class GUI
99
99
100
100
# some output for user
101
101
self .text_information_str = ''
@@ -267,7 +267,7 @@ def thread_create_mesh():
267
267
try :
268
268
mesh = CreateMesh (self .region_parameters , self .boundary_parameters ,
269
269
self .node_parameters , self .calculation_parameters )
270
- mesh_generator_output = mesh .create_mesh ()
270
+ mesh_generator_output = mesh .create_mesh (callback = self . callback_calc )
271
271
self .nodes_mesh_gen = mesh_generator_output [0 ]
272
272
self .single_nodes_dict = mesh_generator_output [1 ]
273
273
self .boundary_nodes_dict = mesh_generator_output [2 ]
@@ -280,15 +280,15 @@ def thread_create_mesh():
280
280
281
281
window_create_mesh_wait = tk .Toplevel (self )
282
282
window_create_mesh_wait .title ('CREATING MESH' )
283
- window_create_mesh_wait .geometry (f"{ 200 } x{ 150 } " )
283
+ window_create_mesh_wait .geometry (f"{ 300 } x{ 150 } " )
284
284
window_create_mesh_wait .resizable (False , False )
285
285
icon_image = ImageTk .PhotoImage (data = GUIStatics .return_icon_bytestring ())
286
286
window_create_mesh_wait .tk .call ('wm' , 'iconphoto' , window_create_mesh_wait ._w , icon_image )
287
- tk .Label (window_create_mesh_wait , text = "Creating Mesh...\n Please Wait" ,
287
+ tk .Label (window_create_mesh_wait , text = "Creating Mesh...Please Wait" ,
288
288
font = GUIStatics .STANDARD_FONT_MID_BOLD ).place (relx = 0.15 , rely = 0.1 )
289
289
window_create_mesh_wait_label = tk .Label (window_create_mesh_wait , text = "" ,
290
- font = GUIStatics .STANDARD_FONT_MID_BOLD )
291
- window_create_mesh_wait_label .place (relx = 0.35 , rely = 0.6 )
290
+ font = GUIStatics .STANDARD_FONT_SMALL_BOLD , anchor = "sw" , justify = "left" )
291
+ window_create_mesh_wait_label .place (relx = 0.05 , rely = 0.3 )
292
292
thread_mesh = threading .Thread (target = thread_create_mesh )
293
293
thread_mesh .start ()
294
294
@@ -301,11 +301,11 @@ def update_wait_label():
301
301
"""
302
302
wait_text = ''
303
303
while thread_mesh .is_alive ():
304
- if wait_text == '.....' :
305
- wait_text = ''
306
- wait_text += '.'
304
+ wait_text = ( f"Current Step: \n "
305
+ f" { self . calc_info [ 'step' ] } \n "
306
+ f" { self . calc_info [ 'n' ] } { self . calc_info [ 'other' ] } " )
307
307
window_create_mesh_wait_label .config (text = wait_text )
308
- time .sleep (0.5 )
308
+ time .sleep (0.05 )
309
309
window_create_mesh_wait .destroy ()
310
310
311
311
update_thread = threading .Thread (target = update_wait_label )
@@ -349,7 +349,7 @@ def thread_solve_system():
349
349
self .calculation_parameters )
350
350
try :
351
351
calcfem = CalcFEM (params_mesh , params_boundaries_materials )
352
- self .solution = calcfem .calc_fem (callback = self .callback_calcfem )
352
+ self .solution = calcfem .calc_fem (callback = self .callback_calc )
353
353
except np .linalg .LinAlgError :
354
354
err_message = ('Singular Matrix encountered!\n '
355
355
'Check Boundary Conditions \n '
@@ -381,15 +381,15 @@ def thread_solve_system():
381
381
382
382
window_solve_system_wait = tk .Toplevel (self )
383
383
window_solve_system_wait .title ('SOLVING' )
384
- window_solve_system_wait .geometry (f"{ 200 } x{ 150 } " )
384
+ window_solve_system_wait .geometry (f"{ 300 } x{ 150 } " )
385
385
window_solve_system_wait .resizable (False , False )
386
386
icon_image = ImageTk .PhotoImage (data = GUIStatics .return_icon_bytestring ())
387
387
window_solve_system_wait .tk .call ('wm' , 'iconphoto' , window_solve_system_wait ._w , icon_image )
388
- tk .Label (window_solve_system_wait , text = "Solving System...\n Please Wait" ,
389
- font = GUIStatics .STANDARD_FONT_MID_BOLD ).place (relx = 0.15 , rely = 0.1 )
388
+ tk .Label (window_solve_system_wait , text = "Solving System...Please Wait" ,
389
+ font = GUIStatics .STANDARD_FONT_MID_BOLD , ).place (relx = 0.15 , rely = 0.1 )
390
390
window_solve_system_wait_label = tk .Label (window_solve_system_wait , text = "" ,
391
- font = GUIStatics .STANDARD_FONT_MID_BOLD )
392
- window_solve_system_wait_label .place (relx = 0.35 , rely = 0.6 )
391
+ font = GUIStatics .STANDARD_FONT_SMALL_BOLD , anchor = "sw" , justify = "left" )
392
+ window_solve_system_wait_label .place (relx = 0.05 , rely = 0.3 )
393
393
thread_mesh = threading .Thread (target = thread_solve_system )
394
394
thread_mesh .start ()
395
395
@@ -400,12 +400,12 @@ def update_wait_label():
400
400
"""
401
401
wait_text = ''
402
402
while thread_mesh .is_alive ():
403
- if wait_text == '.....' :
404
- wait_text = ''
405
- #wait_text += '.'
406
- wait_text = f"Element: { self . elemcounter } / { len ( self . triangulation ) } "
403
+ wait_text = ( f"Current Step: \n "
404
+ f" { self . calc_info [ 'step' ] } \n "
405
+ f" { self . calc_info [ 'n' ] } { self . calc_info [ 'other' ] } " )
406
+
407
407
window_solve_system_wait_label .config (text = wait_text )
408
- time .sleep (0.1 )
408
+ time .sleep (0.05 )
409
409
window_solve_system_wait .destroy ()
410
410
411
411
update_thread = threading .Thread (target = update_wait_label )
@@ -1244,11 +1244,11 @@ def accept_bcs():
1244
1244
width = 12 , height = 1 , font = GUIStatics .STANDARD_FONT_BUTTON_MID_BOLD )
1245
1245
button_accept .place (relx = widgets_x_start + 0.05 , rely = 0.895 )
1246
1246
1247
- def callback_calcfem (self , calc_info ):
1247
+ def callback_calc (self , calc_info ):
1248
1248
"""
1249
1249
callback for parsing calculation e.g. element matrices to GUI
1250
1250
"""
1251
- print ( f"Current Step: { calc_info [ 'step' ] } { calc_info [ 'n' ] } { calc_info [ 'other' ] } " , end = ' \r ' )
1251
+ self . calc_info = calc_info
1252
1252
1253
1253
def create_BC_params (self ):
1254
1254
"""
0 commit comments