Compare commits

...
Author SHA1 Message Date
Pierre-Antoine Rouby b3a7e7f465 HS: Remove useless print. 2024-02-21 10:53:46 +01:00
Pierre-Antoine Rouby 1a66188411 HS: Minor fixes. 2024-02-21 10:49:47 +01:00
Pierre-Antoine Rouby 485b2cad1e ci: Update mage version. 2024-02-20 17:07:12 +01:00
Pierre-Antoine Rouby 3bcd90f7ae Pamhyr: Update translate. 2024-02-20 16:58:54 +01:00
Pierre-Antoine Rouby 586f17dc2a Results, tools: Fix negative timestamp on Windows and some others fixes. 2024-02-20 15:12:51 +01:00
Pierre-Antoine Rouby 9863b05c30 tools: Fix timestamp to pamhyr notation function for Windows. 2024-02-20 14:25:23 +01:00
Pierre-Antoine Rouby a9f92637ca Solver: Mage: Fix ST file name. 2024-02-20 12:07:30 +01:00
Pierre-Antoine Rouby 6b8b1b8e1e Geometry: Fix update. 2024-02-20 11:29:51 +01:00
Pierre-Antoine Rouby c3c5802be2 Solver: Mage: Fix ST file name export. 2024-02-20 11:14:39 +01:00
Pierre-Antoine Rouby ab776f15f4 Friction: Connect to geometry update. 2024-02-20 10:53:22 +01:00
Pierre-Antoine Rouby ebc3e938bf Results: Fix KPC update where no sediment. 2024-02-20 10:36:18 +01:00
Pierre-Antoine Rouby 9cc3bb23c0 IC: Propagate update, update at gemometry change and minor change. 2024-02-20 10:25:04 +01:00
Pierre-Antoine Rouby d2f275c49f Results: Add export function. 2024-02-19 16:44:37 +01:00
Pierre-Antoine Rouby aec31df520 Results: Change default tab. 2024-02-19 15:47:59 +01:00
Pierre-Antoine Rouby 76745dc9d0 Pamhyr: Fix Pep8 and minor change. 2024-02-19 15:44:04 +01:00
Pierre-Antoine Rouby 25dce4d386 Results: Add bedload sediment results to KPC plot. 2024-02-19 15:38:06 +01:00
Pierre-Antoine Rouby 1c736df647 Results: Add overflow to KPC plot. 2024-02-19 14:41:12 +01:00
Pierre-Antoine Rouby aeae8fb710 Results: Update plot XY and add overflow on this plot. 2024-02-19 14:32:10 +01:00
Pierre-Antoine Rouby 6055065e27 Results: Update plot KPC. 2024-02-19 10:57:58 +01:00
Pierre-Antoine Rouby a08b2c77d6 Results: Update AC plot with max water level. 2024-02-19 10:19:46 +01:00
Pierre-Antoine Rouby f9a099a284 Results: Hydrograph: Add legend. 2024-02-19 09:46:43 +01:00
Pierre-Antoine Rouby 62fcafa982 Results: Renew hydrograph. 2024-02-16 16:56:46 +01:00
Pierre-Antoine Rouby 065d94eb4a Results: Add 'raw_data' tab and delete sediment tab. 2024-02-16 15:44:50 +01:00
Pierre-Antoine Rouby 7760181baa Friction: Apply new PamhyrPlot features. 2024-02-16 14:35:37 +01:00
Pierre-Antoine Rouby 9302d1fabc SL: Apply new PamhyrPlot features. 2024-02-16 14:16:58 +01:00
Pierre-Antoine Rouby d1d63c8c29 Reservoir: Apply new PamhyrPlot features. 2024-02-16 11:22:29 +01:00
Pierre-Antoine Rouby bfd166b717 IC: Apply new PamhyrPlot features. 2024-02-16 11:16:18 +01:00
Pierre-Antoine Rouby 4f747f8fa7 HS: Apply new PamhyrPlot features. 2024-02-16 10:58:10 +01:00
Pierre-Antoine Rouby 2111307965 LC: Update plot with PmahyrPlot new features. 2024-02-16 10:18:29 +01:00
Pierre-Antoine Rouby 065e1f063f Pamhyr: Change time edition and plot display (exp BC). 2024-02-16 10:04:22 +01:00
Pierre-Antoine Rouby 5226836211 Pamhyr: Fix Pep8. 2024-02-14 17:03:05 +01:00
Pierre-Antoine Rouby c58dc5785a Plot: Add a default colors set and delete geo:plot_xy dependence on geo:plot_ac. 2024-02-14 16:44:41 +01:00
Pierre-Antoine Rouby 30d76da32f Geometry: Renew Plot AC. 2024-02-14 16:23:48 +01:00
Pierre-Antoine Rouby 876521fdea Geometry: Renew PlotKPC. 2024-02-14 15:49:20 +01:00
Pierre-Antoine Rouby e1e5279366 Plot: Start refactoring with Geometry.PlotXY at exemple. 2024-02-14 15:15:08 +01:00
Pierre-Antoine Rouby 32886c5034 Configure: Remove unused configuration. 2024-02-14 09:37:35 +01:00
Pierre-Antoine Rouby 41e14208e4 SQL: Move SQL class to separate file. 2024-02-14 09:29:34 +01:00
Pierre-Antoine Rouby b79fc28a5f ListedSubWindow: Logging minor change. 2024-02-13 13:33:31 +01:00
Pierre-Antoine Rouby ef72ff6903 doc: Fix Pep8. 2024-02-13 11:51:45 +01:00
Pierre-Antoine Rouby 82e8b510ca Pamhyr: Close sub windows at model close. 2024-02-13 11:46:06 +01:00
Pierre-Antoine Rouby 8109ddf78f Pamhyr: Chose to close all subwindow at window close. 2024-02-13 11:43:24 +01:00
Pierre-Antoine Rouby f0f6ad17e2 Pamhyr: Add recursive window activation. 2024-02-13 11:32:16 +01:00
Pierre-Antoine Rouby 83d53a46fb Pamhyr: Add windows list recursively. 2024-02-13 11:25:53 +01:00
Pierre-Antoine Rouby a8c8e14d6a MainWindow: Add windows menu with list of windows (depth 1). 2024-02-13 11:12:25 +01:00
Pierre-Antoine Rouby e96e291ec4 Pamhyr: Add update propagation mechanism. 2024-02-13 09:23:36 +01:00
Pierre-Antoine Rouby e03ebedfdf tools: licence.el: Minor change. 2024-02-12 17:08:09 +01:00
Pierre-Antoine Rouby deaf114fa3 Pamhyr: Update licence. 2024-02-12 17:06:13 +01:00
Pierre-Antoine Rouby 0071ef22d7 Study: Add window title translate. 2024-02-12 15:43:34 +01:00
Pierre-Antoine Rouby 58924aaf3a Stricklers: Add window title translate. 2024-02-12 15:41:34 +01:00
Pierre-Antoine Rouby d6af6ce486 SP: Add window title translate. 2024-02-12 15:36:30 +01:00
Pierre-Antoine Rouby b1d0e6dc55 SL: Add windows title translate. 2024-02-12 15:34:30 +01:00
Pierre-Antoine Rouby a200adb51a RunSolver: Add windows title translate. 2024-02-12 15:18:01 +01:00
Pierre-Antoine Rouby 6ea00200b0 Results: Add window title translate. 2024-02-12 15:12:34 +01:00
Pierre-Antoine Rouby 5cf03d7ae0 Results: Minor change. 2024-02-12 15:10:47 +01:00
Pierre-Antoine Rouby 3b5fbdabd4 About: Update copyright date. 2024-02-12 15:09:53 +01:00
Pierre-Antoine Rouby 18c5d9b480 Results: Add window title translate. 2024-02-12 15:08:40 +01:00
Pierre-Antoine Rouby fe5c050c61 Reservoir: Add windows title translate. 2024-02-12 14:58:10 +01:00
Pierre-Antoine Rouby a7c56e3920 Network: Add window title translate. 2024-02-12 14:50:12 +01:00
Pierre-Antoine Rouby a519228856 LC: Add windows title translate. 2024-02-12 14:46:09 +01:00
Pierre-Antoine Rouby e1f5628a4f IC: Add windows title translate and minor change. 2024-02-12 14:41:05 +01:00
Pierre-Antoine Rouby e4eee1c29e (B)HS: Add windows title translate. 2024-02-12 14:34:33 +01:00
Pierre-Antoine Rouby 0fc5bd3c10 Geometry: Add windows title translate. 2024-02-12 14:26:40 +01:00
Pierre-Antoine Rouby 77de17d7e3 Friction: Add window title translate. 2024-02-12 14:19:31 +01:00
Pierre-Antoine Rouby 87fcf1c610 Debug, Doc: Add windows title translate. 2024-02-12 14:16:12 +01:00
Pierre-Antoine Rouby 8895d0d565 Config: Add windows title translate. 2024-02-12 14:11:02 +01:00
Pierre-Antoine Rouby 6340d9ea0b CheckList: Add window title translate. 2024-02-12 14:02:55 +01:00
Pierre-Antoine Rouby 62aaa276a7 BC: Translate window title. 2024-02-12 13:58:39 +01:00
Pierre-Antoine Rouby 0391775fed Geometry: Meshing: Add lm parameter translate. 2024-02-12 10:53:00 +01:00
Pierre-Antoine Rouby 400b743feb Geometry: Meshing: Fix pep8. 2024-02-09 17:28:29 +01:00
Pierre-Antoine Rouby 754910f514 Geometry: Meshing: Add lm options (no traduction). 2024-02-09 17:27:09 +01:00
Pierre-Antoine Rouby 614285804d Geometry: Meshing: Add "directrices". 2024-02-09 17:19:13 +01:00
Pierre-Antoine Rouby 1b22ba436b Geometry: Meshing: Add cross sections limites. 2024-02-09 17:08:29 +01:00
Pierre-Antoine Rouby 387d462c2c Geometry: Meshing: Update windows with radiobutton instead of checkbox. 2024-02-09 16:47:51 +01:00
Pierre-Antoine Rouby e6178525d7 Geometry: Add missing file. 2024-02-07 17:19:22 +01:00
Pierre-Antoine Rouby a663dc482c Meshing: Add lplan and linear to meching options. 2024-02-07 17:09:50 +01:00
Pierre-Antoine Rouby b913d76972 Meshing: Mage: Change API of mailleurTT for the next mage version. 2024-02-07 16:56:18 +01:00
Pierre-Antoine Rouby ab276db78c Meshing: Add minimal meshing option dialog. 2024-02-07 16:04:59 +01:00
Pierre-Antoine Rouby 34038d2844 README: Replace installation instruction to link to wiki documentation. 2024-02-07 14:28:04 +01:00
Pierre-Antoine Rouby c27ea5c447 Doc: wiki: Add defender message screenshot. 2024-02-07 12:00:14 +01:00
Pierre-Antoine Rouby a8c71e475e Pep8: Fix. 2024-02-07 11:26:29 +01:00
Pierre-Antoine Rouby 41673145ee Translate: Minor change. 2024-02-07 11:23:15 +01:00
Pierre-Antoine Rouby 4757c7d051 Translate: Update. 2024-02-07 11:22:22 +01:00
Pierre-Antoine Rouby 5619b98468 Solver: Run: Close checklist at solver run, resize solver window and fix empty message. 2024-02-07 10:23:02 +01:00
Pierre-Antoine Rouby 630eb98343 SL: Fix default name. 2024-02-07 10:09:18 +01:00
Pierre-Antoine Rouby 5412cb4d2d HS: Add default name. 2024-02-07 10:06:18 +01:00
Pierre-Antoine Rouby 8f46f128ff SL: Add default name. 2024-02-07 10:00:30 +01:00
Pierre-Antoine Rouby 8807d4d98b Reservoir: Add default name. 2024-02-07 09:59:22 +01:00
Pierre-Antoine Rouby 7719f5270d BC, LC: Add default name. 2024-02-07 09:57:23 +01:00
Pierre-Antoine Rouby afb4c1b61e Friction: Add id to friction and default name to stricklers. 2024-02-07 09:52:43 +01:00
Pierre-Antoine Rouby 28bea42b15 River: Add default reach at study creation. 2024-02-07 09:43:13 +01:00
Pierre-Antoine Rouby 955af412ea MainWindow: Make toolbar run launch the lasest solver used and add sc on F6. 2024-02-06 15:21:51 +01:00
Pierre-Antoine Rouby 49dd3c65e1 ci: Set tag message to release message and minor change. 2024-02-05 13:38:54 +01:00
Pierre-Antoine Rouby b2f41f88c9 ci: Minor change to fix sha256 path. 2024-02-05 13:25:19 +01:00
Pierre-Antoine Rouby f3500c7f24 ci: Add sha256 to release artefact. 2024-02-05 11:52:56 +01:00
Pierre-Antoine Rouby 1cbdc9deff ci: Disable PDF of user documentations. 2024-02-05 11:42:43 +01:00
Pierre-Antoine Rouby 89652cc080 ci: Add packages checksum. 2024-02-05 11:39:56 +01:00
Pierre-Antoine Rouby fe3f151e0b ci: Minor change. 2024-02-05 11:18:33 +01:00
Pierre-Antoine Rouby 16caae9d40 ci: Add build check. 2024-02-05 11:14:14 +01:00
Pierre-Antoine Rouby d541becb1a ci: Add antivirus check with clamav scan. 2024-02-02 11:23:39 +01:00
Pierre-Antoine Rouby 21e97d4e30 Solvers: Disable generic solver. 2024-02-02 10:25:41 +01:00
Pierre-Antoine Rouby 9fd9bd95f4 SolverParameters: Minor change. 2024-02-02 10:17:54 +01:00
Pierre-Antoine Rouby fe9c348ee0 Friction: SQL: Fix type name. 2024-01-31 09:57:58 +01:00
Pierre-Antoine Rouby 0d36ba188e Geometry: Export/Import file extention add lower case. 2024-01-31 09:37:17 +01:00
Pierre-Antoine Rouby 5a6d55c2ca MainWindow: Minor change. 2024-01-31 09:27:21 +01:00
Pierre-Antoine Rouby 36ad9562eb MainWindow: Fix save as function. 2024-01-31 09:23:50 +01:00
Pierre-Antoine Rouby bf06a9fe43 Network: Set unselected edges to black. 2024-01-31 09:12:23 +01:00
Pierre-Antoine Rouby 34c9fbd77a pamhyr: Some hot fixes... 2024-01-30 16:23:00 +01:00
Pierre-Antoine Rouby f4ca2650e5 Some hot fix. 2024-01-30 13:04:53 +01:00
226 changed files with 4900 additions and 2673 deletions

No files matched your search

+150 -30
View File
@@ -20,6 +20,8 @@ stages:
- test - test
- build - build
- package - package
- hash
- antivirus
- release - release
############# #############
@@ -27,7 +29,7 @@ stages:
############# #############
variables: variables:
MAGE_VERSION: "v8.3.3" MAGE_VERSION: "v8.3.4"
dl-mage-doc: dl-mage-doc:
stage: downloads stage: downloads
@@ -148,23 +150,22 @@ test-pep8:
# BUILD # # BUILD #
######### #########
build-users-doc: # build-users-doc:
stage: build # stage: build
tags: # tags:
- linux # - linux
needs: # needs:
- job: set-version # - job: set-version
artifacts: true # artifacts: true
script: # script:
- cd ./doc/users/ # - cd ./doc/users/
- ./build.sh # - ./build.sh
artifacts: # artifacts:
paths: # paths:
- doc/users/documentation.pdf # - doc/users/documentation.pdf
- doc/users/documentation.html # - doc/users/documentation.html
- doc/users/images/ # - doc/users/images/
allow_failure: true # allow_failure: true
build-td: build-td:
stage: build stage: build
@@ -231,8 +232,8 @@ build-linux:
artifacts: true artifacts: true
- job: build-developers-doc - job: build-developers-doc
artifacts: true artifacts: true
- job: build-users-doc # - job: build-users-doc
artifacts: true # artifacts: true
- job: build-td - job: build-td
artifacts: true artifacts: true
script: script:
@@ -322,14 +323,15 @@ build-windows:
artifacts: true artifacts: true
- job: build-developers-doc - job: build-developers-doc
artifacts: true artifacts: true
- job: build-users-doc # - job: build-users-doc
artifacts: true # artifacts: true
- job: build-td - job: build-td
artifacts: true artifacts: true
script: script:
- mkdir windows - mkdir windows
- cd windows - cd windows
# Setup env # Setup env
- python -m pip install -U pip
- python -m pip install -r ..\requirements.txt - python -m pip install -r ..\requirements.txt
- python -m pip install -U -r ..\requirements.txt - python -m pip install -U -r ..\requirements.txt
# Run Pyinstaller # Run Pyinstaller
@@ -403,6 +405,111 @@ windows-package-exe:
- copy ..\packages\pamhyr.nsi pamhyr.nsi - copy ..\packages\pamhyr.nsi pamhyr.nsi
- .\make-windows-exe.bat - .\make-windows-exe.bat
########
# HASH #
########
linux-build-hash:
stage: hash
tags:
- release
- linux
needs:
- job: build-linux
artifacts: true
rules:
- if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG
script:
- cd linux
- sha256sum -b pamhyr/pamhyr/pamhyr > pamhyr/pamhyr/pamhyr.sha256
artifacts:
paths:
- linux/pamhyr/pamhyr/pamhyr.sha256
windows-build-hash:
stage: hash
tags:
- release
- linux
needs:
- job: build-windows
artifacts: true
rules:
- if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG
script:
- cd windows
- sha256sum -b pamhyr/pamhyr/pamhyr.exe > pamhyr/pamhyr/pamhyr.exe.sha256
artifacts:
paths:
- windows/pamhyr/pamhyr/pamhyr.exe.sha256
pkg-hash:
stage: hash
tags:
- release
- linux
needs:
- job: linux-package-tar
artifacts: true
- job: windows-package-zip
artifacts: true
- job: windows-package-exe
artifacts: true
rules:
- if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_TAG
script:
- cd windows
- sha256sum -b pamhyr-windows.exe > pamhyr-windows.exe.sha256
- sha256sum -b pamhyr-windows.zip > pamhyr-windows.zip.sha256
- cd ..
- cd linux
- sha256sum -b pamhyr-gnulinux.tar.xz > pamhyr-gnulinux.tar.xz.sha256
artifacts:
paths:
- windows/pamhyr-windows.exe.sha256
- windows/pamhyr-windows.zip.sha256
- linux/pamhyr-gnulinux.tar.xz.sha256
#############
# ANTIVIRUS #
#############
build-check-clamav:
stage: antivirus
tags:
- release
- linux
needs:
- job: build-linux
artifacts: true
- job: build-windows
artifacts: true
rules:
- if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG
script:
- cd packages
- ./clamav-scan.sh builds
allow_failure: true
pkg-check-clamav:
stage: antivirus
tags:
- release
- linux
needs:
- job: linux-package-tar
artifacts: true
- job: windows-package-zip
artifacts: true
- job: windows-package-exe
artifacts: true
rules:
- if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_TAG
script:
- cd packages
- ./clamav-scan.sh packages
allow_failure: true
########### ###########
# RELEASE # # RELEASE #
########### ###########
@@ -419,10 +526,12 @@ tag-release:
artifacts: true artifacts: true
- job: windows-package-exe - job: windows-package-exe
artifacts: true artifacts: true
- job: build-users-doc # - job: build-users-doc
artifacts: true # artifacts: true
- job: build-developers-doc - job: build-developers-doc
artifacts: true artifacts: true
- job: pkg-hash
artifacts: true
rules: rules:
- if: $CI_COMMIT_TAG - if: $CI_COMMIT_TAG
artifacts: artifacts:
@@ -430,33 +539,44 @@ tag-release:
- linux/pamhyr-gnulinux.tar.xz - linux/pamhyr-gnulinux.tar.xz
- windows/pamhyr-windows.zip - windows/pamhyr-windows.zip
- windows/pamhyr-windows.exe - windows/pamhyr-windows.exe
- linux/pamhyr-gnulinux.tar.xz.sha256
- windows/pamhyr-windows.zip.sha256
- windows/pamhyr-windows.exe.sha256
- doc/dev/documentation.pdf - doc/dev/documentation.pdf
- doc/users/documentation.pdf # - doc/users/documentation.pdf
script: script:
- cd packages - cd packages
release: release:
name: '$CI_COMMIT_TAG' name: '$CI_COMMIT_TAG'
description: 'Automatic release from tag $CI_COMMIT_TAG' description: '$CI_COMMIT_TAG_MESSAGE'
tag_name: '$CI_COMMIT_TAG' tag_name: '$CI_COMMIT_TAG'
ref: '$CI_COMMIT_SHA' ref: '$CI_COMMIT_SHA'
assets: assets:
links: links:
- name: 'GNU/Linux CHECKSUM SHA256 (tar.xz)'
url: '${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/linux/pamhyr-gnulinux.tar.xz.sha256'
filepath: '/linux/pamhyr-gnulinux.tar.xz.sha256'
link_type: 'package'
- name: 'GNU/Linux (tar.xz)' - name: 'GNU/Linux (tar.xz)'
url: '${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/linux/pamhyr-gnulinux.tar.xz' url: '${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/linux/pamhyr-gnulinux.tar.xz'
filepath: '/linux/pamhyr-gnulinux.tar.xz' filepath: '/linux/pamhyr-gnulinux.tar.xz'
link_type: 'package' link_type: 'package'
- name: 'Windows CHECKSUM SHA256 (exe)'
url: '${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/windows/pamhyr-windows.exe.sha256'
filepath: '/windows/pamhyr-windows.exe.sha256'
link_type: 'package'
- name: 'Windows (exe)' - name: 'Windows (exe)'
url: '${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/windows/pamhyr-windows.exe' url: '${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/windows/pamhyr-windows.exe'
filepath: '/windows/pamhyr-windows.exe' filepath: '/windows/pamhyr-windows.exe'
link_type: 'package' link_type: 'package'
- name: 'Windows CHECKSUM SHA256 (zip)'
url: '${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/windows/pamhyr-windows.zip.sha256'
filepath: '/windows/pamhyr-windows.zip.sha256'
link_type: 'package'
- name: 'Windows (zip)' - name: 'Windows (zip)'
url: '${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/windows/pamhyr-windows.zip' url: '${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/windows/pamhyr-windows.zip'
filepath: '/windows/pamhyr-windows.zip' filepath: '/windows/pamhyr-windows.zip'
link_type: 'package' link_type: 'package'
- name: 'User documentations (pdf)'
url: '${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/doc/users/documentation.pdf'
filepath: '/doc/users/documentation.pdf'
link_type: 'other'
- name: 'Dev documentations (pdf)' - name: 'Dev documentations (pdf)'
url: '${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/doc/dev/documentation.pdf' url: '${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/doc/dev/documentation.pdf'
filepath: '/doc/dev/documentation.pdf' filepath: '/doc/dev/documentation.pdf'
+2 -2
View File
@@ -1,3 +1,3 @@
Sylvain COULIBALY, INRAE, 2020 - 2022 Sylvain COULIBALY, INRAE, 2020 - 2022
Théophile TERRAZ, INRAE, 2022 - 2023 Théophile TERRAZ, INRAE, 2022 - 2024
Pierre-Antoine ROUBY, INRAE, 2023 Pierre-Antoine ROUBY, INRAE, 2023 - 2024
+2 -12
View File
@@ -25,21 +25,11 @@ for more details.
### GNU/Linux ### GNU/Linux
Downloads the [last [See documentation](https://gitlab.irstea.fr/theophile.terraz/pamhyr/-/wikis/home/en/Install%20on%20GNULinux)
realease](https://gitlab.irstea.fr/theophile.terraz/pamhyr/-/releases/permalink/latest)
GNU/Linux binary archive.
```shell
tar xf pamhyr-gnulinux.tar.xz
cd pamhyr
./Pamhyr2
```
### Windows ### Windows
Downloads the [last [See documentation](https://gitlab.irstea.fr/theophile.terraz/pamhyr/-/wikis/home/en/Install%20on%20Windows)
realease](https://gitlab.irstea.fr/theophile.terraz/pamhyr/-/releases/permalink/latest)
Windows installer or ZIP archive.
### From source code ### From source code
Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

+1 -1
View File
@@ -4,7 +4,7 @@ PyQt5-sip==12.12.2
PyQtWebEngine==5.15.6 PyQtWebEngine==5.15.6
QScintilla>=2.14.1 QScintilla>=2.14.1
pyqtgraph>=0.12.1 pyqtgraph>=0.12.1
matplotlib>=3.4.1 matplotlib>=3.7.1
numpy>=1.24.2 numpy>=1.24.2
colorama>=0.4.3 colorama>=0.4.3
pyinstaller>=5.11.0 pyinstaller>=5.11.0
+21
View File
@@ -0,0 +1,21 @@
#! /bin/bash
set +x
OPTS="-r -a -i"
if [ "$1" == "builds" ]; then
FILES="../windows/ ../linux/"
else
FILES="../windows/pamhyr-windows.exe ../windows/pamhyr-windows.zip ../linux/pamhyr-gnulinux.tar.xz"
fi
clamscan $OPTS $FILES | tee clamav.log
RES=$(cat clamav.log | grep "Infected files: 0")
if [ -z "$RES" ]; then
echo "Infected files"
exit -1
else
echo "OK"
exit 0
fi
+1 -1
View File
@@ -4,7 +4,7 @@ PyQt5-sip==12.12.2
#PyQtWebEngine==5.15.6 #PyQtWebEngine==5.15.6
QScintilla>=2.14.1 QScintilla>=2.14.1
pyqtgraph>=0.12.1 pyqtgraph>=0.12.1
matplotlib>=3.4.1 matplotlib>=3.7.1
numpy>=1.24.2 numpy>=1.24.2
colorama>=0.4.3 colorama>=0.4.3
pyinstaller>=5.11.0 pyinstaller>=5.11.0
+1 -1
View File
@@ -1,5 +1,5 @@
# Checker.py -- Pamhyr abstract checker class # Checker.py -- Pamhyr abstract checker class
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,5 +1,5 @@
# Mage.py -- Pamhyr MAGE checkers # Mage.py -- Pamhyr MAGE checkers
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,5 +1,5 @@
# Study.py -- Pamhyr study checkers # Study.py -- Pamhyr study checkers
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,5 +1,5 @@
# AMeshingTool.py -- Pamhyr # AMeshingTool.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+37 -3
View File
@@ -1,5 +1,5 @@
# Mage.py -- Pamhyr # Mage.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -65,6 +65,10 @@ class MeshingWithMage(AMeshingTool):
) )
) )
@classmethod
def _path(cls):
return cls._exe_path()
def _init_c_init_bief_from_geo_file(self): def _init_c_init_bief_from_geo_file(self):
self._c_init_bief_from_geo_file = getattr( self._c_init_bief_from_geo_file = getattr(
self._bief_lib, 'c_init_bief_from_geo_file' self._bief_lib, 'c_init_bief_from_geo_file'
@@ -278,23 +282,53 @@ class MeshingWithMageMailleurTT(AMeshingTool):
) )
) )
@classmethod
def _path(cls):
return cls._exe_path()
########### ###########
# Meshing # # Meshing #
########### ###########
def meshing(self, reach, step: float = 50): def meshing(self, reach,
step: float = 50,
limites=[-1, -1],
directrices=['un', 'np'],
lplan: bool = False,
lm: int = 3,
linear: bool = False):
if reach is None or len(reach.profiles) == 0: if reach is None or len(reach.profiles) == 0:
return reach return reach
with tempfile.TemporaryDirectory() as tmp: with tempfile.TemporaryDirectory() as tmp:
logger.debug(f"temp file: {tmp}")
st_file = self.export_reach_to_st(reach, tmp) st_file = self.export_reach_to_st(reach, tmp)
m_file = st_file.rsplit(".ST", 1)[0] + ".M" m_file = st_file.rsplit(".ST", 1)[0] + ".M"
proc = QProcess() proc = QProcess()
proc.setWorkingDirectory(tmp) proc.setWorkingDirectory(tmp)
lplan = 1 if lplan else 0
linear = 1 if linear else 0
logger.info(
f"! mailleurTT {st_file} {m_file} " +
f"{str(step)} " +
f"{limites[0]} {limites[1]} " +
f"{directrices[0]} {directrices[1]} " +
f"{lplan} {lm} {linear}"
)
proc.start( proc.start(
self._exe_path(), [st_file, m_file, str(step)] self._exe_path(),
list(map(
str,
[
st_file, m_file, step,
limites[0], limites[1],
directrices[0], directrices[1],
lplan, lm, linear
]
))
) )
proc.waitForFinished() proc.waitForFinished()
+1 -1
View File
@@ -1,5 +1,5 @@
# __init__.py -- Pamhyr # __init__.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,5 +1,5 @@
# test_Model.py -- Pamhyr # test_Model.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
# BoundaryCondition.py -- Pamhyr # BoundaryCondition.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -200,6 +200,9 @@ class BoundaryCondition(SQLSubModel):
@property @property
def name(self): def name(self):
if self._name == "":
return f"B{self.id + 1}"
return self._name return self._name
@name.setter @name.setter
@@ -1,5 +1,5 @@
# BoundaryConditionList.py -- Pamhyr # BoundaryConditionList.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
# BoundaryConditionTypes.py -- Pamhyr # BoundaryConditionTypes.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,5 +1,5 @@
# Except.py -- Pamhyr model exceptions # Except.py -- Pamhyr model exceptions
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+29 -16
View File
@@ -1,5 +1,5 @@
# Friction.py -- Pamhyr # Friction.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -26,11 +26,21 @@ logger = logging.getLogger()
class Friction(SQLSubModel): class Friction(SQLSubModel):
def __init__(self, name: str = "", status=None): _id_cnt = 0
def __init__(self, id: int = -1, name: str = "",
status=None):
super(Friction, self).__init__() super(Friction, self).__init__()
self._status = status self._status = status
if id == -1:
self.id = Friction._id_cnt
else:
self.id = id
Friction._id_cnt = max(self.id, Friction._id_cnt+1)
self._name = name self._name = name
self._edge = None self._edge = None
self._begin_kp = 0.0 self._begin_kp = 0.0
@@ -42,13 +52,13 @@ class Friction(SQLSubModel):
def _db_create(cls, execute): def _db_create(cls, execute):
execute(""" execute("""
CREATE TABLE friction( CREATE TABLE friction(
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, id INTEGER NOT NULL PRIMARY KEY,
ind INTERGER NOT NULL, ind INTEGER NOT NULL,
begin_kp REAL NOT NULL, begin_kp REAL NOT NULL,
end_kp REAL NOT NULL, end_kp REAL NOT NULL,
reach INTEGER NOT NULL, reach INTEGER NOT NULL,
begin_strickler INTERGER, begin_strickler INTEGER NOT NULL,
end_strickler INTERGER, end_strickler INTEGER NOT NULL,
FOREIGN KEY(reach) REFERENCES river_reach(id), FOREIGN KEY(reach) REFERENCES river_reach(id),
FOREIGN KEY(begin_strickler) REFERENCES stricklers(id), FOREIGN KEY(begin_strickler) REFERENCES stricklers(id),
FOREIGN KEY(end_strickler) REFERENCES stricklers(id) FOREIGN KEY(end_strickler) REFERENCES stricklers(id)
@@ -70,28 +80,30 @@ class Friction(SQLSubModel):
stricklers = data["stricklers"].stricklers stricklers = data["stricklers"].stricklers
table = execute( table = execute(
"SELECT ind, begin_kp, end_kp, begin_strickler, end_strickler " + "SELECT id, ind, begin_kp, end_kp, " +
"begin_strickler, end_strickler " +
f"FROM friction WHERE reach = {reach.id}" f"FROM friction WHERE reach = {reach.id}"
) )
for row in table: for row in table:
ind = row[0] id = row[0]
ind = row[1]
# Get stricklers # Get stricklers
if int(row[3]) == -1: if int(row[4]) == -1:
bs = None bs = None
else: else:
bs = next(filter(lambda s: s.id == row[3], stricklers)) bs = next(filter(lambda s: s.id == row[4], stricklers))
if int(row[4]) == -1: if int(row[5]) == -1:
es = None es = None
else: else:
es = next(filter(lambda s: s.id == row[4], stricklers)) es = next(filter(lambda s: s.id == row[5], stricklers))
# Create friction # Create friction
sec = cls(status=status) sec = cls(status=status)
sec.edge = reach sec.edge = reach
sec.begin_kp = row[1] sec.begin_kp = row[2]
sec.end_kp = row[2] sec.end_kp = row[3]
sec.begin_strickler = bs sec.begin_strickler = bs
sec.end_strickler = es sec.end_strickler = es
@@ -112,10 +124,11 @@ class Friction(SQLSubModel):
execute( execute(
"INSERT INTO " + "INSERT INTO " +
"friction(ind, begin_kp, end_kp, " + "friction(id, ind, begin_kp, end_kp, " +
"reach, begin_strickler, end_strickler) " + "reach, begin_strickler, end_strickler) " +
"VALUES (" + "VALUES (" +
f"{ind}, {self._begin_kp}, {self._end_kp}, " + f"{self.id}, {ind}, " +
f"{self._begin_kp}, {self._end_kp}, " +
f"{self._edge.id}, " + f"{self._edge.id}, " +
f"{b_s_id}, {e_s_id}" + f"{b_s_id}, {e_s_id}" +
")" ")"
+1 -1
View File
@@ -1,5 +1,5 @@
# FrictionList.py -- Pamhyr # FrictionList.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,5 +1,5 @@
# Point.py -- Pamhyr # Point.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,5 +1,5 @@
# PointXY.py -- Pamhyr # PointXY.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,5 +1,5 @@
# PointXYZ.py -- Pamhyr # PointXYZ.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,5 +1,5 @@
# Profile.py -- Pamhyr # Profile.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+30 -32
View File
@@ -1,5 +1,5 @@
# ProfileXYZ.py -- Pamhyr # ProfileXYZ.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -478,57 +478,55 @@ class ProfileXYZ(Profile, SQLSubModel):
return abs(rg.dist(rd)) return abs(rg.dist(rd))
def get_water_limits(self, z): def get_water_limits(self, z):
# ==================================================================== """
# détermination des points limites RG et RD pour un niveau Determine left and right limits of water elevation.
# d'eau donné """
#
# irg et ird sont les premiers indices en partant des rives
# gauche et droite qui correspondent à des points sous la
# surface de l'eau ptX et ptY sont les points interpolés où
# le plan d'eau intersecte le profil known_level est le
# niveau d'eau pour lequel on a obtenu irg, ird, ptX et ptY
# ====================================================================
# initialisation # Get the index of first point with elevation lesser than water
irg = -1 # elevation (for the right and left river side)
ird = -1 i_left = -1
i_right = -1
for i in range(self.number_points): for i in range(self.number_points):
if self.point(i).z <= z: if self.point(i).z <= z:
irg = i i_left = i
break
for i in reversed(range(self.number_points)): for i in reversed(range(self.number_points)):
if self.point(i).z <= z: if self.point(i).z <= z:
ird = i i_right = i
break
# interpolation des points ptX et ptY # Interpolate points at river left side
if (irg < self.number_points - 1): if (i_left > 0):
x = np.interp( x = np.interp(
z, z,
[self.point(irg).z, self.point(irg + 1).z], [self.point(i_left).z, self.point(i_left - 1).z],
[self.point(irg).x, self.point(irg + 1).x] [self.point(i_left).x, self.point(i_left - 1).x]
) )
y = np.interp( y = np.interp(
z, z,
[self.point(irg).z, self.point(irg + 1).z], [self.point(i_left).z, self.point(i_left - 1).z],
[self.point(irg).y, self.point(irg + 1).y] [self.point(i_left).y, self.point(i_left - 1).y]
) )
ptX = PointXYZ(x, y, z) pt_left = PointXYZ(x, y, z)
else: else:
ptX = self.point(0) pt_left = self.point(0)
if (ird > 0):
# Interpolate points at river right side
if (i_right < self.number_points - 1):
x = np.interp( x = np.interp(
z, z,
[self.point(ird-1).z, self.point(ird).z], [self.point(i_right).z, self.point(i_right + 1).z],
[self.point(ird-1).x, self.point(ird).x] [self.point(i_right).x, self.point(i_right + 1).x]
) )
y = np.interp( y = np.interp(
z, z,
[self.point(ird).z, self.point(ird - 1).z], [self.point(i_right).z, self.point(i_right + 1).z],
[self.point(ird).y, self.point(ird - 1).y] [self.point(i_right).y, self.point(i_right + 1).y]
) )
ptY = PointXYZ(x, y, z) pt_right = PointXYZ(x, y, z)
else: else:
ptY = self.point(self.number_points - 1) pt_right = self.point(self.number_points - 1)
return ptX, ptY return pt_left, pt_right
+1 -1
View File
@@ -1,5 +1,5 @@
# Reach.py -- Pamhyr # Reach.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,5 +1,5 @@
# Vector_1d.py -- Pamhyr # Vector_1d.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
# HydraulicStructures.py -- Pamhyr # HydraulicStructures.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -158,6 +158,9 @@ class BasicHS(SQLSubModel):
@property @property
def name(self): def name(self):
if self._name == "":
return f"{self._type}{self.id + 1}"
return self._name return self._name
@name.setter @name.setter
+1 -1
View File
@@ -1,5 +1,5 @@
# Types.py -- Pamhyr # Types.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,5 +1,5 @@
# Value.py -- Pamhyr # Value.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
# HydraulicStructures.py -- Pamhyr # HydraulicStructures.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -187,6 +187,9 @@ class HydraulicStructure(SQLSubModel):
@property @property
def name(self): def name(self):
if self._name == "":
return f"HS{self.id + 1}"
return self._name return self._name
@name.setter @name.setter
@@ -1,5 +1,5 @@
# HydraulicStructuresList.py -- Pamhyr # HydraulicStructuresList.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
# InitialConditions.py -- Pamhyr # InitialConditions.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
# InitialConditionsDict.py -- Pamhyr # InitialConditionsDict.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
# LateralContribution.py -- Pamhyr # LateralContribution.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -200,6 +200,9 @@ class LateralContribution(SQLSubModel):
@property @property
def name(self): def name(self):
if self._name == "":
return f"L{self.id + 1}"
return self._name return self._name
@name.setter @name.setter
@@ -1,5 +1,5 @@
# LateralContributionList.py -- Pamhyr # LateralContributionList.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
# LateralContributionTypes.py -- Pamhyr # LateralContributionTypes.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,5 +1,5 @@
# Edge.py -- Pamhyr # Edge.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,5 +1,5 @@
# Graph.py -- Pamhyr # Graph.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,5 +1,5 @@
# Node.py -- Pamhyr # Node.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,5 +1,5 @@
# Point.py -- Pamhyr # Point.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,5 +1,5 @@
# __init__.py -- Pamhyr # __init__.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,5 +1,5 @@
# test_Network.py -- Pamhyr # test_Network.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+4 -1
View File
@@ -1,5 +1,5 @@
# Reservoir.py -- Pamhyr # Reservoir.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -152,6 +152,9 @@ class Reservoir(SQLSubModel):
@property @property
def name(self): def name(self):
if self._name == "":
return f"R{self.id + 1}"
return self._name return self._name
@name.setter @name.setter
+1 -1
View File
@@ -1,5 +1,5 @@
# ReservoirList.py -- Pamhyr # ReservoirList.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,5 +1,5 @@
# Results.py -- Pamhyr # Results.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+7 -1
View File
@@ -1,5 +1,5 @@
# River.py -- Pamhyr # River.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -59,6 +59,9 @@ class Profile(object):
def get_ts_key(self, timestamp, key): def get_ts_key(self, timestamp, key):
return self._data[timestamp][key] return self._data[timestamp][key]
def has_sediment(self):
return any(map(lambda ts: "sl" in self._data[ts], self._data))
class Reach(object): class Reach(object):
def __init__(self, reach, study): def __init__(self, reach, study):
@@ -92,6 +95,9 @@ class Reach(object):
def set(self, profile_id, timestamp, key, data): def set(self, profile_id, timestamp, key, data):
self._profiles[profile_id].set(timestamp, key, data) self._profiles[profile_id].set(timestamp, key, data)
def has_sediment(self):
return any(map(lambda profile: profile.has_sediment(), self._profiles))
class River(object): class River(object):
def __init__(self, study): def __init__(self, study):
+7 -1
View File
@@ -1,5 +1,5 @@
# River.py -- Pamhyr river model # River.py -- Pamhyr river model
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -372,6 +372,12 @@ class River(Graph, SQLSubModel):
except Exception as e: except Exception as e:
logger_exception(e) logger_exception(e)
def init_default(self):
n1 = self.add_node(880.0, 950.0)
n2 = self.add_node(1120.0, 1020.0)
e = self.add_edge(n1, n2)
@property @property
def boundary_condition(self): def boundary_condition(self):
return self._boundary_condition return self._boundary_condition
+1 -1
View File
@@ -1,5 +1,5 @@
# Saved.py -- Pamhyr model status class # Saved.py -- Pamhyr model status class
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+50
View File
@@ -1,5 +1,23 @@
# SedimentLayer.py -- Pamhyr
# Copyright (C) 2024 INRAE
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from functools import reduce
from tools import trace, timer from tools import trace, timer
from Model.Tools.PamhyrDB import SQLSubModel from Model.Tools.PamhyrDB import SQLSubModel
@@ -37,6 +55,9 @@ class Layer(SQLSubModel):
@property @property
def name(self): def name(self):
if self._name == "":
return f"Layer{self.id + 1}"
return self._name return self._name
@name.setter @name.setter
@@ -204,6 +225,9 @@ class SedimentLayer(SQLSubModel):
@property @property
def name(self): def name(self):
if self._name == "":
return f"SL{self.id + 1}"
return self._name return self._name
@name.setter @name.setter
@@ -340,3 +364,29 @@ class SedimentLayer(SQLSubModel):
lst[index], lst[prev] = lst[prev], lst[index] lst[index], lst[prev] = lst[prev], lst[index]
self._status.modified() self._status.modified()
def compute_height_from_bottom(self, bottom_elevation: list):
sl_height = self.height()
sl_height_by_profile = []
for i in range(len(sl_height)):
cur_profile = []
for _ in bottom_elevation:
cur_profile.append(sl_height[i])
sl_height_by_profile.append(cur_profile)
z_sl = reduce(
lambda acc, current_sl: acc + [
list(
map(
lambda cur_sl_h, prev_sl_h: prev_sl_h - cur_sl_h,
current_sl, acc[-1]
)
)
],
sl_height_by_profile,
[bottom_elevation]
)
return z_sl
@@ -1,3 +1,19 @@
# SedimentLayerList.py -- Pamhyr
# Copyright (C) 2024 INRAE
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from tools import trace, timer from tools import trace, timer
+1 -1
View File
@@ -1,5 +1,5 @@
# Serializable.py -- Pamhyr pickle abstract class # Serializable.py -- Pamhyr pickle abstract class
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
# SolverParametersList.py -- Pamhyr # SolverParametersList.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+3 -1
View File
@@ -1,5 +1,5 @@
# Stricklers.py -- Pamhyr # Stricklers.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -120,6 +120,8 @@ class Stricklers(SQLSubModel):
@property @property
def name(self): def name(self):
if self._name == "":
return f"K{self.id + 1}"
return self._name return self._name
@name.setter @name.setter
+1 -1
View File
@@ -1,5 +1,5 @@
# StricklersList.py -- Pamhyr # StricklersList.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,5 +1,5 @@
# Study.py -- Pamhyr Study class # Study.py -- Pamhyr Study class
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+2 -2
View File
@@ -1,5 +1,5 @@
# PamhyrDB.py -- Pamhyr abstract model database classes # PamhyrDB.py -- Pamhyr abstract model database classes
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ import logging
from pathlib import Path from pathlib import Path
from functools import reduce from functools import reduce
from tools import SQL from SQL import SQL
from Model.Except import NotImplementedMethodeError from Model.Except import NotImplementedMethodeError
logger = logging.getLogger() logger = logging.getLogger()
+1 -1
View File
@@ -1,5 +1,5 @@
# PamhyrDict.py -- Pamhyr abstract dict for model classes # PamhyrDict.py -- Pamhyr abstract dict for model classes
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,5 +1,5 @@
# PamhyrList.py -- Pamhyr Abstract List object for the Model # PamhyrList.py -- Pamhyr Abstract List object for the Model
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,5 +1,5 @@
# __init__.py -- Pamhyr # __init__.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,5 +1,5 @@
# test_Model.py -- Pamhyr # test_Model.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+133
View File
@@ -0,0 +1,133 @@
# SQL.py -- Pamhyr
# Copyright (C) 2023-2024 INRAE
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# -*- coding: utf-8 -*-
import os
import logging
import sqlite3
from pathlib import Path
from tools import timer
logger = logging.getLogger()
class SQL(object):
def _init_db_file(self, db):
exists = Path(db).exists()
os.makedirs(
os.path.dirname(db),
exist_ok=True
)
self._db = sqlite3.connect(db)
self._cur = self._db.cursor()
if not exists:
self._create() # Create db
self._save() # Save
else:
self._update() # Update db scheme if necessary
self._load() # Load data
def __init__(self, filename=None):
self._db = None
if filename is not None:
self._init_db_file(filename)
def commit(self):
logger.debug("SQL - commit")
self._db.commit()
def _close(self):
self.commit()
self._db.close()
def _fetch_string(self, s):
return s.replace("&#39;", "'")
def _fetch_tuple(self, tup):
res = []
for v in tup:
if type(v) is str:
v = self._fetch_string(v)
res.append(v)
return res
def _fetch_list(self, lst):
res = []
for v in lst:
if type(v) is str:
v = self._fetch_string(v)
elif type(v) is tuple:
v = self._fetch_tuple(v)
res.append(v)
return res
def _fetch(self, res, one):
if one:
value = res.fetchone()
else:
value = res.fetchall()
res = value
if type(value) is list:
res = self._fetch_list(value)
elif type(value) is tuple:
res = self._fetch_tuple(value)
return res
def _db_format(self, value):
# Replace ''' by '&#39;' to preserve SQL injection
if type(value) is str:
value = value.replace("'", "&#39;")
return value
@timer
def execute(self, cmd, fetch_one=True, commit=False):
logger.debug(f"SQL - {cmd}")
value = None
try:
res = self._cur.execute(cmd)
if commit:
self._db.commit()
value = self._fetch(res, fetch_one)
except Exception as e:
logger_exception(e)
finally:
return value
def _create(self):
logger.warning("TODO: Create")
def _update(self):
logger.warning("TODO: Update")
def _save(self):
logger.warning("TODO: Save")
def _load(self):
logger.warning("TODO: LOAD")
+1 -1
View File
@@ -1,5 +1,5 @@
# AScript.py -- Pamhyr abstract script class # AScript.py -- Pamhyr abstract script class
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,5 +1,5 @@
# Hello.py -- Pamhyr # Hello.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,5 +1,5 @@
# ListSolver.py -- Pamhyr # ListSolver.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,5 +1,5 @@
# MageMesh.py -- Pamhyr # MageMesh.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,5 +1,5 @@
# P3DST.py -- Pamhyr # P3DST.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,5 +1,5 @@
# Run.py -- Pamhyr # Run.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,5 +1,5 @@
# ASolver.py -- Pamhyr # ASolver.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,5 +1,5 @@
# CommandLine.py -- Pamhyr # CommandLine.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,5 +1,5 @@
# GenericSolver.py -- Pamhyr # GenericSolver.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+20 -15
View File
@@ -1,5 +1,5 @@
# Mage.py -- Pamhyr # Mage.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -90,7 +90,7 @@ class Mage(CommandLineSolver):
("mage_compute_reach_volume_balance", "y"), ("mage_compute_reach_volume_balance", "y"),
("mage_max_reach_volume_balance", "0.001"), ("mage_max_reach_volume_balance", "0.001"),
("mage_min_reach_volume_to_check", "1000.0"), ("mage_min_reach_volume_to_check", "1000.0"),
("mage_init_internal", " "), ("mage_init_internal", "n"),
] ]
return lst return lst
@@ -148,9 +148,7 @@ class Mage(CommandLineSolver):
) )
for edge in edges: for edge in edges:
name = edge.name.replace(" ", "_") name = f"Reach_{edge.id + 1:>3}".replace(" ", "0")
if edge._name == "":
name = f"Reach_{edge.id}"
with mage_file_open( with mage_file_open(
os.path.join(repertory, "net", f"{name}.ST"), os.path.join(repertory, "net", f"{name}.ST"),
@@ -507,6 +505,8 @@ class Mage(CommandLineSolver):
name = bhs.name name = bhs.name
if name == "": if name == "":
name = f"HS_{bhs.id:>3}".replace(" ", "0") name = f"HS_{bhs.id:>3}".replace(" ", "0")
else:
name = name.replace(" ", "_")
f.write( f.write(
f"{sin_dict[bhs._type]} " + f"{sin_dict[bhs._type]} " +
@@ -790,6 +790,10 @@ class Mage8(Mage):
value = ("p" if value.lower() in ["y", "yes", "true"] value = ("p" if value.lower() in ["y", "yes", "true"]
else "") else "")
logger.debug(
f"export: PAR: {name}: {value} ({p.value})"
)
f.write(f"{name} {value}\n") f.write(f"{name} {value}\n")
return files return files
@@ -813,11 +817,8 @@ class Mage8(Mage):
) )
for e in edges: for e in edges:
name = e.name.replace(" ", "_") name = f"Reach_{e.id + 1:>3}".replace(" ", "0")
if e._name == "": id = name
name = f"Reach_{e.id}"
id = f"Bief_{e.id+1}"
n1 = f"{e.node1.id:3}".replace(" ", "x") n1 = f"{e.node1.id:3}".replace(" ", "x")
n2 = f"{e.node2.id:3}".replace(" ", "x") n2 = f"{e.node2.id:3}".replace(" ", "x")
@@ -1017,9 +1018,12 @@ class Mage8(Mage):
reach.set(ri, timestamp, key, d) reach.set(ri, timestamp, key, d)
if key == "Z": if key == "Z":
profile = reach.profile(ri) profile = reach.profile(ri)
ptX, ptY = profile.geometry.get_water_limits(d) limits = profile.geometry.get_water_limits(d)
reach.set(ri, timestamp, "ptX", ptX) reach.set(
reach.set(ri, timestamp, "ptY", ptY) ri, timestamp,
"water_limits",
limits
)
endline() endline()
end = newline().size <= 0 end = newline().size <= 0
@@ -1198,9 +1202,10 @@ class Mage8(Mage):
logger.info(f"read_gra: ... end with {len(ts)} timestamp read") logger.info(f"read_gra: ... end with {len(ts)} timestamp read")
@timer @timer
def results(self, study, repertory, qlog=None): def results(self, study, repertory, qlog=None, name=None):
self._study = study self._study = study
name = study.name.replace(" ", "_") if name is None:
name = study.name.replace(" ", "_")
results = super(Mage8, self).results(study, repertory, qlog, name=name) results = super(Mage8, self).results(study, repertory, qlog, name=name)
self.read_gra(study, repertory, results, qlog, name=name) self.read_gra(study, repertory, results, qlog, name=name)
+3 -3
View File
@@ -1,5 +1,5 @@
# Solvers.py -- Pamhyr # Solvers.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -24,13 +24,13 @@ from Solver.Mage import Mage7, Mage8
_translate = QCoreApplication.translate _translate = QCoreApplication.translate
solver_long_name = { solver_long_name = {
"generic": "Generic", # "generic": "Generic",
# "mage7": "Mage v7", # "mage7": "Mage v7",
"mage8": "Mage v8", "mage8": "Mage v8",
} }
solver_type_list = { solver_type_list = {
"generic": GenericSolver, # "generic": GenericSolver,
# "mage7": Mage7, # "mage7": Mage7,
"mage8": Mage8, "mage8": Mage8,
} }
+2 -2
View File
@@ -1,5 +1,5 @@
# Window.py -- Pamhyr # Window.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -67,5 +67,5 @@ class AboutWindow(PamhyrDialog):
label = f"\n - {author}" + label label = f"\n - {author}" + label
except StopIteration: except StopIteration:
label = _translate("About", "Contributors: ") + label label = _translate("About", "Contributors: ") + label
label = "Copyright © 2023 INRAE\n" + label label = "Copyright © 2023-2024 INRAE\n" + label
self.set_label_text("label_copyright", label) self.set_label_text("label_copyright", label)
+27 -68
View File
@@ -1,5 +1,5 @@
# Plot.py -- Pamhyr # Plot.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -27,8 +27,6 @@ from PyQt5.QtCore import (
QCoreApplication QCoreApplication
) )
from View.BoundaryCondition.Edit.translate import BCETranslate
_translate = QCoreApplication.translate _translate = QCoreApplication.translate
logger = logging.getLogger() logger = logging.getLogger()
@@ -47,99 +45,60 @@ class Plot(PamhyrPlot):
) )
self._table_headers = self._trad.get_dict("table_headers") self._table_headers = self._trad.get_dict("table_headers")
header = self.data.header
self.label_x = self._table_headers[header[0]]
self.label_y = self._table_headers[header[1]]
self._mode = mode self._mode = mode
self._isometric_axis = False
self._auto_relim_update = True
self._autoscale_update = True
def custom_ticks(self): def custom_ticks(self):
if self.data.header[0] != "time": if self.data.header[0] != "time":
return return
t0 = datetime.fromtimestamp(0) self.set_ticks_time_formater()
nb = len(self.data.data)
mod = int(nb / 5)
mod = mod if mod > 0 else nb
fx = list(
map(
lambda x: x[1],
filter(
lambda x: x[0] % mod == 0,
enumerate(self.data.data)
)
)
)
xx = list(map(lambda v: v[0], fx))
if self._mode == "time":
xt = list(
map(
lambda v: str(
datetime.fromtimestamp(v[0]) - t0
).split(",")[0]
.replace("days", _translate("BoundaryCondition", "days"))
.replace("day", _translate("BoundaryCondition", "day")),
fx
)
)
else:
xt = list(
map(
lambda v: str(datetime.fromtimestamp(v[0]).date()),
fx
)
)
self.canvas.axes.set_xticks(ticks=xx, labels=xt, rotation=45)
@timer @timer
def draw(self): def draw(self):
self.canvas.axes.cla() self.init_axes()
self.canvas.axes.grid(color='grey', linestyle='--', linewidth=0.5)
if len(self.data) == 0: if len(self.data) == 0:
self._init = False self._init = False
return return
self.draw_data()
self.custom_ticks()
self.idle()
self._init = True
def draw_data(self):
# Plot data # Plot data
x = list(map(lambda v: v[0], self.data.data)) x = list(map(lambda v: v[0], self.data.data))
y = list(map(lambda v: v[1], self.data.data)) y = list(map(lambda v: v[1], self.data.data))
self._line, = self.canvas.axes.plot( self._line, = self.canvas.axes.plot(
x, y, x, y,
color='r', lw=1., color=self.color_plot,
markersize=5, marker='+', **self.plot_default_kargs
picker=30,
) )
self.custom_ticks()
# Plot label
header = self.data.header
self.canvas.axes.set_xlabel(
self._table_headers[header[0]], color='black', fontsize=10
)
self.canvas.axes.set_ylabel(
self._table_headers[header[1]], color='black', fontsize=10
)
self.canvas.axes.autoscale_view(True, True, True)
self.canvas.figure.tight_layout()
self.canvas.figure.canvas.draw_idle()
# self.toolbar.update()
self._init = True
@timer @timer
def update(self, ind=None): def update(self, ind=None):
if not self._init: if not self._init:
self.draw() self.draw()
return return
self.update_data()
self.update_idle()
def update_data(self):
x = list(map(lambda v: v[0], self.data.data)) x = list(map(lambda v: v[0], self.data.data))
y = list(map(lambda v: v[1], self.data.data)) y = list(map(lambda v: v[1], self.data.data))
self._line.set_data(x, y) self._line.set_data(x, y)
self.custom_ticks()
self.canvas.axes.relim()
self.canvas.axes.autoscale()
self.canvas.figure.tight_layout()
self.canvas.figure.canvas.draw_idle()
+7 -5
View File
@@ -1,5 +1,5 @@
# Table.py -- Pamhyr # Table.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -21,7 +21,11 @@ import traceback
from datetime import date, time, datetime, timedelta from datetime import date, time, datetime, timedelta
from tools import trace, timer from tools import (
trace, timer,
timestamp_to_old_pamhyr_date,
old_pamhyr_date_to_timestamp
)
from View.Tools.PamhyrTable import PamhyrTableModel from View.Tools.PamhyrTable import PamhyrTableModel
@@ -70,9 +74,7 @@ class TableModel(PamhyrTableModel):
value = f"{v:.4f}" value = f"{v:.4f}"
elif self._data.header[column] == "time": elif self._data.header[column] == "time":
if self._opt_data == "time": if self._opt_data == "time":
t0 = datetime.fromtimestamp(0) value = timestamp_to_old_pamhyr_date(int(v))
t = datetime.fromtimestamp(v)
value = str(t - t0)
else: else:
value = str(datetime.fromtimestamp(v)) value = str(datetime.fromtimestamp(v))
else: else:
@@ -1,5 +1,5 @@
# UndoCommand.py -- Pamhyr # UndoCommand.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+3 -4
View File
@@ -1,5 +1,5 @@
# Window.py -- Pamhyr # Window.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -105,12 +105,11 @@ class EditBoundaryConditionWindow(PamhyrWindow):
trad = BCETranslate() trad = BCETranslate()
self._long_types = trad.get_dict("long_types") self._long_types = trad.get_dict("long_types")
name = self._pamhyr_name name = trad[self._pamhyr_name]
if self._data is not None: if self._data is not None:
node_name = (self._data.node.name if self._data.node is not None node_name = (self._data.node.name if self._data.node is not None
else _translate("BoundaryCondition", "Not associate")) else _translate("BoundaryCondition", "Not associate"))
name = ( name += (
_translate("Edit boundary condition", self._pamhyr_name) +
f" - {study.name} " + f" - {study.name} " +
f" - {self._data.name} ({self._data.id}) " + f" - {self._data.name} ({self._data.id}) " +
f"({self._long_types[self._data.bctype]} - {node_name})" f"({self._long_types[self._data.bctype]} - {node_name})"
+5 -1
View File
@@ -1,5 +1,5 @@
# translate.py -- Pamhyr # translate.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -29,6 +29,10 @@ class BCETranslate(BCTranslate):
def __init__(self): def __init__(self):
super(BCETranslate, self).__init__() super(BCETranslate, self).__init__()
self._dict["Edit Boundary Conditions"] = _translate(
"BoundaryCondition", "Edit boundary conditions"
)
self._sub_dict["table_headers"] = { self._sub_dict["table_headers"] = {
"x": _translate("BoundaryCondition", "X"), "x": _translate("BoundaryCondition", "X"),
"y": _translate("BoundaryCondition", "Y"), "y": _translate("BoundaryCondition", "Y"),
+1 -1
View File
@@ -1,5 +1,5 @@
# Table.py -- Pamhyr # Table.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,5 +1,5 @@
# UndoCommand.py -- Pamhyr # UndoCommand.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+7 -3
View File
@@ -1,5 +1,5 @@
# Window.py -- Pamhyr # Window.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -68,13 +68,17 @@ class BoundaryConditionWindow(PamhyrWindow):
_pamhyr_name = "Boundary conditions" _pamhyr_name = "Boundary conditions"
def __init__(self, study=None, config=None, parent=None): def __init__(self, study=None, config=None, parent=None):
name = self._pamhyr_name + " - " + study.name trad = BCTranslate()
name = (
trad[self._pamhyr_name] +
" - " + study.name
)
super(BoundaryConditionWindow, self).__init__( super(BoundaryConditionWindow, self).__init__(
title=name, title=name,
study=study, study=study,
config=config, config=config,
trad=BCTranslate(), trad=trad,
parent=parent parent=parent
) )
+5 -1
View File
@@ -1,5 +1,5 @@
# translate.py -- Pamhyr # translate.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -42,6 +42,10 @@ class BCTranslate(PamhyrTranslate):
def __init__(self): def __init__(self):
super(BCTranslate, self).__init__() super(BCTranslate, self).__init__()
self._dict["Boundary conditions"] = _translate(
"BoundaryConditions", "Boundary conditions"
)
self._sub_dict["long_types"] = { self._sub_dict["long_types"] = {
"ND": _translate("BoundaryCondition", "Not defined"), "ND": _translate("BoundaryCondition", "Not defined"),
"PC": _translate("BoundaryCondition", "Ponctual contribution"), "PC": _translate("BoundaryCondition", "Ponctual contribution"),
+1 -1
View File
@@ -1,5 +1,5 @@
# Table.py -- Pamhyr # Table.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+5 -1
View File
@@ -1,5 +1,5 @@
# Translate.py -- Pamhyr # Translate.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -27,6 +27,10 @@ class CheckListTranslate(PamhyrTranslate):
def __init__(self): def __init__(self):
super(CheckListTranslate, self).__init__() super(CheckListTranslate, self).__init__()
self._dict["Check list"] = _translate(
"Checklist", "Check list"
)
self._sub_dict["table_headers"] = { self._sub_dict["table_headers"] = {
"name": _translate("CheckList", "Name"), "name": _translate("CheckList", "Name"),
"status": _translate("CheckList", "Status"), "status": _translate("CheckList", "Status"),
+6 -3
View File
@@ -1,5 +1,5 @@
# Window.py -- Pamhyr # Window.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -54,16 +54,18 @@ class CheckListWindow(PamhyrWindow):
def __init__(self, autorun: bool = True, def __init__(self, autorun: bool = True,
study=None, config=None, study=None, config=None,
solver=None, parent=None): solver=None, parent=None):
trad = CheckListTranslate()
self._autorun = autorun self._autorun = autorun
self._solver = solver self._solver = solver
name = self._pamhyr_name + " - " + study.name name = trad[self._pamhyr_name] + " - " + study.name
super(CheckListWindow, self).__init__( super(CheckListWindow, self).__init__(
title=name, title=name,
study=study, study=study,
config=config, config=config,
trad=CheckListTranslate(), trad=trad,
options=[], options=[],
parent=parent parent=parent
) )
@@ -167,6 +169,7 @@ class CheckListWindow(PamhyrWindow):
self.find(QPushButton, "pushButton_ok").setEnabled(True) self.find(QPushButton, "pushButton_ok").setEnabled(True)
if self._autorun: if self._autorun:
self._parent.solver_log(self._solver) self._parent.solver_log(self._solver)
self.end()
self.update_statusbar() self.update_statusbar()
+1 -1
View File
@@ -1,5 +1,5 @@
# Worker.py -- Pamhyr # Worker.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+9 -3
View File
@@ -1,5 +1,5 @@
# Window.py -- Pamhyr # Window.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -20,6 +20,8 @@ from View.Tools.PamhyrWindow import PamhyrDialog
from Solver.Solvers import solver_type_list from Solver.Solvers import solver_type_list
from Solver.GenericSolver import GenericSolver from Solver.GenericSolver import GenericSolver
from View.Configure.Translate import ConfigureTranslate
from PyQt5.QtWidgets import ( from PyQt5.QtWidgets import (
QPushButton, QPushButton,
) )
@@ -30,15 +32,19 @@ class ConfigureSolverWindow(PamhyrDialog):
_pamhyr_name = "Add/Edit Solver" _pamhyr_name = "Add/Edit Solver"
def __init__(self, data=None, config=None, parent=None): def __init__(self, data=None, config=None, parent=None):
trad = ConfigureTranslate()
if data is not None: if data is not None:
name = f"Edit Solver - {data.name}" name = trad["edit_solver"]
name += f" - {data.name}"
else: else:
name = "Add a new Solver" name = trad["add_solver"]
super(ConfigureSolverWindow, self).__init__( super(ConfigureSolverWindow, self).__init__(
title=name, title=name,
config=config, config=config,
options=[], options=[],
trad=trad,
parent=parent parent=parent
) )
+13 -1
View File
@@ -1,5 +1,5 @@
# Translate.py -- Pamhyr # Translate.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -27,8 +27,20 @@ class ConfigureTranslate(PamhyrTranslate):
def __init__(self): def __init__(self):
super(ConfigureTranslate, self).__init__() super(ConfigureTranslate, self).__init__()
self._dict["Configure"] = _translate(
"Configure", "Configure"
)
self._sub_dict["table_headers"] = { self._sub_dict["table_headers"] = {
"name": _translate("Configure", "Name"), "name": _translate("Configure", "Name"),
"type": _translate("Configure", "Type"), "type": _translate("Configure", "Type"),
"description": _translate("Configure", "Description"), "description": _translate("Configure", "Description"),
} }
# Solvers
self._dict["edit_solver"] = _translate(
"Configure", "Edit solver"
)
self._dict["add_solver"] = _translate(
"Configure", "Add a new solver"
)
+5 -27
View File
@@ -1,5 +1,5 @@
# Window.py -- Pamhyr # Window.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -83,10 +83,12 @@ class ConfigureWindow(PamhyrDialog):
if config is None: if config is None:
config = Config() config = Config()
trad = ConfigureTranslate()
super(ConfigureWindow, self).__init__( super(ConfigureWindow, self).__init__(
title=self._pamhyr_name, title=trad[self._pamhyr_name],
config=config, config=config,
trad=ConfigureTranslate(), trad=trad,
options=[], options=[],
parent=parent parent=parent
) )
@@ -119,15 +121,6 @@ class ConfigureWindow(PamhyrDialog):
) )
def setup_data(self): def setup_data(self):
# # Meshing_Tool
# self.set_line_edit_text("lineEdit_meshing_tool",
# self._config.meshing_tool)
# Const
self.set_line_edit_text("lineEdit_segment", str(self._config.segment))
self.set_line_edit_text("lineEdit_max_listing",
str(self._config.max_listing))
# Backup # Backup
self.set_check_box("checkBox_backup", self._config.backup_enable) self.set_check_box("checkBox_backup", self._config.backup_enable)
self.set_line_edit_text("lineEdit_backup_path", self.set_line_edit_text("lineEdit_backup_path",
@@ -168,12 +161,6 @@ class ConfigureWindow(PamhyrDialog):
"lineEdit_backup_path", f[0] "lineEdit_backup_path", f[0]
) )
), ),
# "pushButton_meshing_tool": lambda: self.file_dialog(
# select_file=True,
# callback=lambda f: self.set_line_edit_text(
# "lineEdit_meshing_tool", f[0]
# )
# ),
} }
for button in buttons: for button in buttons:
@@ -183,15 +170,6 @@ class ConfigureWindow(PamhyrDialog):
# Solvers # Solvers
self._config.solvers = self.solver_table_model._data.copy() self._config.solvers = self.solver_table_model._data.copy()
# # Meshing_Tool
# self._config.meshing_tool = self.get_line_edit_text(
# "lineEdit_meshing_tool")
# Const
self._config.segment = self.get_line_edit_text("lineEdit_segment")
self._config.max_listing = self.get_line_edit_text(
"lineEdit_max_listing")
# Backup # Backup
self._config.backup_enable = self.get_check_box("checkBox_backup") self._config.backup_enable = self.get_check_box("checkBox_backup")
self._config.backup_path = self.get_line_edit_text( self._config.backup_path = self.get_line_edit_text(
+4 -2
View File
@@ -1,5 +1,5 @@
# Window.py -- Pamhyr # Window.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -54,8 +54,10 @@ class ReplWindow(PamhyrWindow):
def __init__(self, study=None, config=None, def __init__(self, study=None, config=None,
solver=None, parent=None): solver=None, parent=None):
title = _translate("Debug", "Debug REPL")
super(ReplWindow, self).__init__( super(ReplWindow, self).__init__(
title=self._pamhyr_name, title=title,
study=study, study=study,
config=config, config=config,
options=[], options=[],
+9 -4
View File
@@ -1,5 +1,5 @@
# Window.py -- Pamhyr # Window.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ import sys
import logging import logging
import subprocess import subprocess
from PyQt5.QtCore import QUrl from PyQt5.QtCore import QUrl, QCoreApplication
from PyQt5.QtGui import QDesktopServices from PyQt5.QtGui import QDesktopServices
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QAction from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QAction
from PyQt5.QtWebEngineWidgets import QWebEngineView, QWebEngineSettings from PyQt5.QtWebEngineWidgets import QWebEngineView, QWebEngineSettings
@@ -30,10 +30,12 @@ from View.Tools.PamhyrWindow import PamhyrWindow
logger = logging.getLogger() logger = logging.getLogger()
_translate = QCoreApplication.translate
class DocWindow(PamhyrWindow): class DocWindow(PamhyrWindow):
_pamhyr_ui = "WebView" _pamhyr_ui = "WebView"
_pamhyr_name = "Doc" _pamhyr_name = "Documentation"
@classmethod @classmethod
def _path_file(cls, filename): def _path_file(cls, filename):
@@ -55,8 +57,11 @@ class DocWindow(PamhyrWindow):
def __init__(self, filename=None, def __init__(self, filename=None,
study=None, config=None, study=None, config=None,
parent=None): parent=None):
title = _translate("Documentation", "Documentation")
title += f" - {filename}"
super(DocWindow, self).__init__( super(DocWindow, self).__init__(
title=self._pamhyr_name, title=title,
study=study, study=study,
config=config, config=config,
options=[], options=[],
+1 -1
View File
@@ -1,5 +1,5 @@
# DummyWindow.py -- Pamhyr # DummyWindow.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+65 -56
View File
@@ -1,5 +1,5 @@
# PlotStricklers.py -- Pamhyr # PlotStricklers.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -31,7 +31,66 @@ _translate = QCoreApplication.translate
class PlotStricklers(PamhyrPlot): class PlotStricklers(PamhyrPlot):
def draw_frictions(self, frictions, color="r"): def __init__(self, data=None, canvas=None, trad=None,
toolbar=None, parent=None):
super(PlotStricklers, self).__init__(
canvas=canvas,
trad=trad,
data=data,
toolbar=toolbar,
parent=parent
)
self.label_x = self._trad["kp"]
self.label_y = self._trad["stricklers"]
self.line_kp_elevation = [None, None]
self._isometric_axis = False
self._auto_relim = False
self._auto_relim_update = False
self._autoscale_update = True
@timer
def draw(self, highlight=None):
self.init_axes()
if self.data is None:
return
self.draw_data()
self.idle()
self._init = True
def draw_data(self):
kp = self.data.reach.get_kp()
self.canvas.axes.set_xlim(
left=min(kp), right=max(kp)
)
frictions = self.data.frictions
if len(frictions) != 0:
lst = frictions.frictions
self.draw_frictions(lst, self.color_plot)
# HightLight
kp_min, kp_max = (-1, -1)
if self._highlight_data is not None:
kp_min, kp_max = self._highlight_data
lst = list(
filter(
lambda s: (s.begin_kp == kp_min and
s.end_kp == kp_max),
frictions.frictions
)
)
self.draw_frictions(lst, self.color_plot_highlight)
def draw_frictions(self, frictions, color):
lst = sorted( lst = sorted(
filter( filter(
lambda f: f.is_full_defined(), lambda f: f.is_full_defined(),
@@ -57,66 +116,16 @@ class PlotStricklers(PamhyrPlot):
coef_minor = list(map(lambda s: s.minor, coef)) coef_minor = list(map(lambda s: s.minor, coef))
coef_medium = list(map(lambda s: s.medium, coef)) coef_medium = list(map(lambda s: s.medium, coef))
self.line_kp_elevation = self.canvas.axes.plot( self.line_kp_elevation[0] = self.canvas.axes.plot(
kp, coef_minor, kp, coef_minor,
color=color, lw=1. color=color, lw=1.
) )
self.line_kp_elevation = self.canvas.axes.plot( self.line_kp_elevation[1] = self.canvas.axes.plot(
kp, coef_medium, kp, coef_medium,
color=color, lw=1. color=color, lw=1.
) )
@timer @timer
def draw(self, highlight=None): def update(self):
self.canvas.axes.cla() self.draw()
self.canvas.axes.grid(color='grey', linestyle='--', linewidth=0.5)
if self.data is None:
return
self.canvas.axes.set_ylabel(
_translate("MainWindow_reach", "Stricklers"),
color='black', fontsize=11
)
self.canvas.axes.set_xlabel(
_translate("MainWindow_reach", "Kp (m)"),
color='black', fontsize=11
)
kp = self.data.reach.get_kp()
self.canvas.axes.set_xlim(
left=min(kp), right=max(kp)
)
frictions = self.data.frictions
if len(frictions) != 0:
lst = frictions.frictions
self.draw_frictions(lst)
# HightLight
kp_min, kp_max = (-1, -1)
if highlight is not None:
kp_min, kp_max = highlight
lst = list(
filter(
lambda s: (s.begin_kp == kp_min and
s.end_kp == kp_max),
frictions.frictions
)
)
self.draw_frictions(lst, color="b")
self.canvas.figure.tight_layout()
self.canvas.figure.canvas.draw_idle()
if self.toolbar is not None:
self.toolbar.update()
# self._init = True
@timer
def update(self, ind=None):
if not self._init:
self.draw()
return
+1 -1
View File
@@ -1,5 +1,5 @@
# Table.py -- Pamhyr # Table.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,5 +1,5 @@
# UndoCommand.py -- Pamhyr # UndoCommand.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
+28 -19
View File
@@ -1,5 +1,5 @@
# Window.py -- Pamhyr # Window.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -62,6 +62,8 @@ class FrictionsWindow(PamhyrWindow):
_pamhyr_name = "Edit frictions" _pamhyr_name = "Edit frictions"
def __init__(self, reach=None, study=None, config=None, parent=None): def __init__(self, reach=None, study=None, config=None, parent=None):
trad = FrictionsTranslate()
if reach is not None: if reach is not None:
self._reach = reach self._reach = reach
else: else:
@@ -70,7 +72,7 @@ class FrictionsWindow(PamhyrWindow):
self._frictions = self._reach.frictions self._frictions = self._reach.frictions
name = ( name = (
self._pamhyr_name + " - " trad[self._pamhyr_name] + " - "
+ study.name + " - " + study.name + " - "
+ self._reach.name + self._reach.name
) )
@@ -79,7 +81,7 @@ class FrictionsWindow(PamhyrWindow):
title=name, title=name,
study=study, study=study,
config=config, config=config,
trad=FrictionsTranslate(), trad=trad,
parent=parent parent=parent
) )
@@ -130,8 +132,8 @@ class FrictionsWindow(PamhyrWindow):
self.plot = PlotKPZ( self.plot = PlotKPZ(
canvas=self.canvas, canvas=self.canvas,
data=self._reach.reach, data=self._reach.reach,
trad=self._trad,
toolbar=None, toolbar=None,
display_current=False
) )
self.plot.draw() self.plot.draw()
@@ -143,6 +145,7 @@ class FrictionsWindow(PamhyrWindow):
self.plot_2 = PlotStricklers( self.plot_2 = PlotStricklers(
canvas=self.canvas_2, canvas=self.canvas_2,
data=self._reach, data=self._reach,
trad=self._trad,
toolbar=None toolbar=None
) )
self.plot_2.draw() self.plot_2.draw()
@@ -157,10 +160,10 @@ class FrictionsWindow(PamhyrWindow):
table = self.find(QTableView, f"tableView") table = self.find(QTableView, f"tableView")
table.selectionModel()\ table.selectionModel()\
.selectionChanged\ .selectionChanged\
.connect(self._set_current_reach) .connect(self.update)
self._table.dataChanged\ self._table.dataChanged\
.connect(self._set_current_reach) .connect(self.update)
def index_selected_rows(self): def index_selected_rows(self):
table = self.find(QTableView, f"tableView") table = self.find(QTableView, f"tableView")
@@ -174,6 +177,16 @@ class FrictionsWindow(PamhyrWindow):
) )
) )
def update(self):
self._set_current_reach()
# self._propagate_update(key="friction")
def _propagated_update(self, key=None):
if key != "geometry":
return
self.update_plot()
def _set_current_reach(self): def _set_current_reach(self):
rows = self.index_selected_rows() rows = self.index_selected_rows()
@@ -187,20 +200,16 @@ class FrictionsWindow(PamhyrWindow):
sec = self._frictions.get(rows[0]) sec = self._frictions.get(rows[0])
highlight = (sec.begin_kp, sec.end_kp) highlight = (sec.begin_kp, sec.end_kp)
self.plot = PlotKPZ( self.update_plot(highlight)
canvas=self.canvas,
data=reach,
toolbar=None,
display_current=False
)
self.plot.draw(highlight=highlight)
self.plot = PlotStricklers( def update_plot(self, highlight=None):
canvas=self.canvas_2, if highlight is not None:
data=data, self.plot.highlight = highlight
toolbar=None self.plot.draw()
)
self.plot.draw(highlight=highlight) if highlight is not None:
self.plot_2.highlight = highlight
self.plot_2.draw()
def add(self): def add(self):
rows = self.index_selected_rows() rows = self.index_selected_rows()
+12 -1
View File
@@ -1,5 +1,5 @@
# translate.py -- Pamhyr # translate.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -27,6 +27,17 @@ class FrictionsTranslate(PamhyrTranslate):
def __init__(self): def __init__(self):
super(FrictionsTranslate, self).__init__() super(FrictionsTranslate, self).__init__()
self._dict["kp"] = _translate(
"Frictions", "Kp (m)"
)
self._dict["stricklers"] = _translate(
"Frictions", "Stricklers"
)
self._dict["Edit frictions"] = _translate(
"Frictions", "Edit frictions"
)
self._sub_dict["table_headers"] = { self._sub_dict["table_headers"] = {
# "name": _translate("Frictions", "Name"), # "name": _translate("Frictions", "Name"),
# "edge": _translate("Frictions", "Reach"), # "edge": _translate("Frictions", "Reach"),
+183
View File
@@ -0,0 +1,183 @@
# MeshingDialog.py -- Pamhyr
# Copyright (C) 2023-2024 INRAE
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# -*- coding: utf-8 -*-
from View.Tools.PamhyrWindow import PamhyrDialog
from PyQt5.QtGui import (
QKeySequence,
)
from PyQt5.QtCore import (
Qt, QVariant, QAbstractTableModel,
)
from PyQt5.QtWidgets import (
QDialogButtonBox, QComboBox, QUndoStack, QShortcut,
QDoubleSpinBox,
)
class MeshingDialog(PamhyrDialog):
_pamhyr_ui = "MeshingOptions"
_pamhyr_name = "Meshing"
def __init__(self, reach, trad=None, parent=None):
super(MeshingDialog, self).__init__(
title=trad[self._pamhyr_name],
trad=trad,
options=[],
parent=parent
)
self._reach = reach
self._profiles = None
self._init_default_values()
def _init_default_values(self):
self._space_step = 50.0
self._lplan = False
self._lm = "3"
self._linear = False
self._begin_cs = -1
self._end_cs = -1
self._begin_dir = "un"
self._end_dir = "np"
self._init_default_values_profiles()
self._init_default_values_guidelines()
self.set_double_spin_box(
"doubleSpinBox_space_step",
self._space_step
)
lm_dict = self._trad.get_dict("lm_dict")
self.combobox_add_items(
"comboBox_lm", list(
map(
lambda x: lm_dict[x],
["1", "2", "3"]
)
)
)
self.set_combobox_text("comboBox_lm", self._lm)
if self._linear:
self.set_radio_button("radioButton_linear", True)
else:
self.set_radio_button("radioButton_spline", True)
def _init_default_values_profiles(self):
profiles = self.profiles
self.combobox_add_items("comboBox_begin_kp", profiles)
self.combobox_add_items("comboBox_end_kp", profiles)
self.set_combobox_text("comboBox_begin_kp", profiles[0])
self.set_combobox_text("comboBox_end_kp", profiles[-1])
@property
def profiles(self):
if self._profiles is None:
self._profiles = list(
map(
lambda p: self._profile_name(p),
self._reach.profiles
)
)
return self._profiles
def _profile_name(self, profile):
name = profile.name
if name == "":
name = f"{profile.kp}"
else:
name += f" ({profile.kp})"
return name
def _init_default_values_guidelines(self):
gl, _ = self._reach.compute_guidelines()
gl = list(gl)
bgl = ['un'] + gl
egl = gl + ['np']
self.combobox_add_items("comboBox_begin_gl", bgl)
self.combobox_add_items("comboBox_end_gl", egl)
self.set_combobox_text("comboBox_begin_gl", self._begin_dir)
self.set_combobox_text("comboBox_end_gl", self._end_dir)
@property
def space_step(self):
return self._space_step
@property
def lplan(self):
return self._lplan
@property
def lm(self):
return int(self._lm)
@property
def linear(self):
return self._linear
@property
def begin_cs(self):
return self._begin_cs + 1
@property
def end_cs(self):
return self._end_cs + 1
@property
def begin_dir(self):
return self._begin_dir
@property
def end_dir(self):
return self._end_dir
def accept(self):
self._space_step = self.get_double_spin_box(
"doubleSpinBox_space_step",
)
self._linear = self.get_radio_button("radioButton_linear")
p1 = self.get_combobox_text("comboBox_begin_kp")
p2 = self.get_combobox_text("comboBox_end_kp")
self._begin_cs = self.profiles.index(p1)
self._end_cs = self.profiles.index(p2)
self._begin_dir = self.get_combobox_text("comboBox_begin_gl")
self._end_dir = self.get_combobox_text("comboBox_end_gl")
r_lm_dict = self._trad.get_dict("r_lm_dict")
self._lm = r_lm_dict[self.get_combobox_text("comboBox_lm")]
super().accept()
def reject(self):
self.close()
Loaded 100 of 226 files, more files were not shown because too many files have changed in this diff. Show more