Removed unnecessary if conditions at some places, and used itertools.product to make code more readable/cleaner.

这个提交包含在:
Sai-Suraj-27
2023-06-23 19:35:54 +05:30
父节点 e9416e34c8
当前提交 c0762cc112
共有 4 个文件被更改,包括 41 次插入48 次删除

查看文件

@@ -3,9 +3,11 @@
receiver at the centre.
"""
from pathlib import Path
import gprMax
import itertools
# File path for output
fn = Path(__file__)
@@ -17,38 +19,36 @@ ompthreads = [1, 2, 4, 8, 16, 32, 64, 128]
scenes = []
for d in domains:
for threads in ompthreads:
# Discretisation
dl = 0.001
# Discretisation
dl = 0.001
for d, threads in itertools.product(domains, ompthreads):
# Domain
x = d
y = x
z = x
# Domain
x = d
y = x
z = x
scene = gprMax.Scene()
scene = gprMax.Scene()
title = gprMax.Title(name=fn.with_suffix('').name)
domain = gprMax.Domain(p1=(x, y, z))
dxdydz = gprMax.Discretisation(p1=(dl, dl, dl))
time_window = gprMax.TimeWindow(time=3e-9)
wv = gprMax.Waveform(wave_type='gaussiandotnorm', amp=1, freq=900e6,
id='MySource')
src = gprMax.HertzianDipole(p1=(x/2, y/2, z/2), polarisation='x',
waveform_id='MySource')
title = gprMax.Title(name=fn.with_suffix('').name)
domain = gprMax.Domain(p1=(x, y, z))
dxdydz = gprMax.Discretisation(p1=(dl, dl, dl))
time_window = gprMax.TimeWindow(time=3e-9)
wv = gprMax.Waveform(wave_type='gaussiandotnorm', amp=1, freq=900e6,
id='MySource')
src = gprMax.HertzianDipole(p1=(x/2, y/2, z/2), polarisation='x',
waveform_id='MySource')
omp = gprMax.OMPThreads(n=threads)
omp = gprMax.OMPThreads(n=threads)
scene.add(title)
scene.add(domain)
scene.add(dxdydz)
scene.add(time_window)
scene.add(wv)
scene.add(src)
scene.add(omp)
scenes.append(scene)
scene.add(title)
scene.add(domain)
scene.add(dxdydz)
scene.add(time_window)
scene.add(wv)
scene.add(src)
scene.add(omp)
scenes.append(scene)
# Run model
gprMax.run(scenes=scenes, n=len(scenes), geometry_only=False, outputfile=fn, gpu=None)