mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
Compare commits
22
Commits
No files matched your search
+149
-29
@@ -20,6 +20,8 @@ stages:
|
|||||||
- test
|
- test
|
||||||
- build
|
- build
|
||||||
- package
|
- package
|
||||||
|
- hash
|
||||||
|
- antivirus
|
||||||
- release
|
- release
|
||||||
|
|
||||||
#############
|
#############
|
||||||
@@ -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'
|
||||||
|
|||||||
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
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -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,7 +52,7 @@ 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 INTEGER 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,
|
||||||
@@ -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}" +
|
||||||
")"
|
")"
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -37,6 +37,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 +207,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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
+5
-1
@@ -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
|
||||||
@@ -792,6 +792,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
|
||||||
|
|||||||
@@ -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,
|
||||||
}
|
}
|
||||||
@@ -167,6 +167,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()
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,6 @@ class GeometryTranslate(PamhyrTranslate):
|
|||||||
|
|
||||||
self._sub_dict["table_headers"] = {
|
self._sub_dict["table_headers"] = {
|
||||||
"name": _translate("Geometry", "Name"),
|
"name": _translate("Geometry", "Name"),
|
||||||
"kp": _translate("Geometry", "KP"),
|
"kp": _translate("Geometry", "KP (m)"),
|
||||||
"poins": _translate("Geometry", "Points"),
|
"poins": _translate("Geometry", "Points"),
|
||||||
}
|
}
|
||||||
@@ -41,22 +41,22 @@ hydraulic structure values?"
|
|||||||
# BHSValues translation
|
# BHSValues translation
|
||||||
|
|
||||||
self._dict['width'] = _translate(
|
self._dict['width'] = _translate(
|
||||||
"BasicHydraulicStructures", "Width"
|
"BasicHydraulicStructures", "Width (m)"
|
||||||
)
|
)
|
||||||
self._dict['height'] = _translate(
|
self._dict['height'] = _translate(
|
||||||
"BasicHydraulicStructures", "Height"
|
"BasicHydraulicStructures", "Thickness (m)"
|
||||||
)
|
)
|
||||||
self._dict['elevation'] = _translate(
|
self._dict['elevation'] = _translate(
|
||||||
"BasicHydraulicStructures", "Elevation"
|
"BasicHydraulicStructures", "Elevation (m)"
|
||||||
)
|
)
|
||||||
self._dict['diameter'] = _translate(
|
self._dict['diameter'] = _translate(
|
||||||
"BasicHydraulicStructures", "Diameter"
|
"BasicHydraulicStructures", "Diameter (m)"
|
||||||
)
|
)
|
||||||
self._dict['discharge_coefficient'] = _translate(
|
self._dict['discharge_coefficient'] = _translate(
|
||||||
"BasicHydraulicStructures", "Discharge coefficient"
|
"BasicHydraulicStructures", "Discharge coefficient"
|
||||||
)
|
)
|
||||||
self._dict['loading_elevation'] = _translate(
|
self._dict['loading_elevation'] = _translate(
|
||||||
"BasicHydraulicStructures", "Loading elevation"
|
"BasicHydraulicStructures", "Upper elevation (m)"
|
||||||
)
|
)
|
||||||
self._dict['half-angle_tangent'] = _translate(
|
self._dict['half-angle_tangent'] = _translate(
|
||||||
"BasicHydraulicStructures", "Half-angle tangent"
|
"BasicHydraulicStructures", "Half-angle tangent"
|
||||||
@@ -65,13 +65,13 @@ hydraulic structure values?"
|
|||||||
"BasicHydraulicStructures", "Maximal loading elevation"
|
"BasicHydraulicStructures", "Maximal loading elevation"
|
||||||
)
|
)
|
||||||
self._dict['siltation_height'] = _translate(
|
self._dict['siltation_height'] = _translate(
|
||||||
"BasicHydraulicStructures", "Siltation height"
|
"BasicHydraulicStructures", "Siltation height (m)"
|
||||||
)
|
)
|
||||||
self._dict['top_of_the_vault'] = _translate(
|
self._dict['top_of_the_vault'] = _translate(
|
||||||
"BasicHydraulicStructures", "Top of the vault"
|
"BasicHydraulicStructures", "Top of the vault (m)"
|
||||||
)
|
)
|
||||||
self._dict['bottom_of_the_vault'] = _translate(
|
self._dict['bottom_of_the_vault'] = _translate(
|
||||||
"BasicHydraulicStructures", "Bottom of the vault"
|
"BasicHydraulicStructures", "Bottom of the vault (m)"
|
||||||
)
|
)
|
||||||
self._dict['opening'] = _translate(
|
self._dict['opening'] = _translate(
|
||||||
"BasicHydraulicStructures", "Opening"
|
"BasicHydraulicStructures", "Opening"
|
||||||
|
|||||||
@@ -30,5 +30,5 @@ class HydraulicStructuresTranslate(PamhyrTranslate):
|
|||||||
self._sub_dict["table_headers"] = {
|
self._sub_dict["table_headers"] = {
|
||||||
"name": _translate("HydraulicStructures", "Name"),
|
"name": _translate("HydraulicStructures", "Name"),
|
||||||
"reach": _translate("HydraulicStructures", "Reach"),
|
"reach": _translate("HydraulicStructures", "Reach"),
|
||||||
"kp": _translate("HydraulicStructures", "Kp"),
|
"kp": _translate("HydraulicStructures", "Kp (m)"),
|
||||||
}
|
}
|
||||||
+32
-22
@@ -175,7 +175,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
|||||||
self.findChild(QAction, action).setEnabled(enable)
|
self.findChild(QAction, action).setEnabled(enable)
|
||||||
|
|
||||||
def setup_sc(self):
|
def setup_sc(self):
|
||||||
# self._run_sc = QShortcut(QKeySequence("F5"), self)
|
self._run_sc = QShortcut(QKeySequence("F6"), self)
|
||||||
return
|
return
|
||||||
|
|
||||||
def setup_connection(self):
|
def setup_connection(self):
|
||||||
@@ -202,7 +202,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
|||||||
"action_menu_initial_conditions": self.open_initial_conditions,
|
"action_menu_initial_conditions": self.open_initial_conditions,
|
||||||
"action_menu_edit_friction": self.open_frictions,
|
"action_menu_edit_friction": self.open_frictions,
|
||||||
"action_menu_edit_lateral_contribution": self.open_lateral_contrib,
|
"action_menu_edit_lateral_contribution": self.open_lateral_contrib,
|
||||||
"action_menu_run_solver": self.run_solver,
|
"action_menu_run_solver": self.select_and_run_solver,
|
||||||
"action_menu_sediment_layers": self.open_sediment_layers,
|
"action_menu_sediment_layers": self.open_sediment_layers,
|
||||||
"action_menu_edit_reach_sediment_layers":
|
"action_menu_edit_reach_sediment_layers":
|
||||||
self.open_reach_sediment_layers,
|
self.open_reach_sediment_layers,
|
||||||
@@ -222,7 +222,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
|||||||
"action_toolBar_open": self.open_model,
|
"action_toolBar_open": self.open_model,
|
||||||
"action_toolBar_save": self.save_study,
|
"action_toolBar_save": self.save_study,
|
||||||
"action_toolBar_close": self.close_model,
|
"action_toolBar_close": self.close_model,
|
||||||
"action_toolBar_run_solver": self.run_solver,
|
"action_toolBar_run_solver": self.run_lasest_solver,
|
||||||
# Current actions
|
# Current actions
|
||||||
"action_toolBar_network": self.open_network,
|
"action_toolBar_network": self.open_network,
|
||||||
"action_toolBar_geometry": self.open_geometry,
|
"action_toolBar_geometry": self.open_geometry,
|
||||||
@@ -243,7 +243,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
|||||||
.triggered.connect(actions[action])
|
.triggered.connect(actions[action])
|
||||||
# action.triggered.connect(actions[action])
|
# action.triggered.connect(actions[action])
|
||||||
|
|
||||||
# self._run_sc.activated.connect(self.run_solver)
|
self._run_sc.activated.connect(self.run_lasest_solver)
|
||||||
|
|
||||||
def changeEvent(self, event):
|
def changeEvent(self, event):
|
||||||
if event.type() == QEvent.LanguageChange:
|
if event.type() == QEvent.LanguageChange:
|
||||||
@@ -808,7 +808,13 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
|||||||
)
|
)
|
||||||
sl.show()
|
sl.show()
|
||||||
|
|
||||||
def run_solver(self):
|
def run_lasest_solver(self):
|
||||||
|
if self._last_solver is None:
|
||||||
|
return
|
||||||
|
|
||||||
|
self.run_solver(self._last_solver)
|
||||||
|
|
||||||
|
def select_and_run_solver(self):
|
||||||
if self._study is None:
|
if self._study is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -818,25 +824,29 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
|||||||
parent=self
|
parent=self
|
||||||
)
|
)
|
||||||
if run.exec():
|
if run.exec():
|
||||||
solver = run.solver
|
self.run_solver(run.solver)
|
||||||
|
|
||||||
if self.sub_window_exists(
|
def run_solver(self, solver):
|
||||||
CheckListWindow,
|
if self._study is None:
|
||||||
data=[
|
return
|
||||||
self._study,
|
|
||||||
self.conf,
|
|
||||||
solver
|
|
||||||
]
|
|
||||||
):
|
|
||||||
return
|
|
||||||
|
|
||||||
check = CheckListWindow(
|
if self.sub_window_exists(
|
||||||
study=self._study,
|
CheckListWindow,
|
||||||
config=self.conf,
|
data=[
|
||||||
solver=solver,
|
self._study,
|
||||||
parent=self
|
self.conf,
|
||||||
)
|
solver
|
||||||
check.show()
|
]
|
||||||
|
):
|
||||||
|
return
|
||||||
|
|
||||||
|
check = CheckListWindow(
|
||||||
|
study=self._study,
|
||||||
|
config=self.conf,
|
||||||
|
solver=solver,
|
||||||
|
parent=self
|
||||||
|
)
|
||||||
|
check.show()
|
||||||
|
|
||||||
def solver_log(self, solver):
|
def solver_log(self, solver):
|
||||||
sol = SolverLogWindow(
|
sol = SolverLogWindow(
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class CustomPlotTranslate(ResultsTranslate):
|
|||||||
"CustomPlot", "Kp (m)"
|
"CustomPlot", "Kp (m)"
|
||||||
)
|
)
|
||||||
self._dict['elevation'] = _translate(
|
self._dict['elevation'] = _translate(
|
||||||
"CustomPlot", "Elevation (m)"
|
"CustomPlot", "Bed load elevation (m)"
|
||||||
)
|
)
|
||||||
self._dict['water_elevation'] = _translate(
|
self._dict['water_elevation'] = _translate(
|
||||||
"CustomPlot", "Water elevation (m)"
|
"CustomPlot", "Water elevation (m)"
|
||||||
@@ -48,7 +48,7 @@ class CustomPlotTranslate(ResultsTranslate):
|
|||||||
# Unit corresponding long name (plot axes display)
|
# Unit corresponding long name (plot axes display)
|
||||||
|
|
||||||
self._dict['0-meter'] = _translate(
|
self._dict['0-meter'] = _translate(
|
||||||
"CustomPlot", "Elevation (m)"
|
"CustomPlot", "Bed load elevation (m)"
|
||||||
)
|
)
|
||||||
self._dict['1-m3s'] = _translate(
|
self._dict['1-m3s'] = _translate(
|
||||||
"CustomPlot", "Discharge (m³/s)"
|
"CustomPlot", "Discharge (m³/s)"
|
||||||
|
|||||||
@@ -225,8 +225,11 @@ class SolverLogWindow(PamhyrWindow):
|
|||||||
self._log_int(msg, color)
|
self._log_int(msg, color)
|
||||||
|
|
||||||
def _log_str(self, msg, color=None):
|
def _log_str(self, msg, color=None):
|
||||||
|
if msg == "":
|
||||||
|
return
|
||||||
|
|
||||||
logger.info(f"solver: {msg}")
|
logger.info(f"solver: {msg}")
|
||||||
msg = msg.rsplit('\n')[0]
|
msg = msg.rsplit('\n', 1)[0]
|
||||||
|
|
||||||
if color is not None:
|
if color is not None:
|
||||||
msg = f"<font color=\"{color}\">" + msg + "</font>"
|
msg = f"<font color=\"{color}\">" + msg + "</font>"
|
||||||
|
|||||||
@@ -11,12 +11,12 @@ class SedimentEditTranslate(SedimentTranslate):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(SedimentEditTranslate, self).__init__()
|
super(SedimentEditTranslate, self).__init__()
|
||||||
|
|
||||||
self._dict["height"] = _translate("SedimentLayers", "Height (m)"),
|
self._dict["height"] = _translate("SedimentLayers", "Thickness (m)"),
|
||||||
|
|
||||||
self._sub_dict["table_headers"] = {
|
self._sub_dict["table_headers"] = {
|
||||||
"name": _translate("SedimentLayers", "Name"),
|
"name": _translate("SedimentLayers", "Name"),
|
||||||
# "type": _translate("SedimentLayers", "Type"),
|
# "type": _translate("SedimentLayers", "Type"),
|
||||||
"height": _translate("SedimentLayers", "Height"),
|
"height": _translate("SedimentLayers", "Thickness (m)"),
|
||||||
"d50": _translate("SedimentLayers", "D50"),
|
"d50": _translate("SedimentLayers", "D50"),
|
||||||
"sigma": _translate("SedimentLayers", "Sigma"),
|
"sigma": _translate("SedimentLayers", "Sigma"),
|
||||||
"critical_constraint": _translate("SedimentLayers",
|
"critical_constraint": _translate("SedimentLayers",
|
||||||
|
|||||||
@@ -96,76 +96,6 @@ class TableModel(PamhyrTableModel):
|
|||||||
self.dataChanged.emit(index, index)
|
self.dataChanged.emit(index, index)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# def add(self, row, parent=QModelIndex()):
|
|
||||||
# self.beginInsertRows(parent, row, row - 1)
|
|
||||||
|
|
||||||
# self._undo.push(
|
|
||||||
# AddCommand(
|
|
||||||
# self._lst, row
|
|
||||||
# )
|
|
||||||
# )
|
|
||||||
|
|
||||||
# self.endInsertRows()
|
|
||||||
# self.layoutChanged.emit()
|
|
||||||
|
|
||||||
# def delete(self, rows, parent=QModelIndex()):
|
|
||||||
# self.beginRemoveRows(parent, rows[0], rows[-1])
|
|
||||||
|
|
||||||
# self._undo.push(
|
|
||||||
# DelCommand(
|
|
||||||
# self._lst, rows
|
|
||||||
# )
|
|
||||||
# )
|
|
||||||
|
|
||||||
# self.endRemoveRows()
|
|
||||||
# self.layoutChanged.emit()
|
|
||||||
|
|
||||||
# def sort(self, _reverse, parent=QModelIndex()):
|
|
||||||
# self.layoutAboutToBeChanged.emit()
|
|
||||||
|
|
||||||
# self._undo.push(
|
|
||||||
# SortCommand(
|
|
||||||
# self._lst, False
|
|
||||||
# )
|
|
||||||
# )
|
|
||||||
|
|
||||||
# self.layoutAboutToBeChanged.emit()
|
|
||||||
# self.layoutChanged.emit()
|
|
||||||
|
|
||||||
# def move_up(self, row, parent=QModelIndex()):
|
|
||||||
# if row <= 0:
|
|
||||||
# return
|
|
||||||
|
|
||||||
# target = row + 2
|
|
||||||
|
|
||||||
# self.beginMoveRows(parent, row - 1, row - 1, parent, target)
|
|
||||||
|
|
||||||
# self._undo_stack.push(
|
|
||||||
# MoveCommand(
|
|
||||||
# self._lst, "up", row
|
|
||||||
# )
|
|
||||||
# )
|
|
||||||
|
|
||||||
# self.endMoveRows()
|
|
||||||
# self.layoutChanged.emit()
|
|
||||||
|
|
||||||
# def move_down(self, index, parent=QModelIndex()):
|
|
||||||
# if row > len(self._lst):
|
|
||||||
# return
|
|
||||||
|
|
||||||
# target = row
|
|
||||||
|
|
||||||
# self.beginMoveRows(parent, row + 1, row + 1, parent, target)
|
|
||||||
|
|
||||||
# self._undo_stack.push(
|
|
||||||
# MoveCommand(
|
|
||||||
# self._lst, "down", row
|
|
||||||
# )
|
|
||||||
# )
|
|
||||||
|
|
||||||
# self.endMoveRows()
|
|
||||||
# self.layoutChanged.emit()
|
|
||||||
|
|
||||||
def undo(self):
|
def undo(self):
|
||||||
self._undo.undo()
|
self._undo.undo()
|
||||||
self.layoutChanged.emit()
|
self.layoutChanged.emit()
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class StricklersTranslate(PamhyrTranslate):
|
|||||||
|
|
||||||
self._sub_dict["table_headers"] = {
|
self._sub_dict["table_headers"] = {
|
||||||
"name": _translate("LateralContribution", "Name"),
|
"name": _translate("LateralContribution", "Name"),
|
||||||
"minor": _translate("LateralContribution", "Minor bed"),
|
"minor": _translate("LateralContribution", "Main channel"),
|
||||||
"medium": _translate("LateralContribution", "Medium bed"),
|
"medium": _translate("LateralContribution", "Floodway"),
|
||||||
"comment": _translate("LateralContribution", "Comment"),
|
"comment": _translate("LateralContribution", "Comment"),
|
||||||
}
|
}
|
||||||
@@ -89,6 +89,8 @@ class NewStudyWindow(PamhyrDialog):
|
|||||||
|
|
||||||
if self._study is None:
|
if self._study is None:
|
||||||
study = Study.new(name, description)
|
study = Study.new(name, description)
|
||||||
|
study.river.init_default()
|
||||||
|
|
||||||
if self.get_radio_button("radioButton_date"):
|
if self.get_radio_button("radioButton_date"):
|
||||||
date = self.get_datetime_edit("dateTimeEdit_date")
|
date = self.get_datetime_edit("dateTimeEdit_date")
|
||||||
study.use_date(date)
|
study.use_date(date)
|
||||||
|
|||||||
@@ -35,13 +35,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton_cancel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Cancel</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton_run">
|
<widget class="QPushButton" name="pushButton_run">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -53,6 +46,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_cancel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Cancel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>640</width>
|
<width>1152</width>
|
||||||
<height>480</height>
|
<height>648</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>640</width>
|
<width>1152</width>
|
||||||
<height>22</height>
|
<height>22</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
|||||||
+313
-214
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user