def test_start(): if system() != 'Windows': return client = mph.start(cores=1) assert client.java is not None assert client.cores == 1 with logging_disabled(): try: mph.start() except NotImplementedError: pass try: client.disconnect() except RuntimeError: pass
def test_start(): with logging_disabled(): try: mph.option('session', 'invalid') mph.start() except ValueError: pass mph.option('session', 'client-server') client = mph.start(cores=1) assert client.java is not None assert client.cores == 1 with logging_disabled(): try: mph.start() except NotImplementedError: pass
def test_init(): global client if mph.option('session') == 'platform-dependent': mph.option('session', 'client-server') client = mph.start(cores=1) assert client.java is not None assert client.cores == 1 with logging_disabled(): try: mph.start() except NotImplementedError: pass try: mph.Client() except NotImplementedError: pass
def worker(jobs, results): """Performs jobs and delivers the results.""" client = mph.start(cores=1) model = client.load('../tests/capacitor.mph') while True: try: d = jobs.get(block=False) except Empty: break model.parameter('d', f'{d} [mm]') model.solve('static') C = model.evaluate('2*es.intWe/U^2', 'pF') results.put((d, C))
def setup_module(): global client, model client = mph.start() model = models.capacitor()
def setup_module(): global client, model, empty client = mph.start() model = models.capacitor() empty = client.create('empty')
def stop(self): """Stops timing the step, displaying the elapsed time.""" elapsed = now() - self.t0 print(f'{elapsed:.1f} seconds', flush=True) ######################################## # Main # ######################################## # Display welcome message. print('Compacting Comsol models in the current folder.') # Start Comsol client. print('Running Comsol client on single processor core.') client = mph.start(cores=1) # Loop over model files. timer = Timer() for file in Path.cwd().glob('*.mph'): name = file.relative_to(Path.cwd()) print(f'{name}:') timer.start('Loading') try: model = client.load(file) timer.stop() except Exception: timer.cancel('Failed.') continue
"""Exits the Python session right after starting a client.""" __license__ = 'MIT' import parent # noqa F401 import mph import sys client = mph.start() sys.exit(2)
def setup_module(): global client, model client = mph.start() model = client.load(file)
def test_init(): global client client = mph.start(cores=cores) assert client.java is not None assert not client.models() assert client.cores == cores