From 5c86649e8db3280de7814869bf0217cfec4b3875 Mon Sep 17 00:00:00 2001 From: Matthias Hochsteger Date: Wed, 19 Jun 2024 15:33:13 +0200 Subject: [PATCH] something --- .github/workflows/pypi.yml | 2 +- CMakeLists.txt | 20 +++++++++++--------- demo/bessel.py | 4 ++-- pyproject.toml | 6 +++--- src/specialcf.cpp | 2 +- 5 files changed, 18 insertions(+), 16 deletions(-) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 6122952..a6602df 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -4,7 +4,7 @@ on: push: branches: - master - - pip + - use_ngsolve_addon_template tags: - '*' diff --git a/CMakeLists.txt b/CMakeLists.txt index d5bdc7f..f78bb66 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.16) +cmake_minimum_required(VERSION 3.28) include(FetchContent) @@ -10,6 +10,7 @@ FetchContent_Declare( f2c GIT_REPOSITORY https://github.com/mhochsteger/f2c.git GIT_TAG 747683f + EXCLUDE_FROM_ALL ) FetchContent_MakeAvailable(f2c) @@ -55,14 +56,15 @@ add_custom_target(convert_sources ALL BYPRODUCTS ${SLATEC_SOURCES_C} ) -add_ngsolve_addon(_ngsolve_special_functions src/specialcf.cpp ${SLATEC_SOURCES_C} ${CMAKE_CURRENT_BINARY_DIR}/specialcf/Faddeeva/Faddeeva.cc) -add_custom_target(_ngsolve_special_functions_convert ALL DEPENDS convert_sources) -target_sources(_ngsolve_special_functions PRIVATE ${SLATEC_SOURCES_C}) -target_include_directories(_ngsolve_special_functions PRIVATE ${BIN_DIR}/slatec/src ${BIN_DIR}/Faddeeva inc) -target_compile_definitions(_ngsolve_special_functions PRIVATE -DSPECIALCF_LIBRARY_NAME="$") -target_compile_options(_ngsolve_special_functions PRIVATE -Wno-implicit-function-declaration) -install(TARGETS _ngsolve_special_functions DESTINATION ${ADDON_INSTALL_DIR}/ngsolve_special_functions) +add_ngsolve_addon(ngsolve_special_functions src/specialcf.cpp ${SLATEC_SOURCES_C} ${CMAKE_CURRENT_BINARY_DIR}/specialcf/Faddeeva/Faddeeva.cc) +add_custom_target(ngsolve_special_functions_convert ALL DEPENDS convert_sources) +target_sources(ngsolve_special_functions PRIVATE ${SLATEC_SOURCES_C}) +target_include_directories(ngsolve_special_functions PRIVATE ${BIN_DIR}/slatec/src ${BIN_DIR}/Faddeeva inc ${f2c_SOURCE_DIR}/include ${f2c_BINARY_DIR}) +target_compile_definitions(ngsolve_special_functions PRIVATE -DSPECIALCF_LIBRARY_NAME="$") +target_compile_options(ngsolve_special_functions PRIVATE -Wno-implicit-function-declaration) +target_link_libraries(ngsolve_special_functions PRIVATE f2c) +install(TARGETS ngsolve_special_functions DESTINATION ${ADDON_INSTALL_DIR_PYTHON}) if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - target_compile_options(_ngsolve_special_functions PRIVATE -Wno-return-type-c-linkage) + target_compile_options(ngsolve_special_functions PRIVATE -Wno-return-type-c-linkage) endif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") diff --git a/demo/bessel.py b/demo/bessel.py index 2cd21f6..5954d90 100644 --- a/demo/bessel.py +++ b/demo/bessel.py @@ -1,3 +1,4 @@ +import ngsolve_special_functions from ngsolve import * from netgen.geom2d import unit_square import scipy.special as sp @@ -6,11 +7,10 @@ mesh = Mesh(unit_square.GenerateMesh(maxh=0.2)) -import ngsolve.special_functions n = 0 while n>=0: - bessel = ngsolve.special_functions.jv(z=(x-0.5)+1j*(y-0.5), v=n) + bessel = ngsolve_special_functions.jv(z=(x-0.5)+1j*(y-0.5), v=n) Draw(bessel, mesh, 'bessel', sd=5) n = float(input('Set order (<0 to abort): ')) diff --git a/pyproject.toml b/pyproject.toml index de7dbf7..8558a8e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,9 @@ # Here is the project metadata, adapt it to your needs [project] name = "ngsolve_special_functions" -description="A minimal example for an NGSolve addon" +description="Additional coefficient functions based on slatec" readme = "README.md" -requires-python = ">=3.8" +requires-python = ">=3.12" dependencies = [] # ngsolve will be added automatically dynamic = ["version", "dependencies"] classifiers = [ @@ -23,7 +23,7 @@ build-backend = "scikit_build_core.build" [tool.scikit-build] experimental = true -# This adds ngsolve (with exact build-time version) to the dependencies +metadata.version.provider = "scikit_build_core.metadata.setuptools_scm" metadata.dependencies.provider="ngsolve._scikit_build_core_dependencies" [tool.setuptools_scm] diff --git a/src/specialcf.cpp b/src/specialcf.cpp index e53b545..da9f0ad 100644 --- a/src/specialcf.cpp +++ b/src/specialcf.cpp @@ -96,7 +96,7 @@ namespace ngfem { -PYBIND11_MODULE(special_functions, m) { +PYBIND11_MODULE(ngsolve_special_functions, m) { const char * doc_string = "Same as in scipy.special"; ExportPythonSpecialCF(m, "gammaln", gammaln, doc_string);