diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 56893ba9ac93bda32af2423cb25f1765a5e5ebf1..6a18ea99da0a020ebb375e31f98211d3ecabae98 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -5,8 +5,13 @@ ENV \ # Adapt when changing base image: DIST_DIR=ub2204x64 RUN apt-get update \ - && apt-get install -yq --no-install-recommends gpg curl ca-certificates \ - && curl -fsSL https://download.feflow.com/download/FEFLOW/linux/dhi-feflow-key.asc | gpg --dearmor | sudo tee /usr/share/keyrings/feflow.gpg > /dev/null \ + && apt-get install -yq --no-install-recommends gpg curl ca-certificates +# Error: The following packages have unmet dependencies: +# feflow-console81 : Depends: aspnetcore-runtime-6.0 but it is not installable +# Add dot net repos for debian 12 (bookworm base image) +RUN curl -fsSL https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb -o packages-microsoft-prod.deb \ + && dpkg -i packages-microsoft-prod.deb && rm packages-microsoft-prod.deb +RUN curl -fsSL https://download.feflow.com/download/FEFLOW/linux/dhi-feflow-key.asc | gpg --dearmor | sudo tee /usr/share/keyrings/feflow.gpg > /dev/null \ && echo "deb [arch=amd64 signed-by=/usr/share/keyrings/feflow.gpg] https://download.feflow.com/download/FEFLOW/linux/apt-repo/$DIST_DIR stable main" | sudo tee /etc/apt/sources.list.d/feflow.stable.list \ && apt-get update \ && apt list | grep feflow \ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a7c4ec506f13b9ae35d2c2c08a8c2068106647b6..ca5326a5f9a5944831d2fa58d098d0e125ca72a7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,7 +6,6 @@ stages: variables: POETRY_CACHE_DIR: "$CI_PROJECT_DIR/.cache" DOCKER_IMAGE: registry.opengeosys.org/ogs/tools/ogstools/devcontainer-3.9 - DOCKER_IMAGE_PINNED: registry.opengeosys.org/ogs/tools/ogstools/devcontainer-3.9:feflow-8.0 DOCKER_USER_IMAGE: registry.opengeosys.org/ogs/tools/ogstools/main-3.9 workflow: @@ -20,7 +19,7 @@ workflow: - if: $CI_COMMIT_TAG - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PROJECT_PATH == "ogs/tools/ogstools"' -image: $DOCKER_IMAGE_PINNED +image: $DOCKER_IMAGE cache: paths: @@ -151,6 +150,7 @@ devcontainer image: rules: - changes: - .devcontainer/* + - when: manual script: - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - devcontainer build --workspace-folder . --push true --image-name ${DOCKER_IMAGE} diff --git a/Dockerfile b/Dockerfile index 111f38709b7648d51a01fdf15b8c04fcec87ef62..774f5217aecc2c95daa47010c18e42b008b5e7b0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM registry.opengeosys.org/ogs/tools/ogstools/devcontainer-3.9:feflow-8.0 +FROM registry.opengeosys.org/ogs/tools/ogstools/devcontainer-3.9 RUN --mount=target=/ogstools,type=bind,source=.,readwrite \ pip install /ogstools[feflow] \ diff --git a/ogstools/feflowlib/_feflowlib.py b/ogstools/feflowlib/_feflowlib.py index dab5c739bdc142db9218ffb425ccf86e22e922ca..3fc7b83d84163f0389a55e5810934eb3ec26d752 100644 --- a/ogstools/feflowlib/_feflowlib.py +++ b/ogstools/feflowlib/_feflowlib.py @@ -16,15 +16,6 @@ ifm.forceLicense("Viewer") logger = log.getLogger(__name__) -def _getSpeciesName(doc: ifm.FeflowDoc, i: int) -> str: - try: - species = doc.getSpeciesName(i) - except RuntimeError: - species = "single_species" - - return species - - def points_and_cells(doc: ifm.FeflowDoc) -> tuple[np.ndarray, list, list]: """ Get points and cells in a pyvista compatible format. @@ -305,8 +296,12 @@ def get_species_parameter( obsolete_data[data] = point_or_cell # If there is only a single species in the model, doc.getSpeciesName(i) throws a # RunTimeError. - for i in range(doc.getNumberOfSpecies()): - species = _getSpeciesName(doc, i) + number_of_species = doc.getNumberOfSpecies() + for species_id in range(number_of_species): + if number_of_species > 1: + species = doc.getSpeciesName(species_id) + else: + species = "single_species" par = ( doc.getParameter(getattr(ifm.Enum, data), species) if species != "single_species" diff --git a/pyproject.toml b/pyproject.toml index f73358bd791f4b6e8aa2cb88179da47d83a5a501..091f43742d3fceb4522259e6e3b29dccf2f1d4a9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -67,7 +67,7 @@ docs = [ "trame-vtk>=2.6.0", ] feflow = [ - "ifm_contrib>=0.2.1", + "ifm_contrib>=0.2.2", "matplotlib<3.8", # TODO: remove when ifm_contrib supports matplotlib 3.8 ]