printing changes

这个提交包含在:
John Hartley
2019-08-01 11:37:04 +01:00
父节点 315219eadc
当前提交 d74375b0fc
共有 2 个文件被更改,包括 18 次插入5 次删除

查看文件

@@ -25,9 +25,16 @@ from scipy.constants import mu_0 as m0
from scipy.constants import epsilon_0 as e0
import sys
from .utilities import get_terminal_width
from .utilities import get_host_info
from pathlib import Path
from colorama import init
from colorama import Fore
from colorama import Style
init()
# Impedance of free space (Ohms)
z0 = np.sqrt(m0 / e0)
@@ -95,11 +102,16 @@ class ModelConfig():
inputfilestr_f = '\n--- Model {}/{}, input file: {}'
self.inputfilestr = inputfilestr_f.format(self.i + 1, self.sim_config.model_end, self.sim_config.input_file_path)
# string to print at start of each model run
self.next_model = Fore.GREEN + '{} {}\n'.format(self.inputfilestr, '-' * (get_terminal_width() - 1 - len(self.inputfilestr))) + Style.RESET_ALL
# Add the current model run to namespace that can be accessed by
# user in any Python code blocks in input file
#self.usernamespace['current_model_run'] = self.i + 1
def get_scene(self):
return self.sim_config.scenes[self.i]
class SimulationConfig:
def __init__(self, args):
@@ -129,6 +141,7 @@ class SimulationConfig:
self.general = {}
self.general['messages'] = True
self.geometry_fixed = args.geometry_fixed
self.scenes = args.scenes
self.set_input_file_path()
self.set_model_start()

查看文件

@@ -104,13 +104,13 @@ def run_model(solver, sim_config, model_config):
# Normal model reading/building process; bypassed if geometry information to be reused
if not sim_config.geometry_fixed:
printer.print(Fore.GREEN + '{} {}\n'.format(model_config.inputfilestr, '-' * (get_terminal_width() - 1 - len(model_config.inputfilestr))) + Style.RESET_ALL)
printer.print(model_config.next_model)
G = solver.G
G = solver.get_G()
# api for multiple scenes / model runs
try:
scene = model_config.scene
scene = model_config.get_scene()
# process using hashcommands
except AttributeError:
scene = Scene()
@@ -227,8 +227,8 @@ def run_model(solver, sim_config, model_config):
# If geometry information to be reused between model runs
else:
inputfilestr = '\n--- Model {}/{}, input file (not re-processed, i.e. geometry fixed): {}'.format(currentmodelrun, modelend, inputfile.name)
printer.print(Fore.GREEN + '{} {}\n'.format(inputfilestr, '-' * (get_terminal_width() - 1 - len(inputfilestr))) + Style.RESET_ALL)
inputfilestr = '\n--- Model {}/{}, input file (not re-processed, i.e. geometry fixed): {}'.format(currentmodelrun, modelend, model_config.input_file_path)
printer.print(Fore.GREEN + '{} {}\n'.format(model_config.inputfilestr, '-' * (get_terminal_width() - 1 - len(model_config.inputfilestr))) + Style.RESET_ALL)
# Clear arrays for field components
G.initialise_field_arrays()