Updated logging.

这个提交包含在:
craig-warren
2020-04-07 15:40:10 +01:00
父节点 1ef898384a
当前提交 62b73edded
共有 2 个文件被更改,包括 6 次插入7 次删除

查看文件

@@ -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.')

查看文件

@@ -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']: