diff --git a/.github/workflows/msvc-code-analysis.yml b/.github/workflows/msvc-code-analysis.yml index 66b47d479f37b1653fe20916122df16dca79ea88..3892838112f088c2672a233544d2c8f85b5b7ff4 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 faf2e8b7f3d380a960e1e9fdd424e9358af65d14..898d2741049441972784f0ba7942907d61b3cdc5 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<unsigned>(std::numeric_limits<int>::max())) { - return std::numeric_limits<std::size_t>::max(); + // If read incorrectly or the material_id is not safely convertible to + // int. + return std::numeric_limits<int>::max(); } - return material_id; + // Safe conversion was checked above. + return static_cast<int>(material_id); } MeshLib::Element* readElement(std::istream& in, @@ -289,7 +294,7 @@ MeshLib::Mesh* MeshIO::loadMeshFromFile(const std::string& file_name) { std::vector<MeshLib::Node*> nodes; std::vector<MeshLib::Element*> elements; - std::vector<std::size_t> materials; + std::vector<int> materials; while (!in.eof()) { diff --git a/MeshToolsLib/ZeroMeshFieldDataByMaterialIDs.cpp b/MeshToolsLib/ZeroMeshFieldDataByMaterialIDs.cpp index d36aee77c286219069973110a484a42fda93e3ed..f1644372e4d15ca25d6a45388790d27e071aef30 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 e533dbccc3d66fe26c025bf26e46c71e00a459a3..eb4efc471f814311fbee00782d0f32adcd6fb043 100644 --- a/NumLib/StaggeredCoupling/CreateStaggeredCoupling.h +++ b/NumLib/StaggeredCoupling/CreateStaggeredCoupling.h @@ -12,6 +12,7 @@ #pragma once #include <memory> +#include <string> #include <vector> namespace BaseLib diff --git a/Tests/Data/TH2M/H2M/Liakopoulos/liakopoulos_TH2M.prj b/Tests/Data/TH2M/H2M/Liakopoulos/liakopoulos_TH2M.prj index 67887389f068e7e1449e46e99dbad36753c6bdb7..fe492560c1e92b15ed3c39fab9c276d6f503d545 100644 --- a/Tests/Data/TH2M/H2M/Liakopoulos/liakopoulos_TH2M.prj +++ b/Tests/Data/TH2M/H2M/Liakopoulos/liakopoulos_TH2M.prj @@ -200,7 +200,7 @@ <type>PerComponentDeltaX</type> <norm_type>NORM2</norm_type> <abstols>1e-15 1e-15 1e-05 1e-05 1.e-05</abstols> - <reltols>1e-12 1e-12 1e-15 1e-10 1.e-10</reltols> + <reltols>1e-12 1e-11 1e-15 1e-10 1.e-10</reltols> </convergence_criterion> <time_discretization> <type>BackwardEuler</type> diff --git a/pyproject.toml b/pyproject.toml index 8f0af55e70c285ed43e2ab86e71f54bd9a864ed0..113abb2a11c0c7dd47ae36e8dc57e13d84ee880f 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 84ea090a82c2ceb4a4c18614bbe237b5fa68897a..5a8e2b4ded0a46a8e0e970869f65bff204b034b5 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 c4e687de1c61ad97a7ed14f3f0851ebb433baef1..f84ade6b177bdda1a56d3644bf56117a4441cd45 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: