def _find_master(self): ctrl = Controller() master = [] for item in ctrl.keys(): if ctrl[item].models is self: master.append(ctrl[item]) if len(master) > 1: raise Exception('More than one master found! This model dictionary has been associated with multiple objects. To use the same dictionary multiple times use the copy method.') return master[0]
class Simulation: def __init__(self, params): self.controller = Controller() self.topo = params['topology'] self.geo = params['geometry'] self.phs = params['phase'] self.phys = params['physics'] def run(self): self.controller.clear()
def _find_master(self): ctrl = Controller() master = [] for item in ctrl.keys(): if ctrl[item].models is self: master.append(ctrl[item]) if len(master) > 1: raise Exception( 'More than one master found! This model dictionary has been associated with multiple objects. To use the same dictionary multiple times use the copy method.' ) return master[0]
def _find_master(self): ctrl = Controller() master = [] for item in list(ctrl.keys()): if ctrl[item].models is not None: for model in list(ctrl[item].models.keys()): if ctrl[item].models[model] is self: master.append(ctrl[item]) if len(master) > 1: raise Exception( "More than one master found! This model dictionary " "has been associated with multiple objects. To use " "the same dictionary multiple times use the copy" "method." ) return master[0]
def __init__(self, params): self.controller = Controller() self.topo = params['topology'] self.geo = params['geometry'] self.phs = params['phase'] self.phys = params['physics']
""" =============================================================================== GenericNetwork: Abstract class to construct pore networks =============================================================================== """ import itertools import scipy as sp import scipy.sparse as sprs import scipy.spatial as sptl import OpenPNM.Utilities.misc as misc from OpenPNM.Utilities import topology from OpenPNM.Base import Core, Controller, Tools, logging logger = logging.getLogger(__name__) ctrl = Controller() topo = topology() class GenericNetwork(Core): r""" GenericNetwork - Base class to construct pore networks Parameters ---------- name : string Unique name for Network object """ def __init__(self, **kwargs): super().__init__(**kwargs)