diff --git a/gprMax/cython/fractals_generate.pyx b/gprMax/cython/fractals_generate.pyx index 2339b6bf..59799452 100644 --- a/gprMax/cython/fractals_generate.pyx +++ b/gprMax/cython/fractals_generate.pyx @@ -72,6 +72,7 @@ cpdef void generate_fractal3D( int nz, int nthreads, float D, + np.int32_t[:] global_size, np.float64_t[:] weighting, np.float64_t[:] v1, np.complex128_t[:, :, ::1] A, @@ -94,14 +95,19 @@ cpdef void generate_fractal3D( cdef Py_ssize_t i, j, k 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 j in range(ny): for k in range(nz): # Positional vector for current position - v2x = weighting[0] * i - v2y = weighting[1] * j - v2z = weighting[2] * k + v2x = ((weighting[0] * i) + sx) % global_size[0] + v2y = ((weighting[1] * j) + sy) % global_size[1] + v2z = ((weighting[2] * k) + sz) % global_size[2] # Calulate norm of v2 - v1 rr = ((v2x - v1[0])**2 + (v2y - v1[1])**2 + (v2z - v1[2])**2)**(1/2) diff --git a/gprMax/fractals.py b/gprMax/fractals.py index bfe9e5be..b139770c 100644 --- a/gprMax/fractals.py +++ b/gprMax/fractals.py @@ -16,6 +16,8 @@ # You should have received a copy of the GNU General Public License # along with gprMax. If not, see . +from typing import Optional + import numpy as np from scipy import fftpack @@ -135,7 +137,17 @@ class FractalSurface: class FractalVolume: """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: xs, xf, ys, yf, zs, zf: floats for the extent of the fractal volume.