Beispiel #1
0
            help="Toggle the display of elements with no Material.",
            discussion=xmlmenudump.loadFile(
                'DISCUSSIONS/common/menu/hideempty.xml')))
    item.data = gfxwindow


switchboard.requestCallback('open graphics window', addToGfxSettings)
ghostgfxwindow.defineGfxSetting('hideEmptyElements', True)

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

# Common mesh display parameters.

meshdispparams = [
    placeholder.TimeParameter('when',
                              value=placeholder.latest,
                              tip='Time at which to plot'),
    output.PositionOutputParameter(
        'where',
        outputDefs.originalPosition,
        tip="Plot at displaced or original position?")
]

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

# Skeleton and Mesh display methods are very similar, except for how
# they get some of their data.  These two base classes encapsulate the
# *differences* between Skeletons and Meshes, as far as displaying is
# concerned.  They're mixed in with other base classes to create the
# actual DisplayMethods.
Beispiel #2
0
        try:
            meshobj = meshctxt.getObject()
            femesh.init_field(meshobj.skeleton, meshobj, field)
        finally:
            meshctxt.releaseCachedData()

    def shortrepr(self):
        return "mesh=%s" % self.mesh


othermeshparams = [
    whoville.WhoParameter('mesh',
                          ooflib.engine.mesh.meshes,
                          tip='Copy field values from this Mesh.'),
    placeholder.TimeParameter(
        'time',
        value=placeholder.latest,
        tip='Use values at this time in the source Mesh.')
]


class ScalarOtherMeshInit(OtherMeshFieldInit, ScalarFieldInit):
    pass


registeredclass.Registration(
    "Other Mesh",
    ScalarFieldInit,
    ScalarOtherMeshInit,
    2,
    params=othermeshparams,
    tip="Initialize a scalar field from the same field on another mesh.",
Beispiel #3
0
    def __init__(self):
        self.built = False
        oofGUI.MainPage.__init__(self,
                                 name="Boundary Analysis",
                                 ordering=271,
                                 tip="Examine the boundaries of the system.")

        self.timeparam = placeholder.TimeParameter('time', value=0.0)

        mainbox = gtk.VBox(spacing=2)
        self.gtk.add(mainbox)

        align = gtk.Alignment(xalign=0.5)
        mainbox.pack_start(align, expand=0, fill=0)
        centerbox = gtk.HBox(spacing=3)
        align.add(centerbox)
        self.meshwidget = whowidget.WhoWidget(ooflib.engine.mesh.meshes,
                                              callback=self.meshCB,
                                              scope=self)
        label = gtk.Label("Microstructure=")
        label.set_alignment(1.0, 0.5)
        centerbox.pack_start(label, expand=0, fill=0)
        centerbox.pack_start(self.meshwidget.gtk[0], expand=0, fill=0)
        label = gtk.Label("Skeleton=")
        label.set_alignment(1.0, 0.5)
        centerbox.pack_start(label, expand=0, fill=0)
        centerbox.pack_start(self.meshwidget.gtk[1], expand=0, fill=0)
        label = gtk.Label("Mesh=")
        label.set_alignment(1.0, 0.5)
        centerbox.pack_start(label, expand=0, fill=0)
        centerbox.pack_start(self.meshwidget.gtk[2], expand=0, fill=0)

        align = gtk.Alignment(xalign=0.5)
        mainbox.pack_start(align, expand=0, fill=0)
        centerbox = gtk.HBox(spacing=3)
        align.add(centerbox)
        self.timeWidget = self.timeparam.makeWidget(scope=self)
        centerbox.pack_start(gtk.Label("Time:"), expand=0, fill=0)
        centerbox.pack_start(self.timeWidget.gtk, expand=0, fill=0)

        mainpane = gtk.HPaned()
        gtklogger.setWidgetName(mainpane, 'Pane')
        mainbox.pack_start(mainpane, expand=1, fill=1)
        gtklogger.connect_passive(mainpane, 'notify::position')

        leftbox = gtk.VBox()
        mainpane.pack1(leftbox, resize=1, shrink=0)  # ??

        boundarylistframe = gtk.Frame("Boundaries")
        gtklogger.setWidgetName(boundarylistframe, 'frame')
        boundarylistframe.set_shadow_type(gtk.SHADOW_IN)
        leftbox.pack_start(boundarylistframe, expand=1, fill=1)

        self.bdylist = chooser.ScrolledChooserListWidget(
            callback=self.boundarylistCB,
            dbcallback=self.doubleclickCB,
            autoselect=1,
            name="BoundaryList")
        boundarylistframe.add(self.bdylist.gtk)

        rightbox = gtk.VBox()
        mainpane.pack2(rightbox, resize=1, shrink=0)  # ??

        analyzerframe = gtk.Frame("Boundary Operation")
        analyzerframe.set_shadow_type(gtk.SHADOW_IN)
        rightbox.pack_start(analyzerframe, expand=1, fill=1)
        self.analysisWidget = regclassfactory.RegisteredClassFactory(
            meshbdyanalysis.MeshBdyAnalyzer.registry,
            scope=self,
            name="BdyAnalyzerRCF")
        analyzerframe.add(self.analysisWidget.gtk)

        self.buildBottomRow(mainbox)
        # hbox2 = gtk.HBox(homogeneous=True)
        # namebox.pack_start(hbox2, expand=0, fill=0)

        # self.create_button = gtkutils.StockButton(gtk.STOCK_NEW, 'Create...')
        # hbox2.pack_start(self.create_button, expand=1, fill=1)
        # gtklogger.setWidgetName(self.create_button, 'Set')
        # gtklogger.connect(self.create_button, 'clicked', self.createCB)
        # tooltips.set_tooltip_text(
        #     self.create_button,
        #     "Assign a name to the current analysis operation,"
        #     " so that it can be retrieved later.")

        # self.retrieve_button = gtkutils.StockButton(gtk.STOCK_REFRESH,
        #                                             'Retrieve...')
        # hbox2.pack_start(self.retrieve_button, expand=1, fill=1)
        # gtklogger.connect(self.retrieve_button, 'clicked', self.retrieveCB)
        # tooltips.set_tooltip_text(self.retrieve_button,
        #                           'Retrieve a name analysis.')

        # hbox3 = gtk.HBox(homogeneous=True)
        # namebox.pack_start(hbox3, expand=0, fill=0)

        # self.savenamed_button = gtkutils.StockButton(gtk.STOCK_SAVE_AS,
        #                                              'Save...')
        # hbox3.pack_start(self.savenamed_button, expand=1, fill=1)
        # gtklogger.setWidgetName(self.savenamed_button, 'Save')
        # gtklogger.connect(self.savenamed_button, 'clicked', self.savenamedCB)
        # tooltips.set_tooltip_text(self.savenamed_button,
        #                      'Save definitions of named analyses to a file.')

        # self.delete_button = gtkutils.StockButton(gtk.STOCK_DELETE, 'Delete...')
        # hbox3.pack_start(self.delete_button, expand=1, fill=1)
        # gtklogger.setWidgetName(self.delete_button, 'Delete')
        # gtklogger.connect(self.delete_button, 'clicked', self.deleteCB)
        # tooltips.set_tooltip_text(self.delete_button,
        #                      "Delete a named analysis operation")

        # # Destination
        # destframe = gtk.Frame("Destination")
        # destframe.set_shadow_type(gtk.SHADOW_IN)
        # hbox.pack_start(destframe, expand=1, fill=1, padding=3)
        # destbox = gtk.HBox()
        # destframe.add(destbox)
        # self.destwidget = outputdestinationwidget.TextDestinationWidget(
        #     name="Destination", framed=False)
        # destbox.pack_start(self.destwidget.gtk, expand=1, fill=1, padding=2)

        # # Go button
        # self.gobutton = gtkutils.StockButton(gtk.STOCK_EXECUTE, "Go!")
        # gtklogger.setWidgetName(self.gobutton, 'Go')
        # gtklogger.connect(self.gobutton, "clicked", self.goCB)
        # tooltips.set_tooltip_text(self.gobutton,
        #                           "Send the output to the destination.")
        # hbox.pack_end(self.gobutton, expand=1, fill=1, padding=2)

        self.built = True

        switchboard.requestCallbackMain(("new who", "Mesh"), self.newmeshCB)
        switchboard.requestCallbackMain(("new who", "Skeleton"),
                                        self.newskelCB)
        switchboard.requestCallbackMain(self.meshwidget, self.meshwidgetCB)
        switchboard.requestCallbackMain("mesh changed", self.meshchangedCB)
        switchboard.requestCallbackMain(self.analysisWidget,
                                        self.analysisWidgetCB)
        switchboard.requestCallbackMain("new boundary created", self.newbdyCB)
        switchboard.requestCallbackMain("boundary removed", self.newbdyCB)
        switchboard.requestCallbackMain("boundary renamed", self.newbdyCB)
        switchboard.requestCallbackMain("named boundary analyses changed",
                                        self.analysesChangedCB)
        switchboard.requestCallbackMain("retrieve boundary analysis",
                                        self.retrieve_analysis)
        switchboard.requestCallbackMain(('validity', self.timeWidget),
                                        self.validityChangeCB)
        switchboard.requestCallbackMain("mesh status changed",
                                        self.meshchangedCB)
Beispiel #4
0
from ooflib.engine.IO import outputdestination
import ooflib.engine.mesh
import string
import types

bdyanalysismenu = meshmenu.meshmenu.addItem(
    oofmenu.OOFMenuItem(
        'Boundary_Analysis',
        help="Compute properties of the solution on boundaries."))

mesh_param = whoville.WhoParameter(
    'mesh',
    ooflib.engine.mesh.meshes,
    tip="The mesh on which to perform the analysis.")

time_param = placeholder.TimeParameter(
    'time', tip='Time at which to perform the analysis.')

bdy_param = meshparameters.MeshEdgeBdyParameter('boundary',
                                                tip="The boundary to analyze.")

analyzer_param = parameter.RegisteredParameter(
    'analyzer',
    meshbdyanalysis.MeshBdyAnalyzer,
    tip="Operation to perform on the boundary.")

destination_param = outputdestination.OutputDestinationParameter(
    'destination',
    value=outputdestination.msgWindowOutputDestination,
    tip="Where the data should be written.")

Beispiel #5
0
    def __init__(self):
        oofGUI.MainPage.__init__(
            self,
            name="Analysis",
            ordering=259,
            tip="Query the mesh, examine fields and fluxes.")

        self.timeparam = placeholder.TimeParameter('time', value=0.0)

        mainbox = gtk.VBox()
        self.gtk.add(mainbox)

        align = gtk.Alignment(xalign=0.5)
        mainbox.pack_start(align, expand=0, fill=0)
        centerbox = gtk.HBox(spacing=3)
        align.add(centerbox)
        self.meshwidget = whowidget.WhoWidget(ooflib.engine.mesh.meshes,
                                              scope=self)
        # The mesh widget callback is not required, because the field
        # and flux widgets in the "output" widget (which are members
        # of a parameter table, which is a component of the
        # OutputWidget) are context-sensitive and update themselves
        # automatically.
        label = gtk.Label("Microstructure=")
        label.set_alignment(1.0, 0.5)
        centerbox.pack_start(label, expand=0, fill=0)
        centerbox.pack_start(self.meshwidget.gtk[0], expand=0, fill=0)
        label = gtk.Label("Skeleton=")
        label.set_alignment(1.0, 0.5)
        centerbox.pack_start(label, expand=0, fill=0)
        centerbox.pack_start(self.meshwidget.gtk[1], expand=0, fill=0)
        label = gtk.Label("Mesh=")
        label.set_alignment(1.0, 0.5)
        centerbox.pack_start(label, expand=0, fill=0)
        centerbox.pack_start(self.meshwidget.gtk[2], expand=0, fill=0)

        align = gtk.Alignment(xalign=0.5)
        mainbox.pack_start(align, expand=0, fill=0)
        centerbox = gtk.HBox(spacing=3)
        align.add(centerbox)
        self.timeWidget = self.timeparam.makeWidget(scope=self)
        centerbox.pack_start(gtk.Label("Time:"), expand=0, fill=0)
        centerbox.pack_start(self.timeWidget.gtk, expand=0, fill=0)

        mainvpane = gtk.VPaned()
        mainbox.pack_start(mainvpane, expand=1, fill=1)
        self.topPane = gtk.HPaned()
        gtklogger.setWidgetName(self.topPane, 'top')
        mainvpane.pack1(self.topPane, resize=1, shrink=0)
        self.btmPane = gtk.HPaned()
        gtklogger.setWidgetName(self.btmPane, 'bottom')
        mainvpane.pack2(self.btmPane, resize=1, shrink=0)
        # The four panes (Output, Domain, Operation, and Sampling) are
        # contained in the top and bottom HPaneds.  The dividers
        # between the sub panes are synchronized with each other.
        # Since Paneds don't have a dedicated signal indicating that
        # their dividers have been moved, we have to use the the
        # generic 'notify' signal.
        self.paneSignals = {
            self.topPane:
            gtklogger.connect(self.topPane, 'notify::position',
                              self.paneMovedCB, self.btmPane),
            self.btmPane:
            gtklogger.connect(self.btmPane, 'notify::position',
                              self.paneMovedCB, self.topPane)
        }

        # Output
        self.outputframe = gtk.Frame(label="Output")
        self.outputframe.set_shadow_type(gtk.SHADOW_IN)
        output_scroll = gtk.ScrolledWindow()
        gtklogger.logScrollBars(output_scroll, "Output")
        output_scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
        self.outputframe.add(output_scroll)
        output_box = gtk.VBox()

        self.output_obj = outputwidget.ValueOutputParameterWidget(
            value=None, scope=self, name="Outputs")
        output_box.pack_start(self.output_obj.gtk, expand=0, fill=0)

        output_scroll.add_with_viewport(output_box)
        self.topPane.pack1(self.outputframe, resize=1, shrink=pshrink)

        # Operation
        self.operationframe = gtk.Frame(label="Operation")
        self.operationframe.set_shadow_type(gtk.SHADOW_IN)
        op_scroll = gtk.ScrolledWindow()
        gtklogger.logScrollBars(op_scroll, "Operation")
        op_scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
        self.op_obj = regclassfactory.RegisteredClassFactory(
            analyze.DataOperation.registry,
            scope=self,
            name="OperationRCF",
            callback=self.newOperationCB)
        self.operationframe.add(op_scroll)

        operation_box = gtk.VBox()
        operation_box.pack_start(self.op_obj.gtk, expand=0, fill=0)
        op_scroll.add_with_viewport(operation_box)
        self.btmPane.pack1(self.operationframe, resize=1, shrink=pshrink)

        # Domain
        self.domainframe = gtk.Frame(label="Domain")
        self.domainframe.set_shadow_type(gtk.SHADOW_IN)
        dom_scroll = gtk.ScrolledWindow()
        gtklogger.logScrollBars(dom_scroll, "Domain")
        dom_scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
        self.domain_obj = regclassfactory.RegisteredClassFactory(
            analysisdomain.Domain.registry,
            scope=self,
            name="DomainRCF",
            callback=self.newDomainCB)
        self.domainframe.add(dom_scroll)
        dom_scroll.add_with_viewport(self.domain_obj.gtk)
        self.topPane.pack2(self.domainframe, resize=1, shrink=pshrink)

        # Sampling.  The SampleRCF class uses the WidgetScope
        # mechanism to find the Operation and Domain widgets, so that
        # it can display only the relevant SampleSet classes.
        self.sampleframe = gtk.Frame(label="Sampling")
        self.sampleframe.set_shadow_type(gtk.SHADOW_IN)
        sam_scroll = gtk.ScrolledWindow()
        gtklogger.logScrollBars(sam_scroll, "Sampling")
        sam_scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
        self.sample_obj = sampleregclassfactory.SampleRCF(
            scope=self, name="Sampling", callback=self.newSampleCB)
        self.sampleframe.add(sam_scroll)
        sam_scroll.add_with_viewport(self.sample_obj.gtk)
        self.btmPane.pack2(self.sampleframe, resize=1, shrink=pshrink)

        self.buildBottomRow(mainbox)

        # Whenever fields or fluxes are defined or undefined on the
        # mesh, we need to update the output object widget, and
        # possibly invalidate the currently-displayed data, once we
        # start displaying data.

        switchboard.requestCallbackMain(("new who", "Mesh"), self.new_mesh)
        switchboard.requestCallbackMain(("new who", "Skeleton"), self.new_skel)

        switchboard.requestCallbackMain(self.timeWidget,
                                        self.sensitize_widgets)
        switchboard.requestCallbackMain(self.domain_obj,
                                        self.sensitize_widgets)
        switchboard.requestCallbackMain(self.op_obj, self.sensitize_widgets)
        switchboard.requestCallbackMain(self.output_obj,
                                        self.sensitize_widgets)
        switchboard.requestCallbackMain(self.destwidget,
                                        self.sensitize_widgets)

        switchboard.requestCallbackMain("named analyses changed",
                                        self.analysesChanged)
        switchboard.requestCallbackMain("mesh status changed",
                                        self.sensitize_widgets)

        switchboard.requestCallbackMain(self.domain_obj,
                                        self.setNamedAnalysisChooser)
        switchboard.requestCallbackMain(self.op_obj,
                                        self.setNamedAnalysisChooser)
        switchboard.requestCallbackMain(self.output_obj,
                                        self.setNamedAnalysisChooser)
        switchboard.requestCallbackMain(self.sample_obj,
                                        self.setNamedAnalysisChooser)