From 62b73eddedd95d8db2f4bd85927a43f7687d40a6 Mon Sep 17 00:00:00 2001 From: craig-warren Date: Tue, 7 Apr 2020 15:40:10 +0100 Subject: [PATCH] Updated logging. --- gprMax/cmds_multiple.py | 9 ++++----- gprMax/model_build_run.py | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/gprMax/cmds_multiple.py b/gprMax/cmds_multiple.py index 86e5c767..e68097c6 100644 --- a/gprMax/cmds_multiple.py +++ b/gprMax/cmds_multiple.py @@ -50,7 +50,6 @@ class UserObjectMulti: self.hash = '#example' self.autotranslate = True - def __str__(self): """Readable user string as per hash commands.""" s = '' @@ -232,11 +231,11 @@ class HertzianDipole(UserObjectMulti): # Check polarity & position parameters if polarisation not in ('x', 'y', 'z'): raise CmdInputError(f"'{self.params_str()}' polarisation must be x, y, or z") - if '2D TMx' in grid.mode and (polarisation == 'y' or polarisation == 'z'): + if '2D TMx' in config.get_model_config().mode and (polarisation == 'y' or polarisation == 'z'): raise CmdInputError(f"'{self.params_str()}' polarisation must be x in 2D TMx mode") - elif '2D TMy' in grid.mode and (polarisation == 'x' or polarisation == 'z'): + elif '2D TMy' in config.get_model_config().mode and (polarisation == 'x' or polarisation == 'z'): raise CmdInputError(f"'{self.params_str()}' polarisation must be y in 2D TMy mode") - elif '2D TMz' in grid.mode and (polarisation == 'x' or polarisation == 'y'): + elif '2D TMz' in config.get_model_config().mode and (polarisation == 'x' or polarisation == 'y'): raise CmdInputError(f"'{self.params_str()}' polarisation must be z in 2D TMz mode") xcoord, ycoord, zcoord = uip.check_src_rx_point(p1, self.params_str()) @@ -288,7 +287,7 @@ class HertzianDipole(UserObjectMulti): h.calculate_waveform_values(grid) - if grid.mode == '2D': + if config.get_model_config().mode == '2D': logger.info(f'Hertzian dipole is a line source in 2D with polarity {h.polarisation} at {h.xcoord * grid.dx:g}m, {h.ycoord * grid.dy:g}m, {h.zcoord * grid.dz:g}m,' + startstop + f'using waveform {h.waveformID} created.') else: logger.info(f'Hertzian dipole with polarity {h.polarisation} at {h.xcoord * grid.dx:g}m, {h.ycoord * grid.dy:g}m, {h.zcoord * grid.dz:g}m,' + startstop + f'using waveform {h.waveformID} created.') diff --git a/gprMax/model_build_run.py b/gprMax/model_build_run.py index 8ab05dbc..9f3d3a09 100644 --- a/gprMax/model_build_run.py +++ b/gprMax/model_build_run.py @@ -255,12 +255,12 @@ class ModelBuildRun: # Check number of OpenMP threads if config.sim_config.general['cpu']: - logger.basic(f'CPU (OpenMP) solver: {config.get_model_config().ompthreads} thread(s) on {platform.node()}\n') + logger.basic(f'CPU solver using: {config.get_model_config().ompthreads} OpenMP thread(s) on {platform.node()}\n') if config.get_model_config().ompthreads > config.sim_config.hostinfo['physicalcores']: logger.warning(Fore.RED + f"You have specified more threads ({config.get_model_config().ompthreads}) than available physical CPU cores ({config.sim_config.hostinfo['physicalcores']}). This may lead to degraded performance." + Style.RESET_ALL) # Print information about any GPU in use elif config.sim_config.general['cuda']: - logger.basic(f"GPU solver: {config.get_model_config().cuda['gpu'].deviceID} - {config.get_model_config().cuda['gpu'].name} on {platform.node()}\n") + logger.basic(f"GPU solver using: {config.get_model_config().cuda['gpu'].deviceID} - {config.get_model_config().cuda['gpu'].name} on {platform.node()}\n") # Prepare iterator if config.sim_config.general['progressbars']: