你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-08 07:24:19 +08:00
Added return (currently unused) from main gprMax call
这个提交包含在:
@@ -45,7 +45,13 @@ class Context:
|
|||||||
self.tsimstart = None
|
self.tsimstart = None
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
"""Run the simulation in the correct context."""
|
"""Run the simulation in the correct context.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
results: dict that can contain useful results/data from simulation.
|
||||||
|
"""
|
||||||
|
|
||||||
|
results = {}
|
||||||
self.tsimstart = timer()
|
self.tsimstart = timer()
|
||||||
self.print_logo_copyright()
|
self.print_logo_copyright()
|
||||||
print_host_info(config.sim_config.hostinfo)
|
print_host_info(config.sim_config.hostinfo)
|
||||||
@@ -80,6 +86,8 @@ class Context:
|
|||||||
self.tsimend = timer()
|
self.tsimend = timer()
|
||||||
self.print_time_report()
|
self.print_time_report()
|
||||||
|
|
||||||
|
return results
|
||||||
|
|
||||||
def print_logo_copyright(self):
|
def print_logo_copyright(self):
|
||||||
"""Prints gprMax logo, version, and copyright/licencing information."""
|
"""Prints gprMax logo, version, and copyright/licencing information."""
|
||||||
logo_copyright = logo(__version__ + ' (' + codename + ')')
|
logo_copyright = logo(__version__ + ' (' + codename + ')')
|
||||||
@@ -134,7 +142,12 @@ class MPIContext(Context):
|
|||||||
model.solve(solver)
|
model.solve(solver)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
"""Specialise how the models are run."""
|
"""Specialise how the models are run.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
results: dict that can contain useful results/data from simulation.
|
||||||
|
"""
|
||||||
|
|
||||||
if self.rank == 0:
|
if self.rank == 0:
|
||||||
self.tsimstart = timer()
|
self.tsimstart = timer()
|
||||||
self.print_logo_copyright()
|
self.print_logo_copyright()
|
||||||
@@ -173,3 +186,4 @@ class MPIContext(Context):
|
|||||||
if executor.is_master():
|
if executor.is_master():
|
||||||
self.tsimend = timer()
|
self.tsimend = timer()
|
||||||
self.print_time_report()
|
self.print_time_report()
|
||||||
|
return results
|
||||||
|
@@ -96,9 +96,8 @@ def run(scenes=args_defaults['scenes'],
|
|||||||
write_processed=args_defaults['write_processed'],
|
write_processed=args_defaults['write_processed'],
|
||||||
log_level=args_defaults['log_level'],
|
log_level=args_defaults['log_level'],
|
||||||
log_file=args_defaults['log_file']):
|
log_file=args_defaults['log_file']):
|
||||||
"""This is the main function for gprMax when entering using application
|
"""Entry point for application programming interface (API). Runs the
|
||||||
programming interface (API). Run the simulation for the given list of
|
simulation for the given list of scenes.
|
||||||
scenes.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
args = argparse.Namespace(**{'scenes': scenes,
|
args = argparse.Namespace(**{'scenes': scenes,
|
||||||
@@ -121,9 +120,7 @@ def run(scenes=args_defaults['scenes'],
|
|||||||
|
|
||||||
|
|
||||||
def cli():
|
def cli():
|
||||||
"""Main function for gprMax when entering using the command line interface
|
"""Entry point for command line interface (CLI)."""
|
||||||
(CLI).
|
|
||||||
"""
|
|
||||||
|
|
||||||
# Parse command line arguments
|
# Parse command line arguments
|
||||||
parser = argparse.ArgumentParser(prog='gprMax',
|
parser = argparse.ArgumentParser(prog='gprMax',
|
||||||
@@ -154,16 +151,24 @@ def cli():
|
|||||||
help=help_msg['log_file'])
|
help=help_msg['log_file'])
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
run_main(args)
|
results = run_main(args)
|
||||||
|
|
||||||
|
return results
|
||||||
|
|
||||||
|
|
||||||
def run_main(args):
|
def run_main(args):
|
||||||
"""Called by either run (API) or main (CLI).
|
"""Runs simulation contexts. Called by either API or CLI.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
args: namespace with arguments from either API or CLI.
|
args: namespace with arguments from either API or CLI.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
results: dict that can contain useful results/data from simulation.
|
||||||
|
Enables these to be propagated to calling script.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
results = {}
|
||||||
|
|
||||||
logging_config(level=args.log_level, log_file=args.log_file)
|
logging_config(level=args.log_level, log_file=args.log_file)
|
||||||
|
|
||||||
config.sim_config = config.SimulationConfig(args)
|
config.sim_config = config.SimulationConfig(args)
|
||||||
@@ -171,8 +176,10 @@ def run_main(args):
|
|||||||
# MPI running with (OpenMP/CUDA/OpenCL)
|
# MPI running with (OpenMP/CUDA/OpenCL)
|
||||||
if config.sim_config.args.mpi:
|
if config.sim_config.args.mpi:
|
||||||
context = MPIContext()
|
context = MPIContext()
|
||||||
context.run()
|
results = context.run()
|
||||||
# Standard running (OpenMP/CUDA/OpenCL)
|
# Standard running (OpenMP/CUDA/OpenCL)
|
||||||
else:
|
else:
|
||||||
context = Context()
|
context = Context()
|
||||||
context.run()
|
results = context.run()
|
||||||
|
|
||||||
|
return results
|
在新工单中引用
屏蔽一个用户