def uniqueBoundaryName(self, name): if config.dimension() == 2: return utils.uniqueName( name, self.allBoundaryNames() + self.allInterfaceNames()) if config.dimension() == 3: return utils.uniqueName(name, self.allBoundaryNames())
def __call__(self, param, name): if param.automatic(): basename = self.defaultname else: basename = name return utils.uniqueName(basename, _namedAnalyses.keys()+_namedBdyAnalyses.keys())
def __call__(self, param, name): if param.automatic(): basename = self.defaultname else: basename = name return utils.uniqueName( basename, _namedAnalyses.keys() + _namedBdyAnalyses.keys())
def activeAreaNameResolver(param, startname): if param.automatic(): basename = 'activearea' else: basename = startname msname = param.group['microstructure'].value ms = ooflib.common.microstructure.getMicrostructure(msname) return utils.uniqueName(basename, ms.activeAreaNames())
def interfaceNameResolver(param, startname): if param.automatic(): basename = 'interface' else: basename = startname msname = param.group['microstructure'].value msobj = ooflib.common.microstructure.microStructures[msname].getObject() interfacemsplugin=msobj.getPlugIn("Interfaces") return utils.uniqueName(basename, interfacemsplugin.getCurrentReservedNames())
def renameGroup(self, oldname, newname): if oldname in self.groups: for t in self.tracker.values(): newname = utils.uniqueName(newname, list(self.groups), exclude=oldname) t.rename_group(oldname, newname) if oldname != newname: self.groups.replace(oldname, newname) switchboard.notify("groupset member renamed", self.skeletoncontext, self, newname)
def renameActiveArea(self, oldname, newname): for naa in self.namedActiveAreas: if naa.name == oldname: real_new_name = utils.uniqueName(newname, self.activeAreaNames(), exclude=oldname) naa.name = real_new_name for pxl in naa.activearea.members(): aal = activearea.areaListFromPixel(self, pxl) aal.remove(oldname) aal.add(real_new_name)
def uniqueName(self, name, exclude=None): # Given a LabelTree path (list of strings, or colon separated # substrings), returns a single string that doesn't already # name a leaf in the same tree. For example, if the WhoClass # contains a Who called "Hey:Bee:Sea", and you call uniqueName # with the argument "Hey:Bee:Sea" or ["Hey", "Bee", "Sea"], it # will return "Sea<2>". If you pass in "Hay:Bea:Sea" it will # return "Sea". path = labeltree.makePath(name) try: basenode = self.members[path[:-1]] except labeltree.LabelTreeKeyError: return path[-1] # subtree doesn't exist yet return utils.uniqueName(path[-1], basenode.children(), exclude=exclude)
def copymaterialNameResolver(param, startname): if param.automatic(): matactual = materialmanager.getMaterial(param.group['name'].value) # Outside of surface_mode, MATERIALTYPE_INTERFACE is not defined. if runtimeflags.surface_mode: if matactual.type() == MATERIALTYPE_INTERFACE: basename = 'interfacematerial' else: basename = 'material' else: basename = 'material' else: basename = startname return utils.uniqueName(basename, materialmanager.getMaterialNames())
def uniqueName(self, name, exclude=None): # Given a LabelTree path (list of strings, or colon separated # substrings), returns a single string that doesn't already # name a leaf in the same tree. For example, if the WhoClass # contains a Who called "Hey:Bee:Sea", and you call uniqueName # with the argument "Hey:Bee:Sea" or ["Hey", "Bee", "Sea"], it # will return "Sea<2>". If you pass in "Hay:Bea:Sea" it will # return "Sea". path = labeltree.makePath(name) try: basenode = self.members[path[:-1]] except KeyError: return path[-1] # subtree doesn't exist yet return utils.uniqueName(path[-1], basenode.children(), exclude=exclude)
def copymaterialNameResolver(param, startname): if param.automatic(): matactual=materialmanager.getMaterial(param.group['name'].value) # Outside of surface_mode, MATERIALTYPE_INTERFACE is not defined. if runtimeflags.surface_mode: if matactual.type()==MATERIALTYPE_INTERFACE: basename = 'interfacematerial' else: basename = 'material' else: basename = 'material' else: basename = startname return utils.uniqueName(basename, materialmanager.getMaterialNames())
def materialNameResolver(param, startname): if param.automatic(): #Interface branch material_type = param.group['material_type'].value # Slightly convoluted conditional -- in surface mode, you have # to check to see if you have an interface material. Outside # of surface mode, this is impossible, and # MATERIALTYPE_INTERFACE is not defined, so checking for it is # an error. if runtimeflags.surface_mode: if material_type == MATERIALTYPE_INTERFACE: basename = 'interfacematerial' else: basename = 'material' else: basename = 'material' else: basename = startname return utils.uniqueName(basename, materialmanager.getMaterialNames())
def materialNameResolver(param, startname): if param.automatic(): #Interface branch material_type = param.group['material_type'].value # Slightly convoluted conditional -- in surface mode, you have # to check to see if you have an interface material. Outside # of surface mode, this is impossible, and # MATERIALTYPE_INTERFACE is not defined, so checking for it is # an error. if runtimeflags.surface_mode: if material_type==MATERIALTYPE_INTERFACE: basename = 'interfacematerial' else: basename = 'material' else: basename = 'material' else: basename = startname return utils.uniqueName(basename, materialmanager.getMaterialNames())
def uniqueName(self, name, exclude=None): return utils.uniqueName(name, self.names(), exclude)
def uniqueBoundaryName(self, name): if config.dimension() == 2: return utils.uniqueName(name, self.allBoundaryNames()+self.allInterfaceNames()) if config.dimension() == 3: return utils.uniqueName(name, self.allBoundaryNames())
def uniqueGroupName(self, name, oldname=None): return utils.uniqueName(name, self.groupNames(), exclude=oldname)
def __call__(self, param, startname): skelname = param.group['skeleton'].value skelcontext = whoville.getClass('Skeleton')[skelname] groupset = getattr(skelcontext, self.attrname) return utils.uniqueName(self.getBasename(param, startname), list(groupset.allGroups()))