mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
Compare commits
106
Commits
No files matched your search
+150
-30
@@ -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'
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -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 |
@@ -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
|
||||||
|
|||||||
Executable
+21
@@ -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
@@ -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,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
@@ -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,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,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
|
||||||
|
|||||||
+36
-4
@@ -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,11 +282,21 @@ 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
|
||||||
|
|
||||||
@@ -294,9 +308,27 @@ class MeshingWithMageMailleurTT(AMeshingTool):
|
|||||||
proc = QProcess()
|
proc = QProcess()
|
||||||
proc.setWorkingDirectory(tmp)
|
proc.setWorkingDirectory(tmp)
|
||||||
|
|
||||||
logger.debug(f"! mailleurTT {st_file} {m_file} {str(step)}")
|
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,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,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
@@ -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
|
||||||
|
|||||||
@@ -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,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,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,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,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,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
|
||||||
|
|||||||
@@ -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,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,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,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,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,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,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,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,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,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,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
|
||||||
|
|||||||
@@ -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,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,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
|
||||||
|
|||||||
@@ -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
@@ -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
@@ -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
|
||||||
|
|||||||
@@ -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,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
|
||||||
|
|||||||
@@ -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,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
@@ -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
|
||||||
|
|||||||
@@ -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,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,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,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,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
@@ -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("'", "'")
|
||||||
|
|
||||||
|
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 ''' to preserve SQL injection
|
||||||
|
if type(value) is str:
|
||||||
|
value = value.replace("'", "'")
|
||||||
|
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,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,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,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,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,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
@@ -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,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,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,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
|
||||||
|
|||||||
+15
-13
@@ -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"),
|
||||||
@@ -792,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
|
||||||
@@ -815,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")
|
||||||
@@ -1019,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
|
||||||
|
|||||||
@@ -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,
|
||||||
}
|
}
|
||||||
@@ -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)
|
||||||
@@ -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()
|
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -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})"
|
||||||
|
|||||||
@@ -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,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,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
|
||||||
|
|||||||
@@ -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
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -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,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,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"),
|
||||||
|
|||||||
@@ -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,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
|
||||||
|
|||||||
@@ -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
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -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"
|
||||||
|
)
|
||||||
@@ -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(
|
||||||
|
|||||||
@@ -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=[],
|
||||||
|
|||||||
@@ -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,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
|
||||||
|
|||||||
@@ -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,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,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
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|||||||
@@ -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"),
|
||||||
|
|||||||
@@ -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
Reference in new issue
Block a user