你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-06 12:36:51 +08:00
autopep8 code cleanups.
这个提交包含在:
@@ -41,9 +41,9 @@ ccomplextype = 'pycuda::complex<float>'
|
|||||||
|
|
||||||
# Double precision
|
# Double precision
|
||||||
# For numpy arrays
|
# For numpy arrays
|
||||||
#floattype = np.float64
|
# floattype = np.float64
|
||||||
#complextype = np.complex128
|
# complextype = np.complex128
|
||||||
|
|
||||||
# For C (CUDA) arrays
|
# For C (CUDA) arrays
|
||||||
#cfloattype = 'double'
|
# cfloattype = 'double'
|
||||||
#ccomplextype = 'pycuda::complex<double>'
|
# ccomplextype = 'pycuda::complex<double>'
|
||||||
|
@@ -269,7 +269,7 @@ def process_multicmds(multicmds, G):
|
|||||||
m.start = 0
|
m.start = 0
|
||||||
m.stop = G.timewindow
|
m.stop = G.timewindow
|
||||||
startstop = ' '
|
startstop = ' '
|
||||||
|
|
||||||
m.calculate_waveform_values(G)
|
m.calculate_waveform_values(G)
|
||||||
|
|
||||||
if G.messages:
|
if G.messages:
|
||||||
@@ -334,7 +334,7 @@ def process_multicmds(multicmds, G):
|
|||||||
t.start = 0
|
t.start = 0
|
||||||
t.stop = G.timewindow
|
t.stop = G.timewindow
|
||||||
startstop = ' '
|
startstop = ' '
|
||||||
|
|
||||||
t.calculate_waveform_values(G)
|
t.calculate_waveform_values(G)
|
||||||
t.calculate_incident_V_I(G)
|
t.calculate_incident_V_I(G)
|
||||||
|
|
||||||
|
@@ -284,7 +284,7 @@ def solve_cpu(currentmodelrun, numbermodelruns, G):
|
|||||||
pbar = tqdm(total=snapiters, leave=False, unit='byte', unit_scale=True, desc=' Writing snapshot file {} of {}, {}'.format(i + 1, len(G.snapshots), os.path.split(snap.filename)[1]), ncols=get_terminal_width() - 1, file=sys.stdout, disable=G.tqdmdisable)
|
pbar = tqdm(total=snapiters, leave=False, unit='byte', unit_scale=True, desc=' Writing snapshot file {} of {}, {}'.format(i + 1, len(G.snapshots), os.path.split(snap.filename)[1]), ncols=get_terminal_width() - 1, file=sys.stdout, disable=G.tqdmdisable)
|
||||||
snap.write_vtk_imagedata(G.Ex, G.Ey, G.Ez, G.Hx, G.Hy, G.Hz, G, pbar)
|
snap.write_vtk_imagedata(G.Ex, G.Ey, G.Ez, G.Hx, G.Hy, G.Hz, G, pbar)
|
||||||
pbar.close()
|
pbar.close()
|
||||||
|
|
||||||
# Update magnetic field components
|
# Update magnetic field components
|
||||||
update_magnetic(G.nx, G.ny, G.nz, G.nthreads, G.updatecoeffsH, G.ID, G.Ex, G.Ey, G.Ez, G.Hx, G.Hy, G.Hz)
|
update_magnetic(G.nx, G.ny, G.nz, G.nthreads, G.updatecoeffsH, G.ID, G.Ex, G.Ey, G.Ez, G.Hx, G.Hy, G.Hz)
|
||||||
|
|
||||||
|
@@ -85,11 +85,11 @@ def open_path_file(path_or_file):
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
path_or_file: path as a string or a file object.
|
path_or_file: path as a string or a file object.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
f (object): File object.
|
f (object): File object.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if isinstance(path_or_file, str):
|
if isinstance(path_or_file, str):
|
||||||
f = file_to_close = open(path_or_file, 'r')
|
f = file_to_close = open(path_or_file, 'r')
|
||||||
else:
|
else:
|
||||||
@@ -212,21 +212,21 @@ def memory_usage(G):
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
G (class): Grid class instance - holds essential parameters describing the model.
|
G (class): Grid class instance - holds essential parameters describing the model.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
memestimate (int): Estimate of required memory in bytes
|
memestimate (int): Estimate of required memory in bytes
|
||||||
"""
|
"""
|
||||||
|
|
||||||
stdoverhead = 50e6
|
stdoverhead = 50e6
|
||||||
|
|
||||||
# 6 x field arrays + 6 x ID arrays
|
# 6 x field arrays + 6 x ID arrays
|
||||||
fieldarrays = (6 + 6) * (G.nx + 1) * (G.ny + 1) * (G.nz + 1) * np.dtype(floattype).itemsize
|
fieldarrays = (6 + 6) * (G.nx + 1) * (G.ny + 1) * (G.nz + 1) * np.dtype(floattype).itemsize
|
||||||
|
|
||||||
solidarray = G.nx * G.ny * G.nz * np.dtype(np.uint32).itemsize
|
solidarray = G.nx * G.ny * G.nz * np.dtype(np.uint32).itemsize
|
||||||
|
|
||||||
# 12 x rigidE array components + 6 x rigidH array components
|
# 12 x rigidE array components + 6 x rigidH array components
|
||||||
rigidarrays = (12 + 6) * G.nx * G.ny * G.nz * np.dtype(np.int8).itemsize
|
rigidarrays = (12 + 6) * G.nx * G.ny * G.nz * np.dtype(np.int8).itemsize
|
||||||
|
|
||||||
pmlarrays = 0
|
pmlarrays = 0
|
||||||
for (k, v) in G.pmlthickness.items():
|
for (k, v) in G.pmlthickness.items():
|
||||||
if v > 0:
|
if v > 0:
|
||||||
|
在新工单中引用
屏蔽一个用户