Skip to content

Commit

Permalink
something
Browse files Browse the repository at this point in the history
  • Loading branch information
mhochsteger committed Jun 19, 2024
1 parent 9dd57f9 commit c8e6e32
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches:
- master
- pip
- use_ngsolve_addon_template
tags:
- '*'

Expand Down
24 changes: 14 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.16)
cmake_minimum_required(VERSION 3.28)

include(FetchContent)

Expand All @@ -9,7 +9,8 @@ include(ngsolve_addon.cmake)
FetchContent_Declare(
f2c
GIT_REPOSITORY https://github.com/mhochsteger/f2c.git
GIT_TAG 747683f
GIT_TAG 96c2fbf
EXCLUDE_FROM_ALL
)

FetchContent_MakeAvailable(f2c)
Expand Down Expand Up @@ -55,14 +56,17 @@ 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_LINKER_FILE_NAME:_ngsolve_special_functions>")
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_LINKER_FILE_NAME:ngsolve_special_functions>")
if(UNIX)
target_compile_options(ngsolve_special_functions PRIVATE -Wno-implicit-function-declaration)
endif()
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")

4 changes: 2 additions & 2 deletions demo/bessel.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import ngsolve_special_functions
from ngsolve import *
from netgen.geom2d import unit_square
import scipy.special as sp
Expand All @@ -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): '))

6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 = [
Expand All @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion src/specialcf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit c8e6e32

Please sign in to comment.