你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-07 15:10:13 +08:00
Remove shifting of zero frequency component
- Rather than directly shifting the zero frequency component of the fft, generate_fractal3D shifts the positional vector of each index as if the zero frequency had been shifted to the centre - Changing generate_fractal3D to do this will make the MPI implementation easier
这个提交包含在:
@@ -72,6 +72,7 @@ cpdef void generate_fractal3D(
|
|||||||
int nz,
|
int nz,
|
||||||
int nthreads,
|
int nthreads,
|
||||||
float D,
|
float D,
|
||||||
|
np.int32_t[:] global_size,
|
||||||
np.float64_t[:] weighting,
|
np.float64_t[:] weighting,
|
||||||
np.float64_t[:] v1,
|
np.float64_t[:] v1,
|
||||||
np.complex128_t[:, :, ::1] A,
|
np.complex128_t[:, :, ::1] A,
|
||||||
@@ -94,14 +95,19 @@ cpdef void generate_fractal3D(
|
|||||||
|
|
||||||
cdef Py_ssize_t i, j, k
|
cdef Py_ssize_t i, j, k
|
||||||
cdef double v2x, v2y, v2z, rr, B
|
cdef double v2x, v2y, v2z, rr, B
|
||||||
|
cdef int sx, sy, sz
|
||||||
|
|
||||||
|
sx = global_size[0] // 2
|
||||||
|
sy = global_size[1] // 2
|
||||||
|
sz = global_size[2] // 2
|
||||||
|
|
||||||
for i in prange(nx, nogil=True, schedule='static', num_threads=nthreads):
|
for i in prange(nx, nogil=True, schedule='static', num_threads=nthreads):
|
||||||
for j in range(ny):
|
for j in range(ny):
|
||||||
for k in range(nz):
|
for k in range(nz):
|
||||||
# Positional vector for current position
|
# Positional vector for current position
|
||||||
v2x = weighting[0] * i
|
v2x = ((weighting[0] * i) + sx) % global_size[0]
|
||||||
v2y = weighting[1] * j
|
v2y = ((weighting[1] * j) + sy) % global_size[1]
|
||||||
v2z = weighting[2] * k
|
v2z = ((weighting[2] * k) + sz) % global_size[2]
|
||||||
|
|
||||||
# Calulate norm of v2 - v1
|
# Calulate norm of v2 - v1
|
||||||
rr = ((v2x - v1[0])**2 + (v2y - v1[1])**2 + (v2z - v1[2])**2)**(1/2)
|
rr = ((v2x - v1[0])**2 + (v2y - v1[1])**2 + (v2z - v1[2])**2)**(1/2)
|
||||||
|
@@ -16,6 +16,8 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with gprMax. If not, see <http://www.gnu.org/licenses/>.
|
# along with gprMax. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from scipy import fftpack
|
from scipy import fftpack
|
||||||
|
|
||||||
@@ -135,7 +137,17 @@ class FractalSurface:
|
|||||||
class FractalVolume:
|
class FractalVolume:
|
||||||
"""Fractal volumes."""
|
"""Fractal volumes."""
|
||||||
|
|
||||||
def __init__(self, xs, xf, ys, yf, zs, zf, dimension, seed):
|
def __init__(
|
||||||
|
self,
|
||||||
|
xs: int,
|
||||||
|
xf: int,
|
||||||
|
ys: int,
|
||||||
|
yf: int,
|
||||||
|
zs: int,
|
||||||
|
zf: int,
|
||||||
|
dimension: float,
|
||||||
|
seed: Optional[int],
|
||||||
|
):
|
||||||
"""
|
"""
|
||||||
Args:
|
Args:
|
||||||
xs, xf, ys, yf, zs, zf: floats for the extent of the fractal volume.
|
xs, xf, ys, yf, zs, zf: floats for the extent of the fractal volume.
|
||||||
|
在新工单中引用
屏蔽一个用户