示例#1
0
 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())
示例#2
0
 def __call__(self, param, name):
     if param.automatic():
         basename = self.defaultname
     else:
         basename = name
     return utils.uniqueName(basename, 
                             _namedAnalyses.keys()+_namedBdyAnalyses.keys())
示例#3
0
 def __call__(self, param, name):
     if param.automatic():
         basename = self.defaultname
     else:
         basename = name
     return utils.uniqueName(
         basename,
         _namedAnalyses.keys() + _namedBdyAnalyses.keys())
示例#4
0
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())
示例#5
0
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())
示例#6
0
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())
示例#7
0
 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)
示例#8
0
 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)
示例#9
0
 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)
示例#10
0
 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)
示例#11
0
 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)
示例#12
0
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())
示例#13
0
 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)
示例#14
0
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())
示例#15
0
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())
示例#16
0
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())
示例#17
0
 def uniqueName(self, name, exclude=None):
     return utils.uniqueName(name, self.names(), exclude)
示例#18
0
 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())
示例#19
0
 def uniqueGroupName(self, name, oldname=None):
     return utils.uniqueName(name, self.groupNames(), exclude=oldname)
示例#20
0
 def uniqueName(self, name, exclude=None):
     return utils.uniqueName(name, self.names(), exclude)
示例#21
0
 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()))
示例#22
0
 def uniqueGroupName(self, name, oldname=None):
     return utils.uniqueName(name, self.groupNames(), exclude=oldname)