示例#1
0
 def updateNodeList(self, nodes):
     namelist = [
         "%s %d at %s" % (node.classname(), node.uiIdentifier(),
                          genericinfoGUI.posString(node.position()))
         for node in nodes
     ]
     mainthread.runBlock(self.nodes.update, (nodes, namelist))
示例#2
0
 def updateNodeList(self, chsr, objlist, element=None):
     namelist = [
         "Node %d at %s" %
         (obj.uiIdentifier(), genericinfoGUI.posString(obj.position()))
         for obj in objlist
     ]
     mainthread.runBlock(chsr.update, (objlist, namelist))
示例#3
0
 def updateNodeList(self, chsr, objlist, element=None):
     if element is None or config.dimension() == 3:
         namelist = [
             "Node %d at %s" %
             (obj.uiIdentifier(), genericinfoGUI.posString(obj.position()))
             for obj in objlist
         ]
     else:
         # 2D, element given.  Include angle info.
         namelist = [
             "Node %d at %s (angle: %g)" %
             (obj.uiIdentifier(), genericinfoGUI.posString(obj.position()),
              element.getRealAngle(element.nodes.index(obj)))
             for obj in objlist
         ]
     mainthread.runBlock(chsr.update, (objlist, namelist))
示例#4
0
    def update(self, indx):
        debug.subthreadTest()
        if indx is not None:
            meshctxt = self.gfxtoolbox.getMeshContext()
            meshctxt.begin_reading()
            try:
                femesh = meshctxt.getObject()
                node = femesh.getNode(indx)
                # node probably can't be None, but it doesn't hurt to
                # check.
                if node is not None:
                    # Find out which fields are defined at the node
                    fieldnames = node.fieldNames()  # compound field names
                    nfieldrows = 0
                    listedfields = []
                    for fieldname in fieldnames:
                        fld = field.getField(fieldname)
                        nfieldrows += fld.ndof()
                        listedfields.append(fld)
                        if config.dimension() == 2:
                            zfld = fld.out_of_plane()
                            if node.hasField(zfld):
                                listedfields.append(zfld)
                                nfieldrows += zfld.ndof()
                        tfld = fld.time_derivative()
                        if node.hasField(tfld):
                            listedfields.append(tfld)
                            nfieldrows += tfld.ndof()
                    # Rebuild the table of field values, but only if the
                    # fields have changed.
                    if self.fieldslisted != listedfields:
                        mainthread.runBlock(self.rebuildFieldTable, (
                            nfieldrows,
                            listedfields,
                        ))

                    # Get the field values for the table.
                    fieldvals = []
                    # The structure of this loop must match the loop
                    # in update_thread, below.
                    for fld in self.fieldslisted:
                        fcomp = fld.iterator(planarity.ALL_INDICES)
                        while not fcomp.end():
                            fieldvals.append(
                                fld.value(femesh, node, fcomp.integer()))
                            fcomp.next()
                    # end loop over field values
                    mainthread.runBlock(self.update_thread,
                                        ( ` node.index() `, node.classname(),
                                          genericinfoGUI.posString(
                                              node.position()), fieldvals))
                    return
                # end if node is not None
            finally:
                meshctxt.end_reading()
        # end if indx is not None

        # No node
        mainthread.runBlock(self.update_thread, ("", "", "", []))
示例#5
0
    def update(self, indx):
        debug.subthreadTest()
        skelctxt = self.getContext()
        skeleton = skelctxt.getObject()
        if indx is not None and 0 <= indx < skeleton.nnodes():
            skelctxt.begin_reading()
            try:
                node = skeleton.getNode(indx)
                assert node is not None
                self.updateElementList(self.elem, node.getElements())
                self.updateSegmentList(self.segs,
                                       skeleton.getNodeSegments(node))
                if config.dimension() == 3:
                    self.updateFaceList(self.faces,
                                        skeleton.getNodeFaces(node))
                nuid = ` indx `
                npos = genericinfoGUI.posString(node.position())

                movabilities = [
                    node.movable_x(),
                    node.movable_y(),
                    node.movable_z()
                ]
                nmobile = sum(movabilities)
                if nmobile == config.dimension():
                    mobstr = "free"
                elif nmobile == 0:
                    if node.pinned():
                        mobstr = "pinned"
                    else:
                        mobstr = "fixed"
                else:  # nmobile = 1 or 2
                    # mobstr is something like "x only" or "x and y only"
                    m = [
                        "xyz"[i] for i in range(config.dimension())
                        if movabilities[i]
                    ]
                    mobstr = " and ".join(m) + " only"

                bdynames = [
                    nm for (nm, bdy) in skelctxt.pointboundaries.items()
                    if bdy.current_boundary().hasNode(node)
                ]

                grpnames = node.groupNames()

                mainthread.runBlock(self.update_thread,
                                    (nuid, npos, mobstr, ", ".join(grpnames),
                                     ", ".join(bdynames)))
                return
            finally:
                skelctxt.end_reading()
        # end if indx is not None
        # Nothing to display
        mainthread.runBlock(self.update_thread, ("", "", "", "", ""))
        mainthread.runBlock(self.clearObjLists)