fem-core 0.1.2__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.
Files changed (97) hide show
  1. fem_core-0.1.2/.github/actions/setup-python-uv/action.yml +17 -0
  2. fem_core-0.1.2/.github/workflows/ci.yml +74 -0
  3. fem_core-0.1.2/.github/workflows/release.yml +125 -0
  4. fem_core-0.1.2/.gitignore +12 -0
  5. fem_core-0.1.2/LICENSE +21 -0
  6. fem_core-0.1.2/PKG-INFO +696 -0
  7. fem_core-0.1.2/README.md +671 -0
  8. fem_core-0.1.2/examples/frequency_dependent_impedance_example.py +174 -0
  9. fem_core-0.1.2/examples/frequency_sweep_example.py +114 -0
  10. fem_core-0.1.2/examples/geometry_import_example.py +150 -0
  11. fem_core-0.1.2/examples/helmholtz_modal_3d_tube_example.py +138 -0
  12. fem_core-0.1.2/examples/helmholtz_modal_example.py +111 -0
  13. fem_core-0.1.2/examples/linear_elasticity_frequency_sweep_example.py +115 -0
  14. fem_core-0.1.2/examples/linear_elasticity_modal_3d_example.py +143 -0
  15. fem_core-0.1.2/examples/linear_elasticity_modal_example.py +110 -0
  16. fem_core-0.1.2/examples/result_storage_example.py +175 -0
  17. fem_core-0.1.2/examples/subdomain_restriction_example.py +126 -0
  18. fem_core-0.1.2/pyproject.toml +78 -0
  19. fem_core-0.1.2/src/fem_core/__init__.py +0 -0
  20. fem_core-0.1.2/src/fem_core/enums.py +152 -0
  21. fem_core-0.1.2/src/fem_core/facades/__init__.py +0 -0
  22. fem_core-0.1.2/src/fem_core/facades/acoustic_model.py +126 -0
  23. fem_core-0.1.2/src/fem_core/facades/base.py +49 -0
  24. fem_core-0.1.2/src/fem_core/managers/__init__.py +0 -0
  25. fem_core-0.1.2/src/fem_core/managers/fem_model_manager.py +443 -0
  26. fem_core-0.1.2/src/fem_core/managers/study_manager.py +470 -0
  27. fem_core-0.1.2/src/fem_core/models/__init__.py +0 -0
  28. fem_core-0.1.2/src/fem_core/models/boundary_condition.py +130 -0
  29. fem_core-0.1.2/src/fem_core/models/boundary_index.py +127 -0
  30. fem_core-0.1.2/src/fem_core/models/fem_formulation.py +68 -0
  31. fem_core-0.1.2/src/fem_core/models/fem_model.py +47 -0
  32. fem_core-0.1.2/src/fem_core/models/formulation_parameters.py +112 -0
  33. fem_core-0.1.2/src/fem_core/models/formulation_registry.py +42 -0
  34. fem_core-0.1.2/src/fem_core/models/function_space_config.py +49 -0
  35. fem_core-0.1.2/src/fem_core/models/mesh_config.py +41 -0
  36. fem_core-0.1.2/src/fem_core/models/study.py +41 -0
  37. fem_core-0.1.2/src/fem_core/models/study_parameters.py +78 -0
  38. fem_core-0.1.2/src/fem_core/models/study_result.py +34 -0
  39. fem_core-0.1.2/src/fem_core/models/tabular_property.py +43 -0
  40. fem_core-0.1.2/src/fem_core/services/__init__.py +0 -0
  41. fem_core-0.1.2/src/fem_core/services/boundary_condition_service.py +134 -0
  42. fem_core-0.1.2/src/fem_core/services/eigen_solve_service.py +124 -0
  43. fem_core-0.1.2/src/fem_core/services/expression_evaluator.py +82 -0
  44. fem_core-0.1.2/src/fem_core/services/formulation_forms.py +41 -0
  45. fem_core-0.1.2/src/fem_core/services/formulation_service.py +111 -0
  46. fem_core-0.1.2/src/fem_core/services/formulations/__init__.py +9 -0
  47. fem_core-0.1.2/src/fem_core/services/formulations/common.py +105 -0
  48. fem_core-0.1.2/src/fem_core/services/formulations/custom.py +57 -0
  49. fem_core-0.1.2/src/fem_core/services/formulations/helmholtz.py +83 -0
  50. fem_core-0.1.2/src/fem_core/services/formulations/linear_elasticity.py +115 -0
  51. fem_core-0.1.2/src/fem_core/services/formulations/registry.py +40 -0
  52. fem_core-0.1.2/src/fem_core/services/frequency_sweep_service.py +118 -0
  53. fem_core-0.1.2/src/fem_core/services/function_space_service.py +97 -0
  54. fem_core-0.1.2/src/fem_core/services/geometry_import_service.py +196 -0
  55. fem_core-0.1.2/src/fem_core/services/linear_solve_service.py +111 -0
  56. fem_core-0.1.2/src/fem_core/services/mesh_service.py +139 -0
  57. fem_core-0.1.2/src/fem_core/services/model_validation_service.py +305 -0
  58. fem_core-0.1.2/src/fem_core/services/result_storage_service.py +410 -0
  59. fem_core-0.1.2/src/fem_core/services/study_validation_service.py +54 -0
  60. fem_core-0.1.2/src/fem_core/services/tabular_interpolation_service.py +70 -0
  61. fem_core-0.1.2/src/fem_core/services/undo_redo_service.py +174 -0
  62. fem_core-0.1.2/src/fem_core/study_runner.py +81 -0
  63. fem_core-0.1.2/tasks.py +82 -0
  64. fem_core-0.1.2/tests/test_acoustic_model_facade.py +110 -0
  65. fem_core-0.1.2/tests/test_boundary_condition_model.py +78 -0
  66. fem_core-0.1.2/tests/test_boundary_condition_service_real_ngsolve.py +65 -0
  67. fem_core-0.1.2/tests/test_boundary_index_model.py +142 -0
  68. fem_core-0.1.2/tests/test_domain_restriction_real_ngsolve.py +259 -0
  69. fem_core-0.1.2/tests/test_eigen_solve_service_real_ngsolve.py +183 -0
  70. fem_core-0.1.2/tests/test_enums.py +44 -0
  71. fem_core-0.1.2/tests/test_expression_evaluator.py +101 -0
  72. fem_core-0.1.2/tests/test_fem_formulation_model.py +76 -0
  73. fem_core-0.1.2/tests/test_fem_model.py +40 -0
  74. fem_core-0.1.2/tests/test_fem_model_manager.py +319 -0
  75. fem_core-0.1.2/tests/test_formulation_parameters_model.py +65 -0
  76. fem_core-0.1.2/tests/test_formulation_service_real_ngsolve.py +113 -0
  77. fem_core-0.1.2/tests/test_frequency_sweep_service_mocked.py +111 -0
  78. fem_core-0.1.2/tests/test_frequency_sweep_service_real_ngsolve.py +231 -0
  79. fem_core-0.1.2/tests/test_function_space_config_model.py +21 -0
  80. fem_core-0.1.2/tests/test_function_space_service_real_ngsolve.py +43 -0
  81. fem_core-0.1.2/tests/test_geometry_import_service_real_ngsolve.py +328 -0
  82. fem_core-0.1.2/tests/test_linear_solve_service_real_ngsolve.py +42 -0
  83. fem_core-0.1.2/tests/test_manager_undo.py +273 -0
  84. fem_core-0.1.2/tests/test_mesh_config_model.py +29 -0
  85. fem_core-0.1.2/tests/test_mesh_service_real_ngsolve.py +60 -0
  86. fem_core-0.1.2/tests/test_model_validation_service.py +400 -0
  87. fem_core-0.1.2/tests/test_multi_region_boundary_condition.py +240 -0
  88. fem_core-0.1.2/tests/test_result_storage_service_real_ngsolve.py +440 -0
  89. fem_core-0.1.2/tests/test_study_manager.py +388 -0
  90. fem_core-0.1.2/tests/test_study_model.py +26 -0
  91. fem_core-0.1.2/tests/test_study_parameters_model.py +48 -0
  92. fem_core-0.1.2/tests/test_study_result_model.py +23 -0
  93. fem_core-0.1.2/tests/test_study_runner.py +95 -0
  94. fem_core-0.1.2/tests/test_study_validation_service.py +83 -0
  95. fem_core-0.1.2/tests/test_tabular_interpolation_service.py +47 -0
  96. fem_core-0.1.2/tests/test_undo_redo_service.py +118 -0
  97. fem_core-0.1.2/uv.lock +1789 -0
@@ -0,0 +1,17 @@
1
+ name: Set up Python and uv
2
+ description: Checkout, set up Python 3.12, install uv, and sync dev dependencies plus the viz extra (fem-post).
3
+
4
+ runs:
5
+ using: composite
6
+ steps:
7
+ - name: Set up Python 3.12
8
+ uses: actions/setup-python@v6
9
+ with:
10
+ python-version: "3.12"
11
+
12
+ - name: Install uv
13
+ uses: astral-sh/setup-uv@v6
14
+
15
+ - name: Install dependencies
16
+ run: uv sync --group dev --extra viz
17
+ shell: bash
@@ -0,0 +1,74 @@
1
+ name: CI actions
2
+
3
+ permissions:
4
+ contents: read # Required for checkout and comparing commits
5
+ pull-requests: write # Required for creating/updating PR comments
6
+
7
+ on:
8
+ push:
9
+ branches:
10
+ - main
11
+ pull_request:
12
+
13
+ jobs:
14
+ lint:
15
+ name: Lint
16
+ runs-on: ubuntu-latest
17
+
18
+ steps:
19
+ - uses: actions/checkout@v5
20
+ - uses: ./.github/actions/setup-python-uv
21
+
22
+ - name: Run linter
23
+ run: uv run invoke lint
24
+
25
+ - name: Run formatter check
26
+ run: uv run invoke format
27
+
28
+ typecheck:
29
+ name: Typecheck
30
+ runs-on: ubuntu-latest
31
+
32
+ steps:
33
+ - uses: actions/checkout@v5
34
+ - uses: ./.github/actions/setup-python-uv
35
+
36
+ - name: Run typecheck
37
+ run: uv run invoke typecheck
38
+
39
+ tests:
40
+ name: Run tests
41
+ runs-on: ubuntu-latest
42
+
43
+ steps:
44
+ - uses: actions/checkout@v5
45
+ - uses: ./.github/actions/setup-python-uv
46
+
47
+ - name: Run tests
48
+ run: |
49
+ set -o pipefail
50
+ uv run pytest tests -v \
51
+ --cov=fem_core \
52
+ --cov-report=term-missing:skip-covered \
53
+ --junitxml=pytest.xml | tee pytest-coverage.txt
54
+
55
+ - name: Post coverage comment on PR
56
+ uses: MishaKav/pytest-coverage-comment@v1
57
+ if: github.event_name == 'pull_request'
58
+ with:
59
+ pytest-coverage-path: ./pytest-coverage.txt
60
+ junitxml-path: ./pytest.xml
61
+
62
+ fem-post-tests:
63
+ name: Run fem-post tests
64
+ runs-on: ubuntu-latest
65
+
66
+ steps:
67
+ - uses: actions/checkout@v5
68
+ - uses: ./.github/actions/setup-python-uv
69
+
70
+ - name: Install a virtual display and OpenGL for off-screen VTK rendering
71
+ run: sudo apt-get update && sudo apt-get install -y xvfb libgl1 libgl1-mesa-dri libxrender1
72
+
73
+ - name: Run tests
74
+ run: xvfb-run -a uv run pytest packages/fem-post/tests -v
@@ -0,0 +1,125 @@
1
+ name: Release
2
+
3
+ # Publishes fem-core and fem-post to PyPI. Push main to the `release` branch
4
+ # to cut a release; both packages are bumped together (patch) so their
5
+ # versions stay in lockstep.
6
+ #
7
+ # One-time PyPI setup: add a trusted publisher for BOTH projects (fem-core
8
+ # and fem-post) with owner gcmartins, repository fem-core, workflow
9
+ # release.yml and environment pypi. See README.md "Releasing".
10
+
11
+ on:
12
+ push:
13
+ branches:
14
+ - release
15
+
16
+ jobs:
17
+ bump:
18
+ name: Bump Version
19
+ runs-on: ubuntu-latest
20
+ permissions:
21
+ contents: write
22
+ outputs:
23
+ new_version: ${{ steps.bump_version.outputs.new_version }}
24
+
25
+ steps:
26
+ - name: Checkout code
27
+ uses: actions/checkout@v5
28
+ with:
29
+ fetch-depth: 0
30
+
31
+ - name: Set up Python
32
+ uses: actions/setup-python@v6
33
+ with:
34
+ python-version: '3.12'
35
+
36
+ - name: Install uv
37
+ uses: astral-sh/setup-uv@v6
38
+
39
+ - name: Bump patch version (fem-core and fem-post)
40
+ id: bump_version
41
+ run: |
42
+ uv version --bump patch
43
+ uv version --bump patch --package fem-post
44
+ NEW_VERSION=$(uv version --short)
45
+ POST_VERSION=$(uv version --short --package fem-post)
46
+ if [ "$NEW_VERSION" != "$POST_VERSION" ]; then
47
+ echo "fem-core ($NEW_VERSION) and fem-post ($POST_VERSION) versions diverged" >&2
48
+ exit 1
49
+ fi
50
+ echo "new_version=$NEW_VERSION" >> "$GITHUB_OUTPUT"
51
+ uv lock
52
+
53
+ - name: Commit and push version bump
54
+ run: |
55
+ git config user.name "github-actions[bot]"
56
+ git config user.email "github-actions[bot]@users.noreply.github.com"
57
+ git add pyproject.toml packages/fem-post/pyproject.toml uv.lock
58
+ git commit -m "chore: bump version to ${{ steps.bump_version.outputs.new_version }} [skip ci]"
59
+ git push
60
+
61
+ build:
62
+ name: Build wheels and sdists
63
+ needs: bump
64
+ runs-on: ubuntu-latest
65
+
66
+ steps:
67
+ - name: Checkout code
68
+ uses: actions/checkout@v5
69
+ with:
70
+ ref: release
71
+
72
+ - name: Set up Python
73
+ uses: actions/setup-python@v6
74
+ with:
75
+ python-version: '3.12'
76
+
77
+ - name: Install uv
78
+ uses: astral-sh/setup-uv@v6
79
+
80
+ # Both packages are pure Python (MIT), so one py3-none-any wheel and an
81
+ # sdist each cover every platform.
82
+ - name: Build fem-core and fem-post
83
+ run: uv build --all-packages --out-dir dist/
84
+
85
+ - name: Check distributions
86
+ run: uvx twine check dist/*
87
+
88
+ - name: Upload distributions
89
+ uses: actions/upload-artifact@v4
90
+ with:
91
+ name: dist
92
+ path: dist/
93
+
94
+ publish:
95
+ name: Publish and Release
96
+ needs: [bump, build]
97
+ runs-on: ubuntu-latest
98
+ environment:
99
+ name: pypi
100
+ url: https://pypi.org/p/fem-core
101
+ permissions:
102
+ contents: write # create GitHub Release
103
+ id-token: write # OIDC trusted publishing to PyPI
104
+
105
+ steps:
106
+ - name: Download distributions
107
+ uses: actions/download-artifact@v4
108
+ with:
109
+ name: dist
110
+ path: dist/
111
+
112
+ - name: Publish to PyPI
113
+ uses: pypa/gh-action-pypi-publish@release/v1
114
+ with:
115
+ packages-dir: dist/
116
+ skip-existing: true
117
+ verbose: true
118
+
119
+ - name: Create GitHub Release
120
+ uses: softprops/action-gh-release@v2
121
+ with:
122
+ tag_name: v${{ needs.bump.outputs.new_version }}
123
+ name: v${{ needs.bump.outputs.new_version }}
124
+ generate_release_notes: true
125
+ files: dist/*
@@ -0,0 +1,12 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ .venv/
5
+ .pytest_cache/
6
+ .ty_cache/
7
+ .ruff_cache/
8
+ .coverage
9
+ htmlcov/
10
+ dist/
11
+ build/
12
+ examples/vtk_output/
fem_core-0.1.2/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Gustavo Martins
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.