scifem 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- scifem-0.1.0/.github/workflows/tests.yml +24 -0
- scifem-0.1.0/.gitignore +162 -0
- scifem-0.1.0/.vscode/c_cpp_properties.json +17 -0
- scifem-0.1.0/.vscode/settings.json +5 -0
- scifem-0.1.0/CMakeLists.txt +63 -0
- scifem-0.1.0/LICENSE +21 -0
- scifem-0.1.0/PKG-INFO +57 -0
- scifem-0.1.0/README.md +24 -0
- scifem-0.1.0/demo.py +17 -0
- scifem-0.1.0/pyproject.toml +90 -0
- scifem-0.1.0/sandbox/7b0ed8e55b8446fac0eff4b821dad67a/CMakeLists.txt +68 -0
- scifem-0.1.0/sandbox/7b0ed8e55b8446fac0eff4b821dad67a/build-dir/.ninja_deps +0 -0
- scifem-0.1.0/sandbox/7b0ed8e55b8446fac0eff4b821dad67a/build-dir/.ninja_log +6 -0
- scifem-0.1.0/sandbox/7b0ed8e55b8446fac0eff4b821dad67a/build-dir/CMakeCache.txt +714 -0
- scifem-0.1.0/sandbox/7b0ed8e55b8446fac0eff4b821dad67a/build-dir/CMakeFiles/3.28.3/CMakeCCompiler.cmake +74 -0
- scifem-0.1.0/sandbox/7b0ed8e55b8446fac0eff4b821dad67a/build-dir/CMakeFiles/3.28.3/CMakeCXXCompiler.cmake +85 -0
- scifem-0.1.0/sandbox/7b0ed8e55b8446fac0eff4b821dad67a/build-dir/CMakeFiles/3.28.3/CMakeDetermineCompilerABI_C.bin +0 -0
- scifem-0.1.0/sandbox/7b0ed8e55b8446fac0eff4b821dad67a/build-dir/CMakeFiles/3.28.3/CMakeDetermineCompilerABI_CXX.bin +0 -0
- scifem-0.1.0/sandbox/7b0ed8e55b8446fac0eff4b821dad67a/build-dir/CMakeFiles/3.28.3/CMakeSystem.cmake +15 -0
- scifem-0.1.0/sandbox/7b0ed8e55b8446fac0eff4b821dad67a/build-dir/CMakeFiles/3.28.3/CompilerIdC/CMakeCCompilerId.c +880 -0
- scifem-0.1.0/sandbox/7b0ed8e55b8446fac0eff4b821dad67a/build-dir/CMakeFiles/3.28.3/CompilerIdC/a.out +0 -0
- scifem-0.1.0/sandbox/7b0ed8e55b8446fac0eff4b821dad67a/build-dir/CMakeFiles/3.28.3/CompilerIdCXX/CMakeCXXCompilerId.cpp +869 -0
- scifem-0.1.0/sandbox/7b0ed8e55b8446fac0eff4b821dad67a/build-dir/CMakeFiles/3.28.3/CompilerIdCXX/a.out +0 -0
- scifem-0.1.0/sandbox/7b0ed8e55b8446fac0eff4b821dad67a/build-dir/CMakeFiles/CMakeConfigureLog.yaml +714 -0
- scifem-0.1.0/sandbox/7b0ed8e55b8446fac0eff4b821dad67a/build-dir/CMakeFiles/FindMPI/test_mpi_C.bin +0 -0
- scifem-0.1.0/sandbox/7b0ed8e55b8446fac0eff4b821dad67a/build-dir/CMakeFiles/FindMPI/test_mpi_CXX.bin +0 -0
- scifem-0.1.0/sandbox/7b0ed8e55b8446fac0eff4b821dad67a/build-dir/CMakeFiles/TargetDirectories.txt +3 -0
- scifem-0.1.0/sandbox/7b0ed8e55b8446fac0eff4b821dad67a/build-dir/CMakeFiles/cmake.check_cache +1 -0
- scifem-0.1.0/sandbox/7b0ed8e55b8446fac0eff4b821dad67a/build-dir/CMakeFiles/demo_real_space.dir/main.cpp.o +0 -0
- scifem-0.1.0/sandbox/7b0ed8e55b8446fac0eff4b821dad67a/build-dir/CMakeFiles/demo_real_space.dir/poisson.c.o +0 -0
- scifem-0.1.0/sandbox/7b0ed8e55b8446fac0eff4b821dad67a/build-dir/CMakeFiles/rules.ninja +74 -0
- scifem-0.1.0/sandbox/7b0ed8e55b8446fac0eff4b821dad67a/build-dir/build.ninja +166 -0
- scifem-0.1.0/sandbox/7b0ed8e55b8446fac0eff4b821dad67a/build-dir/cmake_install.cmake +54 -0
- scifem-0.1.0/sandbox/7b0ed8e55b8446fac0eff4b821dad67a/build-dir/demo_real_space +0 -0
- scifem-0.1.0/sandbox/7b0ed8e55b8446fac0eff4b821dad67a/build-dir/poisson.c +961 -0
- scifem-0.1.0/sandbox/7b0ed8e55b8446fac0eff4b821dad67a/build-dir/poisson.h +84 -0
- scifem-0.1.0/sandbox/7b0ed8e55b8446fac0eff4b821dad67a/main.cpp +208 -0
- scifem-0.1.0/sandbox/7b0ed8e55b8446fac0eff4b821dad67a/poisson.py +51 -0
- scifem-0.1.0/sandbox/7b0ed8e55b8446fac0eff4b821dad67a/u.bp/data.0 +0 -0
- scifem-0.1.0/sandbox/7b0ed8e55b8446fac0eff4b821dad67a/u.bp/md.0 +0 -0
- scifem-0.1.0/sandbox/7b0ed8e55b8446fac0eff4b821dad67a/u.bp/md.idx +0 -0
- scifem-0.1.0/sandbox/7b0ed8e55b8446fac0eff4b821dad67a/u.bp/mmd.0 +0 -0
- scifem-0.1.0/sandbox/7b0ed8e55b8446fac0eff4b821dad67a/u.bp/profiling.json +3 -0
- scifem-0.1.0/src/scifem/__init__.py +19 -0
- scifem-0.1.0/src/scifem.cpp +71 -0
- scifem-0.1.0/tests/test_real_functionspace.py +17 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
name: Test package
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
push:
|
|
6
|
+
branches: [main]
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test-code:
|
|
10
|
+
runs-on: ubuntu-24.04
|
|
11
|
+
container: ghcr.io/fenics/dolfinx/dolfinx:nightly
|
|
12
|
+
env:
|
|
13
|
+
DEB_PYTHON_INSTALL_LAYOUT: deb_system
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Install package
|
|
20
|
+
run: python3 -m pip install .[test] --no-build-isolation
|
|
21
|
+
|
|
22
|
+
- name: Run tests
|
|
23
|
+
run: python3 -m pytest
|
|
24
|
+
|
scifem-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py,cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# poetry
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
102
|
+
#poetry.lock
|
|
103
|
+
|
|
104
|
+
# pdm
|
|
105
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
106
|
+
#pdm.lock
|
|
107
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
108
|
+
# in version control.
|
|
109
|
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
|
110
|
+
.pdm.toml
|
|
111
|
+
.pdm-python
|
|
112
|
+
.pdm-build/
|
|
113
|
+
|
|
114
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
115
|
+
__pypackages__/
|
|
116
|
+
|
|
117
|
+
# Celery stuff
|
|
118
|
+
celerybeat-schedule
|
|
119
|
+
celerybeat.pid
|
|
120
|
+
|
|
121
|
+
# SageMath parsed files
|
|
122
|
+
*.sage.py
|
|
123
|
+
|
|
124
|
+
# Environments
|
|
125
|
+
.env
|
|
126
|
+
.venv
|
|
127
|
+
env/
|
|
128
|
+
venv/
|
|
129
|
+
ENV/
|
|
130
|
+
env.bak/
|
|
131
|
+
venv.bak/
|
|
132
|
+
|
|
133
|
+
# Spyder project settings
|
|
134
|
+
.spyderproject
|
|
135
|
+
.spyproject
|
|
136
|
+
|
|
137
|
+
# Rope project settings
|
|
138
|
+
.ropeproject
|
|
139
|
+
|
|
140
|
+
# mkdocs documentation
|
|
141
|
+
/site
|
|
142
|
+
|
|
143
|
+
# mypy
|
|
144
|
+
.mypy_cache/
|
|
145
|
+
.dmypy.json
|
|
146
|
+
dmypy.json
|
|
147
|
+
|
|
148
|
+
# Pyre type checker
|
|
149
|
+
.pyre/
|
|
150
|
+
|
|
151
|
+
# pytype static type analyzer
|
|
152
|
+
.pytype/
|
|
153
|
+
|
|
154
|
+
# Cython debug symbols
|
|
155
|
+
cython_debug/
|
|
156
|
+
|
|
157
|
+
# PyCharm
|
|
158
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
159
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
160
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
161
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
162
|
+
#.idea/
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"configurations": [
|
|
3
|
+
{
|
|
4
|
+
"name": "Linux",
|
|
5
|
+
"includePath": [
|
|
6
|
+
"${workspaceFolder}/**",
|
|
7
|
+
"/usr/local/dolfinx-real/include",
|
|
8
|
+
],
|
|
9
|
+
"defines": [],
|
|
10
|
+
"compilerPath": "/usr/bin/gcc",
|
|
11
|
+
"cStandard": "c17",
|
|
12
|
+
"cppStandard": "gnu++20",
|
|
13
|
+
"intelliSenseMode": "linux-gcc-arm64"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"version": 4
|
|
17
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.21)
|
|
2
|
+
|
|
3
|
+
set(PROJECT_NAME scifem)
|
|
4
|
+
# nanobind uses aligned deallocators only present on macOS > 10.14
|
|
5
|
+
if(APPLE)
|
|
6
|
+
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14")
|
|
7
|
+
endif()
|
|
8
|
+
|
|
9
|
+
set(CMAKE_CXX_STANDARD 20)
|
|
10
|
+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
11
|
+
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
12
|
+
project(${PROJECT_NAME} VERSION "0.1.0.0" LANGUAGES C CXX)
|
|
13
|
+
|
|
14
|
+
if (WIN32)
|
|
15
|
+
# Windows requires all symbols to be manually exported.
|
|
16
|
+
# This flag exports all symbols automatically, as in Unix.
|
|
17
|
+
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
|
|
18
|
+
endif(WIN32)
|
|
19
|
+
|
|
20
|
+
execute_process(
|
|
21
|
+
COMMAND
|
|
22
|
+
${Python3_EXECUTABLE} -c
|
|
23
|
+
"import os, sys, basix; sys.stdout.write(os.path.dirname(basix.__file__))"
|
|
24
|
+
OUTPUT_VARIABLE BASIX_PY_DIR
|
|
25
|
+
RESULT_VARIABLE BASIX_PY_COMMAND_RESULT
|
|
26
|
+
ERROR_VARIABLE BASIX_ERROR_OUT
|
|
27
|
+
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
28
|
+
)
|
|
29
|
+
find_package(Basix REQUIRED CONFIG HINTS ${BASIX_PY_DIR})
|
|
30
|
+
|
|
31
|
+
if(Basix_FOUND)
|
|
32
|
+
message(STATUS "Found Basix at ${Basix_DIR}")
|
|
33
|
+
endif()
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
find_package(DOLFINX REQUIRED CONFIG)
|
|
38
|
+
|
|
39
|
+
if(DOLFINX_FOUND)
|
|
40
|
+
message(STATUS "Found DOLFINx at ${DOLFINX_DIR}")
|
|
41
|
+
endif()
|
|
42
|
+
|
|
43
|
+
find_package(Python COMPONENTS Interpreter Development.Module REQUIRED)
|
|
44
|
+
|
|
45
|
+
# Detect the installed nanobind package and import it into CMake
|
|
46
|
+
execute_process(
|
|
47
|
+
COMMAND "${Python_EXECUTABLE}" -c "import nanobind; print(nanobind.cmake_dir())"
|
|
48
|
+
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE NB_DIR)
|
|
49
|
+
list(APPEND CMAKE_PREFIX_PATH "${NB_DIR}")
|
|
50
|
+
find_package(nanobind CONFIG REQUIRED)
|
|
51
|
+
|
|
52
|
+
# We are now ready to compile the actual extension module
|
|
53
|
+
nanobind_add_module(
|
|
54
|
+
_scifem
|
|
55
|
+
STABLE_ABI
|
|
56
|
+
src/scifem.cpp
|
|
57
|
+
)
|
|
58
|
+
target_link_libraries(_scifem PRIVATE dolfinx)
|
|
59
|
+
|
|
60
|
+
set_target_properties(_scifem PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE)
|
|
61
|
+
|
|
62
|
+
# Install directive for scikit-build-core
|
|
63
|
+
install(TARGETS _scifem LIBRARY DESTINATION ${PROJECT_NAME})
|
scifem-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Scientific Computing at Simula Research Laboratory
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
scifem-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: scifem
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Scientific tools for finite element methods
|
|
5
|
+
Author-Email: =?utf-8?q?J=C3=B8rgen_S=2E_Dokken?= <dokken@simula.no>, "Henrik N.T. Finsberg" <henriknf@simula.no>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2024 Scientific Computing at Simula Research Laboratory
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
Project-URL: Repository, https://github.com/scientificcomputing/scifem.git
|
|
28
|
+
Requires-Python: >=3.9
|
|
29
|
+
Provides-Extra: docs
|
|
30
|
+
Provides-Extra: test
|
|
31
|
+
Requires-Dist: pytest; extra == "test"
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
# Scientific Computing Tools for Finite Element Methods
|
|
35
|
+
|
|
36
|
+
This package contains a collection of tools for scientific computing with a focus on finite element methods. The tools are written in Python and are intended to be used in conjunction with the [dolfinx](https://github.com/FEniCS/dolfinx).
|
|
37
|
+
|
|
38
|
+
Many users that are transitioning from legacy FEniCS to FEniCSx may find the transition difficult due to the lack of some functionalities in FEniCSx. This package aims to provide some of the functionalities that are missing in FEniCSx. The package is still in its early stages and many functionalities are still missing.
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
## Installation
|
|
42
|
+
|
|
43
|
+
The package is partly written in C++ and relies on `dolfinx`. User are encouraged to install `scifem` in an environment where `dolfinx` is already installed. The package can be installed using `pip`:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
python3 -m pip install scifem --no-build-isolation
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
## Having issues or want to contribute?
|
|
51
|
+
|
|
52
|
+
If you are having issues, feature request or would like to contribute, please let us know. You can do so by opening an issue on the [issue tracker](https://github.com/scientificcomputing/scifem/issues).
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
## LICENSE
|
|
57
|
+
MIT
|
scifem-0.1.0/README.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Scientific Computing Tools for Finite Element Methods
|
|
2
|
+
|
|
3
|
+
This package contains a collection of tools for scientific computing with a focus on finite element methods. The tools are written in Python and are intended to be used in conjunction with the [dolfinx](https://github.com/FEniCS/dolfinx).
|
|
4
|
+
|
|
5
|
+
Many users that are transitioning from legacy FEniCS to FEniCSx may find the transition difficult due to the lack of some functionalities in FEniCSx. This package aims to provide some of the functionalities that are missing in FEniCSx. The package is still in its early stages and many functionalities are still missing.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
The package is partly written in C++ and relies on `dolfinx`. User are encouraged to install `scifem` in an environment where `dolfinx` is already installed. The package can be installed using `pip`:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
python3 -m pip install scifem --no-build-isolation
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## Having issues or want to contribute?
|
|
18
|
+
|
|
19
|
+
If you are having issues, feature request or would like to contribute, please let us know. You can do so by opening an issue on the [issue tracker](https://github.com/scientificcomputing/scifem/issues).
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## LICENSE
|
|
24
|
+
MIT
|
scifem-0.1.0/demo.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from mpi4py import MPI
|
|
2
|
+
import dolfinx
|
|
3
|
+
import ufl
|
|
4
|
+
import basix
|
|
5
|
+
import scifem
|
|
6
|
+
|
|
7
|
+
mesh = dolfinx.mesh.create_unit_square(MPI.COMM_WORLD, 10, 10)
|
|
8
|
+
# breakpoint()
|
|
9
|
+
# V = dolfinx.fem.functionspace(mesh, ("DG", 0))
|
|
10
|
+
V = scifem.create_real_functionspace(mesh)
|
|
11
|
+
u = ufl.TrialFunction(V)
|
|
12
|
+
v = ufl.TestFunction(V)
|
|
13
|
+
a = ufl.inner(u, v) * ufl.dx
|
|
14
|
+
|
|
15
|
+
A = dolfinx.fem.assemble_matrix(dolfinx.fem.form(a), bcs=[])
|
|
16
|
+
# assert A.to_dense()
|
|
17
|
+
breakpoint()
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["scikit-build-core[pyproject]>=0.4.3", "nanobind>=1.3.2", "mpi4py>=3.0.3"]
|
|
3
|
+
build-backend = "scikit_build_core.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "scifem"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Scientific tools for finite element methods"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = { file = "LICENSE" }
|
|
12
|
+
authors = [
|
|
13
|
+
{ email = "dokken@simula.no", name = "Jørgen S. Dokken" },
|
|
14
|
+
{ email = "henriknf@simula.no" , name = "Henrik N.T. Finsberg" },
|
|
15
|
+
]
|
|
16
|
+
dependencies = []
|
|
17
|
+
|
|
18
|
+
[project.urls]
|
|
19
|
+
repository = "https://github.com/scientificcomputing/scifem.git"
|
|
20
|
+
|
|
21
|
+
[project.optional-dependencies]
|
|
22
|
+
docs = []
|
|
23
|
+
test = ["pytest"]
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
[tool.pytest.ini_options]
|
|
27
|
+
testpaths = ["tests"]
|
|
28
|
+
|
|
29
|
+
[tool.scikit-build]
|
|
30
|
+
minimum-version = "0.5"
|
|
31
|
+
cmake.minimum-version = "3.19.0"
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
[tool.mypy]
|
|
35
|
+
ignore_missing_imports = true
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
[tool.ruff]
|
|
39
|
+
|
|
40
|
+
# Exclude a variety of commonly ignored directories.
|
|
41
|
+
exclude = [
|
|
42
|
+
"examples",
|
|
43
|
+
".bzr",
|
|
44
|
+
".direnv",
|
|
45
|
+
".eggs",
|
|
46
|
+
".git",
|
|
47
|
+
".hg",
|
|
48
|
+
".mypy_cache",
|
|
49
|
+
".nox",
|
|
50
|
+
".pants.d",
|
|
51
|
+
".pytype",
|
|
52
|
+
".ruff_cache",
|
|
53
|
+
".svn",
|
|
54
|
+
".tox",
|
|
55
|
+
".venv",
|
|
56
|
+
"__pypackages__",
|
|
57
|
+
"_build",
|
|
58
|
+
"buck-out",
|
|
59
|
+
"build",
|
|
60
|
+
"dist",
|
|
61
|
+
"node_modules",
|
|
62
|
+
"venv",
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
# Same as Black.
|
|
66
|
+
line-length = 100
|
|
67
|
+
|
|
68
|
+
# Assume Python 3.10.
|
|
69
|
+
target-version = "py310"
|
|
70
|
+
|
|
71
|
+
[tool.ruff.lint]
|
|
72
|
+
# Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default.
|
|
73
|
+
select = ["E", "F"]
|
|
74
|
+
ignore = ["E402", "E741", "E743", "E731"]
|
|
75
|
+
|
|
76
|
+
# Allow autofix for all enabled rules (when `--fix`) is provided.
|
|
77
|
+
fixable = ["A", "B", "C", "D", "E", "F"]
|
|
78
|
+
unfixable = []
|
|
79
|
+
|
|
80
|
+
# Allow unused variables when underscore-prefixed.
|
|
81
|
+
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
[tool.ruff.lint.mccabe]
|
|
85
|
+
# Unlike Flake8, default to a complexity level of 10.
|
|
86
|
+
max-complexity = 10
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
[tool.ruff.lint.pydocstyle]
|
|
90
|
+
convention = "google"
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# This file was generated by running
|
|
2
|
+
#
|
|
3
|
+
# python cmake/scripts/generate-cmakefiles.py from dolfinx/cpp
|
|
4
|
+
#
|
|
5
|
+
cmake_minimum_required(VERSION 3.19)
|
|
6
|
+
|
|
7
|
+
set(PROJECT_NAME demo_real_space)
|
|
8
|
+
project(${PROJECT_NAME} LANGUAGES C CXX)
|
|
9
|
+
|
|
10
|
+
# Set C++20 standard
|
|
11
|
+
set(CMAKE_CXX_STANDARD 20)
|
|
12
|
+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
13
|
+
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
14
|
+
|
|
15
|
+
if(NOT TARGET dolfinx)
|
|
16
|
+
find_package(DOLFINX REQUIRED)
|
|
17
|
+
endif()
|
|
18
|
+
|
|
19
|
+
include(CheckSymbolExists)
|
|
20
|
+
set(CMAKE_REQUIRED_INCLUDES ${PETSC_INCLUDE_DIRS})
|
|
21
|
+
check_symbol_exists(PETSC_USE_COMPLEX petscsystypes.h PETSC_SCALAR_COMPLEX)
|
|
22
|
+
check_symbol_exists(PETSC_USE_REAL_DOUBLE petscsystypes.h PETSC_REAL_DOUBLE)
|
|
23
|
+
|
|
24
|
+
# Add target to compile UFL files
|
|
25
|
+
if(PETSC_SCALAR_COMPLEX EQUAL 1)
|
|
26
|
+
if(PETSC_REAL_DOUBLE EQUAL 1)
|
|
27
|
+
set(SCALAR_TYPE "--scalar_type=complex128")
|
|
28
|
+
else()
|
|
29
|
+
set(SCALAR_TYPE "--scalar_type=complex64")
|
|
30
|
+
endif()
|
|
31
|
+
else()
|
|
32
|
+
if(PETSC_REAL_DOUBLE EQUAL 1)
|
|
33
|
+
set(SCALAR_TYPE "--scalar_type=float64")
|
|
34
|
+
else()
|
|
35
|
+
set(SCALAR_TYPE "--scalar_type=float32")
|
|
36
|
+
endif()
|
|
37
|
+
endif()
|
|
38
|
+
add_custom_command(
|
|
39
|
+
OUTPUT poisson.c
|
|
40
|
+
COMMAND ffcx ${CMAKE_CURRENT_SOURCE_DIR}/poisson.py ${SCALAR_TYPE}
|
|
41
|
+
VERBATIM
|
|
42
|
+
DEPENDS poisson.py
|
|
43
|
+
COMMENT "Compile poisson.py using FFCx"
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|
48
|
+
|
|
49
|
+
add_executable(${PROJECT_NAME} main.cpp ${CMAKE_CURRENT_BINARY_DIR}/poisson.c)
|
|
50
|
+
target_link_libraries(${PROJECT_NAME} dolfinx)
|
|
51
|
+
|
|
52
|
+
# Do not throw error for 'multi-line comments' (these are typical in rst which
|
|
53
|
+
# includes LaTeX)
|
|
54
|
+
include(CheckCXXCompilerFlag)
|
|
55
|
+
check_cxx_compiler_flag("-Wno-comment" HAVE_NO_MULTLINE)
|
|
56
|
+
set_source_files_properties(
|
|
57
|
+
main.cpp
|
|
58
|
+
PROPERTIES
|
|
59
|
+
COMPILE_FLAGS
|
|
60
|
+
"$<$<BOOL:${HAVE_NO_MULTLINE}>:-Wno-comment -Wall -Wextra -pedantic -Werror>"
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
# Test targets (used by DOLFINx testing system)
|
|
64
|
+
set(TEST_PARAMETERS2 -np 2 ${MPIEXEC_PARAMS} "./${PROJECT_NAME}")
|
|
65
|
+
set(TEST_PARAMETERS3 -np 3 ${MPIEXEC_PARAMS} "./${PROJECT_NAME}")
|
|
66
|
+
add_test(NAME ${PROJECT_NAME}_mpi_2 COMMAND "mpirun" ${TEST_PARAMETERS2})
|
|
67
|
+
add_test(NAME ${PROJECT_NAME}_mpi_3 COMMAND "mpirun" ${TEST_PARAMETERS3})
|
|
68
|
+
add_test(NAME ${PROJECT_NAME}_serial COMMAND ${PROJECT_NAME})
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# ninja log v5
|
|
2
|
+
5 209 1726588399917782597 poisson.c 3ef5c459454a212a
|
|
3
|
+
5 209 1726588399917782597 /home/shared/sandbox/7b0ed8e55b8446fac0eff4b821dad67a/build-dir/poisson.c 3ef5c459454a212a
|
|
4
|
+
210 281 1726588400007166216 CMakeFiles/demo_real_space.dir/poisson.c.o 8bc8f6e935459ea4
|
|
5
|
+
210 6066 1726588405782701458 CMakeFiles/demo_real_space.dir/main.cpp.o c51a10538a399a6d
|
|
6
|
+
6094 6316 1726588406041415902 demo_real_space a315f4e981dcdea7
|