@@ -335,6 +335,19 @@ def add_field(
335335 )
336336
337337 def add_streamlines (self , meshed_region , field , radius = 1.0 , ** kwargs ):
338+ import time
339+ t0 = time .time ()
340+
341+ text_time = "Time report \n "
342+ text_time += "=============== \n "
343+
344+ text_time += "\n ------------- \n "
345+ text_time += "MeshedRegion statistics \n "
346+ text_time += "------------- \n "
347+
348+ text_time += str (meshed_region )
349+
350+
338351 # Check velocity field location
339352 if field .location is not dpf .core .locations .nodal :
340353 warnings .warn ("Velocity field must have a nodal location. "
@@ -356,12 +369,21 @@ def add_streamlines(self, meshed_region, field, radius=1.0, **kwargs):
356369 # check src request
357370 return_source = kwargs .pop ("return_source" , None )
358371
372+ text_time += "\n ------------- \n "
373+ text_time += "Grid statistics \n "
374+ text_time += "------------- \n "
375+ text_time += str (grid )
376+
359377 # filter kwargs
360378 kwargs_base = _sort_supported_kwargs (bound_method = grid .streamlines , ** kwargs )
361379 kwargs_from_source = _sort_supported_kwargs (bound_method = grid .streamlines_from_source , ** kwargs )
362380 kwargs_from_source .update (kwargs_base ) # merge both dicts in kwargs_from_source
363381
364382 # create streamlines
383+ text_time += "\n ------------- \n "
384+ text_time += "Streamlines creation duration \n "
385+ text_time += "------------- \n "
386+ prev_time = time .time ()
365387 if return_source :
366388 streamlines , src = grid .streamlines (
367389 vectors = f"{ stream_name } " ,
@@ -373,12 +395,25 @@ def add_streamlines(self, meshed_region, field, radius=1.0, **kwargs):
373395 vectors = f"{ stream_name } " ,
374396 ** kwargs_from_source ,
375397 )
398+ text_time += str (time .time () - prev_time ) + " s \n "
399+
400+ text_time += "\n ------------- \n "
401+ text_time += "Streamline statistics \n "
402+ text_time += "------------- \n "
403+ text_time += str (streamlines )
404+
376405
377406 # set streamline on plotter
378407 sargs = dict (vertical = False )
379408 self ._plotter .add_mesh (streamlines .tube (radius = radius ), scalar_bar_args = sargs )
380409 if return_source :
381410 self ._plotter .add_mesh (src )
411+ text_time += "\n ------------- \n "
412+ text_time += "add_streamline total duration \n "
413+ text_time += "------------- \n "
414+ text_time += str (time .time () - t0 ) + " s \n "
415+
416+ print (text_time )
382417
383418 def show_figure (self , ** kwargs ):
384419
0 commit comments