witwin-maxwell 0.3.0__py3-none-win_amd64.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 (107) hide show
  1. witwin/maxwell/__init__.py +164 -0
  2. witwin/maxwell/adapters/__init__.py +1 -0
  3. witwin/maxwell/adapters/gds.py +203 -0
  4. witwin/maxwell/adapters/tidy3d.py +1669 -0
  5. witwin/maxwell/adjoint_inputs.py +70 -0
  6. witwin/maxwell/compiler/__init__.py +11 -0
  7. witwin/maxwell/compiler/materials.py +1355 -0
  8. witwin/maxwell/compiler/monitors.py +164 -0
  9. witwin/maxwell/compiler/sources.py +222 -0
  10. witwin/maxwell/fdfd/__init__.py +3 -0
  11. witwin/maxwell/fdfd/adjoint/__init__.py +3 -0
  12. witwin/maxwell/fdfd/adjoint/bridge.py +180 -0
  13. witwin/maxwell/fdfd/ams.py +300 -0
  14. witwin/maxwell/fdfd/krylov.py +280 -0
  15. witwin/maxwell/fdfd/plotting.py +110 -0
  16. witwin/maxwell/fdfd/postprocess.py +33 -0
  17. witwin/maxwell/fdfd/solver.py +1057 -0
  18. witwin/maxwell/fdtd/__init__.py +4 -0
  19. witwin/maxwell/fdtd/adjoint/__init__.py +21 -0
  20. witwin/maxwell/fdtd/adjoint/bridge.py +746 -0
  21. witwin/maxwell/fdtd/adjoint/capabilities.py +29 -0
  22. witwin/maxwell/fdtd/adjoint/core.py +3614 -0
  23. witwin/maxwell/fdtd/adjoint/dispatch.py +684 -0
  24. witwin/maxwell/fdtd/adjoint/native.py +2561 -0
  25. witwin/maxwell/fdtd/adjoint/profiler.py +195 -0
  26. witwin/maxwell/fdtd/adjoint/reverse_common.py +207 -0
  27. witwin/maxwell/fdtd/adjoint/seeds.py +524 -0
  28. witwin/maxwell/fdtd/boundary/__init__.py +37 -0
  29. witwin/maxwell/fdtd/boundary/bloch.py +90 -0
  30. witwin/maxwell/fdtd/boundary/common.py +41 -0
  31. witwin/maxwell/fdtd/boundary/cpml.py +527 -0
  32. witwin/maxwell/fdtd/boundary/runtime.py +209 -0
  33. witwin/maxwell/fdtd/checkpoint.py +227 -0
  34. witwin/maxwell/fdtd/coords.py +32 -0
  35. witwin/maxwell/fdtd/cuda/__init__.py +11 -0
  36. witwin/maxwell/fdtd/cuda/backend.py +3532 -0
  37. witwin/maxwell/fdtd/cuda/build.py +292 -0
  38. witwin/maxwell/fdtd/cuda/extension.cpp +2053 -0
  39. witwin/maxwell/fdtd/cuda/kernels/adjoint.cu +5290 -0
  40. witwin/maxwell/fdtd/cuda/kernels/aniso.cu +1704 -0
  41. witwin/maxwell/fdtd/cuda/kernels/boundary.cu +424 -0
  42. witwin/maxwell/fdtd/cuda/kernels/common.cu +74 -0
  43. witwin/maxwell/fdtd/cuda/kernels/common.cuh +82 -0
  44. witwin/maxwell/fdtd/cuda/kernels/dispersive.cu +782 -0
  45. witwin/maxwell/fdtd/cuda/kernels/electric.cu +3613 -0
  46. witwin/maxwell/fdtd/cuda/kernels/magnetic.cu +781 -0
  47. witwin/maxwell/fdtd/cuda/kernels/observers.cu +347 -0
  48. witwin/maxwell/fdtd/cuda/kernels/projection.cu +211 -0
  49. witwin/maxwell/fdtd/cuda/kernels/sources.cu +1482 -0
  50. witwin/maxwell/fdtd/cuda/kernels/spectral.cu +297 -0
  51. witwin/maxwell/fdtd/cuda/launch.h +23 -0
  52. witwin/maxwell/fdtd/cuda/prebuilt/witwin_maxwell_fdtd_cuda.pyd +0 -0
  53. witwin/maxwell/fdtd/cuda/runtime/__init__.py +6 -0
  54. witwin/maxwell/fdtd/cuda/runtime/dispatcher.py +6 -0
  55. witwin/maxwell/fdtd/cuda/runtime/graph.py +33 -0
  56. witwin/maxwell/fdtd/cuda/tensors.h +35 -0
  57. witwin/maxwell/fdtd/dispersion.py +48 -0
  58. witwin/maxwell/fdtd/evaluation.py +290 -0
  59. witwin/maxwell/fdtd/excitation/__init__.py +27 -0
  60. witwin/maxwell/fdtd/excitation/injection.py +1102 -0
  61. witwin/maxwell/fdtd/excitation/modes.py +1675 -0
  62. witwin/maxwell/fdtd/excitation/spatial.py +469 -0
  63. witwin/maxwell/fdtd/excitation/temporal.py +510 -0
  64. witwin/maxwell/fdtd/excitation/tfsf_apply.py +264 -0
  65. witwin/maxwell/fdtd/excitation/tfsf_common.py +421 -0
  66. witwin/maxwell/fdtd/excitation/tfsf_specs.py +490 -0
  67. witwin/maxwell/fdtd/excitation/tfsf_state.py +778 -0
  68. witwin/maxwell/fdtd/io.py +31 -0
  69. witwin/maxwell/fdtd/material_pullback.py +371 -0
  70. witwin/maxwell/fdtd/meshing/__init__.py +3 -0
  71. witwin/maxwell/fdtd/meshing/autogrid.py +335 -0
  72. witwin/maxwell/fdtd/observers.py +1453 -0
  73. witwin/maxwell/fdtd/plotting.py +121 -0
  74. witwin/maxwell/fdtd/postprocess.py +205 -0
  75. witwin/maxwell/fdtd/runtime/__init__.py +119 -0
  76. witwin/maxwell/fdtd/runtime/initialization.py +236 -0
  77. witwin/maxwell/fdtd/runtime/materials.py +1563 -0
  78. witwin/maxwell/fdtd/runtime/module_cache.py +31 -0
  79. witwin/maxwell/fdtd/runtime/spectral.py +581 -0
  80. witwin/maxwell/fdtd/runtime/stepping.py +1987 -0
  81. witwin/maxwell/fdtd/solver.py +502 -0
  82. witwin/maxwell/geometry/__init__.py +5 -0
  83. witwin/maxwell/geometry/polyslab.py +299 -0
  84. witwin/maxwell/materials.py +3 -0
  85. witwin/maxwell/media.py +1467 -0
  86. witwin/maxwell/monitors.py +743 -0
  87. witwin/maxwell/ports.py +113 -0
  88. witwin/maxwell/postprocess/RCS.py +139 -0
  89. witwin/maxwell/postprocess/__init__.py +42 -0
  90. witwin/maxwell/postprocess/diffraction.py +219 -0
  91. witwin/maxwell/postprocess/directivity.py +152 -0
  92. witwin/maxwell/postprocess/emission.py +67 -0
  93. witwin/maxwell/postprocess/modal.py +324 -0
  94. witwin/maxwell/postprocess/nfft.py +266 -0
  95. witwin/maxwell/postprocess/scattering_parameters.py +358 -0
  96. witwin/maxwell/postprocess/stratton_chu.py +1193 -0
  97. witwin/maxwell/result.py +967 -0
  98. witwin/maxwell/scene.py +1338 -0
  99. witwin/maxwell/simulation.py +659 -0
  100. witwin/maxwell/sources.py +917 -0
  101. witwin/maxwell/visualization/__init__.py +28 -0
  102. witwin/maxwell/visualization/interactive.py +484 -0
  103. witwin/maxwell/visualization/plots.py +568 -0
  104. witwin_maxwell-0.3.0.dist-info/METADATA +184 -0
  105. witwin_maxwell-0.3.0.dist-info/RECORD +107 -0
  106. witwin_maxwell-0.3.0.dist-info/WHEEL +4 -0
  107. witwin_maxwell-0.3.0.dist-info/licenses/LICENSE +13 -0
@@ -0,0 +1,2053 @@
1
+ #include <torch/csrc/stable/library.h>
2
+ #include <torch/csrc/stable/tensor.h>
3
+
4
+ #include <optional>
5
+ #include <tuple>
6
+ #include <vector>
7
+
8
+ void synchronize_noop_cuda();
9
+ std::tuple<
10
+ torch::stable::Tensor,
11
+ torch::stable::Tensor,
12
+ torch::stable::Tensor,
13
+ torch::stable::Tensor>
14
+ debug_linear_indices_cuda(int64_t size_x, int64_t size_y, int64_t size_z);
15
+ void update_magnetic_hx_standard_cuda(
16
+ torch::stable::Tensor hx,
17
+ const torch::stable::Tensor& ey,
18
+ const torch::stable::Tensor& ez,
19
+ const torch::stable::Tensor& decay,
20
+ const torch::stable::Tensor& curl,
21
+ const torch::stable::Tensor& inv_dy,
22
+ const torch::stable::Tensor& inv_dz);
23
+ void update_magnetic_hy_standard_cuda(
24
+ torch::stable::Tensor hy,
25
+ const torch::stable::Tensor& ex,
26
+ const torch::stable::Tensor& ez,
27
+ const torch::stable::Tensor& decay,
28
+ const torch::stable::Tensor& curl,
29
+ const torch::stable::Tensor& inv_dx,
30
+ const torch::stable::Tensor& inv_dz);
31
+ void update_magnetic_hz_standard_cuda(
32
+ torch::stable::Tensor hz,
33
+ const torch::stable::Tensor& ex,
34
+ const torch::stable::Tensor& ey,
35
+ const torch::stable::Tensor& decay,
36
+ const torch::stable::Tensor& curl,
37
+ const torch::stable::Tensor& inv_dx,
38
+ const torch::stable::Tensor& inv_dy);
39
+ void update_magnetic_hx_cpml_cuda(
40
+ torch::stable::Tensor hx,
41
+ const torch::stable::Tensor& ey,
42
+ const torch::stable::Tensor& ez,
43
+ const torch::stable::Tensor& decay,
44
+ const torch::stable::Tensor& curl,
45
+ torch::stable::Tensor psi_y,
46
+ torch::stable::Tensor psi_z,
47
+ const torch::stable::Tensor& inv_kappa_y,
48
+ const torch::stable::Tensor& b_y,
49
+ const torch::stable::Tensor& c_y,
50
+ const torch::stable::Tensor& inv_kappa_z,
51
+ const torch::stable::Tensor& b_z,
52
+ const torch::stable::Tensor& c_z,
53
+ const torch::stable::Tensor& inv_dy,
54
+ const torch::stable::Tensor& inv_dz);
55
+ void update_magnetic_hy_cpml_cuda(
56
+ torch::stable::Tensor hy,
57
+ const torch::stable::Tensor& ex,
58
+ const torch::stable::Tensor& ez,
59
+ const torch::stable::Tensor& decay,
60
+ const torch::stable::Tensor& curl,
61
+ torch::stable::Tensor psi_x,
62
+ torch::stable::Tensor psi_z,
63
+ const torch::stable::Tensor& inv_kappa_x,
64
+ const torch::stable::Tensor& b_x,
65
+ const torch::stable::Tensor& c_x,
66
+ const torch::stable::Tensor& inv_kappa_z,
67
+ const torch::stable::Tensor& b_z,
68
+ const torch::stable::Tensor& c_z,
69
+ const torch::stable::Tensor& inv_dx,
70
+ const torch::stable::Tensor& inv_dz);
71
+ void update_magnetic_hz_cpml_cuda(
72
+ torch::stable::Tensor hz,
73
+ const torch::stable::Tensor& ex,
74
+ const torch::stable::Tensor& ey,
75
+ const torch::stable::Tensor& decay,
76
+ const torch::stable::Tensor& curl,
77
+ torch::stable::Tensor psi_x,
78
+ torch::stable::Tensor psi_y,
79
+ const torch::stable::Tensor& inv_kappa_x,
80
+ const torch::stable::Tensor& b_x,
81
+ const torch::stable::Tensor& c_x,
82
+ const torch::stable::Tensor& inv_kappa_y,
83
+ const torch::stable::Tensor& b_y,
84
+ const torch::stable::Tensor& c_y,
85
+ const torch::stable::Tensor& inv_dx,
86
+ const torch::stable::Tensor& inv_dy);
87
+ void update_magnetic_hx_cpml_compressed_cuda(
88
+ torch::stable::Tensor hx,
89
+ const torch::stable::Tensor& ey,
90
+ const torch::stable::Tensor& ez,
91
+ const torch::stable::Tensor& decay,
92
+ const torch::stable::Tensor& curl,
93
+ torch::stable::Tensor psi_y,
94
+ torch::stable::Tensor psi_z,
95
+ const torch::stable::Tensor& inv_kappa_y,
96
+ const torch::stable::Tensor& b_y,
97
+ const torch::stable::Tensor& c_y,
98
+ const torch::stable::Tensor& inv_kappa_z,
99
+ const torch::stable::Tensor& b_z,
100
+ const torch::stable::Tensor& c_z,
101
+ const torch::stable::Tensor& inv_dy,
102
+ const torch::stable::Tensor& inv_dz,
103
+ int64_t y_low_length,
104
+ int64_t y_high_start,
105
+ int64_t y_high_length,
106
+ int64_t z_low_length,
107
+ int64_t z_high_start,
108
+ int64_t z_high_length,
109
+ std::optional<double> uniform_decay,
110
+ std::optional<double> uniform_curl);
111
+ void update_magnetic_hy_cpml_compressed_cuda(
112
+ torch::stable::Tensor hy,
113
+ const torch::stable::Tensor& ex,
114
+ const torch::stable::Tensor& ez,
115
+ const torch::stable::Tensor& decay,
116
+ const torch::stable::Tensor& curl,
117
+ torch::stable::Tensor psi_x,
118
+ torch::stable::Tensor psi_z,
119
+ const torch::stable::Tensor& inv_kappa_x,
120
+ const torch::stable::Tensor& b_x,
121
+ const torch::stable::Tensor& c_x,
122
+ const torch::stable::Tensor& inv_kappa_z,
123
+ const torch::stable::Tensor& b_z,
124
+ const torch::stable::Tensor& c_z,
125
+ const torch::stable::Tensor& inv_dx,
126
+ const torch::stable::Tensor& inv_dz,
127
+ int64_t x_low_length,
128
+ int64_t x_high_start,
129
+ int64_t x_high_length,
130
+ int64_t z_low_length,
131
+ int64_t z_high_start,
132
+ int64_t z_high_length,
133
+ std::optional<double> uniform_decay,
134
+ std::optional<double> uniform_curl);
135
+ void update_magnetic_hz_cpml_compressed_cuda(
136
+ torch::stable::Tensor hz,
137
+ const torch::stable::Tensor& ex,
138
+ const torch::stable::Tensor& ey,
139
+ const torch::stable::Tensor& decay,
140
+ const torch::stable::Tensor& curl,
141
+ torch::stable::Tensor psi_x,
142
+ torch::stable::Tensor psi_y,
143
+ const torch::stable::Tensor& inv_kappa_x,
144
+ const torch::stable::Tensor& b_x,
145
+ const torch::stable::Tensor& c_x,
146
+ const torch::stable::Tensor& inv_kappa_y,
147
+ const torch::stable::Tensor& b_y,
148
+ const torch::stable::Tensor& c_y,
149
+ const torch::stable::Tensor& inv_dx,
150
+ const torch::stable::Tensor& inv_dy,
151
+ int64_t x_low_length,
152
+ int64_t x_high_start,
153
+ int64_t x_high_length,
154
+ int64_t y_low_length,
155
+ int64_t y_high_start,
156
+ int64_t y_high_length,
157
+ std::optional<double> uniform_decay,
158
+ std::optional<double> uniform_curl);
159
+ void update_electric_ex_standard_cuda(
160
+ torch::stable::Tensor ex,
161
+ const torch::stable::Tensor& hy,
162
+ const torch::stable::Tensor& hz,
163
+ const torch::stable::Tensor& decay,
164
+ const torch::stable::Tensor& curl,
165
+ const torch::stable::Tensor& inv_dy,
166
+ const torch::stable::Tensor& inv_dz,
167
+ int64_t y_low_mode,
168
+ int64_t y_high_mode,
169
+ int64_t z_low_mode,
170
+ int64_t z_high_mode);
171
+ void update_electric_ey_standard_cuda(
172
+ torch::stable::Tensor ey,
173
+ const torch::stable::Tensor& hx,
174
+ const torch::stable::Tensor& hz,
175
+ const torch::stable::Tensor& decay,
176
+ const torch::stable::Tensor& curl,
177
+ const torch::stable::Tensor& inv_dx,
178
+ const torch::stable::Tensor& inv_dz,
179
+ int64_t x_low_mode,
180
+ int64_t x_high_mode,
181
+ int64_t z_low_mode,
182
+ int64_t z_high_mode);
183
+ void update_electric_ez_standard_cuda(
184
+ torch::stable::Tensor ez,
185
+ const torch::stable::Tensor& hx,
186
+ const torch::stable::Tensor& hy,
187
+ const torch::stable::Tensor& decay,
188
+ const torch::stable::Tensor& curl,
189
+ const torch::stable::Tensor& inv_dx,
190
+ const torch::stable::Tensor& inv_dy,
191
+ int64_t x_low_mode,
192
+ int64_t x_high_mode,
193
+ int64_t y_low_mode,
194
+ int64_t y_high_mode);
195
+ void update_electric_ex_modulated_cuda(
196
+ torch::stable::Tensor ex,
197
+ const torch::stable::Tensor& hy,
198
+ const torch::stable::Tensor& hz,
199
+ const torch::stable::Tensor& decay,
200
+ const torch::stable::Tensor& curl,
201
+ const torch::stable::Tensor& mod_cos,
202
+ const torch::stable::Tensor& mod_sin,
203
+ const torch::stable::Tensor& mod_omega,
204
+ const torch::stable::Tensor& modulation_time,
205
+ const torch::stable::Tensor& inv_dy,
206
+ const torch::stable::Tensor& inv_dz,
207
+ int64_t y_low_mode,
208
+ int64_t y_high_mode,
209
+ int64_t z_low_mode,
210
+ int64_t z_high_mode);
211
+ void update_electric_ey_modulated_cuda(
212
+ torch::stable::Tensor ey,
213
+ const torch::stable::Tensor& hx,
214
+ const torch::stable::Tensor& hz,
215
+ const torch::stable::Tensor& decay,
216
+ const torch::stable::Tensor& curl,
217
+ const torch::stable::Tensor& mod_cos,
218
+ const torch::stable::Tensor& mod_sin,
219
+ const torch::stable::Tensor& mod_omega,
220
+ const torch::stable::Tensor& modulation_time,
221
+ const torch::stable::Tensor& inv_dx,
222
+ const torch::stable::Tensor& inv_dz,
223
+ int64_t x_low_mode,
224
+ int64_t x_high_mode,
225
+ int64_t z_low_mode,
226
+ int64_t z_high_mode);
227
+ void update_electric_ez_modulated_cuda(
228
+ torch::stable::Tensor ez,
229
+ const torch::stable::Tensor& hx,
230
+ const torch::stable::Tensor& hy,
231
+ const torch::stable::Tensor& decay,
232
+ const torch::stable::Tensor& curl,
233
+ const torch::stable::Tensor& mod_cos,
234
+ const torch::stable::Tensor& mod_sin,
235
+ const torch::stable::Tensor& mod_omega,
236
+ const torch::stable::Tensor& modulation_time,
237
+ const torch::stable::Tensor& inv_dx,
238
+ const torch::stable::Tensor& inv_dy,
239
+ int64_t x_low_mode,
240
+ int64_t x_high_mode,
241
+ int64_t y_low_mode,
242
+ int64_t y_high_mode);
243
+ void update_electric_ex_cpml_modulated_cuda(
244
+ torch::stable::Tensor ex,
245
+ const torch::stable::Tensor& hy,
246
+ const torch::stable::Tensor& hz,
247
+ const torch::stable::Tensor& decay,
248
+ const torch::stable::Tensor& curl,
249
+ const torch::stable::Tensor& mod_cos,
250
+ const torch::stable::Tensor& mod_sin,
251
+ const torch::stable::Tensor& mod_omega,
252
+ const torch::stable::Tensor& modulation_time,
253
+ torch::stable::Tensor psi_y,
254
+ torch::stable::Tensor psi_z,
255
+ const torch::stable::Tensor& inv_kappa_y,
256
+ const torch::stable::Tensor& b_y,
257
+ const torch::stable::Tensor& c_y,
258
+ const torch::stable::Tensor& inv_kappa_z,
259
+ const torch::stable::Tensor& b_z,
260
+ const torch::stable::Tensor& c_z,
261
+ const torch::stable::Tensor& inv_dy,
262
+ const torch::stable::Tensor& inv_dz,
263
+ int64_t y_low_mode,
264
+ int64_t y_high_mode,
265
+ int64_t z_low_mode,
266
+ int64_t z_high_mode);
267
+ void update_electric_ey_cpml_modulated_cuda(
268
+ torch::stable::Tensor ey,
269
+ const torch::stable::Tensor& hx,
270
+ const torch::stable::Tensor& hz,
271
+ const torch::stable::Tensor& decay,
272
+ const torch::stable::Tensor& curl,
273
+ const torch::stable::Tensor& mod_cos,
274
+ const torch::stable::Tensor& mod_sin,
275
+ const torch::stable::Tensor& mod_omega,
276
+ const torch::stable::Tensor& modulation_time,
277
+ torch::stable::Tensor psi_x,
278
+ torch::stable::Tensor psi_z,
279
+ const torch::stable::Tensor& inv_kappa_x,
280
+ const torch::stable::Tensor& b_x,
281
+ const torch::stable::Tensor& c_x,
282
+ const torch::stable::Tensor& inv_kappa_z,
283
+ const torch::stable::Tensor& b_z,
284
+ const torch::stable::Tensor& c_z,
285
+ const torch::stable::Tensor& inv_dx,
286
+ const torch::stable::Tensor& inv_dz,
287
+ int64_t x_low_mode,
288
+ int64_t x_high_mode,
289
+ int64_t z_low_mode,
290
+ int64_t z_high_mode);
291
+ void update_electric_ez_cpml_modulated_cuda(
292
+ torch::stable::Tensor ez,
293
+ const torch::stable::Tensor& hx,
294
+ const torch::stable::Tensor& hy,
295
+ const torch::stable::Tensor& decay,
296
+ const torch::stable::Tensor& curl,
297
+ const torch::stable::Tensor& mod_cos,
298
+ const torch::stable::Tensor& mod_sin,
299
+ const torch::stable::Tensor& mod_omega,
300
+ const torch::stable::Tensor& modulation_time,
301
+ torch::stable::Tensor psi_x,
302
+ torch::stable::Tensor psi_y,
303
+ const torch::stable::Tensor& inv_kappa_x,
304
+ const torch::stable::Tensor& b_x,
305
+ const torch::stable::Tensor& c_x,
306
+ const torch::stable::Tensor& inv_kappa_y,
307
+ const torch::stable::Tensor& b_y,
308
+ const torch::stable::Tensor& c_y,
309
+ const torch::stable::Tensor& inv_dx,
310
+ const torch::stable::Tensor& inv_dy,
311
+ int64_t x_low_mode,
312
+ int64_t x_high_mode,
313
+ int64_t y_low_mode,
314
+ int64_t y_high_mode);
315
+ void update_electric_ex_cpml_modulated_compressed_cuda(
316
+ torch::stable::Tensor ex,
317
+ const torch::stable::Tensor& hy,
318
+ const torch::stable::Tensor& hz,
319
+ const torch::stable::Tensor& decay,
320
+ const torch::stable::Tensor& curl,
321
+ const torch::stable::Tensor& mod_cos,
322
+ const torch::stable::Tensor& mod_sin,
323
+ const torch::stable::Tensor& mod_omega,
324
+ const torch::stable::Tensor& modulation_time,
325
+ torch::stable::Tensor psi_y,
326
+ torch::stable::Tensor psi_z,
327
+ const torch::stable::Tensor& inv_kappa_y,
328
+ const torch::stable::Tensor& b_y,
329
+ const torch::stable::Tensor& c_y,
330
+ const torch::stable::Tensor& inv_kappa_z,
331
+ const torch::stable::Tensor& b_z,
332
+ const torch::stable::Tensor& c_z,
333
+ const torch::stable::Tensor& inv_dy,
334
+ const torch::stable::Tensor& inv_dz,
335
+ int64_t y_low_mode,
336
+ int64_t y_high_mode,
337
+ int64_t z_low_mode,
338
+ int64_t z_high_mode,
339
+ int64_t y_low_length,
340
+ int64_t y_high_start,
341
+ int64_t y_high_length,
342
+ int64_t z_low_length,
343
+ int64_t z_high_start,
344
+ int64_t z_high_length);
345
+ void update_electric_ey_cpml_modulated_compressed_cuda(
346
+ torch::stable::Tensor ey,
347
+ const torch::stable::Tensor& hx,
348
+ const torch::stable::Tensor& hz,
349
+ const torch::stable::Tensor& decay,
350
+ const torch::stable::Tensor& curl,
351
+ const torch::stable::Tensor& mod_cos,
352
+ const torch::stable::Tensor& mod_sin,
353
+ const torch::stable::Tensor& mod_omega,
354
+ const torch::stable::Tensor& modulation_time,
355
+ torch::stable::Tensor psi_x,
356
+ torch::stable::Tensor psi_z,
357
+ const torch::stable::Tensor& inv_kappa_x,
358
+ const torch::stable::Tensor& b_x,
359
+ const torch::stable::Tensor& c_x,
360
+ const torch::stable::Tensor& inv_kappa_z,
361
+ const torch::stable::Tensor& b_z,
362
+ const torch::stable::Tensor& c_z,
363
+ const torch::stable::Tensor& inv_dx,
364
+ const torch::stable::Tensor& inv_dz,
365
+ int64_t x_low_mode,
366
+ int64_t x_high_mode,
367
+ int64_t z_low_mode,
368
+ int64_t z_high_mode,
369
+ int64_t x_low_length,
370
+ int64_t x_high_start,
371
+ int64_t x_high_length,
372
+ int64_t z_low_length,
373
+ int64_t z_high_start,
374
+ int64_t z_high_length);
375
+ void update_electric_ez_cpml_modulated_compressed_cuda(
376
+ torch::stable::Tensor ez,
377
+ const torch::stable::Tensor& hx,
378
+ const torch::stable::Tensor& hy,
379
+ const torch::stable::Tensor& decay,
380
+ const torch::stable::Tensor& curl,
381
+ const torch::stable::Tensor& mod_cos,
382
+ const torch::stable::Tensor& mod_sin,
383
+ const torch::stable::Tensor& mod_omega,
384
+ const torch::stable::Tensor& modulation_time,
385
+ torch::stable::Tensor psi_x,
386
+ torch::stable::Tensor psi_y,
387
+ const torch::stable::Tensor& inv_kappa_x,
388
+ const torch::stable::Tensor& b_x,
389
+ const torch::stable::Tensor& c_x,
390
+ const torch::stable::Tensor& inv_kappa_y,
391
+ const torch::stable::Tensor& b_y,
392
+ const torch::stable::Tensor& c_y,
393
+ const torch::stable::Tensor& inv_dx,
394
+ const torch::stable::Tensor& inv_dy,
395
+ int64_t x_low_mode,
396
+ int64_t x_high_mode,
397
+ int64_t y_low_mode,
398
+ int64_t y_high_mode,
399
+ int64_t x_low_length,
400
+ int64_t x_high_start,
401
+ int64_t x_high_length,
402
+ int64_t y_low_length,
403
+ int64_t y_high_start,
404
+ int64_t y_high_length);
405
+ void update_electric_ex_bloch_cuda(
406
+ torch::stable::Tensor ex_real,
407
+ torch::stable::Tensor ex_imag,
408
+ const torch::stable::Tensor& hy_real,
409
+ const torch::stable::Tensor& hy_imag,
410
+ const torch::stable::Tensor& hz_real,
411
+ const torch::stable::Tensor& hz_imag,
412
+ const torch::stable::Tensor& decay,
413
+ const torch::stable::Tensor& curl,
414
+ double phase_cos_y,
415
+ double phase_sin_y,
416
+ double phase_cos_z,
417
+ double phase_sin_z,
418
+ const torch::stable::Tensor& inv_dy,
419
+ const torch::stable::Tensor& inv_dz);
420
+ void update_electric_ey_bloch_cuda(
421
+ torch::stable::Tensor ey_real,
422
+ torch::stable::Tensor ey_imag,
423
+ const torch::stable::Tensor& hx_real,
424
+ const torch::stable::Tensor& hx_imag,
425
+ const torch::stable::Tensor& hz_real,
426
+ const torch::stable::Tensor& hz_imag,
427
+ const torch::stable::Tensor& decay,
428
+ const torch::stable::Tensor& curl,
429
+ double phase_cos_x,
430
+ double phase_sin_x,
431
+ double phase_cos_z,
432
+ double phase_sin_z,
433
+ const torch::stable::Tensor& inv_dx,
434
+ const torch::stable::Tensor& inv_dz);
435
+ void update_electric_ez_bloch_cuda(
436
+ torch::stable::Tensor ez_real,
437
+ torch::stable::Tensor ez_imag,
438
+ const torch::stable::Tensor& hx_real,
439
+ const torch::stable::Tensor& hx_imag,
440
+ const torch::stable::Tensor& hy_real,
441
+ const torch::stable::Tensor& hy_imag,
442
+ const torch::stable::Tensor& decay,
443
+ const torch::stable::Tensor& curl,
444
+ double phase_cos_x,
445
+ double phase_sin_x,
446
+ double phase_cos_y,
447
+ double phase_sin_y,
448
+ const torch::stable::Tensor& inv_dx,
449
+ const torch::stable::Tensor& inv_dy);
450
+ void update_electric_ex_cpml_cuda(
451
+ torch::stable::Tensor ex,
452
+ const torch::stable::Tensor& hy,
453
+ const torch::stable::Tensor& hz,
454
+ const torch::stable::Tensor& decay,
455
+ const torch::stable::Tensor& curl,
456
+ torch::stable::Tensor psi_y,
457
+ torch::stable::Tensor psi_z,
458
+ const torch::stable::Tensor& inv_kappa_y,
459
+ const torch::stable::Tensor& b_y,
460
+ const torch::stable::Tensor& c_y,
461
+ const torch::stable::Tensor& inv_kappa_z,
462
+ const torch::stable::Tensor& b_z,
463
+ const torch::stable::Tensor& c_z,
464
+ const torch::stable::Tensor& inv_dy,
465
+ const torch::stable::Tensor& inv_dz,
466
+ int64_t y_low_mode,
467
+ int64_t y_high_mode,
468
+ int64_t z_low_mode,
469
+ int64_t z_high_mode);
470
+ void update_electric_ey_cpml_cuda(
471
+ torch::stable::Tensor ey,
472
+ const torch::stable::Tensor& hx,
473
+ const torch::stable::Tensor& hz,
474
+ const torch::stable::Tensor& decay,
475
+ const torch::stable::Tensor& curl,
476
+ torch::stable::Tensor psi_x,
477
+ torch::stable::Tensor psi_z,
478
+ const torch::stable::Tensor& inv_kappa_x,
479
+ const torch::stable::Tensor& b_x,
480
+ const torch::stable::Tensor& c_x,
481
+ const torch::stable::Tensor& inv_kappa_z,
482
+ const torch::stable::Tensor& b_z,
483
+ const torch::stable::Tensor& c_z,
484
+ const torch::stable::Tensor& inv_dx,
485
+ const torch::stable::Tensor& inv_dz,
486
+ int64_t x_low_mode,
487
+ int64_t x_high_mode,
488
+ int64_t z_low_mode,
489
+ int64_t z_high_mode);
490
+ void update_electric_ez_cpml_cuda(
491
+ torch::stable::Tensor ez,
492
+ const torch::stable::Tensor& hx,
493
+ const torch::stable::Tensor& hy,
494
+ const torch::stable::Tensor& decay,
495
+ const torch::stable::Tensor& curl,
496
+ torch::stable::Tensor psi_x,
497
+ torch::stable::Tensor psi_y,
498
+ const torch::stable::Tensor& inv_kappa_x,
499
+ const torch::stable::Tensor& b_x,
500
+ const torch::stable::Tensor& c_x,
501
+ const torch::stable::Tensor& inv_kappa_y,
502
+ const torch::stable::Tensor& b_y,
503
+ const torch::stable::Tensor& c_y,
504
+ const torch::stable::Tensor& inv_dx,
505
+ const torch::stable::Tensor& inv_dy,
506
+ int64_t x_low_mode,
507
+ int64_t x_high_mode,
508
+ int64_t y_low_mode,
509
+ int64_t y_high_mode);
510
+ void update_electric_ex_cpml_compressed_cuda(
511
+ torch::stable::Tensor ex,
512
+ const torch::stable::Tensor& hy,
513
+ const torch::stable::Tensor& hz,
514
+ const torch::stable::Tensor& decay,
515
+ const torch::stable::Tensor& curl,
516
+ torch::stable::Tensor psi_y,
517
+ torch::stable::Tensor psi_z,
518
+ const torch::stable::Tensor& inv_kappa_y,
519
+ const torch::stable::Tensor& b_y,
520
+ const torch::stable::Tensor& c_y,
521
+ const torch::stable::Tensor& inv_kappa_z,
522
+ const torch::stable::Tensor& b_z,
523
+ const torch::stable::Tensor& c_z,
524
+ const torch::stable::Tensor& inv_dy,
525
+ const torch::stable::Tensor& inv_dz,
526
+ int64_t y_low_mode,
527
+ int64_t y_high_mode,
528
+ int64_t z_low_mode,
529
+ int64_t z_high_mode,
530
+ int64_t y_low_length,
531
+ int64_t y_high_start,
532
+ int64_t y_high_length,
533
+ int64_t z_low_length,
534
+ int64_t z_high_start,
535
+ int64_t z_high_length,
536
+ std::optional<double> uniform_decay,
537
+ std::optional<double> uniform_curl);
538
+ void update_electric_ey_cpml_compressed_cuda(
539
+ torch::stable::Tensor ey,
540
+ const torch::stable::Tensor& hx,
541
+ const torch::stable::Tensor& hz,
542
+ const torch::stable::Tensor& decay,
543
+ const torch::stable::Tensor& curl,
544
+ torch::stable::Tensor psi_x,
545
+ torch::stable::Tensor psi_z,
546
+ const torch::stable::Tensor& inv_kappa_x,
547
+ const torch::stable::Tensor& b_x,
548
+ const torch::stable::Tensor& c_x,
549
+ const torch::stable::Tensor& inv_kappa_z,
550
+ const torch::stable::Tensor& b_z,
551
+ const torch::stable::Tensor& c_z,
552
+ const torch::stable::Tensor& inv_dx,
553
+ const torch::stable::Tensor& inv_dz,
554
+ int64_t x_low_mode,
555
+ int64_t x_high_mode,
556
+ int64_t z_low_mode,
557
+ int64_t z_high_mode,
558
+ int64_t x_low_length,
559
+ int64_t x_high_start,
560
+ int64_t x_high_length,
561
+ int64_t z_low_length,
562
+ int64_t z_high_start,
563
+ int64_t z_high_length,
564
+ std::optional<double> uniform_decay,
565
+ std::optional<double> uniform_curl);
566
+ void update_electric_ez_cpml_compressed_cuda(
567
+ torch::stable::Tensor ez,
568
+ const torch::stable::Tensor& hx,
569
+ const torch::stable::Tensor& hy,
570
+ const torch::stable::Tensor& decay,
571
+ const torch::stable::Tensor& curl,
572
+ torch::stable::Tensor psi_x,
573
+ torch::stable::Tensor psi_y,
574
+ const torch::stable::Tensor& inv_kappa_x,
575
+ const torch::stable::Tensor& b_x,
576
+ const torch::stable::Tensor& c_x,
577
+ const torch::stable::Tensor& inv_kappa_y,
578
+ const torch::stable::Tensor& b_y,
579
+ const torch::stable::Tensor& c_y,
580
+ const torch::stable::Tensor& inv_dx,
581
+ const torch::stable::Tensor& inv_dy,
582
+ int64_t x_low_mode,
583
+ int64_t x_high_mode,
584
+ int64_t y_low_mode,
585
+ int64_t y_high_mode,
586
+ int64_t x_low_length,
587
+ int64_t x_high_start,
588
+ int64_t x_high_length,
589
+ int64_t y_low_length,
590
+ int64_t y_high_start,
591
+ int64_t y_high_length,
592
+ std::optional<double> uniform_decay,
593
+ std::optional<double> uniform_curl);
594
+ void accumulate_dft_batched_cuda(
595
+ const torch::stable::Tensor& ex,
596
+ const torch::stable::Tensor& ey,
597
+ const torch::stable::Tensor& ez,
598
+ torch::stable::Tensor ex_real,
599
+ torch::stable::Tensor ex_imag,
600
+ torch::stable::Tensor ey_real,
601
+ torch::stable::Tensor ey_imag,
602
+ torch::stable::Tensor ez_real,
603
+ torch::stable::Tensor ez_imag,
604
+ const torch::stable::Tensor& weighted_cos,
605
+ const torch::stable::Tensor& weighted_sin);
606
+ void accumulate_point_observers_cuda(
607
+ const torch::stable::Tensor& field,
608
+ const torch::stable::Tensor& point_i,
609
+ const torch::stable::Tensor& point_j,
610
+ const torch::stable::Tensor& point_k,
611
+ torch::stable::Tensor real_accum,
612
+ torch::stable::Tensor imag_accum,
613
+ double weighted_cos,
614
+ double weighted_sin);
615
+ void accumulate_plane_observer_cuda(
616
+ const torch::stable::Tensor& field,
617
+ torch::stable::Tensor real_accum,
618
+ torch::stable::Tensor imag_accum,
619
+ int64_t axis,
620
+ int64_t plane_index,
621
+ double weighted_cos,
622
+ double weighted_sin);
623
+ void plane_flux_reduce_cuda(
624
+ const torch::stable::Tensor& ea,
625
+ const torch::stable::Tensor& eb,
626
+ const torch::stable::Tensor& ha,
627
+ const torch::stable::Tensor& hb,
628
+ const torch::stable::Tensor& weights,
629
+ torch::stable::Tensor out,
630
+ int64_t out_index,
631
+ double scale);
632
+ void update_debye_current_cuda(
633
+ const torch::stable::Tensor& electric,
634
+ torch::stable::Tensor polarization,
635
+ torch::stable::Tensor current,
636
+ const torch::stable::Tensor& drive,
637
+ double decay,
638
+ double dt);
639
+ void update_drude_current_cuda(
640
+ const torch::stable::Tensor& electric,
641
+ torch::stable::Tensor current,
642
+ const torch::stable::Tensor& drive,
643
+ double decay);
644
+ void update_lorentz_current_cuda(
645
+ const torch::stable::Tensor& electric,
646
+ torch::stable::Tensor polarization,
647
+ torch::stable::Tensor current,
648
+ const torch::stable::Tensor& drive,
649
+ double decay,
650
+ double restoring,
651
+ double dt);
652
+ void apply_polarization_current_cuda(
653
+ torch::stable::Tensor electric,
654
+ const torch::stable::Tensor& current,
655
+ const torch::stable::Tensor& inv_permittivity,
656
+ double dt);
657
+ void apply_polarization_current_modulated_cuda(
658
+ torch::stable::Tensor electric,
659
+ const torch::stable::Tensor& current,
660
+ const torch::stable::Tensor& inv_permittivity,
661
+ const torch::stable::Tensor& mod_cos,
662
+ const torch::stable::Tensor& mod_sin,
663
+ const torch::stable::Tensor& mod_omega,
664
+ const torch::stable::Tensor& modulation_time,
665
+ double dt);
666
+ void advance_modulation_time_cuda(torch::stable::Tensor modulation_time, double dt);
667
+ void update_kerr_ex_curl_cuda(
668
+ torch::stable::Tensor dynamic_curl,
669
+ const torch::stable::Tensor& ex,
670
+ const torch::stable::Tensor& ey,
671
+ const torch::stable::Tensor& ez,
672
+ const torch::stable::Tensor& linear_permittivity,
673
+ const torch::stable::Tensor& ex_decay,
674
+ const torch::stable::Tensor& chi3,
675
+ double dt,
676
+ double eps0);
677
+ void update_kerr_ey_curl_cuda(
678
+ torch::stable::Tensor dynamic_curl,
679
+ const torch::stable::Tensor& ex,
680
+ const torch::stable::Tensor& ey,
681
+ const torch::stable::Tensor& ez,
682
+ const torch::stable::Tensor& linear_permittivity,
683
+ const torch::stable::Tensor& ey_decay,
684
+ const torch::stable::Tensor& chi3,
685
+ double dt,
686
+ double eps0);
687
+ void update_kerr_ez_curl_cuda(
688
+ torch::stable::Tensor dynamic_curl,
689
+ const torch::stable::Tensor& ex,
690
+ const torch::stable::Tensor& ey,
691
+ const torch::stable::Tensor& ez,
692
+ const torch::stable::Tensor& linear_permittivity,
693
+ const torch::stable::Tensor& ez_decay,
694
+ const torch::stable::Tensor& chi3,
695
+ double dt,
696
+ double eps0);
697
+ void update_nonlinear_coefficients_cuda(
698
+ torch::stable::Tensor dynamic_decay,
699
+ torch::stable::Tensor dynamic_curl,
700
+ const torch::stable::Tensor& ex,
701
+ const torch::stable::Tensor& ey,
702
+ const torch::stable::Tensor& ez,
703
+ const torch::stable::Tensor& linear_permittivity,
704
+ const torch::stable::Tensor& external_decay,
705
+ const torch::stable::Tensor& sigma_static,
706
+ const torch::stable::Tensor& chi2,
707
+ const torch::stable::Tensor& chi3,
708
+ const torch::stable::Tensor& tpa_sigma,
709
+ int64_t component,
710
+ double dt,
711
+ double eps0);
712
+ void update_electric_ex_full_aniso_cuda(
713
+ torch::stable::Tensor ex,
714
+ const torch::stable::Tensor& hx,
715
+ const torch::stable::Tensor& hy,
716
+ const torch::stable::Tensor& hz,
717
+ const torch::stable::Tensor& coeff_y,
718
+ const torch::stable::Tensor& coeff_z,
719
+ const torch::stable::Tensor& inv_dx,
720
+ const torch::stable::Tensor& inv_dy,
721
+ const torch::stable::Tensor& inv_dz,
722
+ int64_t periodic_x,
723
+ int64_t periodic_y,
724
+ int64_t periodic_z);
725
+ void update_electric_ey_full_aniso_cuda(
726
+ torch::stable::Tensor ey,
727
+ const torch::stable::Tensor& hx,
728
+ const torch::stable::Tensor& hy,
729
+ const torch::stable::Tensor& hz,
730
+ const torch::stable::Tensor& coeff_x,
731
+ const torch::stable::Tensor& coeff_z,
732
+ const torch::stable::Tensor& inv_dx,
733
+ const torch::stable::Tensor& inv_dy,
734
+ const torch::stable::Tensor& inv_dz,
735
+ int64_t periodic_x,
736
+ int64_t periodic_y,
737
+ int64_t periodic_z);
738
+ void update_electric_ez_full_aniso_cuda(
739
+ torch::stable::Tensor ez,
740
+ const torch::stable::Tensor& hx,
741
+ const torch::stable::Tensor& hy,
742
+ const torch::stable::Tensor& hz,
743
+ const torch::stable::Tensor& coeff_x,
744
+ const torch::stable::Tensor& coeff_y,
745
+ const torch::stable::Tensor& inv_dx,
746
+ const torch::stable::Tensor& inv_dy,
747
+ const torch::stable::Tensor& inv_dz,
748
+ int64_t periodic_x,
749
+ int64_t periodic_y,
750
+ int64_t periodic_z);
751
+ void update_electric_ex_full_aniso_cpml_cuda(
752
+ torch::stable::Tensor ex,
753
+ const torch::stable::Tensor& hx,
754
+ const torch::stable::Tensor& hy,
755
+ const torch::stable::Tensor& hz,
756
+ const torch::stable::Tensor& coeff_y,
757
+ const torch::stable::Tensor& coeff_z,
758
+ const torch::stable::Tensor& inv_dx,
759
+ const torch::stable::Tensor& inv_dy,
760
+ const torch::stable::Tensor& inv_dz,
761
+ const torch::stable::Tensor& inv_kappa_x,
762
+ const torch::stable::Tensor& b_x,
763
+ const torch::stable::Tensor& c_x,
764
+ const torch::stable::Tensor& inv_kappa_y,
765
+ const torch::stable::Tensor& b_y,
766
+ const torch::stable::Tensor& c_y,
767
+ const torch::stable::Tensor& inv_kappa_z,
768
+ const torch::stable::Tensor& b_z,
769
+ const torch::stable::Tensor& c_z,
770
+ int64_t periodic_x,
771
+ int64_t periodic_y,
772
+ int64_t periodic_z,
773
+ torch::stable::Tensor psi_x,
774
+ torch::stable::Tensor psi_y,
775
+ torch::stable::Tensor psi_z);
776
+ void update_electric_ey_full_aniso_cpml_cuda(
777
+ torch::stable::Tensor ey,
778
+ const torch::stable::Tensor& hx,
779
+ const torch::stable::Tensor& hy,
780
+ const torch::stable::Tensor& hz,
781
+ const torch::stable::Tensor& coeff_x,
782
+ const torch::stable::Tensor& coeff_z,
783
+ const torch::stable::Tensor& inv_dx,
784
+ const torch::stable::Tensor& inv_dy,
785
+ const torch::stable::Tensor& inv_dz,
786
+ const torch::stable::Tensor& inv_kappa_x,
787
+ const torch::stable::Tensor& b_x,
788
+ const torch::stable::Tensor& c_x,
789
+ const torch::stable::Tensor& inv_kappa_y,
790
+ const torch::stable::Tensor& b_y,
791
+ const torch::stable::Tensor& c_y,
792
+ const torch::stable::Tensor& inv_kappa_z,
793
+ const torch::stable::Tensor& b_z,
794
+ const torch::stable::Tensor& c_z,
795
+ int64_t periodic_x,
796
+ int64_t periodic_y,
797
+ int64_t periodic_z,
798
+ torch::stable::Tensor psi_x,
799
+ torch::stable::Tensor psi_y,
800
+ torch::stable::Tensor psi_z);
801
+ void update_electric_ez_full_aniso_cpml_cuda(
802
+ torch::stable::Tensor ez,
803
+ const torch::stable::Tensor& hx,
804
+ const torch::stable::Tensor& hy,
805
+ const torch::stable::Tensor& hz,
806
+ const torch::stable::Tensor& coeff_x,
807
+ const torch::stable::Tensor& coeff_y,
808
+ const torch::stable::Tensor& inv_dx,
809
+ const torch::stable::Tensor& inv_dy,
810
+ const torch::stable::Tensor& inv_dz,
811
+ const torch::stable::Tensor& inv_kappa_x,
812
+ const torch::stable::Tensor& b_x,
813
+ const torch::stable::Tensor& c_x,
814
+ const torch::stable::Tensor& inv_kappa_y,
815
+ const torch::stable::Tensor& b_y,
816
+ const torch::stable::Tensor& c_y,
817
+ const torch::stable::Tensor& inv_kappa_z,
818
+ const torch::stable::Tensor& b_z,
819
+ const torch::stable::Tensor& c_z,
820
+ int64_t periodic_x,
821
+ int64_t periodic_y,
822
+ int64_t periodic_z,
823
+ torch::stable::Tensor psi_x,
824
+ torch::stable::Tensor psi_y,
825
+ torch::stable::Tensor psi_z);
826
+ void apply_aniso_offdiag_current_ex_cuda(
827
+ torch::stable::Tensor ex,
828
+ const torch::stable::Tensor& jy,
829
+ const torch::stable::Tensor& jz,
830
+ const torch::stable::Tensor& coeff_y,
831
+ const torch::stable::Tensor& coeff_z,
832
+ int64_t periodic_x,
833
+ int64_t periodic_y,
834
+ int64_t periodic_z);
835
+ void capture_aniso_conduction_current_cuda(
836
+ const torch::stable::Tensor& sigma_x,
837
+ const torch::stable::Tensor& sigma_y,
838
+ const torch::stable::Tensor& sigma_z,
839
+ const torch::stable::Tensor& ex,
840
+ const torch::stable::Tensor& ey,
841
+ const torch::stable::Tensor& ez,
842
+ torch::stable::Tensor jx,
843
+ torch::stable::Tensor jy,
844
+ torch::stable::Tensor jz);
845
+ void apply_aniso_offdiag_current_ey_cuda(
846
+ torch::stable::Tensor ey,
847
+ const torch::stable::Tensor& jx,
848
+ const torch::stable::Tensor& jz,
849
+ const torch::stable::Tensor& coeff_x,
850
+ const torch::stable::Tensor& coeff_z,
851
+ int64_t periodic_x,
852
+ int64_t periodic_y,
853
+ int64_t periodic_z);
854
+ void apply_aniso_offdiag_current_ez_cuda(
855
+ torch::stable::Tensor ez,
856
+ const torch::stable::Tensor& jx,
857
+ const torch::stable::Tensor& jy,
858
+ const torch::stable::Tensor& coeff_x,
859
+ const torch::stable::Tensor& coeff_y,
860
+ int64_t periodic_x,
861
+ int64_t periodic_y,
862
+ int64_t periodic_z);
863
+ void add_source_patch_cuda(
864
+ torch::stable::Tensor field,
865
+ const torch::stable::Tensor& patch,
866
+ int64_t offset_i,
867
+ int64_t offset_j,
868
+ int64_t offset_k,
869
+ double signal);
870
+ void add_cw_phased_source_patch_cuda(
871
+ torch::stable::Tensor field,
872
+ const torch::stable::Tensor& patch_cos,
873
+ const torch::stable::Tensor& patch_sin,
874
+ int64_t offset_i,
875
+ int64_t offset_j,
876
+ int64_t offset_k,
877
+ double signal_cos,
878
+ double signal_sin);
879
+ void add_time_shifted_source_patch_cuda(
880
+ torch::stable::Tensor field,
881
+ const torch::stable::Tensor& patch,
882
+ const torch::stable::Tensor& delay_patch,
883
+ const torch::stable::Tensor& activation_delay_patch,
884
+ int64_t offset_i,
885
+ int64_t offset_j,
886
+ int64_t offset_k,
887
+ int64_t time_kind,
888
+ double time,
889
+ double frequency,
890
+ double fwidth,
891
+ double amplitude,
892
+ double phase,
893
+ double delay,
894
+ int64_t causal_gate);
895
+ void add_source_patch_periodic_cuda(
896
+ torch::stable::Tensor field,
897
+ const torch::stable::Tensor& patch,
898
+ int64_t offset_i,
899
+ int64_t offset_j,
900
+ int64_t offset_k,
901
+ double signal,
902
+ int64_t axis_a,
903
+ int64_t axis_b,
904
+ int64_t wrap_a,
905
+ int64_t wrap_b);
906
+ void add_source_patch_bloch_cuda(
907
+ torch::stable::Tensor ex_real,
908
+ torch::stable::Tensor ex_imag,
909
+ torch::stable::Tensor ey_real,
910
+ torch::stable::Tensor ey_imag,
911
+ torch::stable::Tensor ez_real,
912
+ torch::stable::Tensor ez_imag,
913
+ const torch::stable::Tensor& patch,
914
+ int64_t offset_i,
915
+ int64_t offset_j,
916
+ int64_t offset_k,
917
+ double signal_real,
918
+ double signal_imag,
919
+ int64_t axis_code,
920
+ double phase_cos_a,
921
+ double phase_sin_a,
922
+ double phase_cos_b,
923
+ double phase_sin_b,
924
+ int64_t wrap_axis_a,
925
+ int64_t wrap_axis_b);
926
+ void add_scaled_slice_source_patch_cuda(
927
+ torch::stable::Tensor field,
928
+ const torch::stable::Tensor& patch,
929
+ const torch::stable::Tensor& incident,
930
+ int64_t sample_index,
931
+ int64_t offset_i,
932
+ int64_t offset_j,
933
+ int64_t offset_k,
934
+ double scale);
935
+ void add_scaled_line_source_patch_cuda(
936
+ torch::stable::Tensor field,
937
+ const torch::stable::Tensor& patch,
938
+ const torch::stable::Tensor& incident,
939
+ const torch::stable::Tensor& sample_indices,
940
+ int64_t sample_axis,
941
+ int64_t offset_i,
942
+ int64_t offset_j,
943
+ int64_t offset_k,
944
+ double scale);
945
+ void add_interpolated_source_patch_cuda(
946
+ torch::stable::Tensor field,
947
+ const torch::stable::Tensor& patch,
948
+ const torch::stable::Tensor& incident,
949
+ const torch::stable::Tensor& sample_positions,
950
+ double origin,
951
+ double ds,
952
+ int64_t offset_i,
953
+ int64_t offset_j,
954
+ int64_t offset_k,
955
+ double scale);
956
+ void add_batched_reference_source_patches_cuda(
957
+ torch::stable::Tensor field_x,
958
+ torch::stable::Tensor field_y,
959
+ torch::stable::Tensor field_z,
960
+ const torch::stable::Tensor& coeff_data,
961
+ const torch::stable::Tensor& incident,
962
+ const torch::stable::Tensor& field_codes_per_coeff,
963
+ const torch::stable::Tensor& field_offsets,
964
+ const torch::stable::Tensor& sample_indices_per_coeff);
965
+ void add_batched_interpolated_source_patches_cuda(
966
+ torch::stable::Tensor field_x,
967
+ torch::stable::Tensor field_y,
968
+ torch::stable::Tensor field_z,
969
+ const torch::stable::Tensor& coeff_data,
970
+ const torch::stable::Tensor& incident,
971
+ const torch::stable::Tensor& sample_positions,
972
+ const torch::stable::Tensor& field_codes_per_coeff,
973
+ const torch::stable::Tensor& field_offsets,
974
+ double origin,
975
+ double ds);
976
+ void update_auxiliary_magnetic_cuda(
977
+ torch::stable::Tensor magnetic,
978
+ const torch::stable::Tensor& electric,
979
+ const torch::stable::Tensor& decay,
980
+ const torch::stable::Tensor& curl);
981
+ void update_auxiliary_electric_cuda(
982
+ torch::stable::Tensor electric,
983
+ const torch::stable::Tensor& magnetic,
984
+ const torch::stable::Tensor& decay,
985
+ const torch::stable::Tensor& curl,
986
+ int64_t source_index,
987
+ double source_value);
988
+ void reverse_magnetic_adjoint_decay_cuda(
989
+ torch::stable::Tensor adj_prev,
990
+ const torch::stable::Tensor& adj_mid,
991
+ const torch::stable::Tensor& decay);
992
+ void reverse_electric_adjoint_to_hx_standard_cuda(
993
+ torch::stable::Tensor adj_hx_mid,
994
+ const torch::stable::Tensor& adj_hx_post,
995
+ const torch::stable::Tensor& adj_ey_post,
996
+ const torch::stable::Tensor& adj_ez_post,
997
+ const torch::stable::Tensor& ey_curl,
998
+ const torch::stable::Tensor& ez_curl,
999
+ const torch::stable::Tensor& inv_dy,
1000
+ const torch::stable::Tensor& inv_dz);
1001
+ void reverse_electric_adjoint_to_hy_standard_cuda(
1002
+ torch::stable::Tensor adj_hy_mid,
1003
+ const torch::stable::Tensor& adj_hy_post,
1004
+ const torch::stable::Tensor& adj_ex_post,
1005
+ const torch::stable::Tensor& adj_ez_post,
1006
+ const torch::stable::Tensor& ex_curl,
1007
+ const torch::stable::Tensor& ez_curl,
1008
+ const torch::stable::Tensor& inv_dx,
1009
+ const torch::stable::Tensor& inv_dz);
1010
+ void reverse_electric_adjoint_to_hz_standard_cuda(
1011
+ torch::stable::Tensor adj_hz_mid,
1012
+ const torch::stable::Tensor& adj_hz_post,
1013
+ const torch::stable::Tensor& adj_ex_post,
1014
+ const torch::stable::Tensor& adj_ey_post,
1015
+ const torch::stable::Tensor& ex_curl,
1016
+ const torch::stable::Tensor& ey_curl,
1017
+ const torch::stable::Tensor& inv_dx,
1018
+ const torch::stable::Tensor& inv_dy);
1019
+ void reverse_magnetic_adjoint_to_ex_standard_cuda(
1020
+ torch::stable::Tensor adj_ex_prev,
1021
+ torch::stable::Tensor grad_eps_ex,
1022
+ const torch::stable::Tensor& adj_ex_post,
1023
+ const torch::stable::Tensor& adj_hy_mid,
1024
+ const torch::stable::Tensor& adj_hz_mid,
1025
+ const torch::stable::Tensor& ex_decay,
1026
+ const torch::stable::Tensor& ex_curl,
1027
+ const torch::stable::Tensor& eps_ex,
1028
+ const torch::stable::Tensor& hy_mid,
1029
+ const torch::stable::Tensor& hz_mid,
1030
+ const torch::stable::Tensor& hy_curl,
1031
+ const torch::stable::Tensor& hz_curl,
1032
+ const torch::stable::Tensor& inv_dy_e,
1033
+ const torch::stable::Tensor& inv_dz_e,
1034
+ const torch::stable::Tensor& inv_dy_h,
1035
+ const torch::stable::Tensor& inv_dz_h,
1036
+ int64_t y_low_mode,
1037
+ int64_t y_high_mode,
1038
+ int64_t z_low_mode,
1039
+ int64_t z_high_mode);
1040
+ void reverse_magnetic_adjoint_to_ey_standard_cuda(
1041
+ torch::stable::Tensor adj_ey_prev,
1042
+ torch::stable::Tensor grad_eps_ey,
1043
+ const torch::stable::Tensor& adj_ey_post,
1044
+ const torch::stable::Tensor& adj_hx_mid,
1045
+ const torch::stable::Tensor& adj_hz_mid,
1046
+ const torch::stable::Tensor& ey_decay,
1047
+ const torch::stable::Tensor& ey_curl,
1048
+ const torch::stable::Tensor& eps_ey,
1049
+ const torch::stable::Tensor& hx_mid,
1050
+ const torch::stable::Tensor& hz_mid,
1051
+ const torch::stable::Tensor& hx_curl,
1052
+ const torch::stable::Tensor& hz_curl,
1053
+ const torch::stable::Tensor& inv_dx_e,
1054
+ const torch::stable::Tensor& inv_dz_e,
1055
+ const torch::stable::Tensor& inv_dx_h,
1056
+ const torch::stable::Tensor& inv_dz_h,
1057
+ int64_t x_low_mode,
1058
+ int64_t x_high_mode,
1059
+ int64_t z_low_mode,
1060
+ int64_t z_high_mode);
1061
+ void reverse_magnetic_adjoint_to_ez_standard_cuda(
1062
+ torch::stable::Tensor adj_ez_prev,
1063
+ torch::stable::Tensor grad_eps_ez,
1064
+ const torch::stable::Tensor& adj_ez_post,
1065
+ const torch::stable::Tensor& adj_hx_mid,
1066
+ const torch::stable::Tensor& adj_hy_mid,
1067
+ const torch::stable::Tensor& ez_decay,
1068
+ const torch::stable::Tensor& ez_curl,
1069
+ const torch::stable::Tensor& eps_ez,
1070
+ const torch::stable::Tensor& hx_mid,
1071
+ const torch::stable::Tensor& hy_mid,
1072
+ const torch::stable::Tensor& hx_curl,
1073
+ const torch::stable::Tensor& hy_curl,
1074
+ const torch::stable::Tensor& inv_dx_e,
1075
+ const torch::stable::Tensor& inv_dy_e,
1076
+ const torch::stable::Tensor& inv_dx_h,
1077
+ const torch::stable::Tensor& inv_dy_h,
1078
+ int64_t x_low_mode,
1079
+ int64_t x_high_mode,
1080
+ int64_t y_low_mode,
1081
+ int64_t y_high_mode);
1082
+ void reverse_electric_adjoint_to_hx_bloch_cuda(
1083
+ torch::stable::Tensor adj_hx_mid_real,
1084
+ torch::stable::Tensor adj_hx_mid_imag,
1085
+ const torch::stable::Tensor& adj_hx_post_real,
1086
+ const torch::stable::Tensor& adj_hx_post_imag,
1087
+ const torch::stable::Tensor& adj_ey_post_real,
1088
+ const torch::stable::Tensor& adj_ey_post_imag,
1089
+ const torch::stable::Tensor& adj_ez_post_real,
1090
+ const torch::stable::Tensor& adj_ez_post_imag,
1091
+ const torch::stable::Tensor& ey_curl,
1092
+ const torch::stable::Tensor& ez_curl,
1093
+ double phase_cos_y,
1094
+ double phase_sin_y,
1095
+ double phase_cos_z,
1096
+ double phase_sin_z,
1097
+ const torch::stable::Tensor& inv_dy,
1098
+ const torch::stable::Tensor& inv_dz);
1099
+ void reverse_electric_adjoint_to_hy_bloch_cuda(
1100
+ torch::stable::Tensor adj_hy_mid_real,
1101
+ torch::stable::Tensor adj_hy_mid_imag,
1102
+ const torch::stable::Tensor& adj_hy_post_real,
1103
+ const torch::stable::Tensor& adj_hy_post_imag,
1104
+ const torch::stable::Tensor& adj_ex_post_real,
1105
+ const torch::stable::Tensor& adj_ex_post_imag,
1106
+ const torch::stable::Tensor& adj_ez_post_real,
1107
+ const torch::stable::Tensor& adj_ez_post_imag,
1108
+ const torch::stable::Tensor& ex_curl,
1109
+ const torch::stable::Tensor& ez_curl,
1110
+ double phase_cos_x,
1111
+ double phase_sin_x,
1112
+ double phase_cos_z,
1113
+ double phase_sin_z,
1114
+ const torch::stable::Tensor& inv_dx,
1115
+ const torch::stable::Tensor& inv_dz);
1116
+ void reverse_electric_adjoint_to_hz_bloch_cuda(
1117
+ torch::stable::Tensor adj_hz_mid_real,
1118
+ torch::stable::Tensor adj_hz_mid_imag,
1119
+ const torch::stable::Tensor& adj_hz_post_real,
1120
+ const torch::stable::Tensor& adj_hz_post_imag,
1121
+ const torch::stable::Tensor& adj_ex_post_real,
1122
+ const torch::stable::Tensor& adj_ex_post_imag,
1123
+ const torch::stable::Tensor& adj_ey_post_real,
1124
+ const torch::stable::Tensor& adj_ey_post_imag,
1125
+ const torch::stable::Tensor& ex_curl,
1126
+ const torch::stable::Tensor& ey_curl,
1127
+ double phase_cos_x,
1128
+ double phase_sin_x,
1129
+ double phase_cos_y,
1130
+ double phase_sin_y,
1131
+ const torch::stable::Tensor& inv_dx,
1132
+ const torch::stable::Tensor& inv_dy);
1133
+ void reverse_magnetic_adjoint_to_ex_bloch_cuda(
1134
+ torch::stable::Tensor adj_ex_prev_real,
1135
+ torch::stable::Tensor adj_ex_prev_imag,
1136
+ torch::stable::Tensor grad_eps_ex,
1137
+ const torch::stable::Tensor& adj_ex_post_real,
1138
+ const torch::stable::Tensor& adj_ex_post_imag,
1139
+ const torch::stable::Tensor& adj_hy_mid_real,
1140
+ const torch::stable::Tensor& adj_hy_mid_imag,
1141
+ const torch::stable::Tensor& adj_hz_mid_real,
1142
+ const torch::stable::Tensor& adj_hz_mid_imag,
1143
+ const torch::stable::Tensor& ex_decay,
1144
+ const torch::stable::Tensor& ex_curl,
1145
+ const torch::stable::Tensor& eps_ex,
1146
+ const torch::stable::Tensor& hy_mid_real,
1147
+ const torch::stable::Tensor& hy_mid_imag,
1148
+ const torch::stable::Tensor& hz_mid_real,
1149
+ const torch::stable::Tensor& hz_mid_imag,
1150
+ const torch::stable::Tensor& hy_curl,
1151
+ const torch::stable::Tensor& hz_curl,
1152
+ double phase_cos_y,
1153
+ double phase_sin_y,
1154
+ double phase_cos_z,
1155
+ double phase_sin_z,
1156
+ const torch::stable::Tensor& inv_dy_e,
1157
+ const torch::stable::Tensor& inv_dz_e,
1158
+ const torch::stable::Tensor& inv_dy_h,
1159
+ const torch::stable::Tensor& inv_dz_h);
1160
+ void reverse_magnetic_adjoint_to_ey_bloch_cuda(
1161
+ torch::stable::Tensor adj_ey_prev_real,
1162
+ torch::stable::Tensor adj_ey_prev_imag,
1163
+ torch::stable::Tensor grad_eps_ey,
1164
+ const torch::stable::Tensor& adj_ey_post_real,
1165
+ const torch::stable::Tensor& adj_ey_post_imag,
1166
+ const torch::stable::Tensor& adj_hx_mid_real,
1167
+ const torch::stable::Tensor& adj_hx_mid_imag,
1168
+ const torch::stable::Tensor& adj_hz_mid_real,
1169
+ const torch::stable::Tensor& adj_hz_mid_imag,
1170
+ const torch::stable::Tensor& ey_decay,
1171
+ const torch::stable::Tensor& ey_curl,
1172
+ const torch::stable::Tensor& eps_ey,
1173
+ const torch::stable::Tensor& hx_mid_real,
1174
+ const torch::stable::Tensor& hx_mid_imag,
1175
+ const torch::stable::Tensor& hz_mid_real,
1176
+ const torch::stable::Tensor& hz_mid_imag,
1177
+ const torch::stable::Tensor& hx_curl,
1178
+ const torch::stable::Tensor& hz_curl,
1179
+ double phase_cos_x,
1180
+ double phase_sin_x,
1181
+ double phase_cos_z,
1182
+ double phase_sin_z,
1183
+ const torch::stable::Tensor& inv_dx_e,
1184
+ const torch::stable::Tensor& inv_dz_e,
1185
+ const torch::stable::Tensor& inv_dx_h,
1186
+ const torch::stable::Tensor& inv_dz_h);
1187
+ void reverse_magnetic_adjoint_to_ez_bloch_cuda(
1188
+ torch::stable::Tensor adj_ez_prev_real,
1189
+ torch::stable::Tensor adj_ez_prev_imag,
1190
+ torch::stable::Tensor grad_eps_ez,
1191
+ const torch::stable::Tensor& adj_ez_post_real,
1192
+ const torch::stable::Tensor& adj_ez_post_imag,
1193
+ const torch::stable::Tensor& adj_hx_mid_real,
1194
+ const torch::stable::Tensor& adj_hx_mid_imag,
1195
+ const torch::stable::Tensor& adj_hy_mid_real,
1196
+ const torch::stable::Tensor& adj_hy_mid_imag,
1197
+ const torch::stable::Tensor& ez_decay,
1198
+ const torch::stable::Tensor& ez_curl,
1199
+ const torch::stable::Tensor& eps_ez,
1200
+ const torch::stable::Tensor& hx_mid_real,
1201
+ const torch::stable::Tensor& hx_mid_imag,
1202
+ const torch::stable::Tensor& hy_mid_real,
1203
+ const torch::stable::Tensor& hy_mid_imag,
1204
+ const torch::stable::Tensor& hx_curl,
1205
+ const torch::stable::Tensor& hy_curl,
1206
+ double phase_cos_x,
1207
+ double phase_sin_x,
1208
+ double phase_cos_y,
1209
+ double phase_sin_y,
1210
+ const torch::stable::Tensor& inv_dx_e,
1211
+ const torch::stable::Tensor& inv_dy_e,
1212
+ const torch::stable::Tensor& inv_dx_h,
1213
+ const torch::stable::Tensor& inv_dy_h);
1214
+ void accumulate_forward_diff_adjoint_cuda(
1215
+ torch::stable::Tensor field_grad,
1216
+ const torch::stable::Tensor& diff_grad,
1217
+ int64_t axis,
1218
+ const torch::stable::Tensor& inv_delta);
1219
+ void accumulate_backward_diff_adjoint_cuda(
1220
+ torch::stable::Tensor field_grad,
1221
+ const torch::stable::Tensor& diff_grad,
1222
+ int64_t axis,
1223
+ const torch::stable::Tensor& inv_delta);
1224
+ void seed_inject_dense_cuda(
1225
+ torch::stable::Tensor adj_field,
1226
+ const torch::stable::Tensor& grad_real,
1227
+ const torch::stable::Tensor& grad_imag,
1228
+ const torch::stable::Tensor& cos_pack,
1229
+ const torch::stable::Tensor& sin_pack,
1230
+ int64_t step);
1231
+ void seed_inject_point_cuda(
1232
+ torch::stable::Tensor adj_field,
1233
+ const torch::stable::Tensor& grad_real,
1234
+ const torch::stable::Tensor& grad_imag,
1235
+ const torch::stable::Tensor& point_i,
1236
+ const torch::stable::Tensor& point_j,
1237
+ const torch::stable::Tensor& point_k,
1238
+ const torch::stable::Tensor& cos_pack,
1239
+ const torch::stable::Tensor& sin_pack,
1240
+ int64_t step);
1241
+ void seed_inject_plane_cuda(
1242
+ torch::stable::Tensor adj_field,
1243
+ const torch::stable::Tensor& grad_real,
1244
+ const torch::stable::Tensor& grad_imag,
1245
+ const torch::stable::Tensor& cos_pack,
1246
+ const torch::stable::Tensor& sin_pack,
1247
+ int64_t axis,
1248
+ int64_t plane_index,
1249
+ int64_t step);
1250
+ void accumulate_in_place_cuda(
1251
+ torch::stable::Tensor dst,
1252
+ const torch::stable::Tensor& src);
1253
+ void reverse_electric_component_ex_cpml_cuda(
1254
+ torch::stable::Tensor adj_prev,
1255
+ torch::stable::Tensor grad_eps,
1256
+ torch::stable::Tensor adj_psi_pos_prev,
1257
+ torch::stable::Tensor adj_psi_neg_prev,
1258
+ torch::stable::Tensor adj_d_pos,
1259
+ torch::stable::Tensor adj_d_neg,
1260
+ const torch::stable::Tensor& adj_post,
1261
+ const torch::stable::Tensor& adj_psi_pos_post,
1262
+ const torch::stable::Tensor& adj_psi_neg_post,
1263
+ const torch::stable::Tensor& decay,
1264
+ const torch::stable::Tensor& curl,
1265
+ const torch::stable::Tensor& eps,
1266
+ const torch::stable::Tensor& psi_pos,
1267
+ const torch::stable::Tensor& psi_neg,
1268
+ const torch::stable::Tensor& b_pos,
1269
+ const torch::stable::Tensor& c_pos,
1270
+ const torch::stable::Tensor& inv_kappa_pos,
1271
+ const torch::stable::Tensor& b_neg,
1272
+ const torch::stable::Tensor& c_neg,
1273
+ const torch::stable::Tensor& inv_kappa_neg,
1274
+ const torch::stable::Tensor& hy_mid,
1275
+ const torch::stable::Tensor& hz_mid,
1276
+ const torch::stable::Tensor& inv_dy,
1277
+ const torch::stable::Tensor& inv_dz,
1278
+ int64_t y_low_mode,
1279
+ int64_t y_high_mode,
1280
+ int64_t z_low_mode,
1281
+ int64_t z_high_mode);
1282
+ void reverse_electric_component_ey_cpml_cuda(
1283
+ torch::stable::Tensor adj_prev,
1284
+ torch::stable::Tensor grad_eps,
1285
+ torch::stable::Tensor adj_psi_pos_prev,
1286
+ torch::stable::Tensor adj_psi_neg_prev,
1287
+ torch::stable::Tensor adj_d_pos,
1288
+ torch::stable::Tensor adj_d_neg,
1289
+ const torch::stable::Tensor& adj_post,
1290
+ const torch::stable::Tensor& adj_psi_pos_post,
1291
+ const torch::stable::Tensor& adj_psi_neg_post,
1292
+ const torch::stable::Tensor& decay,
1293
+ const torch::stable::Tensor& curl,
1294
+ const torch::stable::Tensor& eps,
1295
+ const torch::stable::Tensor& psi_pos,
1296
+ const torch::stable::Tensor& psi_neg,
1297
+ const torch::stable::Tensor& b_pos,
1298
+ const torch::stable::Tensor& c_pos,
1299
+ const torch::stable::Tensor& inv_kappa_pos,
1300
+ const torch::stable::Tensor& b_neg,
1301
+ const torch::stable::Tensor& c_neg,
1302
+ const torch::stable::Tensor& inv_kappa_neg,
1303
+ const torch::stable::Tensor& hx_mid,
1304
+ const torch::stable::Tensor& hz_mid,
1305
+ const torch::stable::Tensor& inv_dx,
1306
+ const torch::stable::Tensor& inv_dz,
1307
+ int64_t x_low_mode,
1308
+ int64_t x_high_mode,
1309
+ int64_t z_low_mode,
1310
+ int64_t z_high_mode);
1311
+ void reverse_electric_component_ez_cpml_cuda(
1312
+ torch::stable::Tensor adj_prev,
1313
+ torch::stable::Tensor grad_eps,
1314
+ torch::stable::Tensor adj_psi_pos_prev,
1315
+ torch::stable::Tensor adj_psi_neg_prev,
1316
+ torch::stable::Tensor adj_d_pos,
1317
+ torch::stable::Tensor adj_d_neg,
1318
+ const torch::stable::Tensor& adj_post,
1319
+ const torch::stable::Tensor& adj_psi_pos_post,
1320
+ const torch::stable::Tensor& adj_psi_neg_post,
1321
+ const torch::stable::Tensor& decay,
1322
+ const torch::stable::Tensor& curl,
1323
+ const torch::stable::Tensor& eps,
1324
+ const torch::stable::Tensor& psi_pos,
1325
+ const torch::stable::Tensor& psi_neg,
1326
+ const torch::stable::Tensor& b_pos,
1327
+ const torch::stable::Tensor& c_pos,
1328
+ const torch::stable::Tensor& inv_kappa_pos,
1329
+ const torch::stable::Tensor& b_neg,
1330
+ const torch::stable::Tensor& c_neg,
1331
+ const torch::stable::Tensor& inv_kappa_neg,
1332
+ const torch::stable::Tensor& hx_mid,
1333
+ const torch::stable::Tensor& hy_mid,
1334
+ const torch::stable::Tensor& inv_dx,
1335
+ const torch::stable::Tensor& inv_dy,
1336
+ int64_t x_low_mode,
1337
+ int64_t x_high_mode,
1338
+ int64_t y_low_mode,
1339
+ int64_t y_high_mode);
1340
+ void reverse_electric_component_ex_cpml_conductive_cuda(
1341
+ torch::stable::Tensor adj_prev,
1342
+ torch::stable::Tensor grad_eps,
1343
+ torch::stable::Tensor adj_psi_pos_prev,
1344
+ torch::stable::Tensor adj_psi_neg_prev,
1345
+ torch::stable::Tensor adj_d_pos,
1346
+ torch::stable::Tensor adj_d_neg,
1347
+ const torch::stable::Tensor& adj_post,
1348
+ const torch::stable::Tensor& adj_psi_pos_post,
1349
+ const torch::stable::Tensor& adj_psi_neg_post,
1350
+ const torch::stable::Tensor& decay,
1351
+ const torch::stable::Tensor& curl,
1352
+ const torch::stable::Tensor& half,
1353
+ const torch::stable::Tensor& e_prev,
1354
+ const torch::stable::Tensor& eps,
1355
+ double dt,
1356
+ const torch::stable::Tensor& psi_pos,
1357
+ const torch::stable::Tensor& psi_neg,
1358
+ const torch::stable::Tensor& b_pos,
1359
+ const torch::stable::Tensor& c_pos,
1360
+ const torch::stable::Tensor& inv_kappa_pos,
1361
+ const torch::stable::Tensor& b_neg,
1362
+ const torch::stable::Tensor& c_neg,
1363
+ const torch::stable::Tensor& inv_kappa_neg,
1364
+ const torch::stable::Tensor& hy_mid,
1365
+ const torch::stable::Tensor& hz_mid,
1366
+ const torch::stable::Tensor& inv_dy,
1367
+ const torch::stable::Tensor& inv_dz,
1368
+ int64_t y_low_mode,
1369
+ int64_t y_high_mode,
1370
+ int64_t z_low_mode,
1371
+ int64_t z_high_mode);
1372
+ void reverse_electric_component_ey_cpml_conductive_cuda(
1373
+ torch::stable::Tensor adj_prev,
1374
+ torch::stable::Tensor grad_eps,
1375
+ torch::stable::Tensor adj_psi_pos_prev,
1376
+ torch::stable::Tensor adj_psi_neg_prev,
1377
+ torch::stable::Tensor adj_d_pos,
1378
+ torch::stable::Tensor adj_d_neg,
1379
+ const torch::stable::Tensor& adj_post,
1380
+ const torch::stable::Tensor& adj_psi_pos_post,
1381
+ const torch::stable::Tensor& adj_psi_neg_post,
1382
+ const torch::stable::Tensor& decay,
1383
+ const torch::stable::Tensor& curl,
1384
+ const torch::stable::Tensor& half,
1385
+ const torch::stable::Tensor& e_prev,
1386
+ const torch::stable::Tensor& eps,
1387
+ double dt,
1388
+ const torch::stable::Tensor& psi_pos,
1389
+ const torch::stable::Tensor& psi_neg,
1390
+ const torch::stable::Tensor& b_pos,
1391
+ const torch::stable::Tensor& c_pos,
1392
+ const torch::stable::Tensor& inv_kappa_pos,
1393
+ const torch::stable::Tensor& b_neg,
1394
+ const torch::stable::Tensor& c_neg,
1395
+ const torch::stable::Tensor& inv_kappa_neg,
1396
+ const torch::stable::Tensor& hx_mid,
1397
+ const torch::stable::Tensor& hz_mid,
1398
+ const torch::stable::Tensor& inv_dx,
1399
+ const torch::stable::Tensor& inv_dz,
1400
+ int64_t x_low_mode,
1401
+ int64_t x_high_mode,
1402
+ int64_t z_low_mode,
1403
+ int64_t z_high_mode);
1404
+ void reverse_electric_component_ez_cpml_conductive_cuda(
1405
+ torch::stable::Tensor adj_prev,
1406
+ torch::stable::Tensor grad_eps,
1407
+ torch::stable::Tensor adj_psi_pos_prev,
1408
+ torch::stable::Tensor adj_psi_neg_prev,
1409
+ torch::stable::Tensor adj_d_pos,
1410
+ torch::stable::Tensor adj_d_neg,
1411
+ const torch::stable::Tensor& adj_post,
1412
+ const torch::stable::Tensor& adj_psi_pos_post,
1413
+ const torch::stable::Tensor& adj_psi_neg_post,
1414
+ const torch::stable::Tensor& decay,
1415
+ const torch::stable::Tensor& curl,
1416
+ const torch::stable::Tensor& half,
1417
+ const torch::stable::Tensor& e_prev,
1418
+ const torch::stable::Tensor& eps,
1419
+ double dt,
1420
+ const torch::stable::Tensor& psi_pos,
1421
+ const torch::stable::Tensor& psi_neg,
1422
+ const torch::stable::Tensor& b_pos,
1423
+ const torch::stable::Tensor& c_pos,
1424
+ const torch::stable::Tensor& inv_kappa_pos,
1425
+ const torch::stable::Tensor& b_neg,
1426
+ const torch::stable::Tensor& c_neg,
1427
+ const torch::stable::Tensor& inv_kappa_neg,
1428
+ const torch::stable::Tensor& hx_mid,
1429
+ const torch::stable::Tensor& hy_mid,
1430
+ const torch::stable::Tensor& inv_dx,
1431
+ const torch::stable::Tensor& inv_dy,
1432
+ int64_t x_low_mode,
1433
+ int64_t x_high_mode,
1434
+ int64_t y_low_mode,
1435
+ int64_t y_high_mode);
1436
+ void collocation_transpose_cuda(
1437
+ torch::stable::Tensor adj_ex,
1438
+ torch::stable::Tensor adj_ey,
1439
+ torch::stable::Tensor adj_ez,
1440
+ const torch::stable::Tensor& g_ex,
1441
+ const torch::stable::Tensor& g_ey,
1442
+ const torch::stable::Tensor& g_ez,
1443
+ const torch::stable::Tensor& ex,
1444
+ const torch::stable::Tensor& ey,
1445
+ const torch::stable::Tensor& ez);
1446
+ void collocate_field_square_cuda(
1447
+ torch::stable::Tensor fsq_ex,
1448
+ torch::stable::Tensor fsq_ey,
1449
+ torch::stable::Tensor fsq_ez,
1450
+ const torch::stable::Tensor& ex,
1451
+ const torch::stable::Tensor& ey,
1452
+ const torch::stable::Tensor& ez);
1453
+ void full_aniso_curl_adjoint_cuda(
1454
+ torch::stable::Tensor adj_curl_x,
1455
+ torch::stable::Tensor adj_curl_y,
1456
+ torch::stable::Tensor adj_curl_z,
1457
+ const torch::stable::Tensor& adj_ex,
1458
+ const torch::stable::Tensor& adj_ey,
1459
+ const torch::stable::Tensor& adj_ez,
1460
+ const torch::stable::Tensor& coeff_ex_y,
1461
+ const torch::stable::Tensor& coeff_ex_z,
1462
+ const torch::stable::Tensor& coeff_ey_x,
1463
+ const torch::stable::Tensor& coeff_ey_z,
1464
+ const torch::stable::Tensor& coeff_ez_x,
1465
+ const torch::stable::Tensor& coeff_ez_y);
1466
+ void reverse_electric_component_ex_cpml_kerr_cuda(
1467
+ torch::stable::Tensor adj_prev,
1468
+ torch::stable::Tensor grad_eps,
1469
+ torch::stable::Tensor grad_chi3,
1470
+ torch::stable::Tensor g_fsq,
1471
+ torch::stable::Tensor adj_psi_pos_prev,
1472
+ torch::stable::Tensor adj_psi_neg_prev,
1473
+ torch::stable::Tensor adj_d_pos,
1474
+ torch::stable::Tensor adj_d_neg,
1475
+ const torch::stable::Tensor& adj_post,
1476
+ const torch::stable::Tensor& adj_psi_pos_post,
1477
+ const torch::stable::Tensor& adj_psi_neg_post,
1478
+ const torch::stable::Tensor& decay,
1479
+ const torch::stable::Tensor& eps,
1480
+ const torch::stable::Tensor& chi3,
1481
+ const torch::stable::Tensor& fsq,
1482
+ double dt,
1483
+ double eps0,
1484
+ const torch::stable::Tensor& psi_pos,
1485
+ const torch::stable::Tensor& psi_neg,
1486
+ const torch::stable::Tensor& b_pos,
1487
+ const torch::stable::Tensor& c_pos,
1488
+ const torch::stable::Tensor& inv_kappa_pos,
1489
+ const torch::stable::Tensor& b_neg,
1490
+ const torch::stable::Tensor& c_neg,
1491
+ const torch::stable::Tensor& inv_kappa_neg,
1492
+ const torch::stable::Tensor& hy_mid,
1493
+ const torch::stable::Tensor& hz_mid,
1494
+ const torch::stable::Tensor& inv_dy,
1495
+ const torch::stable::Tensor& inv_dz,
1496
+ int64_t y_low_mode,
1497
+ int64_t y_high_mode,
1498
+ int64_t z_low_mode,
1499
+ int64_t z_high_mode);
1500
+ void reverse_electric_component_ey_cpml_kerr_cuda(
1501
+ torch::stable::Tensor adj_prev,
1502
+ torch::stable::Tensor grad_eps,
1503
+ torch::stable::Tensor grad_chi3,
1504
+ torch::stable::Tensor g_fsq,
1505
+ torch::stable::Tensor adj_psi_pos_prev,
1506
+ torch::stable::Tensor adj_psi_neg_prev,
1507
+ torch::stable::Tensor adj_d_pos,
1508
+ torch::stable::Tensor adj_d_neg,
1509
+ const torch::stable::Tensor& adj_post,
1510
+ const torch::stable::Tensor& adj_psi_pos_post,
1511
+ const torch::stable::Tensor& adj_psi_neg_post,
1512
+ const torch::stable::Tensor& decay,
1513
+ const torch::stable::Tensor& eps,
1514
+ const torch::stable::Tensor& chi3,
1515
+ const torch::stable::Tensor& fsq,
1516
+ double dt,
1517
+ double eps0,
1518
+ const torch::stable::Tensor& psi_pos,
1519
+ const torch::stable::Tensor& psi_neg,
1520
+ const torch::stable::Tensor& b_pos,
1521
+ const torch::stable::Tensor& c_pos,
1522
+ const torch::stable::Tensor& inv_kappa_pos,
1523
+ const torch::stable::Tensor& b_neg,
1524
+ const torch::stable::Tensor& c_neg,
1525
+ const torch::stable::Tensor& inv_kappa_neg,
1526
+ const torch::stable::Tensor& hx_mid,
1527
+ const torch::stable::Tensor& hz_mid,
1528
+ const torch::stable::Tensor& inv_dx,
1529
+ const torch::stable::Tensor& inv_dz,
1530
+ int64_t x_low_mode,
1531
+ int64_t x_high_mode,
1532
+ int64_t z_low_mode,
1533
+ int64_t z_high_mode);
1534
+ void reverse_electric_component_ez_cpml_kerr_cuda(
1535
+ torch::stable::Tensor adj_prev,
1536
+ torch::stable::Tensor grad_eps,
1537
+ torch::stable::Tensor grad_chi3,
1538
+ torch::stable::Tensor g_fsq,
1539
+ torch::stable::Tensor adj_psi_pos_prev,
1540
+ torch::stable::Tensor adj_psi_neg_prev,
1541
+ torch::stable::Tensor adj_d_pos,
1542
+ torch::stable::Tensor adj_d_neg,
1543
+ const torch::stable::Tensor& adj_post,
1544
+ const torch::stable::Tensor& adj_psi_pos_post,
1545
+ const torch::stable::Tensor& adj_psi_neg_post,
1546
+ const torch::stable::Tensor& decay,
1547
+ const torch::stable::Tensor& eps,
1548
+ const torch::stable::Tensor& chi3,
1549
+ const torch::stable::Tensor& fsq,
1550
+ double dt,
1551
+ double eps0,
1552
+ const torch::stable::Tensor& psi_pos,
1553
+ const torch::stable::Tensor& psi_neg,
1554
+ const torch::stable::Tensor& b_pos,
1555
+ const torch::stable::Tensor& c_pos,
1556
+ const torch::stable::Tensor& inv_kappa_pos,
1557
+ const torch::stable::Tensor& b_neg,
1558
+ const torch::stable::Tensor& c_neg,
1559
+ const torch::stable::Tensor& inv_kappa_neg,
1560
+ const torch::stable::Tensor& hx_mid,
1561
+ const torch::stable::Tensor& hy_mid,
1562
+ const torch::stable::Tensor& inv_dx,
1563
+ const torch::stable::Tensor& inv_dy,
1564
+ int64_t x_low_mode,
1565
+ int64_t x_high_mode,
1566
+ int64_t y_low_mode,
1567
+ int64_t y_high_mode);
1568
+ void reverse_cpml_correction_cuda(
1569
+ torch::stable::Tensor adj_psi_prev, torch::stable::Tensor adj_derivative,
1570
+ const torch::stable::Tensor& adj_field, const torch::stable::Tensor& adj_psi_post,
1571
+ const torch::stable::Tensor& curl, const torch::stable::Tensor& b,
1572
+ const torch::stable::Tensor& c, const torch::stable::Tensor& inv_kappa,
1573
+ int64_t normal_axis, int64_t tangent_axis,
1574
+ int64_t tangent_low_mode, int64_t tangent_high_mode, double sign);
1575
+ void reverse_electric_component_cpml_nonlinear_cuda(
1576
+ int64_t component,
1577
+ torch::stable::Tensor adj_prev, torch::stable::Tensor grad_eps,
1578
+ torch::stable::Tensor grad_chi2, torch::stable::Tensor grad_chi3,
1579
+ torch::stable::Tensor grad_tpa, torch::stable::Tensor g_fsq,
1580
+ torch::stable::Tensor adj_psi_pos_prev, torch::stable::Tensor adj_psi_neg_prev,
1581
+ torch::stable::Tensor adj_d_pos, torch::stable::Tensor adj_d_neg,
1582
+ const torch::stable::Tensor& adj_post,
1583
+ const torch::stable::Tensor& adj_psi_pos_post,
1584
+ const torch::stable::Tensor& adj_psi_neg_post,
1585
+ const torch::stable::Tensor& e_prev,
1586
+ const torch::stable::Tensor& external_decay,
1587
+ const torch::stable::Tensor& eps, const torch::stable::Tensor& chi2,
1588
+ const torch::stable::Tensor& chi3, const torch::stable::Tensor& tpa,
1589
+ const torch::stable::Tensor& sigma_static, const torch::stable::Tensor& fsq,
1590
+ double dt, double eps0,
1591
+ const torch::stable::Tensor& psi_pos, const torch::stable::Tensor& psi_neg,
1592
+ const torch::stable::Tensor& b_pos, const torch::stable::Tensor& c_pos,
1593
+ const torch::stable::Tensor& inv_kappa_pos,
1594
+ const torch::stable::Tensor& b_neg, const torch::stable::Tensor& c_neg,
1595
+ const torch::stable::Tensor& inv_kappa_neg,
1596
+ const torch::stable::Tensor& h_pos_mid, const torch::stable::Tensor& h_neg_mid,
1597
+ const torch::stable::Tensor& inv_pos, const torch::stable::Tensor& inv_neg,
1598
+ int64_t low_mode_a, int64_t high_mode_a, int64_t low_mode_b, int64_t high_mode_b);
1599
+ void reverse_magnetic_component_hx_cpml_cuda(
1600
+ torch::stable::Tensor adj_prev,
1601
+ torch::stable::Tensor adj_psi_pos_prev,
1602
+ torch::stable::Tensor adj_psi_neg_prev,
1603
+ torch::stable::Tensor adj_d_pos,
1604
+ torch::stable::Tensor adj_d_neg,
1605
+ const torch::stable::Tensor& adj_post,
1606
+ const torch::stable::Tensor& adj_psi_pos_post,
1607
+ const torch::stable::Tensor& adj_psi_neg_post,
1608
+ const torch::stable::Tensor& decay,
1609
+ const torch::stable::Tensor& curl,
1610
+ const torch::stable::Tensor& b_pos,
1611
+ const torch::stable::Tensor& c_pos,
1612
+ const torch::stable::Tensor& inv_kappa_pos,
1613
+ const torch::stable::Tensor& b_neg,
1614
+ const torch::stable::Tensor& c_neg,
1615
+ const torch::stable::Tensor& inv_kappa_neg);
1616
+ void reverse_magnetic_component_hy_cpml_cuda(
1617
+ torch::stable::Tensor adj_prev,
1618
+ torch::stable::Tensor adj_psi_pos_prev,
1619
+ torch::stable::Tensor adj_psi_neg_prev,
1620
+ torch::stable::Tensor adj_d_pos,
1621
+ torch::stable::Tensor adj_d_neg,
1622
+ const torch::stable::Tensor& adj_post,
1623
+ const torch::stable::Tensor& adj_psi_pos_post,
1624
+ const torch::stable::Tensor& adj_psi_neg_post,
1625
+ const torch::stable::Tensor& decay,
1626
+ const torch::stable::Tensor& curl,
1627
+ const torch::stable::Tensor& b_pos,
1628
+ const torch::stable::Tensor& c_pos,
1629
+ const torch::stable::Tensor& inv_kappa_pos,
1630
+ const torch::stable::Tensor& b_neg,
1631
+ const torch::stable::Tensor& c_neg,
1632
+ const torch::stable::Tensor& inv_kappa_neg);
1633
+ void reverse_magnetic_component_hz_cpml_cuda(
1634
+ torch::stable::Tensor adj_prev,
1635
+ torch::stable::Tensor adj_psi_pos_prev,
1636
+ torch::stable::Tensor adj_psi_neg_prev,
1637
+ torch::stable::Tensor adj_d_pos,
1638
+ torch::stable::Tensor adj_d_neg,
1639
+ const torch::stable::Tensor& adj_post,
1640
+ const torch::stable::Tensor& adj_psi_pos_post,
1641
+ const torch::stable::Tensor& adj_psi_neg_post,
1642
+ const torch::stable::Tensor& decay,
1643
+ const torch::stable::Tensor& curl,
1644
+ const torch::stable::Tensor& b_pos,
1645
+ const torch::stable::Tensor& c_pos,
1646
+ const torch::stable::Tensor& inv_kappa_pos,
1647
+ const torch::stable::Tensor& b_neg,
1648
+ const torch::stable::Tensor& c_neg,
1649
+ const torch::stable::Tensor& inv_kappa_neg);
1650
+ void reverse_debye_current_cuda(
1651
+ torch::stable::Tensor adj_electric_prev,
1652
+ torch::stable::Tensor adj_polarization_prev,
1653
+ const torch::stable::Tensor& adj_polarization_post,
1654
+ const torch::stable::Tensor& adj_current_post,
1655
+ const torch::stable::Tensor& drive,
1656
+ double decay,
1657
+ double dt);
1658
+ void reverse_drude_current_cuda(
1659
+ torch::stable::Tensor adj_electric_prev,
1660
+ torch::stable::Tensor adj_current_prev,
1661
+ const torch::stable::Tensor& adj_current_post,
1662
+ const torch::stable::Tensor& drive,
1663
+ double decay);
1664
+ void reverse_lorentz_current_cuda(
1665
+ torch::stable::Tensor adj_electric_prev,
1666
+ torch::stable::Tensor adj_polarization_prev,
1667
+ torch::stable::Tensor adj_current_prev,
1668
+ const torch::stable::Tensor& adj_polarization_post,
1669
+ const torch::stable::Tensor& adj_current_post,
1670
+ const torch::stable::Tensor& drive,
1671
+ double decay,
1672
+ double restoring,
1673
+ double dt);
1674
+ void reverse_dispersive_correction_cuda(
1675
+ torch::stable::Tensor adj_current_corrected,
1676
+ torch::stable::Tensor grad_eps,
1677
+ const torch::stable::Tensor& adj_current_post,
1678
+ const torch::stable::Tensor& adj_electric_post,
1679
+ const torch::stable::Tensor& current,
1680
+ const torch::stable::Tensor& eps,
1681
+ double dt);
1682
+ void accumulate_tfsf_scalar_sample_adjoint_cuda(
1683
+ torch::stable::Tensor adj_aux_field,
1684
+ const torch::stable::Tensor& adj_field_patch,
1685
+ const torch::stable::Tensor& coeff_patch,
1686
+ int64_t sample_index,
1687
+ double component_scale);
1688
+ void accumulate_tfsf_line_sample_adjoint_cuda(
1689
+ torch::stable::Tensor adj_aux_field,
1690
+ const torch::stable::Tensor& adj_field_patch,
1691
+ const torch::stable::Tensor& coeff_patch,
1692
+ const torch::stable::Tensor& sample_indices,
1693
+ int64_t sample_axis_code,
1694
+ double component_scale);
1695
+ void accumulate_tfsf_interpolated_sample_adjoint_cuda(
1696
+ torch::stable::Tensor adj_aux_field,
1697
+ const torch::stable::Tensor& adj_field_patch,
1698
+ const torch::stable::Tensor& coeff_patch,
1699
+ const torch::stable::Tensor& sample_positions,
1700
+ double origin,
1701
+ double ds,
1702
+ double component_scale);
1703
+ void reverse_tfsf_auxiliary_electric_cuda(
1704
+ torch::stable::Tensor adj_electric_prev,
1705
+ torch::stable::Tensor adj_magnetic_after,
1706
+ const torch::stable::Tensor& adj_electric_post,
1707
+ const torch::stable::Tensor& electric_decay,
1708
+ const torch::stable::Tensor& electric_curl,
1709
+ int64_t source_index);
1710
+ void reverse_tfsf_auxiliary_magnetic_cuda(
1711
+ torch::stable::Tensor adj_electric_prev,
1712
+ torch::stable::Tensor adj_magnetic_prev,
1713
+ const torch::stable::Tensor& adj_magnetic_after,
1714
+ const torch::stable::Tensor& magnetic_decay,
1715
+ const torch::stable::Tensor& magnetic_curl);
1716
+ void clamp_field_face_cuda(torch::stable::Tensor field, int64_t axis, int64_t side);
1717
+ void clamp_pec_boundary_cuda(torch::stable::Tensor field, int64_t axis_a, int64_t axis_b);
1718
+ void mur_abc_face_cuda(
1719
+ torch::stable::Tensor field,
1720
+ int64_t axis,
1721
+ int64_t boundary_index,
1722
+ int64_t adjacent_index,
1723
+ double coef,
1724
+ torch::stable::Tensor prev_boundary,
1725
+ torch::stable::Tensor prev_adjacent);
1726
+ void apply_sibc_surface_cuda(
1727
+ torch::stable::Tensor electric,
1728
+ const torch::stable::Tensor& magnetic,
1729
+ int64_t axis,
1730
+ int64_t electric_index,
1731
+ int64_t magnetic_index,
1732
+ double sign,
1733
+ double surface_r,
1734
+ double surface_l_over_dt,
1735
+ torch::stable::Tensor h_prev);
1736
+ void project_periodic_boundary_cuda(torch::stable::Tensor field, int64_t axis);
1737
+ void project_bloch_boundary_cuda(
1738
+ torch::stable::Tensor field_real,
1739
+ torch::stable::Tensor field_imag,
1740
+ int64_t axis,
1741
+ double phase_cos,
1742
+ double phase_sin);
1743
+ void update_electric_ex_bloch_y_standard_z_cuda(
1744
+ torch::stable::Tensor ex_real,
1745
+ torch::stable::Tensor ex_imag,
1746
+ const torch::stable::Tensor& hy_real,
1747
+ const torch::stable::Tensor& hy_imag,
1748
+ const torch::stable::Tensor& hz_real,
1749
+ const torch::stable::Tensor& hz_imag,
1750
+ const torch::stable::Tensor& decay,
1751
+ const torch::stable::Tensor& curl,
1752
+ double phase_cos_y,
1753
+ double phase_sin_y,
1754
+ const torch::stable::Tensor& inv_dy,
1755
+ const torch::stable::Tensor& inv_dz,
1756
+ int64_t z_low_mode,
1757
+ int64_t z_high_mode);
1758
+ void update_electric_ey_bloch_x_standard_z_cuda(
1759
+ torch::stable::Tensor ey_real,
1760
+ torch::stable::Tensor ey_imag,
1761
+ const torch::stable::Tensor& hx_real,
1762
+ const torch::stable::Tensor& hx_imag,
1763
+ const torch::stable::Tensor& hz_real,
1764
+ const torch::stable::Tensor& hz_imag,
1765
+ const torch::stable::Tensor& decay,
1766
+ const torch::stable::Tensor& curl,
1767
+ double phase_cos_x,
1768
+ double phase_sin_x,
1769
+ const torch::stable::Tensor& inv_dx,
1770
+ const torch::stable::Tensor& inv_dz,
1771
+ int64_t z_low_mode,
1772
+ int64_t z_high_mode);
1773
+ void apply_electric_ex_cpml_z_correction_cuda(
1774
+ torch::stable::Tensor ex,
1775
+ const torch::stable::Tensor& hy,
1776
+ const torch::stable::Tensor& curl,
1777
+ torch::stable::Tensor psi_z,
1778
+ const torch::stable::Tensor& inv_kappa_z,
1779
+ const torch::stable::Tensor& b_z,
1780
+ const torch::stable::Tensor& c_z,
1781
+ const torch::stable::Tensor& inv_dz,
1782
+ int64_t offset_i,
1783
+ int64_t offset_j,
1784
+ int64_t offset_k,
1785
+ int64_t y_low_mode,
1786
+ int64_t y_high_mode,
1787
+ int64_t full_size_y,
1788
+ int64_t full_size_z);
1789
+ void apply_electric_ey_cpml_z_correction_cuda(
1790
+ torch::stable::Tensor ey,
1791
+ const torch::stable::Tensor& hx,
1792
+ const torch::stable::Tensor& curl,
1793
+ torch::stable::Tensor psi_z,
1794
+ const torch::stable::Tensor& inv_kappa_z,
1795
+ const torch::stable::Tensor& b_z,
1796
+ const torch::stable::Tensor& c_z,
1797
+ const torch::stable::Tensor& inv_dz,
1798
+ int64_t offset_i,
1799
+ int64_t offset_j,
1800
+ int64_t offset_k,
1801
+ int64_t x_low_mode,
1802
+ int64_t x_high_mode,
1803
+ int64_t full_size_x,
1804
+ int64_t full_size_z);
1805
+ void apply_electric_ex_cpml_y_correction_cuda(
1806
+ torch::stable::Tensor ex,
1807
+ const torch::stable::Tensor& hz,
1808
+ const torch::stable::Tensor& curl,
1809
+ torch::stable::Tensor psi_y,
1810
+ const torch::stable::Tensor& inv_kappa_y,
1811
+ const torch::stable::Tensor& b_y,
1812
+ const torch::stable::Tensor& c_y,
1813
+ const torch::stable::Tensor& inv_dy,
1814
+ int64_t offset_i,
1815
+ int64_t offset_j,
1816
+ int64_t offset_k,
1817
+ int64_t z_low_mode,
1818
+ int64_t z_high_mode,
1819
+ int64_t full_size_z,
1820
+ int64_t full_size_y);
1821
+ void apply_electric_ez_cpml_y_correction_cuda(
1822
+ torch::stable::Tensor ez,
1823
+ const torch::stable::Tensor& hx,
1824
+ const torch::stable::Tensor& curl,
1825
+ torch::stable::Tensor psi_y,
1826
+ const torch::stable::Tensor& inv_kappa_y,
1827
+ const torch::stable::Tensor& b_y,
1828
+ const torch::stable::Tensor& c_y,
1829
+ const torch::stable::Tensor& inv_dy,
1830
+ int64_t offset_i,
1831
+ int64_t offset_j,
1832
+ int64_t offset_k,
1833
+ int64_t x_low_mode,
1834
+ int64_t x_high_mode,
1835
+ int64_t full_size_x,
1836
+ int64_t full_size_y);
1837
+ void apply_electric_ey_cpml_x_correction_cuda(
1838
+ torch::stable::Tensor ey,
1839
+ const torch::stable::Tensor& hz,
1840
+ const torch::stable::Tensor& curl,
1841
+ torch::stable::Tensor psi_x,
1842
+ const torch::stable::Tensor& inv_kappa_x,
1843
+ const torch::stable::Tensor& b_x,
1844
+ const torch::stable::Tensor& c_x,
1845
+ const torch::stable::Tensor& inv_dx,
1846
+ int64_t offset_i,
1847
+ int64_t offset_j,
1848
+ int64_t offset_k,
1849
+ int64_t z_low_mode,
1850
+ int64_t z_high_mode,
1851
+ int64_t full_size_z,
1852
+ int64_t full_size_x);
1853
+ void apply_electric_ez_cpml_x_correction_cuda(
1854
+ torch::stable::Tensor ez,
1855
+ const torch::stable::Tensor& hy,
1856
+ const torch::stable::Tensor& curl,
1857
+ torch::stable::Tensor psi_x,
1858
+ const torch::stable::Tensor& inv_kappa_x,
1859
+ const torch::stable::Tensor& b_x,
1860
+ const torch::stable::Tensor& c_x,
1861
+ const torch::stable::Tensor& inv_dx,
1862
+ int64_t offset_i,
1863
+ int64_t offset_j,
1864
+ int64_t offset_k,
1865
+ int64_t y_low_mode,
1866
+ int64_t y_high_mode,
1867
+ int64_t full_size_y,
1868
+ int64_t full_size_x);
1869
+
1870
+ void add_source_patch_ex_periodic_cuda(
1871
+ torch::stable::Tensor field,
1872
+ const torch::stable::Tensor& patch,
1873
+ int64_t offset_i,
1874
+ int64_t offset_j,
1875
+ int64_t offset_k,
1876
+ double signal,
1877
+ int64_t wrap_a,
1878
+ int64_t wrap_b) {
1879
+ add_source_patch_periodic_cuda(
1880
+ field, patch, offset_i, offset_j, offset_k, signal, 1, 2, wrap_a, wrap_b);
1881
+ }
1882
+
1883
+ void add_source_patch_ey_periodic_cuda(
1884
+ torch::stable::Tensor field,
1885
+ const torch::stable::Tensor& patch,
1886
+ int64_t offset_i,
1887
+ int64_t offset_j,
1888
+ int64_t offset_k,
1889
+ double signal,
1890
+ int64_t wrap_a,
1891
+ int64_t wrap_b) {
1892
+ add_source_patch_periodic_cuda(
1893
+ field, patch, offset_i, offset_j, offset_k, signal, 0, 2, wrap_a, wrap_b);
1894
+ }
1895
+
1896
+ void add_source_patch_ez_periodic_cuda(
1897
+ torch::stable::Tensor field,
1898
+ const torch::stable::Tensor& patch,
1899
+ int64_t offset_i,
1900
+ int64_t offset_j,
1901
+ int64_t offset_k,
1902
+ double signal,
1903
+ int64_t wrap_a,
1904
+ int64_t wrap_b) {
1905
+ add_source_patch_periodic_cuda(
1906
+ field, patch, offset_i, offset_j, offset_k, signal, 0, 1, wrap_a, wrap_b);
1907
+ }
1908
+
1909
+ #define WITWIN_CUDA_OPS(_) \
1910
+ _(update_magnetic_hx_standard, "update_magnetic_hx_standard(Tensor(a!) hx, Tensor ey, Tensor ez, Tensor decay, Tensor curl, Tensor inv_dy, Tensor inv_dz) -> ()", update_magnetic_hx_standard_cuda) \
1911
+ _(update_magnetic_hy_standard, "update_magnetic_hy_standard(Tensor(a!) hy, Tensor ex, Tensor ez, Tensor decay, Tensor curl, Tensor inv_dx, Tensor inv_dz) -> ()", update_magnetic_hy_standard_cuda) \
1912
+ _(update_magnetic_hz_standard, "update_magnetic_hz_standard(Tensor(a!) hz, Tensor ex, Tensor ey, Tensor decay, Tensor curl, Tensor inv_dx, Tensor inv_dy) -> ()", update_magnetic_hz_standard_cuda) \
1913
+ _(update_magnetic_hx_cpml, "update_magnetic_hx_cpml(Tensor(a!) hx, Tensor ey, Tensor ez, Tensor decay, Tensor curl, Tensor(b!) psi_y, Tensor(c!) psi_z, Tensor inv_kappa_y, Tensor b_y, Tensor c_y, Tensor inv_kappa_z, Tensor b_z, Tensor c_z, Tensor inv_dy, Tensor inv_dz) -> ()", update_magnetic_hx_cpml_cuda) \
1914
+ _(update_magnetic_hy_cpml, "update_magnetic_hy_cpml(Tensor(a!) hy, Tensor ex, Tensor ez, Tensor decay, Tensor curl, Tensor(b!) psi_x, Tensor(c!) psi_z, Tensor inv_kappa_x, Tensor b_x, Tensor c_x, Tensor inv_kappa_z, Tensor b_z, Tensor c_z, Tensor inv_dx, Tensor inv_dz) -> ()", update_magnetic_hy_cpml_cuda) \
1915
+ _(update_magnetic_hz_cpml, "update_magnetic_hz_cpml(Tensor(a!) hz, Tensor ex, Tensor ey, Tensor decay, Tensor curl, Tensor(b!) psi_x, Tensor(c!) psi_y, Tensor inv_kappa_x, Tensor b_x, Tensor c_x, Tensor inv_kappa_y, Tensor b_y, Tensor c_y, Tensor inv_dx, Tensor inv_dy) -> ()", update_magnetic_hz_cpml_cuda) \
1916
+ _(update_magnetic_hx_cpml_compressed, "update_magnetic_hx_cpml_compressed(Tensor(a!) hx, Tensor ey, Tensor ez, Tensor decay, Tensor curl, Tensor(b!) psi_y, Tensor(c!) psi_z, Tensor inv_kappa_y, Tensor b_y, Tensor c_y, Tensor inv_kappa_z, Tensor b_z, Tensor c_z, Tensor inv_dy, Tensor inv_dz, int y_low_length, int y_high_start, int y_high_length, int z_low_length, int z_high_start, int z_high_length, float? uniform_decay, float? uniform_curl) -> ()", update_magnetic_hx_cpml_compressed_cuda) \
1917
+ _(update_magnetic_hy_cpml_compressed, "update_magnetic_hy_cpml_compressed(Tensor(a!) hy, Tensor ex, Tensor ez, Tensor decay, Tensor curl, Tensor(b!) psi_x, Tensor(c!) psi_z, Tensor inv_kappa_x, Tensor b_x, Tensor c_x, Tensor inv_kappa_z, Tensor b_z, Tensor c_z, Tensor inv_dx, Tensor inv_dz, int x_low_length, int x_high_start, int x_high_length, int z_low_length, int z_high_start, int z_high_length, float? uniform_decay, float? uniform_curl) -> ()", update_magnetic_hy_cpml_compressed_cuda) \
1918
+ _(update_magnetic_hz_cpml_compressed, "update_magnetic_hz_cpml_compressed(Tensor(a!) hz, Tensor ex, Tensor ey, Tensor decay, Tensor curl, Tensor(b!) psi_x, Tensor(c!) psi_y, Tensor inv_kappa_x, Tensor b_x, Tensor c_x, Tensor inv_kappa_y, Tensor b_y, Tensor c_y, Tensor inv_dx, Tensor inv_dy, int x_low_length, int x_high_start, int x_high_length, int y_low_length, int y_high_start, int y_high_length, float? uniform_decay, float? uniform_curl) -> ()", update_magnetic_hz_cpml_compressed_cuda) \
1919
+ _(update_electric_ex_standard, "update_electric_ex_standard(Tensor(a!) ex, Tensor hy, Tensor hz, Tensor decay, Tensor curl, Tensor inv_dy, Tensor inv_dz, int y_low_mode, int y_high_mode, int z_low_mode, int z_high_mode) -> ()", update_electric_ex_standard_cuda) \
1920
+ _(update_electric_ey_standard, "update_electric_ey_standard(Tensor(a!) ey, Tensor hx, Tensor hz, Tensor decay, Tensor curl, Tensor inv_dx, Tensor inv_dz, int x_low_mode, int x_high_mode, int z_low_mode, int z_high_mode) -> ()", update_electric_ey_standard_cuda) \
1921
+ _(update_electric_ez_standard, "update_electric_ez_standard(Tensor(a!) ez, Tensor hx, Tensor hy, Tensor decay, Tensor curl, Tensor inv_dx, Tensor inv_dy, int x_low_mode, int x_high_mode, int y_low_mode, int y_high_mode) -> ()", update_electric_ez_standard_cuda) \
1922
+ _(advance_modulation_time, "advance_modulation_time(Tensor(a!) modulation_time, float dt) -> ()", advance_modulation_time_cuda) \
1923
+ _(update_electric_ex_modulated, "update_electric_ex_modulated(Tensor(a!) ex, Tensor hy, Tensor hz, Tensor decay, Tensor curl, Tensor mod_cos, Tensor mod_sin, Tensor mod_omega, Tensor modulation_time, Tensor inv_dy, Tensor inv_dz, int y_low_mode, int y_high_mode, int z_low_mode, int z_high_mode) -> ()", update_electric_ex_modulated_cuda) \
1924
+ _(update_electric_ey_modulated, "update_electric_ey_modulated(Tensor(a!) ey, Tensor hx, Tensor hz, Tensor decay, Tensor curl, Tensor mod_cos, Tensor mod_sin, Tensor mod_omega, Tensor modulation_time, Tensor inv_dx, Tensor inv_dz, int x_low_mode, int x_high_mode, int z_low_mode, int z_high_mode) -> ()", update_electric_ey_modulated_cuda) \
1925
+ _(update_electric_ez_modulated, "update_electric_ez_modulated(Tensor(a!) ez, Tensor hx, Tensor hy, Tensor decay, Tensor curl, Tensor mod_cos, Tensor mod_sin, Tensor mod_omega, Tensor modulation_time, Tensor inv_dx, Tensor inv_dy, int x_low_mode, int x_high_mode, int y_low_mode, int y_high_mode) -> ()", update_electric_ez_modulated_cuda) \
1926
+ _(update_electric_ex_cpml_modulated, "update_electric_ex_cpml_modulated(Tensor(a!) ex, Tensor hy, Tensor hz, Tensor decay, Tensor curl, Tensor mod_cos, Tensor mod_sin, Tensor mod_omega, Tensor modulation_time, Tensor(b!) psi_y, Tensor(c!) psi_z, Tensor inv_kappa_y, Tensor b_y, Tensor c_y, Tensor inv_kappa_z, Tensor b_z, Tensor c_z, Tensor inv_dy, Tensor inv_dz, int y_low_mode, int y_high_mode, int z_low_mode, int z_high_mode) -> ()", update_electric_ex_cpml_modulated_cuda) \
1927
+ _(update_electric_ey_cpml_modulated, "update_electric_ey_cpml_modulated(Tensor(a!) ey, Tensor hx, Tensor hz, Tensor decay, Tensor curl, Tensor mod_cos, Tensor mod_sin, Tensor mod_omega, Tensor modulation_time, Tensor(b!) psi_x, Tensor(c!) psi_z, Tensor inv_kappa_x, Tensor b_x, Tensor c_x, Tensor inv_kappa_z, Tensor b_z, Tensor c_z, Tensor inv_dx, Tensor inv_dz, int x_low_mode, int x_high_mode, int z_low_mode, int z_high_mode) -> ()", update_electric_ey_cpml_modulated_cuda) \
1928
+ _(update_electric_ez_cpml_modulated, "update_electric_ez_cpml_modulated(Tensor(a!) ez, Tensor hx, Tensor hy, Tensor decay, Tensor curl, Tensor mod_cos, Tensor mod_sin, Tensor mod_omega, Tensor modulation_time, Tensor(b!) psi_x, Tensor(c!) psi_y, Tensor inv_kappa_x, Tensor b_x, Tensor c_x, Tensor inv_kappa_y, Tensor b_y, Tensor c_y, Tensor inv_dx, Tensor inv_dy, int x_low_mode, int x_high_mode, int y_low_mode, int y_high_mode) -> ()", update_electric_ez_cpml_modulated_cuda) \
1929
+ _(update_electric_ex_bloch, "update_electric_ex_bloch(Tensor(a!) ex_real, Tensor(b!) ex_imag, Tensor hy_real, Tensor hy_imag, Tensor hz_real, Tensor hz_imag, Tensor decay, Tensor curl, float phase_cos_y, float phase_sin_y, float phase_cos_z, float phase_sin_z, Tensor inv_dy, Tensor inv_dz) -> ()", update_electric_ex_bloch_cuda) \
1930
+ _(update_electric_ey_bloch, "update_electric_ey_bloch(Tensor(a!) ey_real, Tensor(b!) ey_imag, Tensor hx_real, Tensor hx_imag, Tensor hz_real, Tensor hz_imag, Tensor decay, Tensor curl, float phase_cos_x, float phase_sin_x, float phase_cos_z, float phase_sin_z, Tensor inv_dx, Tensor inv_dz) -> ()", update_electric_ey_bloch_cuda) \
1931
+ _(update_electric_ez_bloch, "update_electric_ez_bloch(Tensor(a!) ez_real, Tensor(b!) ez_imag, Tensor hx_real, Tensor hx_imag, Tensor hy_real, Tensor hy_imag, Tensor decay, Tensor curl, float phase_cos_x, float phase_sin_x, float phase_cos_y, float phase_sin_y, Tensor inv_dx, Tensor inv_dy) -> ()", update_electric_ez_bloch_cuda) \
1932
+ _(update_electric_ex_cpml, "update_electric_ex_cpml(Tensor(a!) ex, Tensor hy, Tensor hz, Tensor decay, Tensor curl, Tensor(b!) psi_y, Tensor(c!) psi_z, Tensor inv_kappa_y, Tensor b_y, Tensor c_y, Tensor inv_kappa_z, Tensor b_z, Tensor c_z, Tensor inv_dy, Tensor inv_dz, int y_low_mode, int y_high_mode, int z_low_mode, int z_high_mode) -> ()", update_electric_ex_cpml_cuda) \
1933
+ _(update_electric_ey_cpml, "update_electric_ey_cpml(Tensor(a!) ey, Tensor hx, Tensor hz, Tensor decay, Tensor curl, Tensor(b!) psi_x, Tensor(c!) psi_z, Tensor inv_kappa_x, Tensor b_x, Tensor c_x, Tensor inv_kappa_z, Tensor b_z, Tensor c_z, Tensor inv_dx, Tensor inv_dz, int x_low_mode, int x_high_mode, int z_low_mode, int z_high_mode) -> ()", update_electric_ey_cpml_cuda) \
1934
+ _(update_electric_ez_cpml, "update_electric_ez_cpml(Tensor(a!) ez, Tensor hx, Tensor hy, Tensor decay, Tensor curl, Tensor(b!) psi_x, Tensor(c!) psi_y, Tensor inv_kappa_x, Tensor b_x, Tensor c_x, Tensor inv_kappa_y, Tensor b_y, Tensor c_y, Tensor inv_dx, Tensor inv_dy, int x_low_mode, int x_high_mode, int y_low_mode, int y_high_mode) -> ()", update_electric_ez_cpml_cuda) \
1935
+ _(update_electric_ex_cpml_compressed, "update_electric_ex_cpml_compressed(Tensor(a!) ex, Tensor hy, Tensor hz, Tensor decay, Tensor curl, Tensor(b!) psi_y, Tensor(c!) psi_z, Tensor inv_kappa_y, Tensor b_y, Tensor c_y, Tensor inv_kappa_z, Tensor b_z, Tensor c_z, Tensor inv_dy, Tensor inv_dz, int y_low_mode, int y_high_mode, int z_low_mode, int z_high_mode, int y_low_length, int y_high_start, int y_high_length, int z_low_length, int z_high_start, int z_high_length, float? uniform_decay, float? uniform_curl) -> ()", update_electric_ex_cpml_compressed_cuda) \
1936
+ _(update_electric_ey_cpml_compressed, "update_electric_ey_cpml_compressed(Tensor(a!) ey, Tensor hx, Tensor hz, Tensor decay, Tensor curl, Tensor(b!) psi_x, Tensor(c!) psi_z, Tensor inv_kappa_x, Tensor b_x, Tensor c_x, Tensor inv_kappa_z, Tensor b_z, Tensor c_z, Tensor inv_dx, Tensor inv_dz, int x_low_mode, int x_high_mode, int z_low_mode, int z_high_mode, int x_low_length, int x_high_start, int x_high_length, int z_low_length, int z_high_start, int z_high_length, float? uniform_decay, float? uniform_curl) -> ()", update_electric_ey_cpml_compressed_cuda) \
1937
+ _(update_electric_ez_cpml_compressed, "update_electric_ez_cpml_compressed(Tensor(a!) ez, Tensor hx, Tensor hy, Tensor decay, Tensor curl, Tensor(b!) psi_x, Tensor(c!) psi_y, Tensor inv_kappa_x, Tensor b_x, Tensor c_x, Tensor inv_kappa_y, Tensor b_y, Tensor c_y, Tensor inv_dx, Tensor inv_dy, int x_low_mode, int x_high_mode, int y_low_mode, int y_high_mode, int x_low_length, int x_high_start, int x_high_length, int y_low_length, int y_high_start, int y_high_length, float? uniform_decay, float? uniform_curl) -> ()", update_electric_ez_cpml_compressed_cuda) \
1938
+ _(update_electric_ex_cpml_modulated_compressed, "update_electric_ex_cpml_modulated_compressed(Tensor(a!) ex, Tensor hy, Tensor hz, Tensor decay, Tensor curl, Tensor mod_cos, Tensor mod_sin, Tensor mod_omega, Tensor modulation_time, Tensor(b!) psi_y, Tensor(c!) psi_z, Tensor inv_kappa_y, Tensor b_y, Tensor c_y, Tensor inv_kappa_z, Tensor b_z, Tensor c_z, Tensor inv_dy, Tensor inv_dz, int y_low_mode, int y_high_mode, int z_low_mode, int z_high_mode, int y_low_length, int y_high_start, int y_high_length, int z_low_length, int z_high_start, int z_high_length) -> ()", update_electric_ex_cpml_modulated_compressed_cuda) \
1939
+ _(update_electric_ey_cpml_modulated_compressed, "update_electric_ey_cpml_modulated_compressed(Tensor(a!) ey, Tensor hx, Tensor hz, Tensor decay, Tensor curl, Tensor mod_cos, Tensor mod_sin, Tensor mod_omega, Tensor modulation_time, Tensor(b!) psi_x, Tensor(c!) psi_z, Tensor inv_kappa_x, Tensor b_x, Tensor c_x, Tensor inv_kappa_z, Tensor b_z, Tensor c_z, Tensor inv_dx, Tensor inv_dz, int x_low_mode, int x_high_mode, int z_low_mode, int z_high_mode, int x_low_length, int x_high_start, int x_high_length, int z_low_length, int z_high_start, int z_high_length) -> ()", update_electric_ey_cpml_modulated_compressed_cuda) \
1940
+ _(update_electric_ez_cpml_modulated_compressed, "update_electric_ez_cpml_modulated_compressed(Tensor(a!) ez, Tensor hx, Tensor hy, Tensor decay, Tensor curl, Tensor mod_cos, Tensor mod_sin, Tensor mod_omega, Tensor modulation_time, Tensor(b!) psi_x, Tensor(c!) psi_y, Tensor inv_kappa_x, Tensor b_x, Tensor c_x, Tensor inv_kappa_y, Tensor b_y, Tensor c_y, Tensor inv_dx, Tensor inv_dy, int x_low_mode, int x_high_mode, int y_low_mode, int y_high_mode, int x_low_length, int x_high_start, int x_high_length, int y_low_length, int y_high_start, int y_high_length) -> ()", update_electric_ez_cpml_modulated_compressed_cuda) \
1941
+ _(accumulate_dft_batched, "accumulate_dft_batched(Tensor ex, Tensor ey, Tensor ez, Tensor(a!) ex_real, Tensor(b!) ex_imag, Tensor(c!) ey_real, Tensor(d!) ey_imag, Tensor(e!) ez_real, Tensor(f!) ez_imag, Tensor weighted_cos, Tensor weighted_sin) -> ()", accumulate_dft_batched_cuda) \
1942
+ _(accumulate_point_observers, "accumulate_point_observers(Tensor field, Tensor point_i, Tensor point_j, Tensor point_k, Tensor(a!) real_accum, Tensor(b!) imag_accum, float weighted_cos, float weighted_sin) -> ()", accumulate_point_observers_cuda) \
1943
+ _(accumulate_plane_observer, "accumulate_plane_observer(Tensor field, Tensor(a!) real_accum, Tensor(b!) imag_accum, int axis, int plane_index, float weighted_cos, float weighted_sin) -> ()", accumulate_plane_observer_cuda) \
1944
+ _(plane_flux_reduce, "plane_flux_reduce(Tensor ea, Tensor eb, Tensor ha, Tensor hb, Tensor weights, Tensor(a!) out, int out_index, float scale) -> ()", plane_flux_reduce_cuda) \
1945
+ _(update_debye_current, "update_debye_current(Tensor electric, Tensor(a!) polarization, Tensor(b!) current, Tensor drive, float decay, float dt) -> ()", update_debye_current_cuda) \
1946
+ _(update_drude_current, "update_drude_current(Tensor electric, Tensor(a!) current, Tensor drive, float decay) -> ()", update_drude_current_cuda) \
1947
+ _(update_lorentz_current, "update_lorentz_current(Tensor electric, Tensor(a!) polarization, Tensor(b!) current, Tensor drive, float decay, float restoring, float dt) -> ()", update_lorentz_current_cuda) \
1948
+ _(apply_polarization_current, "apply_polarization_current(Tensor(a!) electric, Tensor current, Tensor inv_permittivity, float dt) -> ()", apply_polarization_current_cuda) \
1949
+ _(apply_polarization_current_modulated, "apply_polarization_current_modulated(Tensor(a!) electric, Tensor current, Tensor inv_permittivity, Tensor mod_cos, Tensor mod_sin, Tensor mod_omega, Tensor modulation_time, float dt) -> ()", apply_polarization_current_modulated_cuda) \
1950
+ _(update_kerr_ex_curl, "update_kerr_ex_curl(Tensor(a!) dynamic_curl, Tensor ex, Tensor ey, Tensor ez, Tensor linear_permittivity, Tensor ex_decay, Tensor chi3, float dt, float eps0) -> ()", update_kerr_ex_curl_cuda) \
1951
+ _(update_kerr_ey_curl, "update_kerr_ey_curl(Tensor(a!) dynamic_curl, Tensor ex, Tensor ey, Tensor ez, Tensor linear_permittivity, Tensor ey_decay, Tensor chi3, float dt, float eps0) -> ()", update_kerr_ey_curl_cuda) \
1952
+ _(update_kerr_ez_curl, "update_kerr_ez_curl(Tensor(a!) dynamic_curl, Tensor ex, Tensor ey, Tensor ez, Tensor linear_permittivity, Tensor ez_decay, Tensor chi3, float dt, float eps0) -> ()", update_kerr_ez_curl_cuda) \
1953
+ _(update_nonlinear_coefficients, "update_nonlinear_coefficients(Tensor(a!) dynamic_decay, Tensor(b!) dynamic_curl, Tensor ex, Tensor ey, Tensor ez, Tensor linear_permittivity, Tensor external_decay, Tensor sigma_static, Tensor chi2, Tensor chi3, Tensor tpa_sigma, int component, float dt, float eps0) -> ()", update_nonlinear_coefficients_cuda) \
1954
+ _(update_electric_ex_full_aniso, "update_electric_ex_full_aniso(Tensor(a!) ex, Tensor hx, Tensor hy, Tensor hz, Tensor coeff_y, Tensor coeff_z, Tensor inv_dx, Tensor inv_dy, Tensor inv_dz, int periodic_x, int periodic_y, int periodic_z) -> ()", update_electric_ex_full_aniso_cuda) \
1955
+ _(update_electric_ey_full_aniso, "update_electric_ey_full_aniso(Tensor(a!) ey, Tensor hx, Tensor hy, Tensor hz, Tensor coeff_x, Tensor coeff_z, Tensor inv_dx, Tensor inv_dy, Tensor inv_dz, int periodic_x, int periodic_y, int periodic_z) -> ()", update_electric_ey_full_aniso_cuda) \
1956
+ _(update_electric_ez_full_aniso, "update_electric_ez_full_aniso(Tensor(a!) ez, Tensor hx, Tensor hy, Tensor hz, Tensor coeff_x, Tensor coeff_y, Tensor inv_dx, Tensor inv_dy, Tensor inv_dz, int periodic_x, int periodic_y, int periodic_z) -> ()", update_electric_ez_full_aniso_cuda) \
1957
+ _(update_electric_ex_full_aniso_cpml, "update_electric_ex_full_aniso_cpml(Tensor(a!) ex, Tensor hx, Tensor hy, Tensor hz, Tensor coeff_y, Tensor coeff_z, Tensor inv_dx, Tensor inv_dy, Tensor inv_dz, Tensor inv_kappa_x, Tensor b_x, Tensor c_x, Tensor inv_kappa_y, Tensor b_y, Tensor c_y, Tensor inv_kappa_z, Tensor b_z, Tensor c_z, int periodic_x, int periodic_y, int periodic_z, Tensor(b!) psi_x, Tensor(c!) psi_y, Tensor(d!) psi_z) -> ()", update_electric_ex_full_aniso_cpml_cuda) \
1958
+ _(update_electric_ey_full_aniso_cpml, "update_electric_ey_full_aniso_cpml(Tensor(a!) ey, Tensor hx, Tensor hy, Tensor hz, Tensor coeff_x, Tensor coeff_z, Tensor inv_dx, Tensor inv_dy, Tensor inv_dz, Tensor inv_kappa_x, Tensor b_x, Tensor c_x, Tensor inv_kappa_y, Tensor b_y, Tensor c_y, Tensor inv_kappa_z, Tensor b_z, Tensor c_z, int periodic_x, int periodic_y, int periodic_z, Tensor(b!) psi_x, Tensor(c!) psi_y, Tensor(d!) psi_z) -> ()", update_electric_ey_full_aniso_cpml_cuda) \
1959
+ _(update_electric_ez_full_aniso_cpml, "update_electric_ez_full_aniso_cpml(Tensor(a!) ez, Tensor hx, Tensor hy, Tensor hz, Tensor coeff_x, Tensor coeff_y, Tensor inv_dx, Tensor inv_dy, Tensor inv_dz, Tensor inv_kappa_x, Tensor b_x, Tensor c_x, Tensor inv_kappa_y, Tensor b_y, Tensor c_y, Tensor inv_kappa_z, Tensor b_z, Tensor c_z, int periodic_x, int periodic_y, int periodic_z, Tensor(b!) psi_x, Tensor(c!) psi_y, Tensor(d!) psi_z) -> ()", update_electric_ez_full_aniso_cpml_cuda) \
1960
+ _(capture_aniso_conduction_current, "capture_aniso_conduction_current(Tensor sigma_x, Tensor sigma_y, Tensor sigma_z, Tensor ex, Tensor ey, Tensor ez, Tensor(a!) jx, Tensor(b!) jy, Tensor(c!) jz) -> ()", capture_aniso_conduction_current_cuda) \
1961
+ _(apply_aniso_offdiag_current_ex, "apply_aniso_offdiag_current_ex(Tensor(a!) ex, Tensor jy, Tensor jz, Tensor coeff_y, Tensor coeff_z, int periodic_x, int periodic_y, int periodic_z) -> ()", apply_aniso_offdiag_current_ex_cuda) \
1962
+ _(apply_aniso_offdiag_current_ey, "apply_aniso_offdiag_current_ey(Tensor(a!) ey, Tensor jx, Tensor jz, Tensor coeff_x, Tensor coeff_z, int periodic_x, int periodic_y, int periodic_z) -> ()", apply_aniso_offdiag_current_ey_cuda) \
1963
+ _(apply_aniso_offdiag_current_ez, "apply_aniso_offdiag_current_ez(Tensor(a!) ez, Tensor jx, Tensor jy, Tensor coeff_x, Tensor coeff_y, int periodic_x, int periodic_y, int periodic_z) -> ()", apply_aniso_offdiag_current_ez_cuda) \
1964
+ _(add_source_patch, "add_source_patch(Tensor(a!) field, Tensor patch, int offset_i, int offset_j, int offset_k, float signal) -> ()", add_source_patch_cuda) \
1965
+ _(add_cw_phased_source_patch, "add_cw_phased_source_patch(Tensor(a!) field, Tensor patch_cos, Tensor patch_sin, int offset_i, int offset_j, int offset_k, float signal_cos, float signal_sin) -> ()", add_cw_phased_source_patch_cuda) \
1966
+ _(add_time_shifted_source_patch, "add_time_shifted_source_patch(Tensor(a!) field, Tensor patch, Tensor delay_patch, Tensor activation_delay_patch, int offset_i, int offset_j, int offset_k, int time_kind, float time, float frequency, float fwidth, float amplitude, float phase, float delay, int causal_gate) -> ()", add_time_shifted_source_patch_cuda) \
1967
+ _(add_source_patch_bloch, "add_source_patch_bloch(Tensor(a!) ex_real, Tensor(b!) ex_imag, Tensor(c!) ey_real, Tensor(d!) ey_imag, Tensor(e!) ez_real, Tensor(f!) ez_imag, Tensor patch, int offset_i, int offset_j, int offset_k, float signal_real, float signal_imag, int axis_code, float phase_cos_a, float phase_sin_a, float phase_cos_b, float phase_sin_b, int wrap_axis_a, int wrap_axis_b) -> ()", add_source_patch_bloch_cuda) \
1968
+ _(add_scaled_slice_source_patch, "add_scaled_slice_source_patch(Tensor(a!) field, Tensor patch, Tensor incident, int sample_index, int offset_i, int offset_j, int offset_k, float scale) -> ()", add_scaled_slice_source_patch_cuda) \
1969
+ _(add_scaled_line_source_patch, "add_scaled_line_source_patch(Tensor(a!) field, Tensor patch, Tensor incident, Tensor sample_indices, int sample_axis, int offset_i, int offset_j, int offset_k, float scale) -> ()", add_scaled_line_source_patch_cuda) \
1970
+ _(add_interpolated_source_patch, "add_interpolated_source_patch(Tensor(a!) field, Tensor patch, Tensor incident, Tensor sample_positions, float origin, float ds, int offset_i, int offset_j, int offset_k, float scale) -> ()", add_interpolated_source_patch_cuda) \
1971
+ _(add_batched_reference_source_patches, "add_batched_reference_source_patches(Tensor(a!) field_x, Tensor(b!) field_y, Tensor(c!) field_z, Tensor coeff_data, Tensor incident, Tensor field_codes_per_coeff, Tensor field_offsets, Tensor sample_indices_per_coeff) -> ()", add_batched_reference_source_patches_cuda) \
1972
+ _(add_batched_interpolated_source_patches, "add_batched_interpolated_source_patches(Tensor(a!) field_x, Tensor(b!) field_y, Tensor(c!) field_z, Tensor coeff_data, Tensor incident, Tensor sample_positions, Tensor field_codes_per_coeff, Tensor field_offsets, float origin, float ds) -> ()", add_batched_interpolated_source_patches_cuda) \
1973
+ _(update_auxiliary_magnetic, "update_auxiliary_magnetic(Tensor(a!) magnetic, Tensor electric, Tensor decay, Tensor curl) -> ()", update_auxiliary_magnetic_cuda) \
1974
+ _(update_auxiliary_electric, "update_auxiliary_electric(Tensor(a!) electric, Tensor magnetic, Tensor decay, Tensor curl, int source_index, float source_value) -> ()", update_auxiliary_electric_cuda) \
1975
+ _(reverse_magnetic_adjoint_decay, "reverse_magnetic_adjoint_decay(Tensor(a!) adj_prev, Tensor adj_mid, Tensor decay) -> ()", reverse_magnetic_adjoint_decay_cuda) \
1976
+ _(reverse_electric_adjoint_to_hx_standard, "reverse_electric_adjoint_to_hx_standard(Tensor(a!) adj_hx_mid, Tensor adj_hx_post, Tensor adj_ey_post, Tensor adj_ez_post, Tensor ey_curl, Tensor ez_curl, Tensor inv_dy, Tensor inv_dz) -> ()", reverse_electric_adjoint_to_hx_standard_cuda) \
1977
+ _(reverse_electric_adjoint_to_hy_standard, "reverse_electric_adjoint_to_hy_standard(Tensor(a!) adj_hy_mid, Tensor adj_hy_post, Tensor adj_ex_post, Tensor adj_ez_post, Tensor ex_curl, Tensor ez_curl, Tensor inv_dx, Tensor inv_dz) -> ()", reverse_electric_adjoint_to_hy_standard_cuda) \
1978
+ _(reverse_electric_adjoint_to_hz_standard, "reverse_electric_adjoint_to_hz_standard(Tensor(a!) adj_hz_mid, Tensor adj_hz_post, Tensor adj_ex_post, Tensor adj_ey_post, Tensor ex_curl, Tensor ey_curl, Tensor inv_dx, Tensor inv_dy) -> ()", reverse_electric_adjoint_to_hz_standard_cuda) \
1979
+ _(reverse_magnetic_adjoint_to_ex_standard, "reverse_magnetic_adjoint_to_ex_standard(Tensor(a!) adj_ex_prev, Tensor(b!) grad_eps_ex, Tensor adj_ex_post, Tensor adj_hy_mid, Tensor adj_hz_mid, Tensor ex_decay, Tensor ex_curl, Tensor eps_ex, Tensor hy_mid, Tensor hz_mid, Tensor hy_curl, Tensor hz_curl, Tensor inv_dy_e, Tensor inv_dz_e, Tensor inv_dy_h, Tensor inv_dz_h, int y_low_mode, int y_high_mode, int z_low_mode, int z_high_mode) -> ()", reverse_magnetic_adjoint_to_ex_standard_cuda) \
1980
+ _(reverse_magnetic_adjoint_to_ey_standard, "reverse_magnetic_adjoint_to_ey_standard(Tensor(a!) adj_ey_prev, Tensor(b!) grad_eps_ey, Tensor adj_ey_post, Tensor adj_hx_mid, Tensor adj_hz_mid, Tensor ey_decay, Tensor ey_curl, Tensor eps_ey, Tensor hx_mid, Tensor hz_mid, Tensor hx_curl, Tensor hz_curl, Tensor inv_dx_e, Tensor inv_dz_e, Tensor inv_dx_h, Tensor inv_dz_h, int x_low_mode, int x_high_mode, int z_low_mode, int z_high_mode) -> ()", reverse_magnetic_adjoint_to_ey_standard_cuda) \
1981
+ _(reverse_magnetic_adjoint_to_ez_standard, "reverse_magnetic_adjoint_to_ez_standard(Tensor(a!) adj_ez_prev, Tensor(b!) grad_eps_ez, Tensor adj_ez_post, Tensor adj_hx_mid, Tensor adj_hy_mid, Tensor ez_decay, Tensor ez_curl, Tensor eps_ez, Tensor hx_mid, Tensor hy_mid, Tensor hx_curl, Tensor hy_curl, Tensor inv_dx_e, Tensor inv_dy_e, Tensor inv_dx_h, Tensor inv_dy_h, int x_low_mode, int x_high_mode, int y_low_mode, int y_high_mode) -> ()", reverse_magnetic_adjoint_to_ez_standard_cuda) \
1982
+ _(reverse_electric_adjoint_to_hx_bloch, "reverse_electric_adjoint_to_hx_bloch(Tensor(a!) adj_hx_mid_real, Tensor(b!) adj_hx_mid_imag, Tensor adj_hx_post_real, Tensor adj_hx_post_imag, Tensor adj_ey_post_real, Tensor adj_ey_post_imag, Tensor adj_ez_post_real, Tensor adj_ez_post_imag, Tensor ey_curl, Tensor ez_curl, float phase_cos_y, float phase_sin_y, float phase_cos_z, float phase_sin_z, Tensor inv_dy, Tensor inv_dz) -> ()", reverse_electric_adjoint_to_hx_bloch_cuda) \
1983
+ _(reverse_electric_adjoint_to_hy_bloch, "reverse_electric_adjoint_to_hy_bloch(Tensor(a!) adj_hy_mid_real, Tensor(b!) adj_hy_mid_imag, Tensor adj_hy_post_real, Tensor adj_hy_post_imag, Tensor adj_ex_post_real, Tensor adj_ex_post_imag, Tensor adj_ez_post_real, Tensor adj_ez_post_imag, Tensor ex_curl, Tensor ez_curl, float phase_cos_x, float phase_sin_x, float phase_cos_z, float phase_sin_z, Tensor inv_dx, Tensor inv_dz) -> ()", reverse_electric_adjoint_to_hy_bloch_cuda) \
1984
+ _(reverse_electric_adjoint_to_hz_bloch, "reverse_electric_adjoint_to_hz_bloch(Tensor(a!) adj_hz_mid_real, Tensor(b!) adj_hz_mid_imag, Tensor adj_hz_post_real, Tensor adj_hz_post_imag, Tensor adj_ex_post_real, Tensor adj_ex_post_imag, Tensor adj_ey_post_real, Tensor adj_ey_post_imag, Tensor ex_curl, Tensor ey_curl, float phase_cos_x, float phase_sin_x, float phase_cos_y, float phase_sin_y, Tensor inv_dx, Tensor inv_dy) -> ()", reverse_electric_adjoint_to_hz_bloch_cuda) \
1985
+ _(reverse_magnetic_adjoint_to_ex_bloch, "reverse_magnetic_adjoint_to_ex_bloch(Tensor(a!) adj_ex_prev_real, Tensor(b!) adj_ex_prev_imag, Tensor(c!) grad_eps_ex, Tensor adj_ex_post_real, Tensor adj_ex_post_imag, Tensor adj_hy_mid_real, Tensor adj_hy_mid_imag, Tensor adj_hz_mid_real, Tensor adj_hz_mid_imag, Tensor ex_decay, Tensor ex_curl, Tensor eps_ex, Tensor hy_mid_real, Tensor hy_mid_imag, Tensor hz_mid_real, Tensor hz_mid_imag, Tensor hy_curl, Tensor hz_curl, float phase_cos_y, float phase_sin_y, float phase_cos_z, float phase_sin_z, Tensor inv_dy_e, Tensor inv_dz_e, Tensor inv_dy_h, Tensor inv_dz_h) -> ()", reverse_magnetic_adjoint_to_ex_bloch_cuda) \
1986
+ _(reverse_magnetic_adjoint_to_ey_bloch, "reverse_magnetic_adjoint_to_ey_bloch(Tensor(a!) adj_ey_prev_real, Tensor(b!) adj_ey_prev_imag, Tensor(c!) grad_eps_ey, Tensor adj_ey_post_real, Tensor adj_ey_post_imag, Tensor adj_hx_mid_real, Tensor adj_hx_mid_imag, Tensor adj_hz_mid_real, Tensor adj_hz_mid_imag, Tensor ey_decay, Tensor ey_curl, Tensor eps_ey, Tensor hx_mid_real, Tensor hx_mid_imag, Tensor hz_mid_real, Tensor hz_mid_imag, Tensor hx_curl, Tensor hz_curl, float phase_cos_x, float phase_sin_x, float phase_cos_z, float phase_sin_z, Tensor inv_dx_e, Tensor inv_dz_e, Tensor inv_dx_h, Tensor inv_dz_h) -> ()", reverse_magnetic_adjoint_to_ey_bloch_cuda) \
1987
+ _(reverse_magnetic_adjoint_to_ez_bloch, "reverse_magnetic_adjoint_to_ez_bloch(Tensor(a!) adj_ez_prev_real, Tensor(b!) adj_ez_prev_imag, Tensor(c!) grad_eps_ez, Tensor adj_ez_post_real, Tensor adj_ez_post_imag, Tensor adj_hx_mid_real, Tensor adj_hx_mid_imag, Tensor adj_hy_mid_real, Tensor adj_hy_mid_imag, Tensor ez_decay, Tensor ez_curl, Tensor eps_ez, Tensor hx_mid_real, Tensor hx_mid_imag, Tensor hy_mid_real, Tensor hy_mid_imag, Tensor hx_curl, Tensor hy_curl, float phase_cos_x, float phase_sin_x, float phase_cos_y, float phase_sin_y, Tensor inv_dx_e, Tensor inv_dy_e, Tensor inv_dx_h, Tensor inv_dy_h) -> ()", reverse_magnetic_adjoint_to_ez_bloch_cuda) \
1988
+ _(accumulate_forward_diff_adjoint, "accumulate_forward_diff_adjoint(Tensor(a!) field_grad, Tensor diff_grad, int axis, Tensor inv_delta) -> ()", accumulate_forward_diff_adjoint_cuda) \
1989
+ _(accumulate_backward_diff_adjoint, "accumulate_backward_diff_adjoint(Tensor(a!) field_grad, Tensor diff_grad, int axis, Tensor inv_delta) -> ()", accumulate_backward_diff_adjoint_cuda) \
1990
+ _(seed_inject_dense, "seed_inject_dense(Tensor(a!) adj_field, Tensor grad_real, Tensor grad_imag, Tensor cos_pack, Tensor sin_pack, int step) -> ()", seed_inject_dense_cuda) \
1991
+ _(seed_inject_point, "seed_inject_point(Tensor(a!) adj_field, Tensor grad_real, Tensor grad_imag, Tensor point_i, Tensor point_j, Tensor point_k, Tensor cos_pack, Tensor sin_pack, int step) -> ()", seed_inject_point_cuda) \
1992
+ _(seed_inject_plane, "seed_inject_plane(Tensor(a!) adj_field, Tensor grad_real, Tensor grad_imag, Tensor cos_pack, Tensor sin_pack, int axis, int plane_index, int step) -> ()", seed_inject_plane_cuda) \
1993
+ _(accumulate_in_place, "accumulate_in_place(Tensor(a!) dst, Tensor src) -> ()", accumulate_in_place_cuda) \
1994
+ _(reverse_electric_component_ex_cpml, "reverse_electric_component_ex_cpml(Tensor(a!) adj_prev, Tensor(b!) grad_eps, Tensor(c!) adj_psi_pos_prev, Tensor(d!) adj_psi_neg_prev, Tensor(e!) adj_d_pos, Tensor(f!) adj_d_neg, Tensor adj_post, Tensor adj_psi_pos_post, Tensor adj_psi_neg_post, Tensor decay, Tensor curl, Tensor eps, Tensor psi_pos, Tensor psi_neg, Tensor b_pos, Tensor c_pos, Tensor inv_kappa_pos, Tensor b_neg, Tensor c_neg, Tensor inv_kappa_neg, Tensor hy_mid, Tensor hz_mid, Tensor inv_dy, Tensor inv_dz, int y_low_mode, int y_high_mode, int z_low_mode, int z_high_mode) -> ()", reverse_electric_component_ex_cpml_cuda) \
1995
+ _(reverse_electric_component_ey_cpml, "reverse_electric_component_ey_cpml(Tensor(a!) adj_prev, Tensor(b!) grad_eps, Tensor(c!) adj_psi_pos_prev, Tensor(d!) adj_psi_neg_prev, Tensor(e!) adj_d_pos, Tensor(f!) adj_d_neg, Tensor adj_post, Tensor adj_psi_pos_post, Tensor adj_psi_neg_post, Tensor decay, Tensor curl, Tensor eps, Tensor psi_pos, Tensor psi_neg, Tensor b_pos, Tensor c_pos, Tensor inv_kappa_pos, Tensor b_neg, Tensor c_neg, Tensor inv_kappa_neg, Tensor hx_mid, Tensor hz_mid, Tensor inv_dx, Tensor inv_dz, int x_low_mode, int x_high_mode, int z_low_mode, int z_high_mode) -> ()", reverse_electric_component_ey_cpml_cuda) \
1996
+ _(reverse_electric_component_ez_cpml, "reverse_electric_component_ez_cpml(Tensor(a!) adj_prev, Tensor(b!) grad_eps, Tensor(c!) adj_psi_pos_prev, Tensor(d!) adj_psi_neg_prev, Tensor(e!) adj_d_pos, Tensor(f!) adj_d_neg, Tensor adj_post, Tensor adj_psi_pos_post, Tensor adj_psi_neg_post, Tensor decay, Tensor curl, Tensor eps, Tensor psi_pos, Tensor psi_neg, Tensor b_pos, Tensor c_pos, Tensor inv_kappa_pos, Tensor b_neg, Tensor c_neg, Tensor inv_kappa_neg, Tensor hx_mid, Tensor hy_mid, Tensor inv_dx, Tensor inv_dy, int x_low_mode, int x_high_mode, int y_low_mode, int y_high_mode) -> ()", reverse_electric_component_ez_cpml_cuda) \
1997
+ _(reverse_electric_component_ex_cpml_conductive, "reverse_electric_component_ex_cpml_conductive(Tensor(a!) adj_prev, Tensor(b!) grad_eps, Tensor(c!) adj_psi_pos_prev, Tensor(d!) adj_psi_neg_prev, Tensor(e!) adj_d_pos, Tensor(f!) adj_d_neg, Tensor adj_post, Tensor adj_psi_pos_post, Tensor adj_psi_neg_post, Tensor decay, Tensor curl, Tensor half, Tensor e_prev, Tensor eps, float dt, Tensor psi_pos, Tensor psi_neg, Tensor b_pos, Tensor c_pos, Tensor inv_kappa_pos, Tensor b_neg, Tensor c_neg, Tensor inv_kappa_neg, Tensor hy_mid, Tensor hz_mid, Tensor inv_dy, Tensor inv_dz, int y_low_mode, int y_high_mode, int z_low_mode, int z_high_mode) -> ()", reverse_electric_component_ex_cpml_conductive_cuda) \
1998
+ _(reverse_electric_component_ey_cpml_conductive, "reverse_electric_component_ey_cpml_conductive(Tensor(a!) adj_prev, Tensor(b!) grad_eps, Tensor(c!) adj_psi_pos_prev, Tensor(d!) adj_psi_neg_prev, Tensor(e!) adj_d_pos, Tensor(f!) adj_d_neg, Tensor adj_post, Tensor adj_psi_pos_post, Tensor adj_psi_neg_post, Tensor decay, Tensor curl, Tensor half, Tensor e_prev, Tensor eps, float dt, Tensor psi_pos, Tensor psi_neg, Tensor b_pos, Tensor c_pos, Tensor inv_kappa_pos, Tensor b_neg, Tensor c_neg, Tensor inv_kappa_neg, Tensor hx_mid, Tensor hz_mid, Tensor inv_dx, Tensor inv_dz, int x_low_mode, int x_high_mode, int z_low_mode, int z_high_mode) -> ()", reverse_electric_component_ey_cpml_conductive_cuda) \
1999
+ _(reverse_electric_component_ez_cpml_conductive, "reverse_electric_component_ez_cpml_conductive(Tensor(a!) adj_prev, Tensor(b!) grad_eps, Tensor(c!) adj_psi_pos_prev, Tensor(d!) adj_psi_neg_prev, Tensor(e!) adj_d_pos, Tensor(f!) adj_d_neg, Tensor adj_post, Tensor adj_psi_pos_post, Tensor adj_psi_neg_post, Tensor decay, Tensor curl, Tensor half, Tensor e_prev, Tensor eps, float dt, Tensor psi_pos, Tensor psi_neg, Tensor b_pos, Tensor c_pos, Tensor inv_kappa_pos, Tensor b_neg, Tensor c_neg, Tensor inv_kappa_neg, Tensor hx_mid, Tensor hy_mid, Tensor inv_dx, Tensor inv_dy, int x_low_mode, int x_high_mode, int y_low_mode, int y_high_mode) -> ()", reverse_electric_component_ez_cpml_conductive_cuda) \
2000
+ _(collocation_transpose, "collocation_transpose(Tensor(a!) adj_ex, Tensor(b!) adj_ey, Tensor(c!) adj_ez, Tensor g_ex, Tensor g_ey, Tensor g_ez, Tensor ex, Tensor ey, Tensor ez) -> ()", collocation_transpose_cuda) \
2001
+ _(collocate_field_square, "collocate_field_square(Tensor(a!) fsq_ex, Tensor(b!) fsq_ey, Tensor(c!) fsq_ez, Tensor ex, Tensor ey, Tensor ez) -> ()", collocate_field_square_cuda) \
2002
+ _(full_aniso_curl_adjoint, "full_aniso_curl_adjoint(Tensor(a!) adj_curl_x, Tensor(b!) adj_curl_y, Tensor(c!) adj_curl_z, Tensor adj_ex, Tensor adj_ey, Tensor adj_ez, Tensor coeff_ex_y, Tensor coeff_ex_z, Tensor coeff_ey_x, Tensor coeff_ey_z, Tensor coeff_ez_x, Tensor coeff_ez_y) -> ()", full_aniso_curl_adjoint_cuda) \
2003
+ _(reverse_electric_component_ex_cpml_kerr, "reverse_electric_component_ex_cpml_kerr(Tensor(a!) adj_prev, Tensor(b!) grad_eps, Tensor(c!) grad_chi3, Tensor(d!) g_fsq, Tensor(e!) adj_psi_pos_prev, Tensor(f!) adj_psi_neg_prev, Tensor(g!) adj_d_pos, Tensor(h!) adj_d_neg, Tensor adj_post, Tensor adj_psi_pos_post, Tensor adj_psi_neg_post, Tensor decay, Tensor eps, Tensor chi3, Tensor fsq, float dt, float eps0, Tensor psi_pos, Tensor psi_neg, Tensor b_pos, Tensor c_pos, Tensor inv_kappa_pos, Tensor b_neg, Tensor c_neg, Tensor inv_kappa_neg, Tensor hy_mid, Tensor hz_mid, Tensor inv_dy, Tensor inv_dz, int y_low_mode, int y_high_mode, int z_low_mode, int z_high_mode) -> ()", reverse_electric_component_ex_cpml_kerr_cuda) \
2004
+ _(reverse_electric_component_ey_cpml_kerr, "reverse_electric_component_ey_cpml_kerr(Tensor(a!) adj_prev, Tensor(b!) grad_eps, Tensor(c!) grad_chi3, Tensor(d!) g_fsq, Tensor(e!) adj_psi_pos_prev, Tensor(f!) adj_psi_neg_prev, Tensor(g!) adj_d_pos, Tensor(h!) adj_d_neg, Tensor adj_post, Tensor adj_psi_pos_post, Tensor adj_psi_neg_post, Tensor decay, Tensor eps, Tensor chi3, Tensor fsq, float dt, float eps0, Tensor psi_pos, Tensor psi_neg, Tensor b_pos, Tensor c_pos, Tensor inv_kappa_pos, Tensor b_neg, Tensor c_neg, Tensor inv_kappa_neg, Tensor hx_mid, Tensor hz_mid, Tensor inv_dx, Tensor inv_dz, int x_low_mode, int x_high_mode, int z_low_mode, int z_high_mode) -> ()", reverse_electric_component_ey_cpml_kerr_cuda) \
2005
+ _(reverse_electric_component_ez_cpml_kerr, "reverse_electric_component_ez_cpml_kerr(Tensor(a!) adj_prev, Tensor(b!) grad_eps, Tensor(c!) grad_chi3, Tensor(d!) g_fsq, Tensor(e!) adj_psi_pos_prev, Tensor(f!) adj_psi_neg_prev, Tensor(g!) adj_d_pos, Tensor(h!) adj_d_neg, Tensor adj_post, Tensor adj_psi_pos_post, Tensor adj_psi_neg_post, Tensor decay, Tensor eps, Tensor chi3, Tensor fsq, float dt, float eps0, Tensor psi_pos, Tensor psi_neg, Tensor b_pos, Tensor c_pos, Tensor inv_kappa_pos, Tensor b_neg, Tensor c_neg, Tensor inv_kappa_neg, Tensor hx_mid, Tensor hy_mid, Tensor inv_dx, Tensor inv_dy, int x_low_mode, int x_high_mode, int y_low_mode, int y_high_mode) -> ()", reverse_electric_component_ez_cpml_kerr_cuda) \
2006
+ _(reverse_electric_component_cpml_nonlinear, "reverse_electric_component_cpml_nonlinear(int component, Tensor(a!) adj_prev, Tensor(b!) grad_eps, Tensor(c!) grad_chi2, Tensor(d!) grad_chi3, Tensor(e!) grad_tpa, Tensor(f!) g_fsq, Tensor(g!) adj_psi_pos_prev, Tensor(h!) adj_psi_neg_prev, Tensor(i!) adj_d_pos, Tensor(j!) adj_d_neg, Tensor adj_post, Tensor adj_psi_pos_post, Tensor adj_psi_neg_post, Tensor e_prev, Tensor external_decay, Tensor eps, Tensor chi2, Tensor chi3, Tensor tpa, Tensor sigma_static, Tensor fsq, float dt, float eps0, Tensor psi_pos, Tensor psi_neg, Tensor b_pos, Tensor c_pos, Tensor inv_kappa_pos, Tensor b_neg, Tensor c_neg, Tensor inv_kappa_neg, Tensor h_pos_mid, Tensor h_neg_mid, Tensor inv_pos, Tensor inv_neg, int low_mode_a, int high_mode_a, int low_mode_b, int high_mode_b) -> ()", reverse_electric_component_cpml_nonlinear_cuda) \
2007
+ _(reverse_cpml_correction, "reverse_cpml_correction(Tensor(a!) adj_psi_prev, Tensor(b!) adj_derivative, Tensor adj_field, Tensor adj_psi_post, Tensor curl, Tensor b, Tensor c, Tensor inv_kappa, int normal_axis, int tangent_axis, int tangent_low_mode, int tangent_high_mode, float sign) -> ()", reverse_cpml_correction_cuda) \
2008
+ _(reverse_magnetic_component_hx_cpml, "reverse_magnetic_component_hx_cpml(Tensor(a!) adj_prev, Tensor(b!) adj_psi_pos_prev, Tensor(c!) adj_psi_neg_prev, Tensor(d!) adj_d_pos, Tensor(e!) adj_d_neg, Tensor adj_post, Tensor adj_psi_pos_post, Tensor adj_psi_neg_post, Tensor decay, Tensor curl, Tensor b_pos, Tensor c_pos, Tensor inv_kappa_pos, Tensor b_neg, Tensor c_neg, Tensor inv_kappa_neg) -> ()", reverse_magnetic_component_hx_cpml_cuda) \
2009
+ _(reverse_magnetic_component_hy_cpml, "reverse_magnetic_component_hy_cpml(Tensor(a!) adj_prev, Tensor(b!) adj_psi_pos_prev, Tensor(c!) adj_psi_neg_prev, Tensor(d!) adj_d_pos, Tensor(e!) adj_d_neg, Tensor adj_post, Tensor adj_psi_pos_post, Tensor adj_psi_neg_post, Tensor decay, Tensor curl, Tensor b_pos, Tensor c_pos, Tensor inv_kappa_pos, Tensor b_neg, Tensor c_neg, Tensor inv_kappa_neg) -> ()", reverse_magnetic_component_hy_cpml_cuda) \
2010
+ _(reverse_magnetic_component_hz_cpml, "reverse_magnetic_component_hz_cpml(Tensor(a!) adj_prev, Tensor(b!) adj_psi_pos_prev, Tensor(c!) adj_psi_neg_prev, Tensor(d!) adj_d_pos, Tensor(e!) adj_d_neg, Tensor adj_post, Tensor adj_psi_pos_post, Tensor adj_psi_neg_post, Tensor decay, Tensor curl, Tensor b_pos, Tensor c_pos, Tensor inv_kappa_pos, Tensor b_neg, Tensor c_neg, Tensor inv_kappa_neg) -> ()", reverse_magnetic_component_hz_cpml_cuda) \
2011
+ _(reverse_debye_current, "reverse_debye_current(Tensor(a!) adj_electric_prev, Tensor(b!) adj_polarization_prev, Tensor adj_polarization_post, Tensor adj_current_post, Tensor drive, float decay, float dt) -> ()", reverse_debye_current_cuda) \
2012
+ _(reverse_drude_current, "reverse_drude_current(Tensor(a!) adj_electric_prev, Tensor(b!) adj_current_prev, Tensor adj_current_post, Tensor drive, float decay) -> ()", reverse_drude_current_cuda) \
2013
+ _(reverse_lorentz_current, "reverse_lorentz_current(Tensor(a!) adj_electric_prev, Tensor(b!) adj_polarization_prev, Tensor(c!) adj_current_prev, Tensor adj_polarization_post, Tensor adj_current_post, Tensor drive, float decay, float restoring, float dt) -> ()", reverse_lorentz_current_cuda) \
2014
+ _(reverse_dispersive_correction, "reverse_dispersive_correction(Tensor(a!) adj_current_corrected, Tensor(b!) grad_eps, Tensor adj_current_post, Tensor adj_electric_post, Tensor current, Tensor eps, float dt) -> ()", reverse_dispersive_correction_cuda) \
2015
+ _(accumulate_tfsf_scalar_sample_adjoint, "accumulate_tfsf_scalar_sample_adjoint(Tensor(a!) adj_aux_field, Tensor adj_field_patch, Tensor coeff_patch, int sample_index, float component_scale) -> ()", accumulate_tfsf_scalar_sample_adjoint_cuda) \
2016
+ _(accumulate_tfsf_line_sample_adjoint, "accumulate_tfsf_line_sample_adjoint(Tensor(a!) adj_aux_field, Tensor adj_field_patch, Tensor coeff_patch, Tensor sample_indices, int sample_axis_code, float component_scale) -> ()", accumulate_tfsf_line_sample_adjoint_cuda) \
2017
+ _(accumulate_tfsf_interpolated_sample_adjoint, "accumulate_tfsf_interpolated_sample_adjoint(Tensor(a!) adj_aux_field, Tensor adj_field_patch, Tensor coeff_patch, Tensor sample_positions, float origin, float ds, float component_scale) -> ()", accumulate_tfsf_interpolated_sample_adjoint_cuda) \
2018
+ _(reverse_tfsf_auxiliary_electric, "reverse_tfsf_auxiliary_electric(Tensor(a!) adj_electric_prev, Tensor(b!) adj_magnetic_after, Tensor adj_electric_post, Tensor electric_decay, Tensor electric_curl, int source_index) -> ()", reverse_tfsf_auxiliary_electric_cuda) \
2019
+ _(reverse_tfsf_auxiliary_magnetic, "reverse_tfsf_auxiliary_magnetic(Tensor(a!) adj_electric_prev, Tensor(b!) adj_magnetic_prev, Tensor adj_magnetic_after, Tensor magnetic_decay, Tensor magnetic_curl) -> ()", reverse_tfsf_auxiliary_magnetic_cuda) \
2020
+ _(clamp_field_face, "clamp_field_face(Tensor(a!) field, int axis, int side) -> ()", clamp_field_face_cuda) \
2021
+ _(clamp_pec_boundary, "clamp_pec_boundary(Tensor(a!) field, int axis_a, int axis_b) -> ()", clamp_pec_boundary_cuda) \
2022
+ _(mur_abc_face, "mur_abc_face(Tensor(a!) field, int axis, int boundary_index, int adjacent_index, float coef, Tensor(b!) prev_boundary, Tensor(c!) prev_adjacent) -> ()", mur_abc_face_cuda) \
2023
+ _(apply_sibc_surface, "apply_sibc_surface(Tensor(a!) electric, Tensor magnetic, int axis, int electric_index, int magnetic_index, float sign, float surface_r, float surface_l_over_dt, Tensor(b!) h_prev) -> ()", apply_sibc_surface_cuda) \
2024
+ _(project_periodic_boundary, "project_periodic_boundary(Tensor(a!) field, int axis) -> ()", project_periodic_boundary_cuda) \
2025
+ _(project_bloch_boundary, "project_bloch_boundary(Tensor(a!) field_real, Tensor(b!) field_imag, int axis, float phase_cos, float phase_sin) -> ()", project_bloch_boundary_cuda) \
2026
+ _(update_electric_ex_bloch_y_standard_z, "update_electric_ex_bloch_y_standard_z(Tensor(a!) ex_real, Tensor(b!) ex_imag, Tensor hy_real, Tensor hy_imag, Tensor hz_real, Tensor hz_imag, Tensor decay, Tensor curl, float phase_cos_y, float phase_sin_y, Tensor inv_dy, Tensor inv_dz, int z_low_mode, int z_high_mode) -> ()", update_electric_ex_bloch_y_standard_z_cuda) \
2027
+ _(update_electric_ey_bloch_x_standard_z, "update_electric_ey_bloch_x_standard_z(Tensor(a!) ey_real, Tensor(b!) ey_imag, Tensor hx_real, Tensor hx_imag, Tensor hz_real, Tensor hz_imag, Tensor decay, Tensor curl, float phase_cos_x, float phase_sin_x, Tensor inv_dx, Tensor inv_dz, int z_low_mode, int z_high_mode) -> ()", update_electric_ey_bloch_x_standard_z_cuda) \
2028
+ _(apply_electric_ex_cpml_z_correction, "apply_electric_ex_cpml_z_correction(Tensor(a!) ex, Tensor hy, Tensor curl, Tensor(b!) psi_z, Tensor inv_kappa_z, Tensor b_z, Tensor c_z, Tensor inv_dz, int offset_i, int offset_j, int offset_k, int y_low_mode, int y_high_mode, int full_size_y, int full_size_z) -> ()", apply_electric_ex_cpml_z_correction_cuda) \
2029
+ _(apply_electric_ey_cpml_z_correction, "apply_electric_ey_cpml_z_correction(Tensor(a!) ey, Tensor hx, Tensor curl, Tensor(b!) psi_z, Tensor inv_kappa_z, Tensor b_z, Tensor c_z, Tensor inv_dz, int offset_i, int offset_j, int offset_k, int x_low_mode, int x_high_mode, int full_size_x, int full_size_z) -> ()", apply_electric_ey_cpml_z_correction_cuda) \
2030
+ _(apply_electric_ex_cpml_y_correction, "apply_electric_ex_cpml_y_correction(Tensor(a!) ex, Tensor hz, Tensor curl, Tensor(b!) psi_y, Tensor inv_kappa_y, Tensor b_y, Tensor c_y, Tensor inv_dy, int offset_i, int offset_j, int offset_k, int z_low_mode, int z_high_mode, int full_size_z, int full_size_y) -> ()", apply_electric_ex_cpml_y_correction_cuda) \
2031
+ _(apply_electric_ez_cpml_y_correction, "apply_electric_ez_cpml_y_correction(Tensor(a!) ez, Tensor hx, Tensor curl, Tensor(b!) psi_y, Tensor inv_kappa_y, Tensor b_y, Tensor c_y, Tensor inv_dy, int offset_i, int offset_j, int offset_k, int x_low_mode, int x_high_mode, int full_size_x, int full_size_y) -> ()", apply_electric_ez_cpml_y_correction_cuda) \
2032
+ _(apply_electric_ey_cpml_x_correction, "apply_electric_ey_cpml_x_correction(Tensor(a!) ey, Tensor hz, Tensor curl, Tensor(b!) psi_x, Tensor inv_kappa_x, Tensor b_x, Tensor c_x, Tensor inv_dx, int offset_i, int offset_j, int offset_k, int z_low_mode, int z_high_mode, int full_size_z, int full_size_x) -> ()", apply_electric_ey_cpml_x_correction_cuda) \
2033
+ _(apply_electric_ez_cpml_x_correction, "apply_electric_ez_cpml_x_correction(Tensor(a!) ez, Tensor hy, Tensor curl, Tensor(b!) psi_x, Tensor inv_kappa_x, Tensor b_x, Tensor c_x, Tensor inv_dx, int offset_i, int offset_j, int offset_k, int y_low_mode, int y_high_mode, int full_size_y, int full_size_x) -> ()", apply_electric_ez_cpml_x_correction_cuda) \
2034
+ _(add_source_patch_ex_periodic, "add_source_patch_ex_periodic(Tensor(a!) field, Tensor patch, int offset_i, int offset_j, int offset_k, float signal, int wrap_a, int wrap_b) -> ()", add_source_patch_ex_periodic_cuda) \
2035
+ _(add_source_patch_ey_periodic, "add_source_patch_ey_periodic(Tensor(a!) field, Tensor patch, int offset_i, int offset_j, int offset_k, float signal, int wrap_a, int wrap_b) -> ()", add_source_patch_ey_periodic_cuda) \
2036
+ _(add_source_patch_ez_periodic, "add_source_patch_ez_periodic(Tensor(a!) field, Tensor patch, int offset_i, int offset_j, int offset_k, float signal, int wrap_a, int wrap_b) -> ()", add_source_patch_ez_periodic_cuda)
2037
+
2038
+ STABLE_TORCH_LIBRARY(witwin_maxwell_fdtd_cuda, m) {
2039
+ m.def("synchronize_noop() -> ()");
2040
+ m.def("debug_linear_indices(int size_x, int size_y, int size_z) -> (Tensor, Tensor, Tensor, Tensor)");
2041
+ #define WITWIN_DEFINE_CUDA_OP(name, schema, impl) m.def(schema);
2042
+ WITWIN_CUDA_OPS(WITWIN_DEFINE_CUDA_OP)
2043
+ #undef WITWIN_DEFINE_CUDA_OP
2044
+ }
2045
+ STABLE_TORCH_LIBRARY_IMPL(witwin_maxwell_fdtd_cuda, CUDA, m) {
2046
+ #define WITWIN_IMPL_CUDA_OP(name, schema, fn) m.impl(#name, TORCH_BOX(&fn));
2047
+ WITWIN_CUDA_OPS(WITWIN_IMPL_CUDA_OP)
2048
+ #undef WITWIN_IMPL_CUDA_OP
2049
+ }
2050
+ STABLE_TORCH_LIBRARY_IMPL(witwin_maxwell_fdtd_cuda, CompositeExplicitAutograd, m) {
2051
+ m.impl("synchronize_noop", TORCH_BOX(&synchronize_noop_cuda));
2052
+ m.impl("debug_linear_indices", TORCH_BOX(&debug_linear_indices_cuda));
2053
+ }