示例#1
0
文件: meshinfo.py 项目: song2001/OOF2
 def __init__(self, context):
     self.timestamp = timestamp.TimeStamp()
     self.context = context  # mesh context
     self.object = None
     self.mouse_position = None
     self.mesh_position = None
     self.targetname = None
示例#2
0
    def __init__(self, name=None, firstimage=None, filepattern=None, numfiles=None):

        # eventually this will be C++ and we will have multiple constructors
        if (name is not None and firstimage is not None
            and filepattern is not None and numfiles is not None):
            self._name = name
            self._timestamp = timestamp.TimeStamp()

            format = imghdr.what(firstimage)
            depth = numfiles

            readers = {'pbm':vtk.vtkPNMReader,
                       'pgm':vtk.vtkPNMReader,
                       'ppm':vtk.vtkPNMReader,
                       'bmp':vtk.vtkBMPReader,
                       'jpeg':vtk.vtkJPEGReader,
                       'tiff':vtk.vtkTIFFReader,
                       'png':vtk.vtkPNGReader}

            try:
                imageReader = readers[format]()
            except KeyError:
                raise ooferror.ErrUserError("Unrecognized Image Format")

            # the width and height are set based on the actual image size
            imageReader.SetDataExtent(0,0,0,0,0,depth-1)
            imageReader.SetDataSpacing(1,1,1)
            imageReader.SetFilePattern(filepattern)
            self.image = imageReader.GetOutput()
            self.image.Update()
            self.makeFourChannel()
            self.padImage()

            self.setup()
示例#3
0
    def __call__(self, **kwargs):
        # Check for extra arguments
        paramnames = [p.name for p in self.params]
        for argname in kwargs.keys():
            if argname not in paramnames:
                raise ooferror.ErrUserError(
                    "Unexpected argument '%s' in %s constructor" %
                    (argname, self.subclass.__name__))
        pdict = {}
        for p in self.params:
            try:
                p.value = kwargs[p.name]
            except KeyError:
                pass
            pdict[p.name] = p.value
        try:
            object = self.subclass(**pdict)
        except TypeError:
            debug.fmsg("Error creating", self.subclass)
            debug.fmsg("got arguments=", pdict)
            debug.fmsg("expected arguments=", self.params)
            raise

        if not hasattr(object, 'timestamp'):
            object.timestamp = timestamp.TimeStamp()
        return object
示例#4
0
 def assignMaterial(self, groupname, material):
     ts = timestamp.TimeStamp()
     ts.increment()
     self.materials[groupname] = (material, ts)
     switchboard.notify("materials changed in skeleton", self.skeletoncontext)
     for mesh in self.skeletoncontext.getMeshes():
         mesh.refreshMaterials(self.skeletoncontext)
     switchboard.notify("redraw")
示例#5
0
    def __init__(self, gfxwindow):
        self.point = None  # location of last query
        self.timestamp = timestamp.TimeStamp()
        toolbox.Toolbox.__init__(self, "Pixel_Info", gfxwindow)

        self.plugIns = [plugInClass(self) for plugInClass in plugInClasses]

        self.sbcallbacks = [
            switchboard.requestCallback("new pixelinfo plugin", self.newPlugIn)
        ]
示例#6
0
    def __init__(self, skeletoncontext):
        self.timestamp = timestamp.TimeStamp()
        self.skeletoncontext = skeletoncontext
        self.rwLock = lock.RWLock()

        self.sbcallbacks = [
            # switchboard.requestCallback(('who changed', 'Skeleton'),
            #                             self.newSkeleton),
            switchboard.requestCallback(('whodoundo push', 'Skeleton'),
                                        self.whoChanged0)
        ]
示例#7
0
    def __init__(self, context, name, skeleton=None, boundary=None):
        self.context = context
        self.name = name
        self.boundaryset = weakref.WeakKeyDictionary()
        if skeleton is None:
            skeleton = context.getObject()

        if boundary:
            # DeputySkeletons don't have independent boundary
            # information, so all data has to be associated with the
            # sheriff skeleton.
            self.boundaryset[skeleton.sheriffSkeleton()] = boundary
        self.timestamp = timestamp.TimeStamp()
示例#8
0
    def drawIfNecessary(self, gfxwindow, device):
        # Called by Display.draw().
        try:
            lasttime = self.timestamps[device]
            dlayer = self.devicelayers[device]
        except KeyError:
            # Layer hasn't been drawn on this device yet!
            lasttime = self.timestamps[device] = timestamp.TimeStamp()
            lasttime.backdate()
            dlayer = self.devicelayers[device] = device.begin_layer()
            actuallydraw = True
        else:
            actuallydraw = not self.frozen

        # This is needed because it keeps the order of the oofcanvas
        # layers in sync with the higher level layers.
        dlayer.raise_to_top()

        # othertimes is a list of the TimeStamps of events that
        # require the display layer to be redrawn.
        othertimes = [
            self.getTimeStamp(gfxwindow), self.layerset.whotime,
            self.layerset.who.getTimeStamp(gfxwindow)
        ]
        if self.animatable(gfxwindow):
            othertimes.append(gfxwindow.displayTimeChanged)

        if lasttime < max(othertimes):
            dlayer.make_current()
            whoobj = self.layerset.who.resolve(gfxwindow)
            whoobj.begin_reading()  # acquire lock
            try:
                if actuallydraw:
                    dlayer.clear()
                    if self.hidden:
                        dlayer.hide()
                    device.comment('Layer: %s' % ` self `)
                    # Note that if the device is a buffered output device,
                    # this won't necessarily call the lowest level drawing
                    # calls (and *actually* draw something).  That happens
                    # when the buffer is flushed.
                    self.draw(gfxwindow, device)
                    lasttime.increment()
                    device.end_layer()  ## flushes the buffer one last time.
            finally:
                whoobj.end_reading()  # release lock
示例#9
0
    def __init__(self, gfxwindow):
        toolbox.Toolbox.__init__(self, 'Skeleton_Info', gfxwindow)
        self.whoset = ('Skeleton', )
        self.querier = None
        self.peeker = None
        self.records = ringbuffer.RingBuffer(49)
        self.timestamp = timestamp.TimeStamp()
        self.timestamp.backdate()

        self.sbcallbacks = [
            # Looks for a skeleton on the gfx window.
            switchboard.requestCallback((self.gfxwindow(), "layers changed"),
                                        self.newLayers),
            # Looks for a skeleton modification.
            switchboard.requestCallback(('who changed', 'Skeleton'),
                                        self.skelChanged)
        ]
示例#10
0
    def __init__(self, skel, id=None):  # skel may be a deputy
        skeleton.SkeletonBase.__init__(self)
        self.skeleton = skel.sheriffSkeleton()
        self.skeleton.addDeputy(self)
        self._illegal = skel._illegal
        # When the DeputySkeleton is active, the positions of its nodes
        # are stored in the actual nodes, and the positions of the
        # reference Skeleton's nodes are stored in the nodePositions
        # dictionary.  When it's inactive, it's the other way around.
        self.nodePositions = skel.getMovedNodes()
        self.active = 0
        self.timestamp = timestamp.TimeStamp()
        self.meshes = []
        self._destroyed = 0

        # parallel stuff -- temporary until the Skeleton gets proper
        # parallel display method
        if parallel_enable.enabled():
            self.all_skeletons = skel.all_skeletons
示例#11
0
    def __init__(self, skelcontext, name, skeleton=None, boundary=None):
        self.skelcontext = skelcontext
        self.name = name
        self.boundaryset = weakref.WeakKeyDictionary()
        if skeleton is None:
            skeleton = skelcontext.getObject()

        if boundary:
            # DeputySkeletons don't have independent boundary
            # information, so all data has to be associated with the
            # sheriff skeleton.  See comments for resolveCSkeleton in
            # skeletoncontext.py.
            key = self.skelcontext.resolveCSkeleton(skeleton.sheriffSkeleton())
            self.boundaryset[key] = boundary

        ## TODO 3.1: Is this timestamp still needed?  It's set in many
        ## places here, but its value isn't used.  Is it used
        ## elsewhere?
        self.timestamp = timestamp.TimeStamp()
示例#12
0
    def __call__(self, *args, **kwargs):
        for arg, param in zip(args, self.params):
            param.value = arg
        for p in self.params:
            try:
                p.value = kwargs[p.name]
            except KeyError:
                pass
        argvals = [p.value for p in self.params]
        object = self.subclass(*argvals)

        # # Keep an extra reference to the arguments to ensure that the
        # # Python garbage collector won't destroy them before the
        # # registered class object itself is destroyed.  Also, this
        # # allows getParamValues to return the original Python form of
        # # the arguments.  If getParamValues goes into C++ to return
        # # the arguments, it will return the Ptr form, which will
        # # confuse the RegisteredClass type checking.
        # object._keepargs = argvals

        object.timestamp = timestamp.TimeStamp()
        return object
示例#13
0
文件: whoville.py 项目: song2001/OOF2
    def __init__(self, name, classname, obj, parent, secretFlag=0):
        self._name = name
        self._obj = obj
        self.classname = classname  # not necessarily the Python class name,
        # but just a name to be listed in GUI.
        self.parent = parent
        self.switchboardCallbacks = []
        self.timestamp = timestamp.TimeStamp()

        ## Locking variables
        self.have_reservation = 0

        ## Locking methods.
        self.reservation_lock = lock.Lock(
        )  ## holds the Who writing privileges

        # Create an rwlock.  Subclasses may share this lock with their
        # contained objects.
        self.rwLock = lock.RWLock()

        ## secret flag for hiding it from the user
        self.secretFlag = secretFlag
示例#14
0
    def __init__(self, name, classname, skel, parent):
        # All of the args have to be given, although not all are used.
        # This is because the constructor is called by WhoClass.add,
        # which assumes that the arguments are the same as those of
        # Who.__init__.  Probably a better solution using
        # RegisteredClasses could be found.

        # Keep track of node/segment/element index data (in that
        # order), so selectables can be uniquely identified within
        # this context, independently of which skeleton they're in.
        # This used to be done in the individual selectable classes,
        # but for repeatability reasons, it's desirable to restart the
        # indices in each context, ensuring that skeleton copies
        # really are absolutely identical in every respect.
        self.next_indices = (0, 0, 0)

        self.edgeboundaries = utils.OrderedDict()
        self.pointboundaries = utils.OrderedDict()
        self.selectedBdyName = None
        # There are two boundary timestamps, one for keeping track of
        # changes in the currently selected boundary, and another for
        # keeping track of changes to the configuration of boundaries
        # in any of these skeletons.  They are queried by their
        # respective displays in skeletonbdydisplay.py.
        self.bdyselected = timestamp.TimeStamp()
        self.bdytimestamp = timestamp.TimeStamp()

        # Various selection objects live here.  Instance the
        # selections from their constructors.  To get the current
        # selection, do "context.elementselection.retrieve()".
        self.nodeselection = skeletonselectable.NodeSelection(self)
        self.segmentselection = skeletonselectable.SegmentSelection(self)
        self.elementselection = skeletonselectable.ElementSelection(self)
        self.pinnednodes = skeletonnode.PinnedNodeSelection(self)

        # These attribute names (nodegroups, segmentgroups,
        # elementgroups) are used in the generic menu callback in
        # IO/skeletongroupmenu.py.  Also in skeletonselectionmod.py.
        # Change them in all places (or none, of course.)
        self.nodegroups = skeletongroups.NodeGroupSet(self)
        self.segmentgroups = skeletongroups.SegmentGroupSet(self)
        self.elementgroups = skeletongroups.ElementGroupSet(self)

        # WhoDoUndo.__init__ calls pushModification, so timing is
        # important.  pushModification calls implied_select for all
        # the selections, so the selection objects have to exist at
        # this point.
        whoville.WhoDoUndo.__init__(self, name, 'Skeleton', skel, parent)

        # Overwrite function, gets called when an item in the stack is
        # about to be overwritten.  This assignment replaces  the default
        # overwrite function set by the parent class initializer.
        self.undobuffer.overwrite = self.skeletonDestroy

        # Ensure that the passed-in obj really does start a new "family."
        skel.disconnect()

        # Ask the initial skel about any pre-existing boundaries.
        for (name, bdy) in skel.edgeboundaries.items():
            self.edgeboundaries[name] = \
              bdy.makeContextBoundary(self, name, skel)

        for (name, bdy) in skel.pointboundaries.items():
            self.pointboundaries[name] = \
              bdy.makeContextBoundary(self, name, skel)

        self.requestCallback("destroy pixel group", self.ms_grp_changed)
        self.requestCallback("changed pixel group", self.ms_grp_changed)
        self.requestCallback("changed pixel groups", self.ms_grps_changed)
        self.requestCallback('materials changed in microstructure',
                             self.materialsChanged)
示例#15
0
文件: movenode.py 项目: song2001/OOF2
 def __init__(self, node=None):
     self.timestamp = timestamp.TimeStamp()
     self.node_ = node
     # visible is set by the gui toolbox when it switches into
     # keyboard mode.
     self.visible = node is not None
示例#16
0
    def make_linear_system(self, time, linsys):
        # Construct a LinearizedSystem object containing the
        # globally-indexed K, C, and M matrices, and the rhs vectors,
        # and the maps that extract submatrices and subvectors.

        # The linsys argument is either a LinearizedSystem object
        # previously created by this SubProblemContext, or None.  If
        # it's not None, it will be updated and reused.

        mesh    = self.getParent()
        femesh  = mesh.getObject()
        subpobj = self.getObject()

        # Ask every *other* subproblem to interpolate its DoFs to the
        # given time.  Our boundary conditions and/or material
        # properties may depend on them.
        for subproblem in mesh.subproblems():
            if (subproblem is not self and subproblem.installedTime != time):
                vals = subproblem.interpolateValues(time)
                # This requires that the LinearizedSystem for the
                # other subproblem has already been computed.
                # However, it's never needed on the first call to
                # make_linear_system, so that's ok.
                subproblem.set_mesh_dofs(vals, time)

        ## TODO OPT: Be more sophisticated here. Instead of
        ## recomputing everything, only recompute the matrices and
        ## vectors that may have changed.

        ## TODO OPT: Recompute if nonlinear *and* relevant fields
        ## have changed, not just if nonlinear.  Need field-specific
        ## timestamps in the Mesh? 

        femesh.setCurrentSubProblem(self.getObject())

        # Figure out which parts of the calculation have to be redone.
        # If always is set, all steps of the calculation will be
        # peformed, even if they're otherwise unnecessary.  This can
        # be useful when debugging.

        # 'always' can be set with the command line option 
        ##     --command "always=True".
        always = False   
        try:
            always = utils.OOFeval('always')
        except NameError:
            pass

        # If Properties depend nonlinearly on Fields, and if those
        # Fields have changed, the matrices need to be recomputed.
        # The relevant Fields are *all* the Fields defined in the
        # SubProblem's Elements, whether or not those Fields are
        # active in *this* SubProblem.
        flds = self.getParent().all_active_subproblem_fields()

        if linsys is not None:
            linsysComputed = linsys.computed
        else:
            linsysComputed = timestamp.timeZero

        newDefinition = self.defnChanged > linsysComputed or always
        newFieldValues = (max(self.fieldsInstalled, mesh.fieldsInitialized)
                          > linsysComputed) or always
        newTime = linsys is None or linsys.time() != time or always
        newBdys = (mesh.boundariesChanged > linsysComputed
                   or (newTime and self.timeDependentBCs())
                   ## TODO: Check for field dependent boundary conditions
                   # or (newFieldValues and self.fieldDependentBCs(flds))
                   or always)

        newLinSys = (linsys is None) or newDefinition

        newMaterials = mesh.materialsChanged > linsysComputed or always
        rebuildMatrices = (
            newLinSys or newMaterials
            or (self.nonlinear(flds) and (newBdys or newFieldValues))
            or (newFieldValues and self.nonlinear_solver.needsResidual())
            or (self.nonlinear_solver.needsJacobian() and 
                self.nonlinear_solver.jacobianRequirementChanged() >
                linsysComputed)
            or (self.nonlinear_solver.needsResidual() and
                (newFieldValues or 
                 (self.nonlinear_solver.residualRequirementChanged() >
                  linsysComputed)))
            or (newTime and self.timeDependentProperties(flds))
            or always)

        if newDefinition:
            self.getObject().mapFields()

        # Create a new linearized system object if necessary
        if newLinSys:
            linsys = self.getObject().new_linear_system(time)
            linsys.computed = timestamp.TimeStamp()

        if newTime:
            linsys.set_time(time)


        # Apply boundary conditions to the linearized system object.
        # This has to be done before the matrix and rhs values are
        # computed. The matrix and rhs may be nonlinear and therefore
        # depend on field values, which may be determined by boundary
        # conditions.
            
        bcsReset = newLinSys or newBdys
        if bcsReset:
            # reset_bcs() calls Boundary.reset for all Boundaries in
            # the mesh, which resets all FloatBCs on the boundaries.
            femesh.reset_bcs()

            femesh.createAuxiliaryBCs() # convert PeriodicBCs --> FloatBCs
            femesh.createInterfaceFloatBCs(self) # jump conds --> FloatBCs

            # Find intersecting floating boundary conditions, and
            # arrange them into a tree structure.  This must be done
            # *before* fixed boundary conditions are applied so that
            # intersecting fixed and floating bcs are treated
            # correctly.
            femesh.floatBCResolve(subpobj, time)

            # LinearizedSystem::force_bndy_rhs is used by
            # invoke_flux_bcs and invoke_force_bcs, and must be
            # cleared before either of them is called.
            linsys.clearForceBndyRhs()

            femesh.invoke_flux_bcs(subpobj, linsys, time)

        # Apply Dirichlet BCs.  If new values have been assigned to
        # the Fields, the old Dirichlet BCs may have been overwritten,
        # so they have to be reapplied.
        if bcsReset or newFieldValues:
            linsys.resetFieldFlags()
            femesh.invoke_fixed_bcs(subpobj, linsys, time)

        if bcsReset:
            femesh.invoke_force_bcs(subpobj, linsys, time)
            # Set initial values of DoFs used in FloatBCs that
            # intersect fixedBCs.
            femesh.fix_float_bcs(subpobj, linsys, time)

        if rebuildMatrices:
            # Assemble vectors and matrices of the linearized system.
            linsys.clearMatrices()
            linsys.clearBodyRhs()
            if self.nonlinear_solver.needsResidual():
                linsys.clearResidual()
            if self.nonlinear_solver.needsJacobian():
                linsys.clearJacobian()
            # **** This is the cpu intensive step: ****
            self.getObject().make_linear_system(linsys, self.nonlinear_solver)
            self.newMatrixCount += 1

        if bcsReset or rebuildMatrices or newFieldValues:
            linsys.build_submatrix_maps()
            # Apply floating boundary conditions by modifying maps in
            # the LinearizedSystem.  This must follow
            # build_submatrix_maps() and precede build_MCK_maps().
            femesh.invoke_float_bcs(subpobj, linsys, time)
            linsys.build_MCK_maps()
            # Construct vectors of first and second time derivatives
            # of the time-dependent Dirichlet boundary conditions.
            linsys.initDirichletDerivatives()
            femesh.setDirichletDerivatives(subpobj, linsys, time)

        if bcsReset:
            # Compute the part of the rhs due to fixed fields or fixed
            # time derivatives in boundary conditions.
            linsys.find_fix_bndy_rhs(self.getObject().get_meshdofs())

            # Add the floating boundary condition profiles'
            # contributions to the rhs.  This must come after
            # find_fix_bndy_rhs(), and must always be called if
            # find_fix_bndy_rhs() is called.
            ## TODO OPT: Only call float_contrib_rhs if solver needs
            ## to know the rhs explicitly.
            femesh.float_contrib_rhs(self.getObject(), linsys)

        femesh.clearCurrentSubProblem()
        linsys.computed.increment()

        # ## Don't remove this block.  Comment it out instead.  It's
        # ## likely to be needed later.
        # global debugcount
        # debugcount += 1
        # if debugcount==3:
        #     if always:
        #         dumpfile = "dump-always"
        #     else:
        #         dumpfile = "dump"
        #     linsys.dumpAll(dumpfile, time, "")
        #     sys.exit()
        
        return linsys
示例#17
0
    def __init__(self, name, classname, obj, parent, subptype, secretFlag=0):
        whoville.Who.__init__(self, name, classname, obj, parent, secretFlag)
        obj.set_rwlock(self.rwLock)
        # Obj is a CSubProblem.

        obj.set_mesh(parent)
        obj.set_nnodes(self.nfuncnodes())

        # These shouldn't be accessed directly.  They store the values
        # of properties defined below..
        self._solver_mode = None
        self._time_stepper = None
        self._nonlinear_solver = None
        self._symmetric_solver = None
        self._asymmetric_solver = None

        self.stepperSet = timestamp.TimeStamp()

        self.startTime = 0.0
        self.endTime = None
        self.installedTime = None
        self.fieldsInstalled = timestamp.TimeStamp()
        self.startValues = doublevec.DoubleVec(0)
        self.endValues = doublevec.DoubleVec(0)
        self.subptype = subptype
        self._precomputing = False
        self._timeDependent = False
        self._second_order_fields = set()

        # solveOrder determines the order in which subproblems are to
        # be solved.
        self.solveOrder = parent.nSubproblems()
        # solveFlag indicates whether or not the subproblem is to be
        # solved at all.
        self.solveFlag = True

        self.defnChanged = timestamp.TimeStamp() # fields or eqns changed
        self.solutiontimestamp = timestamp.TimeStamp() # last "solve" command
        self.solutiontimestamp.backdate()

        self.solverStats = solverstats.SolverStats()
        self.newMatrixCount = 0 # no. of time matrices have been rebuilt.

        self.requestCallback(("preremove who", "SubProblem"),
                             self.preremoveCB)
        self.requestCallback("subproblem redefined", self.redefinedCB)

        self.matrix_symmetry_K = symstate.SymState()
        self.matrix_symmetry_C = symstate.SymState()
        self.matrix_symmetry_M = symstate.SymState()

        # If a SubProblemType's Registration has a callable 'startup'
        # member, it's invoked here.  This can be used to set up
        # switchboard signals, for instance.  A corresponding
        # 'cleanup' function is called when the subproblem is
        # destroyed.
        try:
            startupfn = self.subptype.getRegistration().startup
        except AttributeError:
            pass
        else:
            startupfn(self)
示例#18
0
    def __init__(self, name, classname, skel, parent):
        # All of the args have to be given, although not all are used.
        # This is because the constructor is called by WhoClass.add,
        # which assumes that the arguments are the same as those of
        # Who.__init__.  Probably a better solution using
        # RegisteredClasses could be found.

        if config.dimension() == 3:
            self.faceboundaries = utils.OrderedDict()
        self.edgeboundaries = utils.OrderedDict()
        self.pointboundaries = utils.OrderedDict()
        self.selectedBdyName = None
        # There are two boundary timestamps, one for keeping track of
        # changes in the currently selected boundary, and another for
        # keeping track of changes to the configuration of boundaries
        # in any of these skeletons.  They are queried by their
        # respective displays in skeletonbdydisplay.py.
        ## TODO 3.1: The second of these timestamps (bdytimestamp) is
        ## obsolete and has been removed.  Is the first also obsolete?
        self.bdyselected = timestamp.TimeStamp()

        # Various selection objects live here.  Instance the
        # selections from their constructors.  To get the current
        # selection, do "context.elementselection.retrieve()".
        self.nodeselection = skeletonselectable.NodeSelection(self)
        self.segmentselection = skeletonselectable.SegmentSelection(self)
        if config.dimension() == 3:
            self.faceselection = skeletonselectable.FaceSelection(self)
        self.elementselection = skeletonselectable.ElementSelection(self)
        self.pinnednodes = skeletonselectable.PinnedNodeSelection(self)

        # These attribute names (nodegroups, segmentgroups,
        # elementgroups) are used in the generic menu callback in
        # IO/skeletongroupmenu.py.  Also in skeletonselectionmod.py.
        # Change them in all places (or none, of course.)
        self.nodegroups = skeletongroups.NodeGroupSet(self)
        self.segmentgroups = skeletongroups.SegmentGroupSet(self)
        self.facegroups = skeletongroups.FaceGroupSet(self)
        self.elementgroups = skeletongroups.ElementGroupSet(self)

        # WhoDoUndo.__init__ calls pushModification, so timing is
        # important.  pushModification calls implied_select for all
        # the selections, so the selection objects have to exist at
        # this point.
        whoville.WhoDoUndo.__init__(self,
                                    name,
                                    'Skeleton',
                                    skel,
                                    parent,
                                    overwritefn=self.skeletonStackOverwrite)

        # When a skeleton with deputies is overwritten, a reference to
        # it must be kept as long any deputies exist.
        self.zombieSheriff = None

        # Ensure that the passed-in obj really does start a new "family."
        ## TODO OPT: Restore this, or delete this block if it's
        ## unnecessary.  In 2D, skel.disconnect() calls
        ## SkeletonSelectable.disconnect() for all selectables, which
        ## severs their parent/child relationships.  This is probably
        ## only necessary when copying a SkeletonContext.
        #skel.disconnect()

        # Ask the initial skel about any pre-existing boundaries.
        fbs = skel.getFaceBoundaries()
        for (name, bdy) in fbs.items():
            self.faceboundaries[name] = \
                bdy.makeContextBoundary(self, name, skel)

        ebs = skel.getEdgeBoundaries()
        for (name, bdy) in ebs.items():
            self.edgeboundaries[name] = \
                bdy.makeContextBoundary(self, name, skel)

        pbs = skel.getPointBoundaries()
        for name in pbs:
            self.pointboundaries[name] = \
              pbs[name].makeContextBoundary(self, name, skel)

        self.requestCallback("destroy pixel group", self.ms_grp_changed)
        self.requestCallback("changed pixel group", self.ms_grp_changed)
        self.requestCallback("changed pixel groups", self.ms_grps_changed)
        self.requestCallback('materials changed in microstructure',
                             self.materialsChanged)
示例#19
0
文件: meshinfo.py 项目: song2001/OOF2
 def __init__(self, context):
     self.timestamp = timestamp.TimeStamp()
     self.context = context
     self.objects = {"Node":None}
示例#20
0
 def __init__(self):
     self.layers = []  # Displaymethod objects, from bottom to top.
     self.layerChangeTime = timestamp.TimeStamp()
     self.sorted = True
     # This lock just protects the local list.
     self.lock = lock.SLock()
示例#21
0
 def __init__(self, who=whoville.nobody):
     self.who = who
     self.methods = []  # DisplayMethod objects
     self.whotime = timestamp.TimeStamp()  # When self.who was changed last
     self.forced = 0  # should it be incorporated into a
示例#22
0
 def __init__(self, gfxwindow):
     self.point = None  # location of last query
     self.timestamp = timestamp.TimeStamp()
     toolbox.Toolbox.__init__(self, "Pixel_Info", gfxwindow)