你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-07 15:10:13 +08:00
Added check for space char between command name and parameters.
这个提交包含在:
@@ -171,11 +171,16 @@ def check_cmd_names(processedlines, checkessential=True):
|
|||||||
lindex = 0
|
lindex = 0
|
||||||
while(lindex < len(processedlines)):
|
while(lindex < len(processedlines)):
|
||||||
cmd = processedlines[lindex].split(':')
|
cmd = processedlines[lindex].split(':')
|
||||||
cmdname = cmd[0].lower()
|
cmdname = cmd[0]
|
||||||
|
cmdparams = cmd[1]
|
||||||
|
|
||||||
|
# Check if there is space between command name and parameters
|
||||||
|
if ' ' not in cmdparams[0]:
|
||||||
|
raise CmdInputError('There must be a space between the command name and parameters in ' + processedlines[lindex])
|
||||||
|
|
||||||
# Check if command name is valid
|
# Check if command name is valid
|
||||||
if cmdname not in essentialcmds and cmdname not in singlecmds and cmdname not in multiplecmds and cmdname not in geometrycmds:
|
if cmdname not in essentialcmds and cmdname not in singlecmds and cmdname not in multiplecmds and cmdname not in geometrycmds:
|
||||||
raise CmdInputError('Your input file contains the invalid command: ' + cmdname)
|
raise CmdInputError('Your input file contains an invalid command: ' + cmdname)
|
||||||
|
|
||||||
# Count essential commands
|
# Count essential commands
|
||||||
if cmdname in essentialcmds:
|
if cmdname in essentialcmds:
|
||||||
@@ -186,7 +191,7 @@ def check_cmd_names(processedlines, checkessential=True):
|
|||||||
if singlecmds[cmdname] == 'None':
|
if singlecmds[cmdname] == 'None':
|
||||||
singlecmds[cmdname] = cmd[1].strip(' \t\n')
|
singlecmds[cmdname] = cmd[1].strip(' \t\n')
|
||||||
else:
|
else:
|
||||||
raise CmdInputError('You can only have one ' + cmdname + ' commmand in your model')
|
raise CmdInputError('You can only have instance of ' + cmdname + ' in your model')
|
||||||
|
|
||||||
elif cmdname in multiplecmds:
|
elif cmdname in multiplecmds:
|
||||||
multiplecmds[cmdname].append(cmd[1].strip(' \t\n'))
|
multiplecmds[cmdname].append(cmd[1].strip(' \t\n'))
|
||||||
@@ -198,6 +203,6 @@ def check_cmd_names(processedlines, checkessential=True):
|
|||||||
|
|
||||||
if checkessential:
|
if checkessential:
|
||||||
if (countessentialcmds < len(essentialcmds)):
|
if (countessentialcmds < len(essentialcmds)):
|
||||||
raise CmdInputError('Your input file is missing essential gprMax commands required to run a model. Essential commands are: ' + ', '.join(essentialcmds))
|
raise CmdInputError('Your input file is missing essential commands required to run a model. Essential commands are: ' + ', '.join(essentialcmds))
|
||||||
|
|
||||||
return singlecmds, multiplecmds, geometry
|
return singlecmds, multiplecmds, geometry
|
||||||
|
在新工单中引用
屏蔽一个用户