你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-07 15:10:13 +08:00
Merged nested if conditions, and removed some un-necessary conditional statement in a function.
这个提交包含在:
@@ -427,19 +427,11 @@ def dispersion_analysis(G):
|
||||
results["error"] = "user waveform detected."
|
||||
|
||||
else:
|
||||
# User-defined waveform
|
||||
if waveform.type == "user":
|
||||
iterations = G.iterations
|
||||
|
||||
# Built-in waveform
|
||||
else:
|
||||
# Time to analyse waveform - 4*pulse_width as using entire
|
||||
# time window can result in demanding FFT
|
||||
waveform.calculate_coefficients()
|
||||
iterations = round_value(4 * waveform.chi / G.dt)
|
||||
if iterations > G.iterations:
|
||||
iterations = G.iterations
|
||||
|
||||
# Time to analyse waveform - 4*pulse_width as using entire
|
||||
# time window can result in demanding FFT
|
||||
waveform.calculate_coefficients()
|
||||
iterations = round_value(4 * waveform.chi / G.dt)
|
||||
iterations = min(iterations, G.iterations)
|
||||
waveformvalues = np.zeros(G.iterations)
|
||||
for iteration in range(G.iterations):
|
||||
waveformvalues[iteration] = waveform.calculate_value(iteration * G.dt, G.dt)
|
||||
|
@@ -185,8 +185,7 @@ def write_processed_file(processedlines):
|
||||
f.write(f"{item}")
|
||||
|
||||
logger.info(
|
||||
f"Written input commands, after processing any Python "
|
||||
+ f"code and include commands, to file: {processedfile}\n"
|
||||
f"Written input commands, after processing any Python code and include commands, to file: {processedfile}\n"
|
||||
)
|
||||
|
||||
|
||||
|
@@ -64,9 +64,7 @@ def process_singlecmds(singlecmds):
|
||||
if singlecmds[cmd] is not None:
|
||||
tmp = tuple(int(x) for x in singlecmds[cmd].split())
|
||||
if len(tmp) != 1:
|
||||
logger.exception(
|
||||
f"{cmd} requires exactly one parameter to specify " + f"the number of CPU OpenMP threads to use"
|
||||
)
|
||||
logger.exception(f"{cmd} requires exactly one parameter to specify the number of CPU OpenMP threads to use")
|
||||
raise ValueError
|
||||
|
||||
omp_threads = OMPThreads(n=tmp[0])
|
||||
@@ -106,7 +104,7 @@ def process_singlecmds(singlecmds):
|
||||
if len(tmp) != 1:
|
||||
logger.exception(
|
||||
f"{cmd} requires exactly one parameter to specify the "
|
||||
+ f"time window. Either in seconds or number of iterations."
|
||||
f"time window. Either in seconds or number of iterations."
|
||||
)
|
||||
raise ValueError
|
||||
tmp = tmp[0].lower()
|
||||
|
@@ -317,9 +317,8 @@ class PeplinskiSoil:
|
||||
# Check to see if the material already exists before creating a new one
|
||||
requiredID = "|{:.4f}|".format(float(muiter[0]))
|
||||
material = next((x for x in G.materials if x.ID == requiredID), None)
|
||||
if muiter.index == 0:
|
||||
if material:
|
||||
self.matID.append(material.numID)
|
||||
if muiter.index == 0 and material:
|
||||
self.matID.append(material.numID)
|
||||
if not material:
|
||||
m = DispersiveMaterial(len(G.materials), requiredID)
|
||||
m.type = "debye"
|
||||
@@ -412,9 +411,8 @@ class RangeMaterial:
|
||||
# Check to see if the material already exists before creating a new one
|
||||
requiredID = f"|{float(er):.4f}+{float(se):.4f}+{float(mr):.4f}+{float(sm):.4f}|"
|
||||
material = next((x for x in G.materials if x.ID == requiredID), None)
|
||||
if iter == 0:
|
||||
if material:
|
||||
self.matID.append(material.numID)
|
||||
if iter == 0 and material:
|
||||
self.matID.append(material.numID)
|
||||
if not material:
|
||||
m = Material(len(G.materials), requiredID)
|
||||
m.type = ""
|
||||
|
在新工单中引用
屏蔽一个用户