def _find_master(self): mgr = Workspace() master = [] for item in list(mgr.keys()): if mgr[item].models is not None: for model in list(mgr[item].models.keys()): if mgr[item].models[model] is self: master.append(mgr[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]
# -*- coding: utf-8 -*- """ =============================================================================== 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, Workspace, Tools, logging logger = logging.getLogger(__name__) mgr = Workspace() 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)