Exemple #1
0
 def makeMenu(self, menu):
     self.menu = menu
     menu.addItem(oofmenu.OOFMenuItem(
             'MoveNode',
             callback = self.moveNode,
             params=[
                 parameter.IntParameter(
                     'node', tip='Index of the node to be moved.'),
                     primitives.PointParameter(
                     'destination', tip=parameter.emptyTipString)],
             help="Move a node to another positon.",
             discussion=xmlmenudump.loadFile(
                 'DISCUSSIONS/engine/menu/move_node.xml')
             ))
     menu.addItem(oofmenu.OOFMenuItem(
             'SelectNode',
             callback = self.selectNode,
             params=[
                 primitives.PointParameter(
                     'position', tip=parameter.emptyTipString),
                 view.ViewParameter('view')],
             help="Select a node to move.",
             discussion=xmlmenudump.loadFile(
                 'DISCUSSIONS/engine/menu/select_move_node.xml')
             ))
     menu.addItem(oofmenu.OOFMenuItem(
             'AllowIllegal',
             callback = self.allowIllegal,
             params=[parameter.BooleanParameter(
                     'allowed', 0, tip=parameter.emptyTipString)],
             help="Are illegal elements allowed?",
             discussion=xmlmenudump.loadFile(
                 'DISCUSSIONS/engine/menu/allow_illegal.xml')
             ))
Exemple #2
0
    def makeMenu(self, menu):
        self.menu = menu
        if config.dimension() == 2:
            pixelname = 'pixel'
        else:
            pixelname = 'voxel'
        positionparams = [
            primitives.PointParameter(
                'point', tip='The position of the queried %s.' % pixelname)
            ]
        if config.dimension() == 3:
            positionparams.append(view.ViewParameter('view'))
        # positionparams=[
        #     parameter.IntParameter('x', 0, tip="The x coordinate."),
        #     parameter.IntParameter('y', 0, tip="The y coordinate.")]
        # if config.dimension() == 3:
        #     positionparams.append(
        #         parameter.IntParameter('z', 0, tip="The z coordinate."))
        helpstring = "Query the %s at the given point." % pixelname

        menu.addItem(oofmenu.OOFMenuItem(
            'Query',
            callback=self.queryPixel,
            params=positionparams,
            help=helpstring,
            discussion="""<para>
            Display information about the %s at the given screen
            coordinate.  In GUI mode, the information appears in the
            <link linkend='Section:Graphics:PixelInfo'>Pixel
            Info</link> toolbox in the graphics window.  This command
            has no effect when the GUI is not running.
            </para>""" % pixelname
            ))
        menu.addItem(oofmenu.OOFMenuItem(
                'QueryDirectly',
                callback=self.queryPixelDirectly,
                params=[primitives.PointParameter(
                        'voxel', tip="The coordinates of the queried voxel.")],
                help="Query the voxel at the given position in the image.",
                discussion="""<para>
                Display information about the voxel at the given
                position.  In GUI mode, the information appears in the
                <link linkend='Section:Graphics:PixelInfo'>PIxel
                Info</link> toolbox in the graphics window.  This
                command has no effect when the GUI is not running.
                </para>"""
                ))
        menu.addItem(oofmenu.OOFMenuItem(
            'Clear',
            callback=self.clearPixel,
            params=[],
            help="Reset the pixel info toolbox.",
            discussion="""<para>
            Clear any displayed information from previous mouse clicks.
            In GUI mode, this clears the <link
            linkend='Section:Graphics:PixelInfo'>Pixel Info</link>
            toolbox in the graphics window.  This command has no
            effect if the GUI is not running.
            </para>"""
            ))
Exemple #3
0
 def makeMenu(self, menu):
     self.menu = menu
     menu.addItem(
         oofmenu.OOFMenuItem(
             'QueryElement',
             callback=self.queryElem,
             params=[
                 primitives.PointParameter('position', tip='Target point.')
             ],
             help="Query the element closest to the given point.",
             discussion=xmlmenudump.loadFile(
                 'DISCUSSIONS/engine/menu/query_skel_elem.xml')))
     menu.addItem(
         oofmenu.OOFMenuItem(
             'QueryElementByID',
             callback=self.queryElemByID,
             params=[parameter.IntParameter('index', tip="Element index.")],
             help="Query the element with the given index.",
             discussion=xmlmenudump.loadFile(
                 'DISCUSSIONS/engine/menu/query_skel_elem_id.xml')))
     menu.addItem(
         oofmenu.OOFMenuItem(
             'QuerySegment',
             callback=self.querySgmt,
             params=[
                 primitives.PointParameter('position', tip='Target point.')
             ],
             help="Query the segment closest to the given point.",
             discussion=xmlmenudump.loadFile(
                 'DISCUSSIONS/engine/menu/query_skel_sgmt.xml')))
     menu.addItem(
         oofmenu.OOFMenuItem(
             'QuerySegmentByID',
             callback=self.querySgmtByID,
             params=[parameter.IntParameter('index', tip="Segment index.")],
             help="Query the segment with the given index.",
             discussion=xmlmenudump.loadFile(
                 'DISCUSSIONS/engine/menu/query_skel_sgmt_id.xml')))
     menu.addItem(
         oofmenu.OOFMenuItem(
             'QueryNode',
             callback=self.queryNode,
             params=[
                 primitives.PointParameter('position', tip='Target point.')
             ],
             help="Query the node closest to the given point.",
             discussion=xmlmenudump.loadFile(
                 'DISCUSSIONS/engine/menu/query_skel_node.xml')))
     menu.addItem(
         oofmenu.OOFMenuItem(
             'QueryNodeByID',
             callback=self.queryNodeByID,
             params=[parameter.IntParameter(
                 'index',
                 tip="Node index.",
             )],
             help="Query the node with the given index.",
             discussion=xmlmenudump.loadFile(
                 'DISCUSSIONS/engine/menu/query_skel_node_id.xml')))
Exemple #4
0
 def makeMenu(self, menu):
     self.menu = menu
     menu.addItem(oofmenu.OOFMenuItem(
         'QueryElement',
         callback=self.queryElem,
         params=[primitives.PointParameter('position', tip='Target point.')],
         help="Query an FE element at a given point.",
         discussion=xmlmenudump.loadFile('DISCUSSIONS/engine/menu/query_mesh_elem.xml')
         ))
     menu.addItem(oofmenu.OOFMenuItem(
         'QueryNode',
         callback=self.queryNode,
         params=[primitives.PointParameter('position', tip='Target point.')],
         help="Query an FE node at a given point.",
         discussion=xmlmenudump.loadFile('DISCUSSIONS/engine/menu/query_mesh_node.xml')
         ))
Exemple #5
0
 def makeMenu(self, menu):
     mismenu = menu.addItem(oofmenu.OOFMenuItem('Misorientation'))
     mismenu.addItem(
         oofmenu.OOFMenuItem(
             "Set_Reference",
             callback=self.setReference,
             params=[
                 primitives.PointParameter(
                     'point', tip="The location of the reference pixel."),
                 parameter.ConvertibleRegisteredParameter(
                     'orientation',
                     orientationmatrix.Orientation,
                     tip='Calculate misorientations relative to this.')
             ],
             help="Set the reference orientation."))
     symcmd = mismenu.addItem(
         oofmenu.OOFMenuItem(
             "Set_Symmetry",
             callback=self.setSymmetry,
             params=[latticesystem.LatticeSymmetryParameter('symmetry')],
             help="Set lattice symmetry used when comparing orientations"))
     self.symmetry = symcmd.get_arg('symmetry').value
Exemple #6
0
                    reporter.report(msg)
                else:
                    reporter.report("No enclosing element found!\n")
            else:
                #Backend sends report to front end
                mpitools.Send_String(reportstring,0)
                mpitools.Send_Double(distance2,0)
    finally:
        skelcontext.end_reading()

smenu.addItem(oofmenu.OOFMenuItem(
    'Skel_Info_Query',
    callback=parallel_skel_info_query,
    threadable=oofmenu.PARALLEL_THREADABLE,
    params=[StringParameter('targetname'),
            primitives.PointParameter('position', tip='Target point.'),
            WhoParameter('skeleton', skeletoncontext.skeletonContexts,
                         tip=parameter.emptyTipString)]
    ))

#############################################################################
#

def parallel_move_node(menuitem, origin, destination,
                       allow_illegal,
                       skeletonpath):
    skelcontext = skeletoncontext.skeletonContexts[skeletonpath]
    #skelcontext = self.gfxwindow().topwho('Skeleton')
    if skelcontext:
        skeleton = skelcontext.getObject().deputyCopy()
        skeleton.activate()
Exemple #7
0
    except KeyError:
        pass
    else:
        oldms.lockAndDelete()
    ms = ooflib.SWIG.common.cmicrostructure.CMicrostructure(name, isize, size)


micromenu.addItem(
    oofmenu.OOFMenuItem(
        'New',
        callback=_newMicrostructure,
        params=[
            parameter.StringParameter('name', tip="Name of Microstructure."),
            primitives.iPointParameter(
                'isize', tip="Pixel resolution of Microstructure."),
            primitives.PointParameter('size',
                                      tip="Physical size of Microstructure.")
        ],
        help="Create a new Microstructure.  Used internally in data files.",
        discussion="""<para>Create a new <quote>empty</quote> &micro;,
    containing no data other than its size.  This command is used only
    in <link linkend='MenuItem:OOF.LoadData.Microstructure'>data
    files</link>.</para>"""))

##########


def _newpixelgroup(menuitem, microstructure, group, meshable):
    mscontext = ooflib.common.microstructure.microStructures[microstructure]
    ms = mscontext.getObject()
    mscontext.begin_writing()
    try:
Exemple #8
0
    )

#=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=#

class SinglePoint(Domain):
    def __init__(self, point):
        self.point = point
    def get_points(self):
        return [self.point]

registeredclass.Registration(
    'Single Point',
    Domain,
    SinglePoint,
    ordering=0.5,
    params=[primitives.PointParameter(
            'point', tip='Undisplaced position of the sample point.')
            ],
    sample_types=[analysissample.POINT],
    tip='Use a single point for the post-processing domain.',
    discussion=xmlmenudump.loadFile('DISCUSSIONS/engine/reg/pointdomain.xml')
)

#=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=#

class SegmentSide(enum.EnumClass('LEFT', 'RIGHT')):
    tip="The side of an element edge on which output data should be computed."
    discussion=xmlmenudump.loadFile('DISCUSSIONS/engine/enum/segmentside.xml')

class SkeletonEdgeBoundaryDomain(Domain):
    def __init__(self, boundary, side):
        self.boundary = boundary
Exemple #9
0
    registry = []

class BoxSelectionShape(SelectionShape):
    def __init__(self, point0, point1):
        self.point0 = point0
        self.point1 = point1
    def scaled(self, factors):   # factors is a Point
        return BoxSelectionShape(self.point0.scale(factors),
                                 self.point1.scale(factors))

registeredclass.Registration(
    'Box',
    SelectionShape,
    BoxSelectionShape,
    ordering=0,
    params=[primitives.PointParameter(
            "point0", tip="One corner of the box."),
            primitives.PointParameter(
            "point1", tip="The diagonally opposite corner of the box.")
            ],
    tip="Select a rectangular region defined by diagonally opposing corners.")

class CircleSelectionShape(SelectionShape):
    def __init__(self, center, radius):
        self.center = center
        self.radius = radius
    def scaled(self, factors):
        avgscale = factors.x + factors.y
        if config.dimension() == 3:
            avgscale += factors.z
        avgscale = avgscale/config.dimension()
        return CircleSelectionShape(self.center.scale(factors),
Exemple #10
0
class MeshCrossSection(registeredclass.RegisteredClass):
    registry = []


MeshCrossSection.tip = "Paths within a Mesh for post-processing."
MeshCrossSection.discussion = xmlmenudump.loadFile(
    "DISCUSSIONS/engine/reg/meshcrosssection.xml")


class StraightCrossSection(MeshCrossSection):
    # start and end should be primitives.Point objects...
    def __init__(self, start, end):
        self.start = start
        self.end = end


registeredclass.Registration('Straight',
                             MeshCrossSection,
                             StraightCrossSection,
                             1,
                             params=[
                                 primitives.PointParameter(
                                     'start', tip="Starting point."),
                                 primitives.PointParameter('end',
                                                           tip="Ending point.")
                             ],
                             tip="Cross section defined by two points.",
                             discussion="""<para>
    A Cross Section which is a straight line, defined by its endpoints.
    </para>""")
Exemple #11
0
    def makeMenu(self, menu):
        self.menu = menu
        if config.dimension() == 2:
            pinparams = [
                self.skeleton_param,
                primitives.PointParameter('point', tip='Target point.')
            ]
        else:  # 3D
            pinparams = [
                self.skeleton_param,
                primitives.PointParameter('point', tip='Target point'),
                view.ViewParameter('view')
            ]

        menu.addItem(
            oofmenu.OOFMenuItem(
                'Pin',
                callback=self.pin,
                params=pinparams,
                help="Pin the node closest to the given point.",
                discussion=xmlmenudump.loadFile(
                    'DISCUSSIONS/engine/menu/pin.xml')))
        menu.addItem(
            oofmenu.OOFMenuItem(
                'UnPin',
                callback=self.unpin,
                params=pinparams,
                help="Unpin the node closest to the given point.",
                discussion=xmlmenudump.loadFile(
                    'DISCUSSIONS/engine/menu/unpin.xml')))
        menu.addItem(
            oofmenu.OOFMenuItem(
                'TogglePin',
                callback=self.togglepin,
                params=pinparams,
                help=
                "Toggle the pinnedness of the node closest to the given point.",
                discussion=xmlmenudump.loadFile(
                    'DISCUSSIONS/engine/menu/toggle_pin.xml')))
        menu.addItem(
            oofmenu.OOFMenuItem('UnPinAll',
                                callback=pinnodesmodifier.unpinall,
                                params=[self.skeleton_param],
                                help="Unpin all nodes.",
                                discussion=xmlmenudump.loadFile(
                                    'DISCUSSIONS/engine/menu/unpin_all.xml')))
        menu.addItem(
            oofmenu.OOFMenuItem('Invert',
                                callback=pinnodesmodifier.invert,
                                params=[self.skeleton_param],
                                help="Invert pinned nodes.",
                                discussion=xmlmenudump.loadFile(
                                    'DISCUSSIONS/engine/menu/invert_pin.xml')))

        menu.addItem(
            oofmenu.OOFMenuItem('Undo',
                                callback=pinnodesmodifier.undo,
                                params=[self.skeleton_param],
                                help="Undo the latest pin.",
                                discussion=xmlmenudump.loadFile(
                                    'DISCUSSIONS/engine/menu/undo_pin.xml')))
        menu.addItem(
            oofmenu.OOFMenuItem('Redo',
                                callback=pinnodesmodifier.redo,
                                params=[self.skeleton_param],
                                help="Redo the latest undone pin.",
                                discussion=xmlmenudump.loadFile(
                                    'DISCUSSIONS/engine/menu/redo_pin.xml')))
Exemple #12
0
            #Find closest element among those "nominated" by each process
            for proc in range(_size):
                if distance2list[proc] >= 0:
                    if distance2list[proc] < dmin:
                        dmin = distance2list[proc]
                        dmin_proc = proc
            if dmin_proc != -1:
                msg += "From process %d:" % dmin_proc
                msg += reportstringlist[dmin_proc]
                reporter.report(msg)
            else:
                reporter.report("No enclosing element found!\n")
        else:
            #Backend sends report to front end
            mpitools.Send_String(reportstring, 0)
            mpitools.Send_Double(distance2, 0)


ipcmeshmenu.addItem(
    oofmenu.OOFMenuItem('Mesh_Info_Query',
                        callback=parallel_mesh_info_query,
                        threadable=oofmenu.PARALLEL_THREADABLE,
                        params=[
                            StringParameter('targetname'),
                            primitives.PointParameter('position',
                                                      tip='Target point.'),
                            whoville.WhoParameter('mesh',
                                                  ooflib.engine.mesh.meshes,
                                                  tip=parameter.emptyTipString)
                        ]))