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/Results2DGPU.py
CHANGED
@@ -622,21 +622,45 @@ class wolfres2DGPU(Wolfresults_2D):
|
|
622
622
|
|
623
623
|
|
624
624
|
self.mapviewer.add_object('vector', newobj = grid_tiles, id = 'Tiles')
|
625
|
-
class Sim_2D_GPU():
|
626
|
-
""" Simulation 2D GPU -- Interface """
|
627
625
|
|
628
|
-
def
|
626
|
+
def set_hqxqy_as_initial_conditions(self, idx:int = None, as_multiblocks:bool = False):
|
627
|
+
"""
|
628
|
+
Set the result as IC
|
629
|
+
|
630
|
+
:param idx : 0-based index
|
631
|
+
"""
|
632
|
+
|
633
|
+
if idx is not None:
|
634
|
+
if idx>=0 and idx<self.get_nbresults():
|
635
|
+
self.read_oneresult(idx)
|
636
|
+
elif idx ==-1:
|
637
|
+
self.read_oneresult(-1) # last one
|
638
|
+
else:
|
639
|
+
logging.error(_('Bad index for initial conditions'))
|
640
|
+
return
|
641
|
+
|
642
|
+
self.set_currentview(views_2D.WATERDEPTH)
|
629
643
|
|
630
|
-
|
631
|
-
from wolfgpu.simple_simulation import SimpleSimulation
|
632
|
-
except:
|
633
|
-
logging.error(_("Unable to import wolfgpu.simple_simulation.SimpleSimulation. Please install wolfgpu package or add a symlink to the wolfgpu package in the wolfhece directory"))
|
644
|
+
hini = self.as_WolfArray()
|
634
645
|
|
635
|
-
self.
|
636
|
-
self.loaded = False
|
646
|
+
self.set_currentview(views_2D.QX)
|
637
647
|
|
638
|
-
|
639
|
-
self.sim = SimpleSimulation.load(self.filename)
|
640
|
-
self.loaded = True
|
648
|
+
qxini = self.as_WolfArray()
|
641
649
|
|
642
|
-
|
650
|
+
self.set_currentview(views_2D.QY)
|
651
|
+
|
652
|
+
qyini = self.as_WolfArray()
|
653
|
+
|
654
|
+
if (hini is not None) and (qxini is not None) and (qyini is not None):
|
655
|
+
|
656
|
+
# hini = hini.as_WolfArray()
|
657
|
+
# qxini = qxini.as_WolfArray()
|
658
|
+
# qyini = qyini.as_WolfArray()
|
659
|
+
|
660
|
+
hini.write_all(self.filename.parent / 'h.npy')
|
661
|
+
qxini.write_all(self.filename.parent / 'qx.npy')
|
662
|
+
qyini.write_all(self.filename.parent / 'qy.npy')
|
663
|
+
|
664
|
+
logging.info(_('Initial conditions saved as Numpy files'))
|
665
|
+
else:
|
666
|
+
logging.error(_('No initial conditions saved'))
|
wolfhece/acceptability/func.py
CHANGED
@@ -51,8 +51,8 @@ class GPU_2D_file_extensions(Enum):
|
|
51
51
|
BIN = '.bin' # WOLF binary file
|
52
52
|
JSON = '.json' # json file
|
53
53
|
TXT = '.txt' # hydrographs
|
54
|
-
|
55
|
-
|
54
|
+
|
55
|
+
|
56
56
|
class Vulnerability_csv():
|
57
57
|
|
58
58
|
def __init__(self, file:Path) -> None:
|
@@ -241,8 +241,8 @@ class Accept_Manager():
|
|
241
241
|
|
242
242
|
self.TMP_VULN_DIR = self.TMP_STUDYAREA / "VULNERABILITY"
|
243
243
|
self.TMP_SA_SC = self.TMP_VULN_DIR / str(self._scenario)
|
244
|
-
|
245
|
-
|
244
|
+
|
245
|
+
|
246
246
|
self.TMP_RASTERS = self.TMP_VULN_DIR / "RASTERS"
|
247
247
|
self.TMP_RASTERS_CODE = self.TMP_RASTERS / "Code"
|
248
248
|
self.TMP_RASTERS_VULNE = self.TMP_RASTERS / "Vulne"
|
@@ -295,7 +295,7 @@ class Accept_Manager():
|
|
295
295
|
self.IN_SA_INTERP = self.IN_SCEN_DIR / "INTERP_WD"
|
296
296
|
self.IN_SA_EXTRACTED = self.IN_SCEN_DIR / "EXTRACTED_LAST_STEP_WD"
|
297
297
|
self.IN_SA_DEM = self.IN_SCEN_DIR / "DEM_FILES"
|
298
|
-
|
298
|
+
|
299
299
|
self.IN_RM_BUILD_DIR = self.IN_SCEN_DIR / "REMOVED_BUILDINGS"
|
300
300
|
|
301
301
|
self.TMP_SCEN_DIR = self.TMP_VULN_DIR / self.scenario
|
@@ -306,7 +306,7 @@ class Accept_Manager():
|
|
306
306
|
self.TMP_CODE = self.TMP_SCEN_DIR / "Vulnerability_Code.tiff"
|
307
307
|
|
308
308
|
self.OUT_SCEN_DIR = self.OUT_STUDY_AREA / self.scenario
|
309
|
-
|
309
|
+
|
310
310
|
self.OUT_VULN = self.OUT_SCEN_DIR / "Vulnerability.tiff"
|
311
311
|
self.OUT_VULN_VRT = self.OUT_SCEN_DIR / "__vuln_assembly.vrt"
|
312
312
|
self.OUT_VULN_S = self.OUT_SCEN_DIR / "Vulnerability_scenarios" #no .tif because wolf_vrt add it itself (see create_vrtIfExists below)
|
@@ -392,7 +392,7 @@ class Accept_Manager():
|
|
392
392
|
|
393
393
|
def get_files_in_rm_buildings(self) -> list[Path]:
|
394
394
|
return [Path(a) for a in glob.glob(str(self.IN_RM_BUILD_DIR / ("*"+ EXTENT)))]
|
395
|
-
|
395
|
+
|
396
396
|
def get_files_in_CHANGE_VULNE(self) -> list[Path]:
|
397
397
|
return [Path(a) for a in glob.glob(str(self.IN_CH_VULN / "*.tiff"))]
|
398
398
|
|
@@ -421,8 +421,8 @@ class Accept_Manager():
|
|
421
421
|
return [Path(a) for a in glob.glob(str(self.TMP_QFILES / "*.tif"))]
|
422
422
|
|
423
423
|
def get_list_scenarios(self) -> list[str]:
|
424
|
-
|
425
|
-
list_sc = [Path(a).stem for a in glob.glob(str(self.IN_WATER_DEPTH / self.SA.stem / "Scenario*"))]
|
424
|
+
|
425
|
+
list_sc = [Path(a).stem for a in glob.glob(str(self.IN_WATER_DEPTH / self.SA.stem / "Scenario*"))]
|
426
426
|
return list_sc
|
427
427
|
|
428
428
|
def get_list_studyareas(self, with_suffix:bool = False) -> list[str]:
|
@@ -439,7 +439,7 @@ class Accept_Manager():
|
|
439
439
|
else :
|
440
440
|
logging.error("No _baseline")
|
441
441
|
return files
|
442
|
-
|
442
|
+
|
443
443
|
def get_sims_files_for_baseline(self) -> list[Path]:
|
444
444
|
files = [] #to avoid NoneType
|
445
445
|
if self.IN_SA_INTERP.exists() :
|
@@ -448,7 +448,7 @@ class Accept_Manager():
|
|
448
448
|
files = [Path(a) for a in glob.glob(str(track))]
|
449
449
|
else :
|
450
450
|
logging.error("No _baseline WATER_DEPTHS files")
|
451
|
-
|
451
|
+
|
452
452
|
return files
|
453
453
|
|
454
454
|
def get_sim_file_for_return_period(self, return_period:int) -> Path:
|
@@ -593,7 +593,7 @@ class Accept_Manager():
|
|
593
593
|
if len(rt)<2:
|
594
594
|
logging.info("Need for more simulations")
|
595
595
|
return None
|
596
|
-
|
596
|
+
|
597
597
|
else :
|
598
598
|
pond = []
|
599
599
|
|
@@ -624,7 +624,7 @@ class Accept_Manager():
|
|
624
624
|
def check_inputs(self) -> bool:
|
625
625
|
"""
|
626
626
|
Check if the input directories exist.
|
627
|
-
|
627
|
+
|
628
628
|
Inputs can not be created automatically. The user must provide them.
|
629
629
|
"""
|
630
630
|
|
@@ -677,7 +677,7 @@ class Accept_Manager():
|
|
677
677
|
logging.error("The wd scenario directory does not exist")
|
678
678
|
err = True
|
679
679
|
|
680
|
-
return not err
|
680
|
+
return not err
|
681
681
|
|
682
682
|
def check_temporary(self) -> bool:
|
683
683
|
"""
|
@@ -774,7 +774,7 @@ class Accept_Manager():
|
|
774
774
|
return False
|
775
775
|
|
776
776
|
return True
|
777
|
-
|
777
|
+
|
778
778
|
def check_vuln_code_sa(self) -> bool:
|
779
779
|
|
780
780
|
if not self.SA_VULN.exists():#SA_VULN
|
@@ -926,26 +926,26 @@ class Accept_Manager():
|
|
926
926
|
logging.error("The dimensions do not match {}".format(cur))
|
927
927
|
diff.append(cur)
|
928
928
|
|
929
|
-
return diff
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
929
|
+
return diff
|
930
|
+
|
931
|
+
|
932
|
+
|
933
|
+
|
934
934
|
# Assembly (FR : agglomération)
|
935
935
|
# -----------------------------
|
936
936
|
"""Basically the same operations as in the config manager to agglomerate several rasters
|
937
937
|
The class Config_Manager_2D_GPU is called, however some functions were rewritten to allow
|
938
938
|
the search of a more specific word ('vuln', and not 'bath', 'mann', or 'inf').
|
939
939
|
"""
|
940
|
-
|
940
|
+
|
941
941
|
def tree_vuln_tif(folder_path):
|
942
942
|
"""Find all .tiff files starting with 'vuln' in the directory and return paths"""
|
943
943
|
folder = Path(folder_path)
|
944
944
|
vuln_tiff_files = {file for file in folder.rglob("*.tiff") if file.name.startswith("vuln")}
|
945
945
|
vuln_tif_files = {file for file in folder.rglob("*.tif") if file.name.startswith("vuln")}
|
946
|
-
|
946
|
+
|
947
947
|
vuln_files = vuln_tiff_files.union(vuln_tif_files)
|
948
|
-
|
948
|
+
|
949
949
|
tiff_trees = []
|
950
950
|
if len(vuln_files) !=0:
|
951
951
|
for tiff in vuln_files:
|
@@ -954,7 +954,7 @@ class Accept_Manager():
|
|
954
954
|
tiff = tiff.parent
|
955
955
|
curtree.insert(0, tiff)
|
956
956
|
tiff_trees.append(curtree)
|
957
|
-
return tiff_trees
|
957
|
+
return tiff_trees
|
958
958
|
|
959
959
|
def select_vuln_tif(self, path_baseline: Path, folder_path: Path) -> list[Path]:
|
960
960
|
"""
|
@@ -964,12 +964,12 @@ class Accept_Manager():
|
|
964
964
|
#first element must be vulnerability_baseline
|
965
965
|
files.append(path_baseline.as_posix())
|
966
966
|
tiff_trees = Accept_Manager.tree_vuln_tif(folder_path)
|
967
|
-
|
967
|
+
|
968
968
|
#only the 'final' path of the tree
|
969
969
|
for tree in tiff_trees:
|
970
970
|
files.append(tree[-1].as_posix())
|
971
|
-
return files
|
972
|
-
|
971
|
+
return files
|
972
|
+
|
973
973
|
def check_nodata(self):
|
974
974
|
""" Check nodata in a path """
|
975
975
|
|
@@ -982,7 +982,7 @@ class Accept_Manager():
|
|
982
982
|
curarray.set_nullvalue_in_mask()
|
983
983
|
curarray.write_all()
|
984
984
|
logging.warning(_('nodata changed in favor of 99999. value for file {} !'.format(cur_lst)))
|
985
|
-
|
985
|
+
|
986
986
|
def create_vrtIfExists(self):
|
987
987
|
""" Create a vrt file from a path """
|
988
988
|
logging.info(_('Checking nodata values...'))
|
@@ -1001,7 +1001,7 @@ class Accept_Manager():
|
|
1001
1001
|
""" Translate vrt from OUTPUT > ... > Scenario to tif saved in the same folder """
|
1002
1002
|
if (self.OUT_VULN_VRT).exists():
|
1003
1003
|
translate_vrt2tif(self.OUT_VULN_VRT, self.OUT_VULN_S)
|
1004
|
-
|
1004
|
+
|
1005
1005
|
def copy_tif_files(self, files: list[Path], destination_dir: Path) -> None:
|
1006
1006
|
destination_dir.mkdir(parents=True, exist_ok=True)
|
1007
1007
|
|
@@ -1013,7 +1013,7 @@ class Accept_Manager():
|
|
1013
1013
|
continue
|
1014
1014
|
gdal_driver = gdal.GetDriverByName('GTiff')
|
1015
1015
|
gdal_driver.CreateCopy(str(destination_file), dataset, strict=0)
|
1016
|
-
|
1016
|
+
|
1017
1017
|
dataset = None
|
1018
1018
|
|
1019
1019
|
logging.info("All .tif files have been copied to the destination directory.")
|
@@ -1379,7 +1379,7 @@ def compute_code(manager:Accept_Manager):
|
|
1379
1379
|
|
1380
1380
|
for i in tqdm(range(len(rasters_code)), 'Computing Code : '):
|
1381
1381
|
logging.info("Computing layer {} / {}".format(i, len(rasters_code)))
|
1382
|
-
|
1382
|
+
|
1383
1383
|
loccode = vuln_csv.get_vulnerability_code(rasters_code[i].stem.removesuffix("_CODE"))
|
1384
1384
|
|
1385
1385
|
if rasters_code[i].with_suffix('.npz').exists():
|
@@ -1570,7 +1570,7 @@ def compute_acceptability(manager:Accept_Manager,
|
|
1570
1570
|
|
1571
1571
|
return accept
|
1572
1572
|
|
1573
|
-
def shp_to_raster(vector_fn:str, raster_fn:str, pixel_size:float = 1., manager:Accept_Manager = None):
|
1573
|
+
def shp_to_raster(vector_fn:str | Path, raster_fn:str | Path, pixel_size:float = 1., manager:Accept_Manager = None):
|
1574
1574
|
"""
|
1575
1575
|
Convert a vector layer to a raster tiff file.
|
1576
1576
|
|
@@ -1584,6 +1584,16 @@ def shp_to_raster(vector_fn:str, raster_fn:str, pixel_size:float = 1., manager:A
|
|
1584
1584
|
:param pixel_size: the pixel size of the raster
|
1585
1585
|
"""
|
1586
1586
|
|
1587
|
+
vector_path = Path(vector_fn)
|
1588
|
+
raster_path = Path(raster_fn)
|
1589
|
+
|
1590
|
+
if not vector_path.exists():
|
1591
|
+
logging.error(f"The vector file {vector_path} does not exist")
|
1592
|
+
return
|
1593
|
+
|
1594
|
+
if raster_path.exists():
|
1595
|
+
os.remove(raster_path)
|
1596
|
+
|
1587
1597
|
# Force the input to be a string
|
1588
1598
|
vector_fn = str(vector_fn)
|
1589
1599
|
raster_fn = str(raster_fn)
|
@@ -1665,6 +1675,7 @@ def vector_to_raster(layer:str,
|
|
1665
1675
|
out_file = manager.TMP_RASTERS / attribute / (layer + "_CODE.tiff")
|
1666
1676
|
else :
|
1667
1677
|
out_file = manager.TMP_RASTERS / attribute / (layer + ".tiff")
|
1678
|
+
|
1668
1679
|
if out_file.exists():
|
1669
1680
|
os.remove(out_file)
|
1670
1681
|
|
wolfhece/apps/version.py
CHANGED
wolfhece/bernoulli/losses.py
CHANGED
@@ -17,7 +17,7 @@ from numba import jit
|
|
17
17
|
from jax.scipy.optimize import minimize
|
18
18
|
import timeit
|
19
19
|
|
20
|
-
@jit
|
20
|
+
@jit(nopython=True)
|
21
21
|
def _colebrook_white(f:float, k:float, diameter:float, reynolds:float) -> float:
|
22
22
|
"""
|
23
23
|
Colebrook-White equation for friction factor
|
@@ -30,7 +30,7 @@ def _colebrook_white(f:float, k:float, diameter:float, reynolds:float) -> float:
|
|
30
30
|
ret = 1. / np.sqrt(f) + 2. * np.log10(k / (3.7 * diameter) + 2.51 / (reynolds * np.sqrt(f)))
|
31
31
|
return ret
|
32
32
|
|
33
|
-
@jit
|
33
|
+
@jit(nopython=True)
|
34
34
|
def _grad_colebrook_white(f, k, diameter, reynolds):
|
35
35
|
|
36
36
|
term1 = -0.5 * f**(-1.5)
|
@@ -98,7 +98,7 @@ def test_colebrook_newton():
|
|
98
98
|
f_sol = newton(_colebrook_white, f_guess, _grad_colebrook_white, args=(k, diam, reynolds), rtol=1e-6)
|
99
99
|
return f_sol.item()
|
100
100
|
|
101
|
-
@jit
|
101
|
+
@jit(nopython=True)
|
102
102
|
def dichotomy(f, a:float, b:float, args, tol=1e-10, max_iter=1000):
|
103
103
|
def cond_fun(val):
|
104
104
|
a, b, i = val
|
wolfhece/gpuview.py
CHANGED
@@ -376,7 +376,10 @@ class VectorField(Element_To_Draw):
|
|
376
376
|
y[mask] *= newnorms
|
377
377
|
|
378
378
|
# recherche du maximum
|
379
|
-
|
379
|
+
if newnorms.size > 0:
|
380
|
+
self.max_norm = np.max(newnorms)
|
381
|
+
else:
|
382
|
+
self.max_norm = 0
|
380
383
|
|
381
384
|
# x[mask] += np.sign(x[mask])*self.min_size*(1.-norms[mask])
|
382
385
|
# y[mask] += np.sign(y[mask])*self.min_size*(1.-norms[mask])
|
wolfhece/libs/__init__.py
CHANGED
@@ -2,6 +2,7 @@ from pathlib import Path
|
|
2
2
|
import sys
|
3
3
|
import os
|
4
4
|
import shutil
|
5
|
+
import logging
|
5
6
|
|
6
7
|
"""
|
7
8
|
Mandatory DLLs for MKL and Fortran.
|
@@ -39,26 +40,26 @@ def find_Librarybin(which, test):
|
|
39
40
|
sites = sys.path
|
40
41
|
|
41
42
|
candidate = interpreter_path / 'Library/bin'
|
42
|
-
|
43
|
+
logging.debug(f'Searching {which} in {candidate}')
|
43
44
|
if candidate.exists():
|
44
45
|
if (candidate/test).exists():
|
45
|
-
|
46
|
+
logging.debug(f"Found {which} in {candidate}")
|
46
47
|
return candidate
|
47
48
|
|
48
49
|
candidate = interpreter_path.parent / 'Library/bin'
|
49
|
-
|
50
|
+
logging.debug(f'Searching {which} in {candidate}')
|
50
51
|
if candidate.exists():
|
51
52
|
if (candidate/test).exists():
|
52
|
-
|
53
|
+
logging.debug(f"Found {which} in {candidate}")
|
53
54
|
return candidate
|
54
55
|
|
55
56
|
for cursite in sites:
|
56
57
|
if 'site-packages' in cursite:
|
57
58
|
candidate = Path(cursite).parent.parent / 'Library/bin'
|
58
|
-
|
59
|
+
logging.debug(f'Searching {which} in {candidate}')
|
59
60
|
if candidate.exists():
|
60
61
|
if (candidate/test).exists():
|
61
|
-
|
62
|
+
logging.debug(f"Found {which} in {candidate}")
|
62
63
|
return candidate
|
63
64
|
|
64
65
|
return None
|
@@ -67,9 +68,9 @@ mkl_path = find_Librarybin('MKL', MKL_DLLS[0])
|
|
67
68
|
fortran_path = find_Librarybin('FORTRAN', FORTRAN_DLLS[0])
|
68
69
|
|
69
70
|
if mkl_path is None:
|
70
|
-
|
71
|
+
logging.error("MKL package not found -- Please install MKL with 'pip install mkl'")
|
71
72
|
if fortran_path is None:
|
72
|
-
|
73
|
+
logging.error("Fortran package not found -- Please install Intel Fortran RunTime with 'pip install intel_fortran_rt'")
|
73
74
|
|
74
75
|
if mkl_path is None or fortran_path is None:
|
75
76
|
raise FileNotFoundError("Missing MKL or Fortran package. Please check the output above.")
|
@@ -82,7 +83,7 @@ if mkl_path.exists():
|
|
82
83
|
dll_path = mkl_path / dll
|
83
84
|
if not dll_path.exists():
|
84
85
|
error = True
|
85
|
-
|
86
|
+
logging.error(f"Missing DLL: {dll} in {mkl_path}")
|
86
87
|
else:
|
87
88
|
if not (mydir / dll).exists():
|
88
89
|
shutil.copy(dll_path, mydir / dll)
|
@@ -91,7 +92,7 @@ for dll in FORTRAN_DLLS:
|
|
91
92
|
dll_path = fortran_path / dll
|
92
93
|
if not dll_path.exists():
|
93
94
|
error = True
|
94
|
-
|
95
|
+
logging.error(f"Missing DLL: {dll} in {fortran_path}")
|
95
96
|
else:
|
96
97
|
if not (mydir / dll).exists():
|
97
98
|
shutil.copy(dll_path, mydir / dll)
|
Binary file
|
@@ -112,10 +112,11 @@ class Calculator(wx.Frame):
|
|
112
112
|
self.reset_memory()
|
113
113
|
self._memory.clear()
|
114
114
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
115
|
+
if self._mapviewer is not None:
|
116
|
+
from ..PyDraw import draw_type
|
117
|
+
ids = self._mapviewer.get_list_keys(drawing_type=draw_type.ARRAYS, checked_state=None)
|
118
|
+
for id in ids:
|
119
|
+
self.memory_txt += id
|
119
120
|
|
120
121
|
def memory_clear_event(self, e):
|
121
122
|
self.memory_clear()
|
wolfhece/mesh2d/bc_manager.py
CHANGED
@@ -17,7 +17,7 @@ from typing import Union,Literal
|
|
17
17
|
from os.path import exists
|
18
18
|
from pathlib import Path
|
19
19
|
|
20
|
-
from .cst_2D_boundary_conditions import BCType_2D_OO, BCType_2D, ColorsNb, choose_bc_type, Direction
|
20
|
+
from .cst_2D_boundary_conditions import BCType_2D_OO, BCType_2D, ColorsNb, choose_bc_type, Direction, BCType_2D_GPU
|
21
21
|
from ..PyTranslate import _
|
22
22
|
from ..wolf_array import WolfArray
|
23
23
|
from .wolf2dprev import prev_boundary_conditions, boundary_condition_2D, prev_parameters_simul
|
@@ -749,7 +749,7 @@ class BcManager(wx.Frame):
|
|
749
749
|
"""
|
750
750
|
Send BC to parent
|
751
751
|
"""
|
752
|
-
from ..PyGui import Wolf2DModel
|
752
|
+
from ..PyGui import Wolf2DModel, Wolf2DGPUModel
|
753
753
|
|
754
754
|
if self.wolfparent is not None:
|
755
755
|
|
@@ -779,6 +779,29 @@ class BcManager(wx.Frame):
|
|
779
779
|
|
780
780
|
self.wolfparent._show_glob_properties()
|
781
781
|
|
782
|
+
elif isinstance(self.wolfparent, Wolf2DGPUModel):
|
783
|
+
self.wolfparent.reset_boundary_conditions()
|
784
|
+
|
785
|
+
for orient in range(1,3):
|
786
|
+
if orient==1:
|
787
|
+
curlist=self.bordersX['bc']
|
788
|
+
direction=Direction.LEFT
|
789
|
+
else:
|
790
|
+
curlist=self.bordersY['bc']
|
791
|
+
direction=Direction.BOTTOM
|
792
|
+
|
793
|
+
curlist:dict
|
794
|
+
ij:str
|
795
|
+
allbc:dict
|
796
|
+
|
797
|
+
for ij, allbc in curlist.items():
|
798
|
+
for tbc, val in allbc.items():
|
799
|
+
i,j=ij.split('-')
|
800
|
+
namebc=self._find_Enum_TypeBC(tbc)
|
801
|
+
|
802
|
+
if(str(val)!='99999.0'):
|
803
|
+
self.wolfparent.add_boundary_condition(int(i), int(j), namebc, float(val), direction)
|
804
|
+
|
782
805
|
def parse(self, text:str):
|
783
806
|
"""
|
784
807
|
Parse text and fill bordersX and bordersY
|