Skip to content

Commit

Permalink
Merge branch 'win-enable-th2m' into 'master'
Browse files Browse the repository at this point in the history
[ci] Re-enable TH2M on Windows.

See merge request ogs/ogs!4757
  • Loading branch information
endJunction committed Aug 25, 2024
2 parents 4aea7bc + a921bff commit 6e85bab
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/msvc-code-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 10 additions & 5 deletions MeshLib/IO/Legacy/MeshIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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())
{
Expand Down
2 changes: 1 addition & 1 deletion MeshToolsLib/ZeroMeshFieldDataByMaterialIDs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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; });
}

Expand Down
1 change: 1 addition & 0 deletions NumLib/StaggeredCoupling/CreateStaggeredCoupling.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#pragma once

#include <memory>
#include <string>
#include <vector>

namespace BaseLib
Expand Down
2 changes: 1 addition & 1 deletion Tests/Data/TH2M/H2M/Liakopoulos/liakopoulos_TH2M.prj
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion scripts/ci/jobs/build-gui-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]/
Expand Down
3 changes: 1 addition & 2 deletions scripts/ci/jobs/build-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 6e85bab

Please sign in to comment.