wolfhece 2.1.100__py3-none-any.whl → 2.1.101__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wolfhece/PyDraw.py +200 -16
- wolfhece/PyGui.py +1039 -53
- wolfhece/Results2DGPU.py +37 -13
- wolfhece/acceptability/func.py +43 -32
- wolfhece/apps/version.py +1 -1
- wolfhece/bernoulli/losses.py +3 -3
- wolfhece/gpuview.py +4 -1
- wolfhece/libs/__init__.py +11 -10
- wolfhece/libs/wolfogl.cp310-win_amd64.pyd +0 -0
- wolfhece/math_parser/calculator.py +5 -4
- wolfhece/mesh2d/bc_manager.py +25 -2
- wolfhece/mesh2d/gpu_2d.py +644 -0
- wolfhece/mesh2d/simple_2d.py +581 -163
- wolfhece/mesh2d/wolf2dprev.py +4 -1
- wolfhece/scenario/config_manager.py +97 -20
- wolfhece/wolf_array.py +235 -73
- wolfhece/wolfresults_2D.py +53 -20
- {wolfhece-2.1.100.dist-info → wolfhece-2.1.101.dist-info}/METADATA +3 -1
- {wolfhece-2.1.100.dist-info → wolfhece-2.1.101.dist-info}/RECORD +22 -21
- {wolfhece-2.1.100.dist-info → wolfhece-2.1.101.dist-info}/WHEEL +1 -1
- {wolfhece-2.1.100.dist-info → wolfhece-2.1.101.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.1.100.dist-info → wolfhece-2.1.101.dist-info}/top_level.txt +0 -0
wolfhece/PyDraw.py
CHANGED
@@ -262,7 +262,7 @@ class Memory_Views_GUI(wx.Frame):
|
|
262
262
|
def __init__(self, parent, title, memory_views:Memory_Views, mapviewer:"WolfMapViewer"):
|
263
263
|
""" Constructor """
|
264
264
|
|
265
|
-
super(Memory_Views_GUI, self).__init__(parent, title=title, size=(200, 400), style = wx.DEFAULT_FRAME_STYLE & ~ (wx.RESIZE_BORDER | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX
|
265
|
+
super(Memory_Views_GUI, self).__init__(parent, title=title, size=(200, 400), style = wx.DEFAULT_FRAME_STYLE & ~ (wx.RESIZE_BORDER | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX))
|
266
266
|
self.mapviewer = mapviewer
|
267
267
|
self._memory_views = memory_views
|
268
268
|
|
@@ -1241,6 +1241,7 @@ class WolfMapViewer(wx.Frame):
|
|
1241
1241
|
self.menuwalous = None
|
1242
1242
|
self.timer_ps = None
|
1243
1243
|
self.menusim2D = None
|
1244
|
+
self.menusim2D_GPU = None
|
1244
1245
|
self.menulaz = None
|
1245
1246
|
self.menutiles = None
|
1246
1247
|
|
@@ -1267,14 +1268,31 @@ class WolfMapViewer(wx.Frame):
|
|
1267
1268
|
|
1268
1269
|
# SIMULATION 2D
|
1269
1270
|
|
1270
|
-
|
1271
|
-
|
1271
|
+
self.menu_sim2d = wx.Menu()
|
1272
|
+
self.menu_sim2d_cpu = wx.Menu()
|
1273
|
+
self.menu_sim2d_gpu = wx.Menu()
|
1274
|
+
self.menu_sim1d = wx.Menu()
|
1275
|
+
|
1276
|
+
sim2d = self.menu_sim2d_cpu.Append(wx.ID_ANY, _('Create/Open multiblock model'), _('Create or open a multiblock model in the viewer --> CPU/Fortran Wolf2D model'))
|
1277
|
+
check2D = self.menu_sim2d_cpu.Append(wx.ID_ANY, _('Check headers'), _('Check the header .txt files from an existing 2D CPU simulation'))
|
1278
|
+
|
1279
|
+
sim2dgpu = self.menu_sim2d_gpu.Append(wx.ID_ANY, _('Create/Open GPU model'), _('Create or open a GPU model in the viewer --> GPU Wolf2D model'))
|
1280
|
+
|
1281
|
+
create1Dmodel = self.menu_sim1d.Append(wx.ID_ANY, _('Create Wolf1D...'),('Create a 1D model using crossections, vectors and arrays...'))
|
1272
1282
|
|
1273
|
-
|
1283
|
+
|
1284
|
+
self.menu_sim2d.Append(wx.ID_ANY,_('2D GPU'),self.menu_sim2d_gpu)
|
1285
|
+
self.menu_sim2d.Append(wx.ID_ANY,_('2D CPU'),self.menu_sim2d_cpu)
|
1286
|
+
self.filemenu.Append(wx.ID_ANY,_('2D Model'),self.menu_sim2d)
|
1287
|
+
self.filemenu.Append(wx.ID_ANY,_('1D Model'),self.menu_sim1d)
|
1288
|
+
|
1289
|
+
# self.filemenu.AppendSeparator()
|
1274
1290
|
|
1275
1291
|
# SIMULATION Hydrologique
|
1276
1292
|
|
1277
|
-
|
1293
|
+
self.menu_hydrology = wx.Menu()
|
1294
|
+
hydrol = self.menu_hydrology.Append(wx.ID_ANY, _('Open Hydrological model'), _('Hydrological simulation'))
|
1295
|
+
self.filemenu.Append(wx.ID_ANY,_('Hydrology'),self.menu_hydrology)
|
1278
1296
|
|
1279
1297
|
self.filemenu.AppendSeparator()
|
1280
1298
|
|
@@ -1302,7 +1320,6 @@ class WolfMapViewer(wx.Frame):
|
|
1302
1320
|
createscenario2D = self.menucreateobj.Append(wx.ID_ANY, _('Create scenarios manager ...'), _('New scenarios manager 2D'))
|
1303
1321
|
createbcmanager2D = self.menucreateobj.Append(wx.ID_ANY, _('Create BC manager Wolf2D...'), _('New BC manager 2D'))
|
1304
1322
|
createpartsystem = self.menucreateobj.Append(wx.ID_ANY, _('Create particle system...'), _('Create a particle system - Lagrangian view'))
|
1305
|
-
create1Dmodel = self.menucreateobj.Append(wx.ID_ANY, _('Create Wolf1D...'),('Create a 1D model using crossections, vectors and arrays...'))
|
1306
1323
|
create_acceptability = self.menucreateobj.Append(wx.ID_ANY, _('Create acceptability manager...'), _('Create acceptability manager'))
|
1307
1324
|
|
1308
1325
|
self.filemenu.AppendSeparator()
|
@@ -1395,10 +1412,19 @@ class WolfMapViewer(wx.Frame):
|
|
1395
1412
|
_("Apply mask from sim2D"))
|
1396
1413
|
filterinund = self.analyzemenu.Append(wx.ID_ANY, _("Filter inundation arrays..."),
|
1397
1414
|
_("Filter arrays"))
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1415
|
+
# Plot hydrographs
|
1416
|
+
self.menuHydrographs = wx.Menu()
|
1417
|
+
self.analyzemenu.Append(wx.ID_ANY,_('Integrate Q...'),self.menuHydrographs)
|
1418
|
+
plotqvect = self.menuHydrographs.Append(wx.ID_ANY, _("Plot integrated Q along active vector..."),
|
1419
|
+
_("Integrate Q along the active vector and plot"))
|
1420
|
+
plotqvect = self.menuHydrographs.Append(wx.ID_ANY, _("Plot integrated Q along active zone..."),
|
1421
|
+
_("Integrate Q along the active zone and plot"))
|
1422
|
+
self.menuHydrographs.AppendSeparator()
|
1423
|
+
exportqvect = self.menuHydrographs.Append(wx.ID_ANY, _("Export integrated Q along active vector..."),
|
1424
|
+
_("Integrate Q along the active vector and export"))
|
1425
|
+
exportqvect = self.menuHydrographs.Append(wx.ID_ANY, _("Export integrated Q along all vectors in active zone..."),
|
1426
|
+
_("Integrate Q along ALL VECTORS of the active zone and export"))
|
1427
|
+
|
1402
1428
|
plothselect = self.analyzemenu.Append(wx.ID_ANY, _("Plot stats unknown (selected nodes)..."),
|
1403
1429
|
_("Compute stats and plot on the selected nodes"))
|
1404
1430
|
plothvector = self.analyzemenu.Append(wx.ID_ANY, _("Plot stats unknown (inside active vector)..."),
|
@@ -1634,6 +1660,13 @@ class WolfMapViewer(wx.Frame):
|
|
1634
1660
|
|
1635
1661
|
newview = Wolf2DModel(splash = False)
|
1636
1662
|
|
1663
|
+
def create_2D_GPU_model(self):
|
1664
|
+
""" Create a 2D GPU model """
|
1665
|
+
|
1666
|
+
from .PyGui import Wolf2DGPUModel
|
1667
|
+
|
1668
|
+
newview = Wolf2DGPUModel(splash = False)
|
1669
|
+
|
1637
1670
|
def check_2D_MB_headers(self):
|
1638
1671
|
""" Check headers of a 2D simulation without opening viewer"""
|
1639
1672
|
|
@@ -2707,8 +2740,41 @@ class WolfMapViewer(wx.Frame):
|
|
2707
2740
|
|
2708
2741
|
self.menusim2D.Bind(wx.EVT_MENU, self.Onmenusim2D)
|
2709
2742
|
|
2743
|
+
def menu_sim2DGPU(self):
|
2744
|
+
""" Menu for 2D GPU simulations """
|
2745
|
+
|
2746
|
+
if self.menusim2D_GPU is None:
|
2747
|
+
self.menusim2D_GPU = wx.Menu()
|
2748
|
+
self.menubar.Append(self.menusim2D_GPU, _('Tools 2D GPU'))
|
2749
|
+
|
2750
|
+
menu2dGPU_options = self.menusim2D_GPU.Append(wx.ID_ANY, _("Parameters..."), _("Parameters"))
|
2751
|
+
|
2752
|
+
self.menusim2D_GPU.Bind(wx.EVT_MENU, self.Onmenusim2DGPU)
|
2753
|
+
|
2754
|
+
def Onmenusim2DGPU(self, event: wx.MenuEvent):
|
2755
|
+
""" Action to perform when menu 2D GPU entry is selected """
|
2756
|
+
|
2757
|
+
id = event.GetId()
|
2758
|
+
item = self.menubar.FindItemById(event.GetId())
|
2759
|
+
|
2760
|
+
if item is None:
|
2761
|
+
return
|
2762
|
+
|
2763
|
+
itemlabel = item.ItemLabel
|
2764
|
+
|
2765
|
+
from .PyGui import Wolf2DGPUModel
|
2766
|
+
|
2767
|
+
if not isinstance(self.wolfparent, Wolf2DGPUModel):
|
2768
|
+
logging.error(_('This is not a 2D GPUmodel'))
|
2769
|
+
return
|
2770
|
+
|
2771
|
+
self.wolfparent:Wolf2DGPUModel
|
2772
|
+
|
2773
|
+
if itemlabel == _("Parameters..."):
|
2774
|
+
self.wolfparent.show_properties()
|
2775
|
+
|
2710
2776
|
def Onmenusim2D(self, event: wx.MenuEvent):
|
2711
|
-
""" Action to perform
|
2777
|
+
""" Action to perform when menu 2D entry is selected """
|
2712
2778
|
|
2713
2779
|
id = event.GetId()
|
2714
2780
|
item = self.menubar.FindItemById(event.GetId())
|
@@ -5648,7 +5714,7 @@ class WolfMapViewer(wx.Frame):
|
|
5648
5714
|
self.check_for_updates()
|
5649
5715
|
autoscale = False
|
5650
5716
|
|
5651
|
-
elif itemlabel == _("
|
5717
|
+
elif itemlabel == _("Plot integrated Q along active vector..."):
|
5652
5718
|
""" Integrate Q along active vector """
|
5653
5719
|
autoscale = False
|
5654
5720
|
|
@@ -5662,7 +5728,7 @@ class WolfMapViewer(wx.Frame):
|
|
5662
5728
|
|
5663
5729
|
self.active_res2d.plot_q(self.active_vector, 'border', toshow=True)
|
5664
5730
|
|
5665
|
-
elif itemlabel == _("
|
5731
|
+
elif itemlabel == _("Plot integrated Q along active zone..."):
|
5666
5732
|
""" Integrate Q along active zone """
|
5667
5733
|
autoscale = False
|
5668
5734
|
|
@@ -5676,6 +5742,116 @@ class WolfMapViewer(wx.Frame):
|
|
5676
5742
|
|
5677
5743
|
self.active_res2d.plot_q(self.active_zone.myvectors, ['border'] * self.active_zone.nbvectors, toshow=True)
|
5678
5744
|
|
5745
|
+
elif itemlabel == _("Export integrated Q along active vector..."):
|
5746
|
+
autoscale = False
|
5747
|
+
|
5748
|
+
if self.active_vector is None:
|
5749
|
+
logging.warning(_('No active vector !'))
|
5750
|
+
return
|
5751
|
+
|
5752
|
+
if self.active_res2d is None:
|
5753
|
+
logging.warning(_('No active 2D result !'))
|
5754
|
+
return
|
5755
|
+
|
5756
|
+
filterArray = ".csv (*.csv)|*.csv|all (*.*)|*.*"
|
5757
|
+
fdlg = wx.FileDialog(self, "Choose file name : ", wildcard=filterArray,
|
5758
|
+
style=wx.FD_SAVE)
|
5759
|
+
ret = fdlg.ShowModal()
|
5760
|
+
hydrographCSVPath = None
|
5761
|
+
if ret == wx.ID_OK:
|
5762
|
+
curfil = fdlg.GetFilterIndex()
|
5763
|
+
|
5764
|
+
hydrographCSVPath = fdlg.GetPath()
|
5765
|
+
|
5766
|
+
fdlg.Destroy()
|
5767
|
+
|
5768
|
+
if hydrographCSVPath is not None:
|
5769
|
+
# Create a progress dialog
|
5770
|
+
progress_dialog = wx.ProgressDialog(
|
5771
|
+
_("Export Progress"),
|
5772
|
+
_("Exporting hydrographs..."),
|
5773
|
+
maximum=100,
|
5774
|
+
parent=self,
|
5775
|
+
style= wx.PD_AUTO_HIDE | wx.PD_APP_MODAL | wx.PD_ELAPSED_TIME
|
5776
|
+
)
|
5777
|
+
|
5778
|
+
def update_progress(progress):
|
5779
|
+
progress_dialog.Update(progress)
|
5780
|
+
|
5781
|
+
try:
|
5782
|
+
# Call the export function, passing the progress callback
|
5783
|
+
status = self.active_res2d.export_hydrographs(
|
5784
|
+
vect=self.active_vector,
|
5785
|
+
filename=hydrographCSVPath,
|
5786
|
+
progress_callback=update_progress
|
5787
|
+
)
|
5788
|
+
finally:
|
5789
|
+
progress_dialog.Destroy() # Ensure dialog is destroyed even if an error occurs
|
5790
|
+
|
5791
|
+
# Inform the user about the result
|
5792
|
+
if status:
|
5793
|
+
wx.MessageBox(_("Hydrographs exported successfully"), _("Export Hydrographs"), wx.OK | wx.ICON_INFORMATION)
|
5794
|
+
logging.info(_('Hydrographs exported successfully'))
|
5795
|
+
else:
|
5796
|
+
wx.MessageBox(_("Error exporting hydrographs"), _("Export Hydrographs"), wx.OK | wx.ICON_ERROR)
|
5797
|
+
logging.error(_('Error exporting hydrographs'))
|
5798
|
+
|
5799
|
+
|
5800
|
+
elif itemlabel == _("Export integrated Q along all vectors in active zone..."):
|
5801
|
+
autoscale = False
|
5802
|
+
|
5803
|
+
if self.active_zone is None:
|
5804
|
+
logging.warning(_('No active zone !'))
|
5805
|
+
return
|
5806
|
+
|
5807
|
+
if self.active_res2d is None:
|
5808
|
+
logging.warning(_('No active 2D result !'))
|
5809
|
+
return
|
5810
|
+
|
5811
|
+
filterArray = ".csv (*.csv)|*.csv|all (*.*)|*.*"
|
5812
|
+
fdlg = wx.FileDialog(self, "Choose file name : ", wildcard=filterArray,
|
5813
|
+
style=wx.FD_SAVE)
|
5814
|
+
ret = fdlg.ShowModal()
|
5815
|
+
hydrographCSVPath = None
|
5816
|
+
if ret == wx.ID_OK:
|
5817
|
+
curfil = fdlg.GetFilterIndex()
|
5818
|
+
|
5819
|
+
hydrographCSVPath = fdlg.GetPath()
|
5820
|
+
|
5821
|
+
fdlg.Destroy()
|
5822
|
+
|
5823
|
+
if hydrographCSVPath is not None:
|
5824
|
+
# Create a progress dialog
|
5825
|
+
progress_dialog = wx.ProgressDialog(
|
5826
|
+
_("Export Progress"),
|
5827
|
+
_("Exporting hydrographs..."),
|
5828
|
+
maximum=100,
|
5829
|
+
parent=self,
|
5830
|
+
style= wx.PD_AUTO_HIDE | wx.PD_APP_MODAL | wx.PD_ELAPSED_TIME
|
5831
|
+
)
|
5832
|
+
|
5833
|
+
def update_progress(progress):
|
5834
|
+
progress_dialog.Update(progress)
|
5835
|
+
|
5836
|
+
try:
|
5837
|
+
# Call the export function, passing the progress callback
|
5838
|
+
status = self.active_res2d.export_hydrographs(
|
5839
|
+
vect=self.active_zone,
|
5840
|
+
filename=hydrographCSVPath,
|
5841
|
+
progress_callback=update_progress
|
5842
|
+
)
|
5843
|
+
finally:
|
5844
|
+
progress_dialog.Destroy() # Ensure dialog is destroyed even if an error occurs
|
5845
|
+
|
5846
|
+
# Inform the user about the result
|
5847
|
+
if status:
|
5848
|
+
wx.MessageBox(_("Hydrographs exported successfully"), _("Export Hydrographs"), wx.OK | wx.ICON_INFORMATION)
|
5849
|
+
logging.info(_('Hydrographs exported successfully'))
|
5850
|
+
else:
|
5851
|
+
wx.MessageBox(_("Error exporting hydrographs"), _("Export Hydrographs"), wx.OK | wx.ICON_ERROR)
|
5852
|
+
logging.error(_('Error exporting hydrographs'))
|
5853
|
+
|
5854
|
+
|
5679
5855
|
elif itemlabel == _("Plot stats unknown (selected nodes)..."):
|
5680
5856
|
autoscale = False
|
5681
5857
|
|
@@ -6301,7 +6477,11 @@ class WolfMapViewer(wx.Frame):
|
|
6301
6477
|
|
6302
6478
|
self.create_2D_MB_model()
|
6303
6479
|
|
6304
|
-
elif itemlabel == _('Open
|
6480
|
+
elif itemlabel == _('Create/Open GPU model'):
|
6481
|
+
|
6482
|
+
self.create_2D_GPU_model()
|
6483
|
+
|
6484
|
+
elif itemlabel == _('Open Hydrological model'):
|
6305
6485
|
|
6306
6486
|
self.open_hydrological_model()
|
6307
6487
|
|
@@ -6649,7 +6829,7 @@ class WolfMapViewer(wx.Frame):
|
|
6649
6829
|
fnpos = dlg.GetPath()
|
6650
6830
|
dlg.Destroy()
|
6651
6831
|
|
6652
|
-
choices = ["matplotlib", "scipy"
|
6832
|
+
choices = ["matplotlib", "scipy"] #, "pyvista"]
|
6653
6833
|
dlg = wx.SingleChoiceDialog(None, _("Pick an interpolation method"), _("Choices"), choices)
|
6654
6834
|
ret = dlg.ShowModal()
|
6655
6835
|
if ret == wx.ID_CANCEL:
|
@@ -8008,7 +8188,11 @@ class WolfMapViewer(wx.Frame):
|
|
8008
8188
|
return [curobj.idx for curobj in self._get_list(drawing_type) if curobj.plotted == checked_state]
|
8009
8189
|
|
8010
8190
|
def get_list_objects(self, drawing_type:draw_type, checked_state:bool=True):
|
8011
|
-
""" Create a list of objects of type draw_type
|
8191
|
+
""" Create a list of objects of type draw_type
|
8192
|
+
|
8193
|
+
:param drawing_type: type of object to search
|
8194
|
+
:param checked_state: if True/False, return only objects that are plotted or not. None return all objects.
|
8195
|
+
"""
|
8012
8196
|
|
8013
8197
|
if checked_state is None:
|
8014
8198
|
return [curobj for curobj in self._get_list(drawing_type)]
|