feectools 0.1.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.
Files changed (98) hide show
  1. feectools/__init__.py +0 -0
  2. feectools/accelerate/__init__.py +0 -0
  3. feectools/accelerate/accelerate.py +220 -0
  4. feectools/accelerate/compile_psydac.mk +52 -0
  5. feectools/api/__init__.py +0 -0
  6. feectools/api/essential_bc.py +122 -0
  7. feectools/api/fem_bilinear_form.py +2226 -0
  8. feectools/api/fem_common.py +286 -0
  9. feectools/api/fem_sum_form.py +123 -0
  10. feectools/api/settings.py +82 -0
  11. feectools/core/__init__.py +11 -0
  12. feectools/core/bsplines.py +1107 -0
  13. feectools/core/bsplines_kernels.py +1349 -0
  14. feectools/core/field_evaluation_kernels.py +5015 -0
  15. feectools/core/tests/__init__.py +0 -0
  16. feectools/core/tests/test_bsplines.py +263 -0
  17. feectools/core/tests/test_bsplines_kernel.py +40 -0
  18. feectools/core/tests/test_bsplines_pyccel.py +752 -0
  19. feectools/ddm/__init__.py +3 -0
  20. feectools/ddm/basic.py +78 -0
  21. feectools/ddm/blocking_data_exchanger.py +348 -0
  22. feectools/ddm/cart.py +1835 -0
  23. feectools/ddm/interface_data_exchanger.py +122 -0
  24. feectools/ddm/mpi.py +109 -0
  25. feectools/ddm/nonblocking_data_exchanger.py +331 -0
  26. feectools/ddm/partition.py +207 -0
  27. feectools/ddm/petsc.py +112 -0
  28. feectools/ddm/tests/__init__.py +0 -0
  29. feectools/ddm/tests/test_cart_1d.py +138 -0
  30. feectools/ddm/tests/test_cart_2d.py +164 -0
  31. feectools/ddm/tests/test_cart_3d.py +158 -0
  32. feectools/ddm/tests/test_multicart_2d.py +173 -0
  33. feectools/ddm/tests/test_partition.py +124 -0
  34. feectools/ddm/utilities.py +24 -0
  35. feectools/feec/__init__.py +0 -0
  36. feectools/feec/derivatives.py +780 -0
  37. feectools/feec/dof_kernels.py +210 -0
  38. feectools/feec/global_geometric_projectors.py +1073 -0
  39. feectools/feec/hodge.py +148 -0
  40. feectools/fem/__init__.py +0 -0
  41. feectools/fem/basic.py +465 -0
  42. feectools/fem/grid.py +181 -0
  43. feectools/fem/partitioning.py +344 -0
  44. feectools/fem/projectors.py +160 -0
  45. feectools/fem/splines.py +559 -0
  46. feectools/fem/tensor.py +1393 -0
  47. feectools/fem/tests/__init__.py +0 -0
  48. feectools/fem/tests/analytical_profiles_1d.py +100 -0
  49. feectools/fem/tests/analytical_profiles_base.py +34 -0
  50. feectools/fem/tests/splines_error_bounds.py +155 -0
  51. feectools/fem/tests/test_spline_histopolation.py +120 -0
  52. feectools/fem/tests/test_spline_interpolation.py +182 -0
  53. feectools/fem/tests/test_splines.py +184 -0
  54. feectools/fem/tests/test_splines_par.py +46 -0
  55. feectools/fem/tests/test_vector_spaces.py +150 -0
  56. feectools/fem/tests/utilities.py +47 -0
  57. feectools/fem/vector.py +729 -0
  58. feectools/linalg/__init__.py +0 -0
  59. feectools/linalg/basic.py +1386 -0
  60. feectools/linalg/block.py +1451 -0
  61. feectools/linalg/direct_solvers.py +201 -0
  62. feectools/linalg/fft.py +258 -0
  63. feectools/linalg/kernels/__init__.py +0 -0
  64. feectools/linalg/kernels/axpy_kernels.py +57 -0
  65. feectools/linalg/kernels/inner_kernels.py +100 -0
  66. feectools/linalg/kernels/matvec_kernels.py +206 -0
  67. feectools/linalg/kernels/stencil2IJV_kernels.py +227 -0
  68. feectools/linalg/kernels/stencil2coo_kernels.py +179 -0
  69. feectools/linalg/kernels/transpose_kernels.py +263 -0
  70. feectools/linalg/kron.py +911 -0
  71. feectools/linalg/solvers.py +1914 -0
  72. feectools/linalg/sparse.py +114 -0
  73. feectools/linalg/stencil.py +2923 -0
  74. feectools/linalg/stencil_dot_kernels.py +317 -0
  75. feectools/linalg/stencil_transpose_kernels.py +372 -0
  76. feectools/linalg/tests/__init__.py +0 -0
  77. feectools/linalg/tests/test_block.py +1588 -0
  78. feectools/linalg/tests/test_fft.py +106 -0
  79. feectools/linalg/tests/test_kron_stencil_matrix.py +114 -0
  80. feectools/linalg/tests/test_linalg.py +1065 -0
  81. feectools/linalg/tests/test_matrix_free.py +128 -0
  82. feectools/linalg/tests/test_solvers.py +213 -0
  83. feectools/linalg/tests/test_stencil_interface_matrix.py +379 -0
  84. feectools/linalg/tests/test_stencil_vector.py +1036 -0
  85. feectools/linalg/tests/test_stencil_vector_space.py +440 -0
  86. feectools/linalg/topetsc.py +522 -0
  87. feectools/linalg/utilities.py +200 -0
  88. feectools/utilities/__init__.py +0 -0
  89. feectools/utilities/quadratures.py +113 -0
  90. feectools/utilities/utils.py +166 -0
  91. feectools/version.py +1 -0
  92. feectools-0.1.0.dist-info/METADATA +66 -0
  93. feectools-0.1.0.dist-info/RECORD +98 -0
  94. feectools-0.1.0.dist-info/WHEEL +5 -0
  95. feectools-0.1.0.dist-info/entry_points.txt +3 -0
  96. feectools-0.1.0.dist-info/licenses/AUTHORS +22 -0
  97. feectools-0.1.0.dist-info/licenses/LICENSE +21 -0
  98. feectools-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,263 @@
1
+ from typing import TypeVar
2
+
3
+ T = TypeVar('T', float, complex)
4
+
5
+ #========================================================================================================
6
+ def transpose_1d(M : "T[:,:]",
7
+ Mt : "T[:,:]",
8
+ n : "int64[:]",
9
+ nc : "int64[:]",
10
+ gp : "int64[:]",
11
+ p : "int64[:]",
12
+ dm : "int64[:]",
13
+ cm : "int64[:]",
14
+ nd : "int64[:]",
15
+ ndT: "int64[:]",
16
+ si : "int64[:]",
17
+ sk : "int64[:]",
18
+ sl : "int64[:]"):
19
+
20
+ # -- removed omp: #$ omp parallel default(private) shared(Mt,M) firstprivate( n,nc,gp,p,dm,cm,nd,ndT,si,sk,sl)
21
+ d1 = gp[0] - p[0]
22
+ e1 = nd[0] - sl[0]
23
+ # -- removed omp: #$ omp for schedule(static) collapse(1)
24
+ for x1 in range(n[0]):
25
+
26
+ j1 = dm[0] * gp[0] + x1
27
+ for l1 in range(nd[0]):
28
+
29
+ i1 = si[0] + cm[0] * (x1 // dm[0]) + l1 + d1
30
+
31
+ k1 = sk[0] + x1 % dm[0] - dm[0] * (l1 // cm[0])
32
+
33
+ if k1 < ndT[0] and k1 > -1 and l1 < e1 and i1 < nc[0]:
34
+ Mt[j1, l1 + sl[0]] = M[i1, k1]
35
+ # -- removed omp: #$ omp end parallel
36
+ return
37
+
38
+ #========================================================================================================
39
+ def transpose_2d(M : "T[:,:,:,:]",
40
+ Mt : "T[:,:,:,:]",
41
+ n : "int64[:]",
42
+ nc : "int64[:]",
43
+ gp : "int64[:]",
44
+ p : "int64[:]",
45
+ dm : "int64[:]",
46
+ cm : "int64[:]",
47
+ nd : "int64[:]",
48
+ ndT: "int64[:]",
49
+ si : "int64[:]",
50
+ sk : "int64[:]",
51
+ sl : "int64[:]"):
52
+
53
+ # -- removed omp: #$ omp parallel default(private) shared(Mt,M) firstprivate( n,nc,gp,p,dm,cm,nd,ndT,si,sk,sl)
54
+ d1 = gp[0] - p[0]
55
+ d2 = gp[1] - p[1]
56
+
57
+ e1 = nd[0] - sl[0]
58
+ e2 = nd[1] - sl[1]
59
+
60
+ # -- removed omp: #$ omp for schedule(static) collapse(2)
61
+ for x1 in range(n[0]):
62
+ for x2 in range(n[1]):
63
+
64
+ j1 = dm[0]*gp[0] + x1
65
+ j2 = dm[1]*gp[1] + x2
66
+
67
+ for l1 in range(nd[0]):
68
+ for l2 in range(nd[1]):
69
+
70
+ i1 = si[0] + cm[0]*(x1//dm[0]) + l1 + d1
71
+ i2 = si[1] + cm[1]*(x2//dm[1]) + l2 + d2
72
+
73
+ k1 = sk[0] + x1%dm[0]-dm[0]*(l1//cm[0])
74
+ k2 = sk[1] + x2%dm[1]-dm[1]*(l2//cm[1])
75
+
76
+ if k1<ndT[0] and k1>-1 and k2<ndT[1] and k2>-1 and l1<e1 and l2<e2 and i1<nc[0] and i2<nc[1]:
77
+ Mt[j1,j2, l1 + sl[0],l2 + sl[1]] = M[i1,i2, k1,k2]
78
+ # -- removed omp: #$ omp end parallel
79
+ return
80
+
81
+ #========================================================================================================
82
+ def transpose_3d(M : "T[:,:,:,:,:,:]",
83
+ Mt : "T[:,:,:,:,:,:]",
84
+ n : "int64[:]",
85
+ nc : "int64[:]",
86
+ gp : "int64[:]",
87
+ p : "int64[:]",
88
+ dm : "int64[:]",
89
+ cm : "int64[:]",
90
+ nd : "int64[:]",
91
+ ndT: "int64[:]",
92
+ si : "int64[:]",
93
+ sk : "int64[:]",
94
+ sl : "int64[:]"):
95
+
96
+ # -- removed omp: #$ omp parallel default(private) shared(Mt,M) firstprivate(n,nc,gp,p,dm,cm,nd,ndT,si,sk,sl)
97
+ d1 = gp[0] - p[0]
98
+ d2 = gp[1] - p[1]
99
+ d3 = gp[2] - p[2]
100
+
101
+ e1 = nd[0] - sl[0]
102
+ e2 = nd[1] - sl[1]
103
+ e3 = nd[2] - sl[2]
104
+
105
+ # -- removed omp: #$ omp for schedule(static) collapse(3)
106
+ for x1 in range(n[0]):
107
+ for x2 in range(n[1]):
108
+ for x3 in range(n[2]):
109
+
110
+ j1 = dm[0]*gp[0] + x1
111
+ j2 = dm[1]*gp[1] + x2
112
+ j3 = dm[2]*gp[2] + x3
113
+
114
+ for l1 in range(nd[0]):
115
+ for l2 in range(nd[1]):
116
+ for l3 in range(nd[2]):
117
+
118
+ i1 = si[0] + cm[0]*(x1//dm[0]) + l1 + d1
119
+ i2 = si[1] + cm[1]*(x2//dm[1]) + l2 + d2
120
+ i3 = si[2] + cm[2]*(x3//dm[2]) + l3 + d3
121
+
122
+ k1 = sk[0] + x1%dm[0]-dm[0]*(l1//cm[0])
123
+ k2 = sk[1] + x2%dm[1]-dm[1]*(l2//cm[1])
124
+ k3 = sk[2] + x3%dm[2]-dm[2]*(l3//cm[2])
125
+
126
+ if k1<ndT[0] and k1>-1 and k2<ndT[1] and k2>-1 and k3<ndT[2] and k3>-1\
127
+ and l1<e1 and l2<e2 and l3<e3 and i1<nc[0] and i2<nc[1] and i3<nc[2]:
128
+ Mt[j1,j2,j3, l1 + sl[0],l2 + sl[1],l3 + sl[2]] = M[i1,i2,i3, k1,k2,k3]
129
+ # -- removed omp: #$ omp end parallel
130
+ return
131
+
132
+ #========================================================================================================
133
+ def interface_transpose_1d(M : "T[:,:]",
134
+ Mt : "T[:,:]",
135
+ n : "int64[:]",
136
+ nc : "int64[:]",
137
+ gp : "int64[:]",
138
+ p : "int64[:]",
139
+ dm : "int64[:]",
140
+ cm : "int64[:]",
141
+ nd : "int64[:]",
142
+ ndT: "int64[:]",
143
+ si : "int64[:]",
144
+ sk : "int64[:]",
145
+ sl : "int64[:]"):
146
+
147
+ # -- removed omp: #$ omp parallel default(private) shared(Mt,M) firstprivate(n,nc,gp,p,dm,cm,nd,ndT,si,sk,sl)
148
+ d1 = gp[0] - p [0]
149
+ e1 = nd[0] - sl[0]
150
+
151
+ # -- removed omp: #$ omp for schedule(static) collapse(1)
152
+ for x1 in range(n[0]):
153
+
154
+ j1 = gp[0] + x1
155
+
156
+ for l1 in range(nd[0]):
157
+
158
+ i1 = si[0] + cm[0]*(x1//dm[0]) + l1 + d1
159
+
160
+ k1 = sk[0] + x1%dm[0] - dm[0]*(l1//cm[0])
161
+
162
+ if k1<ndT[0] and k1>-1 and l1<e1 and i1<nc[0]:
163
+ Mt[j1, l1+sl[0]] = M[i1, k1]
164
+
165
+ # -- removed omp: #$ omp end parallel
166
+ return
167
+
168
+ #========================================================================================================
169
+ def interface_transpose_2d(M : "T[:,:,:,:]",
170
+ Mt : "T[:,:,:,:]",
171
+ n : "int64[:]",
172
+ nc : "int64[:]",
173
+ gp : "int64[:]",
174
+ p : "int64[:]",
175
+ dm : "int64[:]",
176
+ cm : "int64[:]",
177
+ nd : "int64[:]",
178
+ ndT: "int64[:]",
179
+ si : "int64[:]",
180
+ sk : "int64[:]",
181
+ sl : "int64[:]"):
182
+
183
+ # -- removed omp: #$ omp parallel default(private) shared(Mt,M) firstprivate(n,nc,gp,p,dm,cm,nd,ndT,si,sk,sl)
184
+ d1 = gp[0] - p[0]
185
+ d2 = gp[1] - p[1]
186
+
187
+ e1 = nd[0] - sl[0]
188
+ e2 = nd[1] - sl[1]
189
+
190
+ # -- removed omp: #$ omp for schedule(static) collapse(2)
191
+ for x1 in range(n[0]):
192
+ for x2 in range(n[1]):
193
+
194
+ j1 = gp[0] + x1
195
+ j2 = gp[1] + x2
196
+
197
+ for l1 in range(nd[0]):
198
+ for l2 in range(nd[1]):
199
+
200
+ i1 = si[0] + cm[0]*(x1//dm[0]) + l1 + d1
201
+ i2 = si[1] + cm[1]*(x2//dm[1]) + l2 + d2
202
+
203
+ k1 = sk[0] + x1%dm[0] - dm[0]*(l1//cm[0])
204
+ k2 = sk[1] + x2%dm[1] - dm[1]*(l2//cm[1])
205
+
206
+ if k1<ndT[0] and k1>-1 and k2<ndT[1] and k2>-1\
207
+ and l1<e1 and l2<e2 and i1<nc[0] and i2<nc[1]:
208
+ Mt[j1,j2, l1+sl[0],l2+sl[1]] = M[i1,i2, k1,k2]
209
+
210
+ # -- removed omp: #$ omp end parallel
211
+ return
212
+
213
+ #========================================================================================================
214
+ def interface_transpose_3d(M : "T[:,:,:,:,:,:]",
215
+ Mt : "T[:,:,:,:,:,:]",
216
+ n : "int64[:]",
217
+ nc : "int64[:]",
218
+ gp : "int64[:]",
219
+ p : "int64[:]",
220
+ dm : "int64[:]",
221
+ cm : "int64[:]",
222
+ nd : "int64[:]",
223
+ ndT: "int64[:]",
224
+ si : "int64[:]",
225
+ sk : "int64[:]",
226
+ sl : "int64[:]"):
227
+
228
+ # -- removed omp: #$ omp parallel default(private) shared(Mt,M) firstprivate(n,nc,gp,p,dm,cm,nd,ndT,si,sk,sl)
229
+ d1 = gp[0] - p[0]
230
+ d2 = gp[1] - p[1]
231
+ d3 = gp[2] - p[2]
232
+
233
+ e1 = nd[0] - sl[0]
234
+ e2 = nd[1] - sl[1]
235
+ e3 = nd[2] - sl[2]
236
+
237
+ # -- removed omp: #$ omp for schedule(static) collapse(3)
238
+ for x1 in range(n[0]):
239
+ for x2 in range(n[1]):
240
+ for x3 in range(n[2]):
241
+
242
+ j1 = gp[0] + x1
243
+ j2 = gp[1] + x2
244
+ j3 = gp[2] + x3
245
+
246
+ for l1 in range(nd[0]):
247
+ for l2 in range(nd[1]):
248
+ for l3 in range(nd[2]):
249
+
250
+ i1 = si[0] + cm[0]*(x1//dm[0]) + l1 + d1
251
+ i2 = si[1] + cm[1]*(x2//dm[1]) + l2 + d2
252
+ i3 = si[2] + cm[2]*(x3//dm[2]) + l3 + d3
253
+
254
+ k1 = sk[0] + x1%dm[0] - dm[0]*(l1//cm[0])
255
+ k2 = sk[1] + x2%dm[1] - dm[1]*(l2//cm[1])
256
+ k3 = sk[2] + x3%dm[2] - dm[2]*(l3//cm[2])
257
+
258
+ if k1<ndT[0] and k1>-1 and k2<ndT[1] and k2>-1 and k3<ndT[2] and k3>-1\
259
+ and l1<e1 and l2<e2 and l3<e3 and i1<nc[0] and i2<nc[1] and i3<nc[2]:
260
+ Mt[j1,j2,j3, l1+sl[0],l2+sl[1],l3+sl[2]] = M[i1,i2,i3, k1,k2,k3]
261
+
262
+ # -- removed omp: #$ omp end parallel
263
+ return