From 0ceca23d9866c1733330b04e39c274ef13ee310e Mon Sep 17 00:00:00 2001 From: Lars Bilke Date: Mon, 9 Oct 2023 10:40:12 +0200 Subject: [PATCH 1/6] [ci] Re-enable TH2M on Windows. --- .github/workflows/msvc-code-analysis.yml | 2 +- pyproject.toml | 1 - scripts/ci/jobs/build-gui-win.yml | 2 +- scripts/ci/jobs/build-win.yml | 2 -- 4 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/msvc-code-analysis.yml b/.github/workflows/msvc-code-analysis.yml index 66b47d479f3..3892838112f 100644 --- a/.github/workflows/msvc-code-analysis.yml +++ b/.github/workflows/msvc-code-analysis.yml @@ -15,7 +15,7 @@ jobs: uses: actions/checkout@v2 - name: Configure CMake - run: cmake -B ${{ env.build }} -DCMAKE_BUILD_TYPE=${{ env.config }} -DOGS_BUILD_PROCESS_TH2M=OFF -DOGS_USE_UNITY_BUILDS=OFF -DOGS_BUILD_TESTING=OFF -DOGS_ENABLE_ELEMENT_PRISM=OFF -DOGS_ENABLE_ELEMENT_PYRAMID=OFF -DOGS_MAX_ELEMENT_DIM=2 + run: cmake -B ${{ env.build }} -DCMAKE_BUILD_TYPE=${{ env.config }} -DOGS_USE_UNITY_BUILDS=OFF -DOGS_BUILD_TESTING=OFF -DOGS_ENABLE_ELEMENT_PRISM=OFF -DOGS_ENABLE_ELEMENT_PYRAMID=OFF -DOGS_MAX_ELEMENT_DIM=2 # Build is not required unless generated source files are used # - name: Build CMake diff --git a/pyproject.toml b/pyproject.toml index 8f0af55e70c..113abb2a11c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -78,7 +78,6 @@ environment-pass = [ # maybe this should be moved to CMake logic, i.e. disabling both features on win [tool.cibuildwheel.windows.config-settings] "cmake.define.OGS_USE_MFRONT" = "OFF" -"cmake.define.OGS_BUILD_PROCESS_TH2M" = "OFF" # Generator needs to be set here, CMAKE_GENERATOR env var does not work. # Ninja generator does not select the host64 compiler. "cmake.args" = "-G;Visual Studio 16 2019;--preset;wheel" diff --git a/scripts/ci/jobs/build-gui-win.yml b/scripts/ci/jobs/build-gui-win.yml index 84ea090a82c..5a8e2b4ded0 100644 --- a/scripts/ci/jobs/build-gui-win.yml +++ b/scripts/ci/jobs/build-gui-win.yml @@ -5,7 +5,7 @@ build gui win: rules: - if: '$CI_COMMIT_BRANCH == "master"' variables: - ADDITIONAL_CMAKE_ARGS: " -DOGS_BUILD_CLI=ON -DOGS_BUILD_PROCESS_TH2M=OFF" + ADDITIONAL_CMAKE_ARGS: " -DOGS_BUILD_CLI=ON" BUILD_TESTS: "false" BUILD_CTEST: "false" - if: $CI_COMMIT_BRANCH =~ /^v[0-9]\.[0-9]\.[0-9]/ diff --git a/scripts/ci/jobs/build-win.yml b/scripts/ci/jobs/build-win.yml index c4e687de1c6..772a55de8b0 100644 --- a/scripts/ci/jobs/build-win.yml +++ b/scripts/ci/jobs/build-win.yml @@ -5,10 +5,8 @@ build win: variables: CHECK_WARNINGS: "true" CMAKE_PRESET: release - # TODO: temporary switched off TH2M CMAKE_ARGS: >- -DOGS_CI_TESTRUNNER_REPEAT=1 - -DOGS_BUILD_PROCESS_TH2M=OFF -DOGS_USE_PIP=ON -DOGS_USE_MKL=ON From b06231ebc1a4b399f2f65fadc89231cbf877288c Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Mon, 22 Apr 2024 22:45:45 +0200 Subject: [PATCH 2/6] [T/TH2M] Relax NLS norm; reaching minimum on win --- Tests/Data/TH2M/H2M/Liakopoulos/liakopoulos_TH2M.prj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/Data/TH2M/H2M/Liakopoulos/liakopoulos_TH2M.prj b/Tests/Data/TH2M/H2M/Liakopoulos/liakopoulos_TH2M.prj index 67887389f06..fe492560c1e 100644 --- a/Tests/Data/TH2M/H2M/Liakopoulos/liakopoulos_TH2M.prj +++ b/Tests/Data/TH2M/H2M/Liakopoulos/liakopoulos_TH2M.prj @@ -200,7 +200,7 @@ PerComponentDeltaX NORM2 1e-15 1e-15 1e-05 1e-05 1.e-05 - 1e-12 1e-12 1e-15 1e-10 1.e-10 + 1e-12 1e-11 1e-15 1e-10 1.e-10 BackwardEuler From e770c4ca0f006ffece9fccde158bbc29f505d064 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Mon, 22 Jul 2024 14:45:08 +0200 Subject: [PATCH 3/6] [ci] Disable unity builds on windows --- scripts/ci/jobs/build-win.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/ci/jobs/build-win.yml b/scripts/ci/jobs/build-win.yml index 772a55de8b0..f84ade6b177 100644 --- a/scripts/ci/jobs/build-win.yml +++ b/scripts/ci/jobs/build-win.yml @@ -9,6 +9,7 @@ build win: -DOGS_CI_TESTRUNNER_REPEAT=1 -DOGS_USE_PIP=ON -DOGS_USE_MKL=ON + -DOGS_USE_UNITY_BUILDS=OFF build win msvc: extends: From e0ae06022852f8bb88591ee61bef22b8e06288cf Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Mon, 22 Jul 2024 15:19:57 +0200 Subject: [PATCH 4/6] [NL] Include --- NumLib/StaggeredCoupling/CreateStaggeredCoupling.h | 1 + 1 file changed, 1 insertion(+) diff --git a/NumLib/StaggeredCoupling/CreateStaggeredCoupling.h b/NumLib/StaggeredCoupling/CreateStaggeredCoupling.h index e533dbccc3d..eb4efc471f8 100644 --- a/NumLib/StaggeredCoupling/CreateStaggeredCoupling.h +++ b/NumLib/StaggeredCoupling/CreateStaggeredCoupling.h @@ -12,6 +12,7 @@ #pragma once #include +#include #include namespace BaseLib From 8db8708d75fc33dec43be20d28298304d91f4963 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Thu, 22 Aug 2024 15:11:21 +0200 Subject: [PATCH 5/6] [MeL/IO] Explicit checked material ids conversion The legacy reader is designed for unsigned type of material ids, but current implementation works on signed integers. This fixes a compilation warning. --- MeshLib/IO/Legacy/MeshIO.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/MeshLib/IO/Legacy/MeshIO.cpp b/MeshLib/IO/Legacy/MeshIO.cpp index faf2e8b7f3d..898d2741049 100644 --- a/MeshLib/IO/Legacy/MeshIO.cpp +++ b/MeshLib/IO/Legacy/MeshIO.cpp @@ -29,15 +29,20 @@ namespace { -std::size_t readMaterialID(std::istream& in) +int readMaterialID(std::istream& in) { unsigned index; unsigned material_id; - if (!(in >> index >> material_id)) + + if (!(in >> index >> material_id) || + material_id > static_cast(std::numeric_limits::max())) { - return std::numeric_limits::max(); + // If read incorrectly or the material_id is not safely convertible to + // int. + return std::numeric_limits::max(); } - return material_id; + // Safe conversion was checked above. + return static_cast(material_id); } MeshLib::Element* readElement(std::istream& in, @@ -289,7 +294,7 @@ MeshLib::Mesh* MeshIO::loadMeshFromFile(const std::string& file_name) { std::vector nodes; std::vector elements; - std::vector materials; + std::vector materials; while (!in.eof()) { From a921bffe653a792b7ac0f49287d986343c662ea2 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Fri, 23 Aug 2024 13:14:37 +0200 Subject: [PATCH 6/6] [MTL] Avoid int to double and back conversion --- MeshToolsLib/ZeroMeshFieldDataByMaterialIDs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MeshToolsLib/ZeroMeshFieldDataByMaterialIDs.cpp b/MeshToolsLib/ZeroMeshFieldDataByMaterialIDs.cpp index d36aee77c28..f1644372e4d 100644 --- a/MeshToolsLib/ZeroMeshFieldDataByMaterialIDs.cpp +++ b/MeshToolsLib/ZeroMeshFieldDataByMaterialIDs.cpp @@ -81,7 +81,7 @@ void zeroMeshFieldDataByMaterialIDs( std::transform(element_ip_data_offsets.begin(), element_ip_data_offsets.end(), element_ip_data_offsets.begin(), - [n = n_components](double const v) + [n = n_components](std::size_t const v) { return v / n; }); }