Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,3 @@ runs:
run: |
echo "MACOSX_DEPLOYMENT_TARGET=15.0" >> $GITHUB_ENV

- name: Setup vcpkg (Windows)
shell: bash
if: ${{ inputs.os == 'windows-latest' }}
run: |
git clone https://github.com/microsoft/vcpkg.git
./vcpkg/bootstrap-vcpkg.bat
24 changes: 17 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
container: ${{ matrix.container }}

env:
VCPKG_COMMIT: c3867e714dd3a51c272826eea77267876517ed99
VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/.vcpkg-bincache

name: "🧪 Test on ${{ matrix.os }} (⚙️: ${{ matrix.config }}, 💿: ${{ matrix.container || matrix.os }})"
Expand All @@ -50,28 +51,37 @@ jobs:
if: ${{ matrix.os == 'macos-latest' }}
run: brew install vtk

- name: Create vcpkg binary cache dir
if: ${{ matrix.os == 'windows-latest' }}
- name: 🖥️ Setup vcpkg (Windows)
shell: pwsh
if: ${{ matrix.os == 'windows-latest' }}
run: |
Remove-Item Env:VCPKG_ROOT -ErrorAction SilentlyContinue

git clone https://github.com/microsoft/vcpkg.git
git -C vcpkg checkout $env:VCPKG_COMMIT
& .\vcpkg\bootstrap-vcpkg.bat

"VCPKG_ROOT=$($env:GITHUB_WORKSPACE)\vcpkg" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append

New-Item -ItemType Directory -Force -Path "${{ env.VCPKG_DEFAULT_BINARY_CACHE }}"

- name: 🦥 Cache VTK vcpkg build
- name: 🦥 Cache vcpkg binary (Windows)
if: ${{ matrix.os == 'windows-latest' }}
uses: actions/cache@v4
with:
path: ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}
key: vcpkg-${{ matrix.os }}-${{ matrix.config }}
key: vcpkg-${{ matrix.os }}-${{ matrix.config }}-${{ env.VCPKG_COMMIT }}

- name: 🛠️ Build VTK (Windows)
- name: 🛠️ Build Dependencies (Windows)
if: ${{ matrix.os == 'windows-latest' }}
shell: pwsh
run: |
./vcpkg/vcpkg install vtk
./vcpkg/vcpkg install --triplet x64-windows

- name: 🏗️ Compile (Windows)
if: ${{ matrix.os == 'windows-latest' }}
run: |
cmake -DVIENNALS_BUILD_TESTS=ON -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake -B build
cmake -DVIENNALS_BUILD_TESTS=ON -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows -B build
cmake --build build --config ${{ matrix.config }}

- name: 🏗️ Compile (other)
Expand Down
32 changes: 22 additions & 10 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
container: ${{ matrix.container }}

env:
VCPKG_COMMIT: c3867e714dd3a51c272826eea77267876517ed99
VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/.vcpkg-bincache

name: "🐍 Test Bindings on ${{ matrix.os }}"
Expand All @@ -43,27 +44,36 @@ jobs:
with:
os: ${{ matrix.os }}

- name: 📋 Install MacOS Dependencies
if: ${{ matrix.os == 'macos-latest' }}
run: brew install vtk

- name: Create vcpkg binary cache dir
if: ${{ matrix.os == 'windows-latest' }}
- name: 🖥️ Setup vcpkg (Windows)
shell: pwsh
if: ${{ matrix.os == 'windows-latest' }}
run: |
Remove-Item Env:VCPKG_ROOT -ErrorAction SilentlyContinue

git clone https://github.com/microsoft/vcpkg.git
git -C vcpkg checkout $env:VCPKG_COMMIT
& .\vcpkg\bootstrap-vcpkg.bat

"VCPKG_ROOT=$($env:GITHUB_WORKSPACE)\vcpkg" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append

New-Item -ItemType Directory -Force -Path "${{ env.VCPKG_DEFAULT_BINARY_CACHE }}"

- name: 🦥 Cache VTK vcpkg build
- name: 📋 Install MacOS Dependencies
if: ${{ matrix.os == 'macos-latest' }}
run: brew install vtk

- name: 🦥 Cache vcpkg binary
if: ${{ matrix.os == 'windows-latest' }}
uses: actions/cache@v4
with:
path: ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}
key: vcpkg-${{ matrix.os }}-Release
key: vcpkg-${{ matrix.os }}-Release-${{ env.VCPKG_COMMIT }}

- name: 🛠️ Build VTK (Windows)
if: ${{ matrix.os == 'windows-latest' }}
shell: pwsh
run: |
./vcpkg/vcpkg install vtk
./vcpkg/vcpkg install --triplet x64-windows

- name: 🛠️ Disable IPO
if: ${{ matrix.os == 'ubuntu-latest' }}
Expand All @@ -79,7 +89,9 @@ jobs:
$toolchain = "${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake".Replace('\', '/')

.\venv\Scripts\python -m pip install --upgrade pip
.\venv\Scripts\python -m pip install . --config-settings=cmake.args="-DCMAKE_TOOLCHAIN_FILE=$toolchain"
.\venv\Scripts\python -m pip install . `
--config-settings=cmake.define.CMAKE_TOOLCHAIN_FILE="$toolchain" `
--config-settings=cmake.define.VCPKG_TARGET_TRIPLET="x64-windows"
.\venv\Scripts\python -c "import viennals; print(viennals.__doc__)"

- name: 🐍 Build and check Python Module (Other)
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.20 FATAL_ERROR)
project(
ViennaLS
LANGUAGES CXX
VERSION 5.7.1)
VERSION 5.7.2)

# --------------------------------------------------------------------------------------------------------
# Library options
Expand Down Expand Up @@ -111,7 +111,7 @@ include(cmake/vtk.cmake)

CPMAddPackage(
NAME ViennaCore
VERSION 2.1.1
VERSION 2.1.2
GIT_REPOSITORY "https://github.com/ViennaTools/ViennaCore"
OPTIONS "VIENNACORE_FORMAT_EXCLUDE build/"
EXCLUDE_FROM_ALL ${VIENNALS_BUILD_PYTHON})
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ We recommend using [CPM.cmake](https://github.com/cpm-cmake/CPM.cmake) to consum

* Installation with CPM
```cmake
CPMAddPackage("gh:viennatools/viennals@5.6.0")
CPMAddPackage("gh:viennatools/viennals@5.7.2")
```

* With a local installation
Expand Down
16 changes: 13 additions & 3 deletions include/viennals/lsToHullMesh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ template <class T, int D> class ToHullMesh {
SmartPointer<MaterialMap> materialMap = nullptr;
bool generateSharpCorners = false;
T bottomExtension = 0.0;
double minNodeDistanceFactor = 0.05;

/// Generate hull mesh using ToMultiSurfaceMesh and boundary caps.
/// generateSharpCorners is forwarded to the converter. Works for both
Expand Down Expand Up @@ -71,7 +72,7 @@ template <class T, int D> class ToHullMesh {
}

// Generate multi-surface mesh with sharp corners
ToMultiSurfaceMesh<T, D> converter;
ToMultiSurfaceMesh<T, D> converter(minNodeDistanceFactor, 1e-12);
for (auto &ls : levelSets)
converter.insertNextLevelSet(ls);
if (materialMap)
Expand All @@ -89,7 +90,7 @@ template <class T, int D> class ToHullMesh {
double rangeMin, double rangeMax) {
int varyingAxis = 1 - boundaryAxis;
std::vector<std::pair<double, unsigned>> boundaryNodes;
double tolerance = 1e-6 * gridDelta;
const double tolerance = 1e-6 * gridDelta;

for (unsigned i = 0; i < multiMesh->nodes.size(); ++i) {
if (std::abs(multiMesh->nodes[i][boundaryAxis] - fixedValue) <
Expand Down Expand Up @@ -204,7 +205,7 @@ template <class T, int D> class ToHullMesh {
using EdgeKey = std::tuple<int, int, int, int>;
std::map<EdgeKey, unsigned> edgeToNode;
std::map<std::tuple<int, int, int>, unsigned> existingGridNodes;
double invGridDelta = 1.0 / gridDelta;
const double invGridDelta = 1.0 / gridDelta;

for (unsigned i = 0; i < multiMesh->nodes.size(); ++i) {
const auto &pos = multiMesh->nodes[i];
Expand Down Expand Up @@ -447,6 +448,15 @@ template <class T, int D> class ToHullMesh {
}
}

void setMinNodeDistanceFactor(double factor) {
if (factor <= 0) {
VIENNACORE_LOG_WARNING("ToHullMesh: minNodeDistanceFactor must be "
"positive. Ignoring value.");
return;
}
minNodeDistanceFactor = factor;
}

void apply() { generateHull(); }
};

Expand Down
4 changes: 2 additions & 2 deletions include/viennals/lsVersion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
namespace viennals {

// Version information generated by CMake
inline constexpr const char *version = "5.7.1";
inline constexpr const char *version = "5.7.2";
inline constexpr int versionMajor = 5;
inline constexpr int versionMinor = 7;
inline constexpr int versionPatch = 1;
inline constexpr int versionPatch = 2;

// Utility functions for version comparison
inline constexpr uint32_t versionAsInteger() {
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ requires = [
build-backend = "scikit_build_core.build"

[project]
version = "5.7.1"
version = "5.7.2"
name = "ViennaLS"
readme = "README.md"
license = {file = "LICENSE"}
Expand Down
5 changes: 4 additions & 1 deletion python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ add_dependencies(${PROJECT_NAME} ${MOD})

set(VIENNALS_LIB_FOLDER ${CMAKE_BINARY_DIR}/${PKG}.libs)

viennacore_setup_vtk_env(${MOD} ${VIENNALS_LIB_FOLDER})
if(VIENNALS_PACKAGE_PYTHON OR MSVC)
# Copy the required libraries to the lib folder, this is required for packaging and on Windows
viennacore_setup_vtk_env(${MOD} ${VIENNALS_LIB_FOLDER})
endif()

install(
DIRECTORY ${VIENNALS_LIB_FOLDER}
Expand Down
9 changes: 7 additions & 2 deletions python/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ def _windows_dll_path():
]

for path in additional_paths:
os.add_dll_directory(path)
os.environ["PATH"] = path + os.pathsep + os.environ["PATH"]
if os.path.isdir(path):
os.add_dll_directory(path)
os.environ["PATH"] = path + os.pathsep + os.environ["PATH"]
else:
print(f"Warning: DLL path {path} does not exist.")


import sys as _sys
Expand Down Expand Up @@ -51,6 +54,7 @@ def setDimension(d: int):
else:
raise ValueError("Dimension must be 2 or 3.")


def getDimension() -> int:
"""Get the current dimension of the simulation.

Expand All @@ -61,6 +65,7 @@ def getDimension() -> int:
"""
return PROXY_DIM


def __getattr__(name):
# 1) common/top-level from _core
try:
Expand Down
4 changes: 2 additions & 2 deletions python/viennals/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,6 @@ def setDimension(d: int):

"""
PROXY_DIM: int = 2
__version__: str = '5.7.1'
version: str = '5.7.1'
__version__: str = '5.7.2'
version: str = '5.7.2'
_C = _core
4 changes: 2 additions & 2 deletions python/viennals/_core.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,6 @@ class VoidTopSurfaceEnum(enum.IntEnum):
"""
def setNumThreads(arg0: typing.SupportsInt | typing.SupportsIndex) -> None:
...
__version__: str = '5.7.1'
version: str = '5.7.1'
__version__: str = '5.7.2'
version: str = '5.7.2'
IntegrationSchemeEnum = SpatialSchemeEnum
8 changes: 8 additions & 0 deletions vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "viennals-ci",
"version-string": "1.0.0",
"dependencies": [
"vtk"
],
"builtin-baseline": "c3867e714dd3a51c272826eea77267876517ed99"
}
Loading