PyFinitDiff 1.2.3__py3-none-any.whl → 1.3.0__py3-none-any.whl
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.
- PyFinitDiff/VERSION +1 -1
- PyFinitDiff/__pycache__/__init__.cpython-311.pyc +0 -0
- PyFinitDiff/__pycache__/triplet.cpython-311.pyc +0 -0
- PyFinitDiff/__pycache__/utils.cpython-311.pyc +0 -0
- PyFinitDiff/coefficients/__pycache__/__init__.cpython-311.pyc +0 -0
- PyFinitDiff/coefficients/__pycache__/backward.cpython-311.pyc +0 -0
- PyFinitDiff/coefficients/__pycache__/central.cpython-311.pyc +0 -0
- PyFinitDiff/coefficients/__pycache__/forward.cpython-311.pyc +0 -0
- PyFinitDiff/finite_difference_1D/__init__.py +6 -6
- PyFinitDiff/finite_difference_1D/__pycache__/__init__.cpython-311.pyc +0 -0
- PyFinitDiff/finite_difference_1D/__pycache__/boundaries.cpython-311.pyc +0 -0
- PyFinitDiff/finite_difference_1D/__pycache__/derivative.cpython-311.pyc +0 -0
- PyFinitDiff/finite_difference_1D/__pycache__/diagonals.cpython-311.pyc +0 -0
- PyFinitDiff/finite_difference_1D/__pycache__/finite_difference.cpython-311.pyc +0 -0
- PyFinitDiff/finite_difference_1D/__pycache__/utils.cpython-311.pyc +0 -0
- PyFinitDiff/finite_difference_1D/boundaries.py +113 -30
- PyFinitDiff/finite_difference_1D/derivative.py +44 -0
- PyFinitDiff/finite_difference_1D/diagonals.py +4 -3
- PyFinitDiff/finite_difference_1D/finite_difference.py +21 -7
- PyFinitDiff/finite_difference_1D/utils.py +40 -4
- PyFinitDiff/finite_difference_2D/__init__.py +5 -7
- PyFinitDiff/finite_difference_2D/__pycache__/__init__.cpython-311.pyc +0 -0
- PyFinitDiff/finite_difference_2D/__pycache__/boundaries.cpython-311.pyc +0 -0
- PyFinitDiff/finite_difference_2D/__pycache__/derivative.cpython-311.pyc +0 -0
- PyFinitDiff/finite_difference_2D/__pycache__/diagonals.cpython-311.pyc +0 -0
- PyFinitDiff/finite_difference_2D/__pycache__/finite_difference.cpython-311.pyc +0 -0
- PyFinitDiff/finite_difference_2D/__pycache__/utils.cpython-311.pyc +0 -0
- PyFinitDiff/finite_difference_2D/boundaries.py +103 -23
- PyFinitDiff/finite_difference_2D/dense.py +15 -9
- PyFinitDiff/finite_difference_2D/derivative.py +18 -29
- PyFinitDiff/finite_difference_2D/diagonals.py +147 -91
- PyFinitDiff/finite_difference_2D/finite_difference.py +67 -56
- PyFinitDiff/finite_difference_2D/utils.py +51 -5
- {PyFinitDiff-1.2.3.dist-info → PyFinitDiff-1.3.0.dist-info}/METADATA +1 -1
- PyFinitDiff-1.3.0.dist-info/RECORD +61 -0
- tests/1D/__pycache__/__init__.cpython-311.pyc +0 -0
- tests/1D/__pycache__/test_api.cpython-311-pytest-8.2.2.pyc +0 -0
- tests/1D/__pycache__/test_derivative.cpython-311-pytest-8.2.2.pyc +0 -0
- tests/2D/__pycache__/__init__.cpython-311.pyc +0 -0
- tests/2D/__pycache__/test_api.cpython-311-pytest-8.2.2.pyc +0 -0
- tests/2D/__pycache__/test_derivative.cpython-311-pytest-8.2.2.pyc +0 -0
- tests/2D/__pycache__/test_eigen.cpython-311-pytest-8.2.2.pyc +0 -0
- PyFinitDiff/finite_difference_1D/__pycache__/derivatives.cpython-311.pyc +0 -0
- PyFinitDiff/finite_difference_1D/__pycache__/meshes.cpython-311.pyc +0 -0
- PyFinitDiff/finite_difference_1D/derivatives.py +0 -53
- PyFinitDiff/finite_difference_1D/meshes.py +0 -41
- PyFinitDiff/finite_difference_2D/__pycache__/meshes.cpython-311.pyc +0 -0
- PyFinitDiff/finite_difference_2D/meshes.py +0 -50
- PyFinitDiff-1.2.3.dist-info/RECORD +0 -65
- {PyFinitDiff-1.2.3.dist-info → PyFinitDiff-1.3.0.dist-info}/LICENSE +0 -0
- {PyFinitDiff-1.2.3.dist-info → PyFinitDiff-1.3.0.dist-info}/WHEEL +0 -0
- {PyFinitDiff-1.2.3.dist-info → PyFinitDiff-1.3.0.dist-info}/top_level.txt +0 -0
|
@@ -1,22 +1,68 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
|
|
4
|
+
import numpy
|
|
5
|
+
from PyFinitDiff.triplet import DiagonalTriplet
|
|
4
6
|
from dataclasses import dataclass
|
|
5
7
|
|
|
6
8
|
|
|
7
9
|
@dataclass
|
|
8
|
-
class MeshInfo
|
|
10
|
+
class MeshInfo:
|
|
11
|
+
"""
|
|
12
|
+
This class represents the mesh information for a finite-difference grid.
|
|
13
|
+
|
|
14
|
+
Attributes:
|
|
15
|
+
n_x (int): Number of points in the x direction.
|
|
16
|
+
n_y (int): Number of points in the y direction.
|
|
17
|
+
dx (float): Infinitesimal displacement in the x direction. Defaults to 1.
|
|
18
|
+
dy (float): Infinitesimal displacement in the y direction. Defaults to 1.
|
|
19
|
+
size (int): Total number of points in the mesh.
|
|
20
|
+
shape (Tuple[int, int]): Shape of the mesh as a tuple.
|
|
21
|
+
"""
|
|
9
22
|
n_x: int
|
|
10
|
-
""" Number of point in the x direction """
|
|
11
23
|
n_y: int
|
|
12
|
-
""" Number of point in the y direction """
|
|
13
24
|
dx: float = 1
|
|
14
|
-
""" Infinetisemal displacement in x direction """
|
|
15
25
|
dy: float = 1
|
|
16
|
-
""" Infinetisemal displacement in y direction """
|
|
17
26
|
|
|
18
27
|
def __post_init__(self):
|
|
28
|
+
"""Post-initialization to calculate mesh size and shape."""
|
|
19
29
|
self.size = self.n_x * self.n_y
|
|
20
30
|
self.shape = (self.n_x, self.n_y)
|
|
21
31
|
|
|
32
|
+
|
|
33
|
+
def get_circular_mesh_triplet(
|
|
34
|
+
n_x: int,
|
|
35
|
+
n_y: int,
|
|
36
|
+
radius: float,
|
|
37
|
+
x_offset: float = 0,
|
|
38
|
+
y_offset: float = 0,
|
|
39
|
+
value_out: float = 0,
|
|
40
|
+
value_in: float = 1) -> 'DiagonalTriplet':
|
|
41
|
+
"""
|
|
42
|
+
Gets a Triplet corresponding to a 2D mesh with a circular structure of value_in inside and value_out outside.
|
|
43
|
+
|
|
44
|
+
Args:
|
|
45
|
+
n_x (int): The number of points in the x-axis.
|
|
46
|
+
n_y (int): The number of points in the y-axis.
|
|
47
|
+
radius (float): The radius of the circular structure.
|
|
48
|
+
x_offset (float, optional): The x offset of the circular structure. Defaults to 0.
|
|
49
|
+
y_offset (float, optional): The y offset of the circular structure. Defaults to 0.
|
|
50
|
+
value_in (float, optional): The value inside the circular structure. Defaults to 1.
|
|
51
|
+
value_out (float, optional): The value outside the circular structure. Defaults to 0.
|
|
52
|
+
|
|
53
|
+
Returns:
|
|
54
|
+
DiagonalTriplet: The 2D circular mesh triplet.
|
|
55
|
+
"""
|
|
56
|
+
y, x = numpy.mgrid[
|
|
57
|
+
-100:100:complex(n_y),
|
|
58
|
+
-100:100:complex(n_x)
|
|
59
|
+
]
|
|
60
|
+
|
|
61
|
+
r = numpy.sqrt((x - x_offset)**2 + (y - y_offset)**2)
|
|
62
|
+
mesh = numpy.ones(x.shape) * value_out
|
|
63
|
+
mesh[r < radius] = value_in
|
|
64
|
+
|
|
65
|
+
return DiagonalTriplet(mesh, shape=[n_x, n_y])
|
|
66
|
+
|
|
67
|
+
|
|
22
68
|
# -
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
PyFinitDiff/VERSION,sha256=ZNI_hY71Gw-Zbklm1OJ8A3G0N-LSeHiQsfetItTsVmM,6
|
|
2
|
+
PyFinitDiff/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
PyFinitDiff/triplet.py,sha256=o_pnW-Y_igF29IosZGQX6WJdX0QZtIGDL2Mu-1X1Ihg,12701
|
|
4
|
+
PyFinitDiff/utils.py,sha256=oKaaG1qbAjJe3Kd9rS86LuylEuoYu2oPeKgTjKtdxME,3175
|
|
5
|
+
PyFinitDiff/__pycache__/__init__.cpython-311.pyc,sha256=9e16m5kCObiwhKE-CMQH_HaHtUVTNuBCXuxoggChXqE,174
|
|
6
|
+
PyFinitDiff/__pycache__/triplet.cpython-311.pyc,sha256=9wGGAsXwwnJpXrVW_8afegFKxw2_0lW8awxuzeG9hvg,21838
|
|
7
|
+
PyFinitDiff/__pycache__/utils.cpython-311.pyc,sha256=geiigp4FhZ2U3ABm9GPThkhoz1W3dwx12EL1rsr1yfo,5020
|
|
8
|
+
PyFinitDiff/coefficients/__init__.py,sha256=D6leOHW6065G9S6rdcQLmTc99bhWJ9OldfR8lWYQJIU,4179
|
|
9
|
+
PyFinitDiff/coefficients/backward.py,sha256=cTti5MkcrhvuJVNURLJqnTcMmSQhdPvRPImu6ZSEsfY,1977
|
|
10
|
+
PyFinitDiff/coefficients/central.py,sha256=Xq1W-yXnTFLNugYwHajl8XynHPWdV7jH6ll2fy_NVSI,2377
|
|
11
|
+
PyFinitDiff/coefficients/forward.py,sha256=znCszjYptZpQiINx_VQXFeLTNKhntm3MV1g7CNOW67E,1973
|
|
12
|
+
PyFinitDiff/coefficients/__pycache__/__init__.cpython-311.pyc,sha256=rM9vRmDfISHm69MJ_71I-frCtCt8vn61xwVzUyvlE8I,7581
|
|
13
|
+
PyFinitDiff/coefficients/__pycache__/backward.cpython-311.pyc,sha256=aGpidbhd8mMg9bHPFYVW8zQ86JzohXQ-o84BIQDRwMk,1326
|
|
14
|
+
PyFinitDiff/coefficients/__pycache__/central.cpython-311.pyc,sha256=-o8CjzMpRHALHGyNJWhBB9bYvBSYdlBmuMXLLDqiiRU,1404
|
|
15
|
+
PyFinitDiff/coefficients/__pycache__/forward.cpython-311.pyc,sha256=gSP2jgtk_8Snq7aBksFJiIBuGcm02Pq04qMbttgmIp0,1321
|
|
16
|
+
PyFinitDiff/finite_difference_1D/__init__.py,sha256=VIxWZB2VhtmtnU-Qz-VDGLIz1V1ufqXHyUxlIAYKgW4,237
|
|
17
|
+
PyFinitDiff/finite_difference_1D/boundaries.py,sha256=2HWURIrSMWLUTn4KoSBXYHZdWQEISzw-m6yZxt7CF3w,6159
|
|
18
|
+
PyFinitDiff/finite_difference_1D/derivative.py,sha256=OK6jN426iXHriiesQSy4hsZEN6z1I6osTw7IUK5aqMY,1476
|
|
19
|
+
PyFinitDiff/finite_difference_1D/diagonals.py,sha256=v6C0bPAApLl4qSwFMeoDPKzg8THlObVm9qc7co8QgnM,7082
|
|
20
|
+
PyFinitDiff/finite_difference_1D/finite_difference.py,sha256=q9UpPDxAxN78iBarW1x8W5UEdHTsE6o2BcXddKBIDXM,5871
|
|
21
|
+
PyFinitDiff/finite_difference_1D/utils.py,sha256=wFToOvAEK3A9VqBf_9e4O3cXRdP_igA_iS-67_5JV3Y,1708
|
|
22
|
+
PyFinitDiff/finite_difference_1D/__pycache__/__init__.cpython-311.pyc,sha256=-ZArBy1_sj36fQxNrl8jYe3ElQ2T9QTuQnarNIaHbwM,473
|
|
23
|
+
PyFinitDiff/finite_difference_1D/__pycache__/boundaries.cpython-311.pyc,sha256=BPoq2d7HIGNFVQ7OiKpJzYyr6ifNiTDlMAJrFIkkXco,8541
|
|
24
|
+
PyFinitDiff/finite_difference_1D/__pycache__/derivative.cpython-311.pyc,sha256=wjianpKLMZ-D5ZDl1c4L6sPK0C9-Nitznv6gttkrXvI,1816
|
|
25
|
+
PyFinitDiff/finite_difference_1D/__pycache__/diagonals.cpython-311.pyc,sha256=Q5fOEgO93DGk5Mio-QzDFlWsVh79H8E3v775OW7kCQ8,11354
|
|
26
|
+
PyFinitDiff/finite_difference_1D/__pycache__/finite_difference.cpython-311.pyc,sha256=DYm8zaRsa8zg8X97wXB8cs5mgJ40EEr8gAkc_JAX0xw,7368
|
|
27
|
+
PyFinitDiff/finite_difference_1D/__pycache__/utils.cpython-311.pyc,sha256=qIX5etmoiYcUFJp6Mo22xGen9l0OSO7AnasEm9FTTu8,2682
|
|
28
|
+
PyFinitDiff/finite_difference_2D/__init__.py,sha256=TIijlPbN-SiZ9UsaO5zVSZrb5ZsKVm0P63TZ_rjEySU,234
|
|
29
|
+
PyFinitDiff/finite_difference_2D/boundaries.py,sha256=jokzZ1VXq680XLCMsgAxS9Aza_DTmlYN-w2O_IRe33c,7312
|
|
30
|
+
PyFinitDiff/finite_difference_2D/dense.py,sha256=hWcncevb1gSk_-LSHr2SIk5LWy1bcCKN8UKCFI2robM,9199
|
|
31
|
+
PyFinitDiff/finite_difference_2D/derivative.py,sha256=MlO2aGFuxuK5yAf8q8dEOlc3dgRdf68lf1HTFh7IRzo,1820
|
|
32
|
+
PyFinitDiff/finite_difference_2D/diagonals.py,sha256=KPcmx8LoNyUuBQIJC330GUNEdP5UP4mrg__Vtpy1ZQU,9581
|
|
33
|
+
PyFinitDiff/finite_difference_2D/finite_difference.py,sha256=QRMwCjp4iF7jqkp3LqwzOQum2qT_VwRpjl7ZZp73aEI,6889
|
|
34
|
+
PyFinitDiff/finite_difference_2D/utils.py,sha256=OZgp9Wk1NuOEwXSf8PvQyHXOe927K37shu-WDjN21CM,2182
|
|
35
|
+
PyFinitDiff/finite_difference_2D/__pycache__/__init__.cpython-311.pyc,sha256=WK7cD3zPzFawDannqFty5AHmRc51uszHBmEy7XBBhVI,470
|
|
36
|
+
PyFinitDiff/finite_difference_2D/__pycache__/boundaries.cpython-311.pyc,sha256=44JlTNY0EjIOSh2JwYhLrHxhV3nf3yqj6FjGyTIoaQo,9894
|
|
37
|
+
PyFinitDiff/finite_difference_2D/__pycache__/derivative.cpython-311.pyc,sha256=ef89zIvIyGiT963_vL_K-u0NoTQ66PHgF81cgJ1mCP4,2350
|
|
38
|
+
PyFinitDiff/finite_difference_2D/__pycache__/diagonals.cpython-311.pyc,sha256=nbIwfQpFDR3j9c19WnymQBO_5gOI0mV0vvuk_Q8qjuM,14480
|
|
39
|
+
PyFinitDiff/finite_difference_2D/__pycache__/finite_difference.cpython-311.pyc,sha256=jzLyDEyWLdQiQ8AGBsLzsKVaBJ-WfQu-sqS1EJsYrlw,8842
|
|
40
|
+
PyFinitDiff/finite_difference_2D/__pycache__/utils.cpython-311.pyc,sha256=SnuvmKNDMdbgWgnrzTq_07UmUrmgXXXJpO0h9p3oHoE,3308
|
|
41
|
+
PyFinitDiff/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
42
|
+
PyFinitDiff/tools/directories.py,sha256=CjG37eY-Z68Czo5L7MzHJpu8KEJNhZPnh5VB5MTQ2Tg,837
|
|
43
|
+
tests/1D/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
44
|
+
tests/1D/test_api.py,sha256=A69vKTYoka7Xc2CCbsodzJOURzkVAipWlRQZQDdIoWY,1384
|
|
45
|
+
tests/1D/test_derivative.py,sha256=K0r0zg_Ds3WzIM3g37Jgrgk_ZmlYW64MZUhmgxBjIjs,2088
|
|
46
|
+
tests/1D/__pycache__/__init__.cpython-311.pyc,sha256=X5DqcdwMIWnTwLKFPgvEhMFg2k2Y8zzkhAdShxsWTjA,171
|
|
47
|
+
tests/1D/__pycache__/test_api.cpython-311-pytest-8.2.2.pyc,sha256=i5ZF4uNKIdhZuBnXxTgDas0XTykUm7-oOV21QGrY96w,2076
|
|
48
|
+
tests/1D/__pycache__/test_derivative.cpython-311-pytest-8.2.2.pyc,sha256=SlvVykvQn3i-xrHNmOw5Fbx9_Jkw2cCXV5fkiuDJS3A,3335
|
|
49
|
+
tests/2D/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
50
|
+
tests/2D/test_api.py,sha256=uZ_4cgfYhZvdreCpggFfHs_EUfE8YmkGcWDjEMlx-mc,1738
|
|
51
|
+
tests/2D/test_derivative.py,sha256=QkgXlrbZNkasyp_c8pcYYAr-kaA9RVUuhm_Ib66KXOI,2266
|
|
52
|
+
tests/2D/test_eigen.py,sha256=Pn_j_Fqkk6h0k94uOzEYIMyFeUKHDh5STg6BEgd4YAI,1702
|
|
53
|
+
tests/2D/__pycache__/__init__.cpython-311.pyc,sha256=sxS3dSCdNHH55VKsefzR9ePCcGBci30NGp5oFKn2j3I,171
|
|
54
|
+
tests/2D/__pycache__/test_api.cpython-311-pytest-8.2.2.pyc,sha256=Ylw691Y7nl43DaMDd-QwAN84hOipPeyJucE7Kuxqjzo,2292
|
|
55
|
+
tests/2D/__pycache__/test_derivative.cpython-311-pytest-8.2.2.pyc,sha256=y-XI0DYsaPQvTeEsRgHIb1eTBLXlcxqVTMGMeaECjhU,4128
|
|
56
|
+
tests/2D/__pycache__/test_eigen.cpython-311-pytest-8.2.2.pyc,sha256=ttmczUnRA6j0yV-SbyT9gPlISH5r5oQ_DGVwGCt-BcQ,2197
|
|
57
|
+
PyFinitDiff-1.3.0.dist-info/LICENSE,sha256=U6YG4UEW9XJzHa53oijR0qw6JNN_SZ38WOBmYn3NPd0,1072
|
|
58
|
+
PyFinitDiff-1.3.0.dist-info/METADATA,sha256=b5SCHAEkG_SKkbVeM2PUrdZpL11xQQirm0agEQtRaaU,3779
|
|
59
|
+
PyFinitDiff-1.3.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
60
|
+
PyFinitDiff-1.3.0.dist-info/top_level.txt,sha256=2ZG92aJV6elyv6Xl7U2Mhqv6Jcu9s3U2507uMBKTXiI,18
|
|
61
|
+
PyFinitDiff-1.3.0.dist-info/RECORD,,
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
|
|
4
|
-
from PyFinitDiff.coefficients import FiniteCoefficients
|
|
5
|
-
|
|
6
|
-
import numpy
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def get_function_derivative(
|
|
10
|
-
function: numpy.ndarray,
|
|
11
|
-
x_eval: float,
|
|
12
|
-
derivative: int,
|
|
13
|
-
delta: float,
|
|
14
|
-
function_kwargs: dict,
|
|
15
|
-
accuracy: int = 4,
|
|
16
|
-
coefficient_type: str = 'central') -> float:
|
|
17
|
-
"""
|
|
18
|
-
Returns the derivative a the given function
|
|
19
|
-
|
|
20
|
-
:param function: The function
|
|
21
|
-
:type function: function
|
|
22
|
-
:param x_eval: parameter to derive
|
|
23
|
-
:type x_eval: float
|
|
24
|
-
:param order: Differentiation order (1 to 5)
|
|
25
|
-
:type order: int
|
|
26
|
-
:param n_point: Number of points (3 to 6)
|
|
27
|
-
:type n_point: int
|
|
28
|
-
:param delta: Distance between points
|
|
29
|
-
:type delta: float
|
|
30
|
-
:param args: The arguments
|
|
31
|
-
:type args: list
|
|
32
|
-
|
|
33
|
-
:returns: The value of the derivative
|
|
34
|
-
:rtype: float
|
|
35
|
-
"""
|
|
36
|
-
coefficients = FiniteCoefficients(
|
|
37
|
-
derivative=derivative,
|
|
38
|
-
accuracy=accuracy,
|
|
39
|
-
coefficient_type=coefficient_type
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
summation = 0
|
|
43
|
-
for index, value in coefficients:
|
|
44
|
-
|
|
45
|
-
x = x_eval + index * delta
|
|
46
|
-
|
|
47
|
-
y = function(x, **function_kwargs)
|
|
48
|
-
|
|
49
|
-
summation += value * y
|
|
50
|
-
|
|
51
|
-
return summation / delta ** derivative
|
|
52
|
-
|
|
53
|
-
# -
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
|
|
4
|
-
import numpy
|
|
5
|
-
|
|
6
|
-
from PyFinitDiff.triplet import DiagonalTriplet
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def get_circular_mesh_triplet(
|
|
10
|
-
n_x: int,
|
|
11
|
-
radius: float,
|
|
12
|
-
x_offset: float = 0,
|
|
13
|
-
value_out: float = 0,
|
|
14
|
-
value_in: float = 1) -> DiagonalTriplet:
|
|
15
|
-
"""
|
|
16
|
-
Gets a Triplet corresponding to a 1d mesh with
|
|
17
|
-
circular structure of value_in inside and value_out outside.
|
|
18
|
-
|
|
19
|
-
:param n_x: The number of point in the x-axis
|
|
20
|
-
:type n_x: int
|
|
21
|
-
:param radius: The radius of the structure
|
|
22
|
-
:type radius: float
|
|
23
|
-
:param x_offset: The x offset of the circular structure
|
|
24
|
-
:type x_offset: float
|
|
25
|
-
:param value_out: The value inside
|
|
26
|
-
:type value_out: float
|
|
27
|
-
:param value_in: The value outside
|
|
28
|
-
:type value_in: float
|
|
29
|
-
|
|
30
|
-
:returns: The 1d circular mesh triplet.
|
|
31
|
-
:rtype: DiagonalTriplet
|
|
32
|
-
"""
|
|
33
|
-
x = numpy.linspace(-100, 100, n_x)
|
|
34
|
-
|
|
35
|
-
r = numpy.sqrt((x - x_offset)**2)
|
|
36
|
-
mesh = numpy.ones(x.shape) * value_out
|
|
37
|
-
mesh[r < radius] = value_in
|
|
38
|
-
|
|
39
|
-
return DiagonalTriplet(mesh, shape=(n_x,))
|
|
40
|
-
|
|
41
|
-
# -
|
|
Binary file
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
|
|
4
|
-
import numpy
|
|
5
|
-
from PyFinitDiff.triplet import DiagonalTriplet
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def get_circular_mesh_triplet(
|
|
9
|
-
n_x: int,
|
|
10
|
-
n_y: int,
|
|
11
|
-
radius: float,
|
|
12
|
-
x_offset: float = 0,
|
|
13
|
-
y_offset: float = 0,
|
|
14
|
-
value_out: float = 0,
|
|
15
|
-
value_in: float = 1) -> DiagonalTriplet:
|
|
16
|
-
"""
|
|
17
|
-
Gets a Triplet corresponding to a 2d mesh with
|
|
18
|
-
circular structure of value_in inside and value_out outside.
|
|
19
|
-
|
|
20
|
-
:param n_x: The number of point in the x-axis
|
|
21
|
-
:type n_x: int
|
|
22
|
-
:param n_y: The number of point in the y-axis
|
|
23
|
-
:type n_y: int
|
|
24
|
-
:param radius: The radius of the structure
|
|
25
|
-
:type radius: float
|
|
26
|
-
:param x_offset: The x offset of the circular structure
|
|
27
|
-
:type x_offset: float
|
|
28
|
-
:param y_offset: The y offset of the circular structure
|
|
29
|
-
:type y_offset: float
|
|
30
|
-
:param value_in: The value inside
|
|
31
|
-
:type value_in: float
|
|
32
|
-
:param value_out: The value outside
|
|
33
|
-
:type value_out: float
|
|
34
|
-
|
|
35
|
-
:returns: The 2d circular mesh triplet.
|
|
36
|
-
:rtype: DiagonalTriplet
|
|
37
|
-
"""
|
|
38
|
-
y, x = numpy.mgrid[
|
|
39
|
-
-100:100:complex(n_y),
|
|
40
|
-
-100:100:complex(n_x)
|
|
41
|
-
]
|
|
42
|
-
|
|
43
|
-
r = numpy.sqrt((x - x_offset)**2 + (y - y_offset)**2)
|
|
44
|
-
mesh = numpy.ones(x.shape) * value_out
|
|
45
|
-
mesh[r < radius] = value_in
|
|
46
|
-
|
|
47
|
-
return DiagonalTriplet(mesh, shape=[n_x, n_y])
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
# -
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
PyFinitDiff/VERSION,sha256=2C80rpqkG8Sgy1KaGsCJj-0J1rR5-xzETLZsNPFe6E0,6
|
|
2
|
-
PyFinitDiff/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
PyFinitDiff/triplet.py,sha256=o_pnW-Y_igF29IosZGQX6WJdX0QZtIGDL2Mu-1X1Ihg,12701
|
|
4
|
-
PyFinitDiff/utils.py,sha256=oKaaG1qbAjJe3Kd9rS86LuylEuoYu2oPeKgTjKtdxME,3175
|
|
5
|
-
PyFinitDiff/__pycache__/__init__.cpython-311.pyc,sha256=Bfp7tVgdD9j4ekwww1nRHfQ_UOJXr3r941ck9knY46U,174
|
|
6
|
-
PyFinitDiff/__pycache__/triplet.cpython-311.pyc,sha256=5MxcAidaZMvaAupxoxN77GRWLMaBfM7uuBFSPcqlhjA,21838
|
|
7
|
-
PyFinitDiff/__pycache__/utils.cpython-311.pyc,sha256=VFS5WUVX9LH53UNal9EOs2vAbMib3VFF_BkTghZ5g1w,5020
|
|
8
|
-
PyFinitDiff/coefficients/__init__.py,sha256=D6leOHW6065G9S6rdcQLmTc99bhWJ9OldfR8lWYQJIU,4179
|
|
9
|
-
PyFinitDiff/coefficients/backward.py,sha256=cTti5MkcrhvuJVNURLJqnTcMmSQhdPvRPImu6ZSEsfY,1977
|
|
10
|
-
PyFinitDiff/coefficients/central.py,sha256=Xq1W-yXnTFLNugYwHajl8XynHPWdV7jH6ll2fy_NVSI,2377
|
|
11
|
-
PyFinitDiff/coefficients/forward.py,sha256=znCszjYptZpQiINx_VQXFeLTNKhntm3MV1g7CNOW67E,1973
|
|
12
|
-
PyFinitDiff/coefficients/__pycache__/__init__.cpython-311.pyc,sha256=rME1Nk-IhHBM1bowWtJkCqkGwaUIET6GPr9arOqfXAw,7581
|
|
13
|
-
PyFinitDiff/coefficients/__pycache__/backward.cpython-311.pyc,sha256=kZM1b4DReKTR3cdTit4-ZZHveT4dqPp_RLvKuOlHg7o,1326
|
|
14
|
-
PyFinitDiff/coefficients/__pycache__/central.cpython-311.pyc,sha256=zevTxbT8R5BzxxyIzGnziNb7QqtyCRG7roLPRR7lD6Y,1404
|
|
15
|
-
PyFinitDiff/coefficients/__pycache__/forward.cpython-311.pyc,sha256=5SIeGMRiKVAY-bYYuRXsSfqVy_LWaqf3jDy76OKCAbU,1321
|
|
16
|
-
PyFinitDiff/finite_difference_1D/__init__.py,sha256=ObFxFFDp__KhrEhTluPJmi3jX9nGZEswPsYIk2Ixm-8,153
|
|
17
|
-
PyFinitDiff/finite_difference_1D/boundaries.py,sha256=J6Mzal-8KVlo4ouA4Lalmnc1pWNBdsmurIDIpMUEc9A,3281
|
|
18
|
-
PyFinitDiff/finite_difference_1D/derivatives.py,sha256=xCn2qrQ1jUq_0XJCarB4kBNZLd_x4BI_N0idvBYM_a0,1403
|
|
19
|
-
PyFinitDiff/finite_difference_1D/diagonals.py,sha256=U_WKLLA-tM8f0dBss9rp1p7VPgM7o_pRHN1iYhHEnnk,7021
|
|
20
|
-
PyFinitDiff/finite_difference_1D/finite_difference.py,sha256=hGyP8RSvwK2MQrJYrn5p1ux_XgtFvIUD15vYIk5t4LE,5526
|
|
21
|
-
PyFinitDiff/finite_difference_1D/meshes.py,sha256=YEZf-RsGAwXb-xSK3TCI-fnPjLBbxg0p5RBVOAOLL6o,1153
|
|
22
|
-
PyFinitDiff/finite_difference_1D/utils.py,sha256=-Vh8jdV30Cl3CkC_W7WzP2EftX6VQeZ8BkrVPj-fOfM,341
|
|
23
|
-
PyFinitDiff/finite_difference_1D/__pycache__/__init__.cpython-311.pyc,sha256=xxfFS0fo88_LyBMcLM5yI63wv2weOWnsso-Sc4jg9fw,388
|
|
24
|
-
PyFinitDiff/finite_difference_1D/__pycache__/boundaries.cpython-311.pyc,sha256=O-04GpTRAfH68tI3f_KHhjC0mfCM54fk0TELuKbXgQU,5554
|
|
25
|
-
PyFinitDiff/finite_difference_1D/__pycache__/derivatives.cpython-311.pyc,sha256=pM4ZoU_EHH3IUtgYywfg7GqRHiwCtnSt6g2KBE32ai4,1757
|
|
26
|
-
PyFinitDiff/finite_difference_1D/__pycache__/diagonals.cpython-311.pyc,sha256=RE4TQUXIYmpNr5b5J2poiHLYZH3KEbkzG4DQ9Nuv4vU,11308
|
|
27
|
-
PyFinitDiff/finite_difference_1D/__pycache__/finite_difference.cpython-311.pyc,sha256=z4AsU3KUC5z8sJnhFyaDXIDxoNY0j4QuvO5tpmfY3Dk,6992
|
|
28
|
-
PyFinitDiff/finite_difference_1D/__pycache__/meshes.cpython-311.pyc,sha256=u_xcJLLr1g34Y9UEF72gidjLJLiFRwohCEuBItGhFjw,1675
|
|
29
|
-
PyFinitDiff/finite_difference_1D/__pycache__/utils.cpython-311.pyc,sha256=CZaxwyGboSlHv63KGu_bDm0TVAE7Kmmei8FeIHp2uiQ,848
|
|
30
|
-
PyFinitDiff/finite_difference_2D/__init__.py,sha256=ca37gMSuzi5zoy-g4GkSUwTfnN8513dHobOKONg6Ntc,176
|
|
31
|
-
PyFinitDiff/finite_difference_2D/boundaries.py,sha256=9OgXjUcMiEVfbnArPGocLlixA_nH1qyeDcVxxBXtWaY,4458
|
|
32
|
-
PyFinitDiff/finite_difference_2D/dense.py,sha256=EJBuX-F_iXSD3sYAvXinhV8ZjnbMsRoGWNWQI4YgK5Q,8971
|
|
33
|
-
PyFinitDiff/finite_difference_2D/derivative.py,sha256=NFyPNeBSj1jwScfGPc0JiXKmQ09Ckv-6IsVR-jPIPOU,1974
|
|
34
|
-
PyFinitDiff/finite_difference_2D/diagonals.py,sha256=dECNVSqfO_xnedjZoPgbhH5gTcSyeckWMbB0PDMYAaw,7353
|
|
35
|
-
PyFinitDiff/finite_difference_2D/finite_difference.py,sha256=vNFFbaG9gm5_hwYT7RWVbyKJzvmCFrCCOFLMC-f1VOk,6174
|
|
36
|
-
PyFinitDiff/finite_difference_2D/meshes.py,sha256=WABzzBU1ShfaJVhNZz8J3R5YgoJgmT7iCnjK_J1dRcU,1457
|
|
37
|
-
PyFinitDiff/finite_difference_2D/utils.py,sha256=zP_mxy_HHXrii3YRvBbKYTy5lKLtEuIB2RvJPyBp63I,493
|
|
38
|
-
PyFinitDiff/finite_difference_2D/__pycache__/__init__.cpython-311.pyc,sha256=dvsiHTD6JWrktssxQx8jd1VX5wcrGbkWZjrscHo7Vfg,387
|
|
39
|
-
PyFinitDiff/finite_difference_2D/__pycache__/boundaries.cpython-311.pyc,sha256=YGLBPC8x3rftWemXY0DQO6qkdVyOBul8T9qhRvKAo8g,6683
|
|
40
|
-
PyFinitDiff/finite_difference_2D/__pycache__/derivative.cpython-311.pyc,sha256=Gsw6-DBGfKSCVGXODhzQr6GxWYq6PT-nyixYCgUTfcQ,2488
|
|
41
|
-
PyFinitDiff/finite_difference_2D/__pycache__/diagonals.cpython-311.pyc,sha256=GZVLUqHz_HeD7hp0GQOtQrZBvTYbiVmYPMH8LjMxdbQ,12184
|
|
42
|
-
PyFinitDiff/finite_difference_2D/__pycache__/finite_difference.cpython-311.pyc,sha256=y6Er2g-UCBq2DgjWuUUEuEU457z5j7jLU8lvJe1Do9A,7697
|
|
43
|
-
PyFinitDiff/finite_difference_2D/__pycache__/meshes.cpython-311.pyc,sha256=X7k8bf70N6YtNczOVTagcBfekEKTJlJxCerNfvUhzLI,2069
|
|
44
|
-
PyFinitDiff/finite_difference_2D/__pycache__/utils.cpython-311.pyc,sha256=xc2kxMcqqUr53oC2VK5u80Ay3Ty3Okq6l2d6RnQ5Uow,963
|
|
45
|
-
PyFinitDiff/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
46
|
-
PyFinitDiff/tools/directories.py,sha256=CjG37eY-Z68Czo5L7MzHJpu8KEJNhZPnh5VB5MTQ2Tg,837
|
|
47
|
-
tests/1D/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
48
|
-
tests/1D/test_api.py,sha256=A69vKTYoka7Xc2CCbsodzJOURzkVAipWlRQZQDdIoWY,1384
|
|
49
|
-
tests/1D/test_derivative.py,sha256=K0r0zg_Ds3WzIM3g37Jgrgk_ZmlYW64MZUhmgxBjIjs,2088
|
|
50
|
-
tests/1D/__pycache__/__init__.cpython-311.pyc,sha256=WQ2gfd2pRRI_e0pakPEZ4eVf03DaIdGE2np5i1_jiwI,171
|
|
51
|
-
tests/1D/__pycache__/test_api.cpython-311-pytest-8.2.2.pyc,sha256=xvtJ1kHbYi3MarIRip3XMyRuz18BrnTsuw_Oco1qe4I,2076
|
|
52
|
-
tests/1D/__pycache__/test_derivative.cpython-311-pytest-8.2.2.pyc,sha256=W6D0dcdw7yow06b2qJFwvz-GUjyvdF8nvNNSO9RcgDY,3335
|
|
53
|
-
tests/2D/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
54
|
-
tests/2D/test_api.py,sha256=uZ_4cgfYhZvdreCpggFfHs_EUfE8YmkGcWDjEMlx-mc,1738
|
|
55
|
-
tests/2D/test_derivative.py,sha256=QkgXlrbZNkasyp_c8pcYYAr-kaA9RVUuhm_Ib66KXOI,2266
|
|
56
|
-
tests/2D/test_eigen.py,sha256=Pn_j_Fqkk6h0k94uOzEYIMyFeUKHDh5STg6BEgd4YAI,1702
|
|
57
|
-
tests/2D/__pycache__/__init__.cpython-311.pyc,sha256=eR_bKVTDaCWwAHPEx49qtaj9MBGlUxGXt4Kuy3ovhKE,171
|
|
58
|
-
tests/2D/__pycache__/test_api.cpython-311-pytest-8.2.2.pyc,sha256=c9Zwv9AZlCgLQjip8lWTaNkIQhq4likZ4iTmSYWfVA0,2292
|
|
59
|
-
tests/2D/__pycache__/test_derivative.cpython-311-pytest-8.2.2.pyc,sha256=AXFXMdgjD1BpoGLQjsAqR6P5VgIbXK_FUUjEVoBDuIo,4128
|
|
60
|
-
tests/2D/__pycache__/test_eigen.cpython-311-pytest-8.2.2.pyc,sha256=1Pin3KbG5GZnWFVT535f1xt7Sv-ehKfyAtTO9BUpGkE,2197
|
|
61
|
-
PyFinitDiff-1.2.3.dist-info/LICENSE,sha256=U6YG4UEW9XJzHa53oijR0qw6JNN_SZ38WOBmYn3NPd0,1072
|
|
62
|
-
PyFinitDiff-1.2.3.dist-info/METADATA,sha256=_lmfDCIY3bAodYjSKWC3AtqjL8BSjA-mEhHRymE59dY,3779
|
|
63
|
-
PyFinitDiff-1.2.3.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
64
|
-
PyFinitDiff-1.2.3.dist-info/top_level.txt,sha256=2ZG92aJV6elyv6Xl7U2Mhqv6Jcu9s3U2507uMBKTXiI,18
|
|
65
|
-
PyFinitDiff-1.2.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|