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/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()) { 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; }); } 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 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 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..f84ade6b177 100644 --- a/scripts/ci/jobs/build-win.yml +++ b/scripts/ci/jobs/build-win.yml @@ -5,12 +5,11 @@ 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 + -DOGS_USE_UNITY_BUILDS=OFF build win msvc: extends: