コード例 #1
0
 def __init__(self, name, parameters=[], ordering=0,
              initializer=None,
              tip=None, discussion=None):
     param = enum.EnumParameter(
         "format",
         orientationmatrix.OrientationEnum,
         tip="How to print the orientation.")
     op = output.Output(name=name,
                        callback=self.opfunc,
                        otype=corientation.COrientationPtr,
                        instancefn=self.instancefn,
                        srepr=_orientation_srepr,
                        column_names=_orientation_column_names,
                        params=[param] + parameters,
                        tip=tip, discussion=discussion)
     NonArithmeticPropertyOutputRegistration.__init__(self, name, op,
                                                      initializer)
     output.defineAggregateOutput(name, op, ordering=ordering)
コード例 #2
0
                     (field.name(), it.shortstring(), derivative.string()))
        it.next()
    return names


FieldDerivOutput = output.Output(
    name="field derivative",
    callback=_fieldderiv,
    otype=outputval.OutputValPtr,
    instancefn=_field_instancefn,
    params=[
        meshparameters.FieldParameter("field",
                                      outofplane=1,
                                      tip=parameter.emptyTipString),
        enum.EnumParameter("derivative",
                           InPlaneSpaceComponent,
                           tip='Which derivative to take.')
    ],
    srepr=_fieldderiv_shortrepr,
    column_names=_fieldderiv_column_names,
    tip='Compute derivatives of Fields.',
    discussion=
    '<para>Compute the spatial derivative of a &field; on a &mesh;.</para>')

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

from ooflib.SWIG.common import threadstate


def _flux(mesh, elements, coords, flux):
    ans = []
コード例 #3
0
ファイル: imagemenu.py プロジェクト: santiama/OOF3D
        reporter.warn("Image was not saved!")


mainmenu.OOF.File.Save.addItem(
    oofmenu.OOFMenuItem(
        'Image',
        callback=saveImage,
        ordering=40,
        params=[
            filenameparam.WriteFileNameParameter(
                'filename',
                'filename',
                tip="Name of the file.  In 3D, include '%i' for a file number."
            ),
            enum.EnumParameter('format',
                               ImageFormatE,
                               value="png",
                               tip="Image file format."),
            ## TODO 3.1: Does it make sense to have an OverwriteParameter
            ## here?  Images should never be appended to existing
            ## files.
            filenameparam.WriteModeParameter('mode'),
            whoville.WhoParameter('image',
                                  whoville.getClass('Image'),
                                  tip=parameter.emptyTipString)
        ],
        help="Save an Image in a file.",
        discussion=xmlmenudump.loadFile(
            'DISCUSSIONS/image/menu/saveimage.xml')))


def _fix_image_save(*args):
コード例 #4
0
        self.operator = operator

    def select(self, skelctxt, selection):
        clist, plist = selection.trackerlist()
        courier = skeletonselectioncourier.NodesFromElementsCourier(
            skelctxt.getObject(), self.coverage,
            skelctxt.elementselection.currentSelectionTracker(), clist, plist)
        self.operator.operate(selection, courier)


NodeSelectionModRegistration(
    'From Selected Elements',
    NodeFromSelectedElements,
    ordering=_selectFromElementsOrdering,
    params=[
        enum.EnumParameter('coverage', ooflib.engine.coverage.Coverage),
        selectionoperators.SelectionOperatorParam('operator')
    ],
    tip="Select nodes from selected elements.",
    discussion=xmlmenudump.loadFile(
        'DISCUSSIONS/engine/menu/nodes_from_elements.xml'))

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


class NodeFromSelectedFaces(NodeSelectionModifier):
    def __init__(self, coverage, operator):
        self.coverage = coverage
        self.operator = operator

    def select(self, skelctxt, selection):
コード例 #5
0
    <varname>separator</varname> argument that sets the character that
    divides one column of data from the next.  The
    <classname>Separator</classname> contains all of the allowed
    separators.
    </para>"""


_separator_strings = {
    Separator("space"): " ",
    Separator("comma"): ", ",
    Separator("tab"): "\t"
}

separator_param = enum.EnumParameter(
    'separator',
    Separator,
    'comma',
    default='comma',
    tip="The character to appear between columns in output.")


def getSeparator():
    return _separator_strings[separator_param.value]


settingsmenu.addItem(
    oofmenu.OOFMenuItem(
        'Separator',
        callback=_dummy,
        params=[separator_param],
        help="Set the character to appear between columns in output files."))
コード例 #6
0
    no_log=True,                        # because it calls other menu items
    params=parameter.ParameterGroup(
    parameter.AutomaticNameParameter('name',
                           value=automatic.automatic,
                           resolver=skeletonNameResolver,
                           tip="Name of the new skeleton."),
    whoville.WhoParameter('microstructure',
                          ooflib.common.microstructure.microStructures,
                          tip=parameter.emptyTipString)) +
    periodicityParams +
    parameter.ParameterGroup(
    parameter.FloatParameter('maxscale', value=1.0,
                             tip="Rough size of the largest elements."),
    parameter.FloatParameter("minscale", value=1.0,
                             tip="Rough size of the smallest elements."),
    enum.EnumParameter('units', ooflib.common.units.Units, value='Physical',
                       tip="Units for minscale and maxscale."),
    parameter.FloatRangeParameter('threshold', (0.0, 1.0, 0.01),
                                  value=0.90,
                                  tip="Minimum acceptable homogeneity")
    ),                                  # end of ParameterGroup
    help="Automatically create and refine a &skel;.",
    discussion=xmlmenudump.loadFile("DISCUSSIONS/engine/menu/autoskel.xml")
    ))

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

def sanity_check(menuitem, skeleton, quick):
    skel = skeletoncontext.skeletonContexts[skeleton].getObject()
    if quick:
        sane = skel.quick_sanity_check()
    else:
コード例 #7
0
ファイル: refine.py プロジェクト: song2001/OOF2
    def __init__(self, rule_set):
        self.rule_set = rule_set

    def markExtras(self, skeleton, markedEdges):
        if self.rule_set.name == "conservative":
            refinequadbisection.markExtras(skeleton, markedEdges)


registeredclass.Registration(
    'Bisection',
    RefinementDegree,
    Bisection,
    1,
    params=[
        enum.EnumParameter('rule_set',
                           refinemethod.RuleSet,
                           refinemethod.conservativeRuleSetEnum(),
                           tip='How to subdivide elements.')
    ],
    tip="Divide element edges into two.",
    discussion=xmlmenudump.loadFile('DISCUSSIONS/engine/reg/bisection.xml'))

if config.dimension() == 2:

    class Trisection(RefinementDegree):
        divisions = 2

        def __init__(self, rule_set):
            self.rule_set = rule_set

    registeredclass.Registration(
        'Trisection',
コード例 #8
0
##############################


def versionCB(menuitem, number, format):
    if format == BINARY:
        menuitem.parser.binaryMode()


versionCmd = oofmenu.OOFMenuItem(
    'FileVersion',
    callback=versionCB,
    params=[
        parameter.FloatParameter('number', tip='file format version number'),
        enum.EnumParameter('format',
                           DataFileFormat,
                           tip='format for the data file.')
    ],
    help="Identify data file format.  Used internally in data files.",
    discussion="""
    <para>&oof2; data files must begin with a FileVersion command.
    The <varname>number</varname> parameter is used to maintain
    compatibility with older data files.  For now, its value should be
    <userinput>1.0</userinput>.  The <varname>format</varname>
    parameter must be one of the values discussed in <xref
    linkend='Section:Concepts:FileFormats'/>.</para>
    """)

mainmenu.OOF.LoadData.addItem(versionCmd)

コード例 #9
0
ファイル: orientmapmenu.py プロジェクト: santiama/OOF3D
        orientmapplugin = mscontext.getObject().getPlugIn("OrientationMap")
        orientmapplugin.set_data(data, filename)
        orientmapplugin.timestamp.increment()
    finally:
        mscontext.end_writing()
        mscontext.cancel_reservation()
    reader.postProcess(mscontext)
    orientmapdata.orientationmapNotify(mscontext.getObject())


loadparams = [
    filenameparam.ReadFileNameParameter(
        'filename',
        tip="Name of the file containing the orientation map data."),
    enum.EnumParameter('format',
                       orientmapdata.OrientMapType,
                       tip="Type of orientation map file."),
    MicrostructureWithoutOrientMapParameter(
        'microstructure',
        tip='Add the orientation map to this Microstructure.')
]

mainmenu.OOF.File.Load.addItem(
    oofmenu.OOFMenuItem('OrientationMap',
                        callback=_loadOrientationMap,
                        ordering=10,
                        params=loadparams,
                        help="Load an orientation map into a Microstructure",
                        discussion=xmlmenudump.loadFile(
                            'DISCUSSIONS/orientationmap/menu/load.xml')))
コード例 #10
0
ファイル: boundarybuilder.py プロジェクト: pk-organics/OOF3D
                nodes = (skelcontext.allNodesOfElementSet(elements) -
                         skelcontext.exteriorNodesOfElementSet(elements))

        skelcontext.createPointBoundary(name, nodes)


registeredclass.Registration(
    "Point boundary from elements",
    BoundaryConstructor,
    PointFromElements,
    ordering=_nodeBdyConstructor + _elemBdySource,
    params=[
        skeletongroupparams.ElementAggregateParameter(
            'group', tip="Construct the boundary from these elements"),
        enum.EnumParameter(
            'coverage',
            coverage.Coverage,
            tip="Which nodes to choose from the set of elements.")
    ],
    tip="Construct a point boundary from a set of elements.",
    discussion=xmlmenudump.loadFile(
        'DISCUSSIONS/engine/reg/point_from_elements.xml'))

###############################################################
#Interface branch


# Build an edge boundary from segments along an interface
class EdgeFromInterface(BoundaryConstructor):
    def __init__(self, interface, direction):
        self.interface = interface
        self.direction = direction
コード例 #11
0
        image.flip(self.axis.name)


# Registering the FlipImage class like this installs it in the menus
# and GUI.  The names of the Parameters in the params list *must* be
# the same as the arguments to the __init__ method.

registeredclass.Registration(
    'Flip',  # name appearing in menus & GUI
    ImageModifier,  # base class
    FlipImage,  # derived class
    ordering=1.0,  # position in menus
    params=[  # list of constructor arguments
        enum.EnumParameter(
            'axis',  # argument name
            FlipDirection,  # argument type
            FlipDirection('x'),  # initial value
            tip="Flip the image about this axis")  # helpful hint
    ],
    tip="Flip the image about the x or y axis.",
    discussion="""<para>
    Flip an &image; about its center line, in either the x or y direction.
    </para>""")

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


class GrayImage(ImageModifier):
    def __call__(self, image):
        image.gray()
コード例 #12
0
ファイル: menudump.py プロジェクト: song2001/OOF2
    <classname>MenuDumpFormat</classname> objects are used by <xref
    linkend='MenuItem-OOF.Help.API_Listing'/> to specify the output
    format.
    </para>"""

from ooflib.common.IO import xmlmenudump

def menudump(menuitem, filename, format):
    file = open(filename, 'w')
    if file:
        try:
            if format=="text":
                textmenudump(file)
            elif format=="xml":
                xmlmenudump.xmlmenudump(file)
        finally:
            file.close()

mainmenu.OOF.Help.addItem(oofmenu.OOFMenuItem(
    'API_Listing',
    callback=menudump,
    threadable = oofmenu.UNTHREADABLE,
    params=[
    parameter.StringParameter('filename', 'oof2_api.txt', tip="File name."),
    enum.EnumParameter('format', MenuDumpFormat, value="text",
                       tip="Format for the api listing, 'text' or 'xml'.")
    ],
    help="Create a verbose listing of all OOF menu commands.",
    discussion=xmlmenudump.loadFile('DISCUSSIONS/common/menu/api_listing.xml')
    ))
コード例 #13
0
    params=[
        parameter.FloatRangeParameter(
            'local_flammability',
            range=(0, 1, 0.001),
            value=0.1,
            tip=
            'Maximum difference in neighboring pixel values across which a burn will extend.'
        ),
        parameter.FloatRangeParameter(
            'global_flammability',
            range=(0, 1, 0.001),
            value=0.2,
            tip=
            'Difference from initial pixel value beyond which a burn will not spread.'
        ),
        enum.EnumParameter(
            'color_space_norm',
            pixeldifferentiator.ColorNorm,
            value=pixeldifferentiator.L1,
            tip="How to compute the difference between two colors in RGB space."
        ),
        parameter.BooleanParameter('next_nearest',
                                   value=0,
                                   tip="Burn next-nearest neighbors?")
    ],
    events=['up'],
    whoclasses=['Image'],
    tip=
    "Select a contiguous set of similar pixels, using a forest fire algorithm.",
    discussion=xmlmenudump.loadFile('DISCUSSIONS/image/reg/burn.xml'))
コード例 #14
0
            result.append((primitives.Segment(nodes[0].position(),
                                              nodes[1].position()),
                           self.femesh.getElement(el.meshindex)))
        return result

registeredclass.Registration(
    'Edge Boundary',
    Domain,
    SkeletonEdgeBoundaryDomain,
    25,
    params=[
        skeletongroupparams.SkeletonEdgeBoundaryParameter(
            'boundary',
            tip="The name of the boundary on which to evaluate the output."),
        enum.EnumParameter(
            'side', SegmentSide,
            tip="Use the element on this side, if both exist.")],
    sample_types = [analysissample.BENTLINE],
    tip="Use a Skeleton edge boundary as the post-processing domain.",
    discussion=xmlmenudump.loadFile('DISCUSSIONS/engine/reg/skeledgedomain.xml')
)
    
#=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=#

# Evaluating outputs at the nodes of a Skeleton PointBoundary is sort
# of weird, because if a point boundary contains more than one node,
# it's possible that the corresponding boundary in the Mesh should
# contain intermediate nodes, if the Mesh elements are high order.
# SkeletonPointBoundaryDomain is provided for completeness, but
# probably only makes sense when the boundary in question consists of
# a single node.  The same consideration applies to setting boundary
コード例 #15
0
    try:
        themes += os.listdir(dir)
    except:
        pass

if themes:
    # This is ugly... We can't use an EnumParam for the theme, because the
    # theme names are only known when the GUI is loaded.  But it's easiest
    # to use a EnumParameter and a ParameterDialog to get the value.  So
    # we create an Enum and an EnumParameter just for the GUI, then pass
    # the string to the menuitem.

    class ThemeEnum(enum.EnumClass(*themes)):
        pass

    themeParam = enum.EnumParameter('theme', ThemeEnum)

    def setTheme_gui(menuitem):
        if parameterwidgets.getParameters(themeParam,
                                          title="Choose a Gnome Theme"):
            themename = themeParam.value.name
            menuitem.callWithDefaults(theme=themename)

    mainmenu.OOF.Settings.Theme.add_gui_callback(setTheme_gui)

    def reallySetTheme(themename):
        debug.mainthreadTest()
        settings = gtk.settings_get_default()
        settings.set_property("gtk-theme-name", themename)

    switchboard.requestCallbackMain('change theme', reallySetTheme)
コード例 #16
0
 parameter.RegisteredParameter(
     "separator",
     formatchars.InputSeparator,
     formatchars.WhiteSpaceSeparator(),
     tip="How columns are divided in the input file."),
 parameter.PositiveIntParameter('angle_column',
                                1,
                                tip='First column of angle data.'),
 parameter.MetaRegisteredParameter(
     'angle_type',
     orientationmatrix.Orientation,
     orientationmatrix.Bunge,
     tip="The way in which orientations are specified in the input file."
 ),
 enum.EnumParameter('angle_units',
                    AngleUnits,
                    'Radians',
                    tip="The units used for angles in the input file."),
 parameter.FloatParameter(
     'angle_offset',
     0,
     tip="An xy-plane rotation to apply to all input orientations,"
     " in degrees.  In the Abg format, the angle is added to gamma."
     " In Bunge, it's subtracted from phi1."),
 parameter.PositiveIntParameter('xy_column',
                                4,
                                tip='First column of position data.'),
 parameter.FloatParameter(
     'scale_factor',
     1.0,
     tip="All x and y values will be multiplied by this factor."),
 parameter.BooleanParameter('flip_x',
コード例 #17
0
ファイル: analysisdomain.py プロジェクト: santiama/OOF3D
    "Planar Cross Section",
    Domain,
    PlanarCrossSectionDomain,
    20,
    params=[
        parameter.ConvertibleRegisteredParameter(
            "normal", direction.Direction,
            direction.VectorDirection(1., 0., 0.),
            "The normal direction to the cross section plane."),
        parameter.FloatParameter(
            "offset",
            0.0,
            tip="The distance from the origin to the cross section plane."),
        enum.EnumParameter(
            "side",
            primitives.PlaneOrientation,
            "FRONT",
            tip="Evaluate the output with elements on this side of the plane.")
    ],
    sampling=(analysissample.ContinuumSampleSet, ),
    tip="Use a plane through the Mesh as the post-processing domain.")

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


class ElementGroup(BulkDomain):
    def __init__(self, elements):
        self.elements = elements  # name of an element group

    def _elements_from_aggregate(self):
        skel_els = []
コード例 #18
0
        basename = startname
    return utils.uniqueName(basename, materialmanager.getMaterialNames())


#Interface branch
_materialmenu.addItem(
    OOFMenuItem('New',
                callback=_newmaterial,
                params=parameter.ParameterGroup(
                    parameter.AutomaticNameParameter(
                        'name',
                        resolver=materialNameResolver,
                        value=automatic.automatic,
                        tip="Name of the material."),
                    enum.EnumParameter('material_type',
                                       MaterialType,
                                       value=MATERIALTYPE_BULK,
                                       tip="Type of the material.")),
                help="Create a new Material.",
                discussion="""<para>
    Create a new &material; containing no &properties;.  If another
    &material; with the same <varname>name</varname> already exists,
    <userinput>&lt;x&gt;</userinput> will be appended to the new
    <varname>name</varname>, where <userinput>x</userinput> is an
    integer chosen to make the new name unique.
    </para>"""))


# Rename an existing material.
def _renamematerial(menuitem, material, name):
    if parallel_enable.enabled():
        materialmenuIPC.ipcmaterialmenu.Rename(material=material, name=name)
コード例 #19
0
    </para>"""


def _Energy_shortrepr(self):
    etype = self.findParam("etype").value
    return etype.string() + " Energy"


# ScalarPropertyOutputRegistration places the output in both the
# ScalarOutput and AggregateOutput trees.

propertyoutputreg.ScalarPropertyOutputRegistration(
    "Energy",
    parameters=[
        enum.EnumParameter("etype",
                           EnergyType,
                           default="Total",
                           tip='The type of energy to compute.')
    ],
    ordering=3,
    srepr=_Energy_shortrepr,
    tip='Compute an energy density.',
    discussion="""
      <para>Compute the energy density of the &fields; on the &mesh;.
      Different values of <varname>etype</varname> include different
      contributions to the energy.</para>""")

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

# Parameters used for PropertyParameterOutputs

コード例 #20
0
            selected = []
            for element in skeleton.getObject().element_iterator():
                if element.type() == self.shape:
                    selected.append(element)
            selection.start()
            selection.clear()
            selection.select(selected)

    registeredclass.Registration(
        'Select by Element Type',
        ElementSelectionModifier,
        ByElementType,
        ordering=1,
        params=[
            enum.EnumParameter('shape',
                               skeletonelement.ElementShapeType,
                               skeletonelement.ElementShapeType('triangle'),
                               tip="Element shape.")
        ],
        tip='Select elements by shape.',
        discussion="""<para>
        <command>Select_By_Element_Type</command> selects all &elems; of a
        given topology, <foreignphrase>i.e,</foreignphrase> triangular or
        quadrilateral.
        </para>""")

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


class ByElementMaterial(ElementSelectionModifier):
    def __init__(self, material):
        self.material = material
コード例 #21
0
ファイル: imagemodifier.py プロジェクト: santiama/OOF3D
        image.flip(self.axis.name)


# Registering the FlipImage class like this installs it in the menus
# and GUI.  The names of the Parameters in the params list *must* be
# the same as the arguments to the __init__ method.

registeredclass.Registration(
    'Flip',  # name appearing in menus & GUI
    ImageModifier,  # base class
    FlipImage,  # derived class
    ordering=1.0,  # position in menus
    params=[  # list of constructor arguments
        enum.EnumParameter(
            'axis',  # argument name
            FlipDirection,  # argument type
            FlipDirection('x'),  # initial value
            tip="Flip the image about this axis")  # helpful hint
    ],
    tip="Flip the image about an axis.",
    discussion="""<para>
    Flip an &image; about its center line, in various directions.
    </para>""")

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

if config.dimension() == 2:

    class AxesPermutation(
            enum.EnumClass(('xy', "Don't permute the axes"),
                           ('yx', "Swap the x and y axes."))):
コード例 #22
0
        dfile.argument('boundary', analysis.boundary)
        dfile.argument('analyzer', analysis.analyzer)
        dfile.endCmd()


bdyanalysismenu.addItem(
    oofmenu.OOFMenuItem(
        "SaveAnalysisDefs",
        callback=_saveAnalysis,
        params=[
            filenameparam.WriteFileNameParameter('filename',
                                                 tip='Name of the file.'),
            filenameparam.WriteModeParameter(
                'mode', tip="'w' to (over)write, 'a' to append."),
            enum.EnumParameter('format',
                               datafile.DataFileFormat,
                               datafile.ASCII,
                               tip="Format of the file."),
            namedanalysis.BdyAnalysisNamesParameter(
                'names', tip="Names of the analyses to be saved.")
        ],
        help=
        "Save the definitions of named boundary analysis operations in a file.",
        discussion=xmlmenudump.loadFile(
            'DISCUSSIONS/engine/menu/savebdyanal.xml')))


def _retrieveNamedAnalyis(menutiem, name):
    switchboard.notify("retrieve boundary analysis", name)


bdyanalysismenu.addItem(
コード例 #23
0
ファイル: scheduledoutput.py プロジェクト: song2001/OOF2
    def printHeaders(self, destination):
        from ooflib.engine.IO import analyzemenu
        analyzemenu.printBulkHeaders(destination, self.operation, self.data,
                                     self.domain, self.sampling)


registeredclass.Registration(
    'Bulk Analysis',
    ScheduledOutput,
    BulkAnalysis,
    ordering=0.5,
    destinationClass=outputdestination.TextOutputDestination,
    params=[
        enum.EnumParameter('output_type',
                           output.OutputType,
                           tip='The kind of output to produce.'),
        output.ValueOutputParameter('data', tip="The output data source."),
        parameter.RegisteredParameter('operation',
                                      analyze.DataOperation,
                                      tip='What to do to the data.'),
        parameter.RegisteredParameter(
            'domain',
            analysisdomain.Domain,
            tip="Where on the mesh to compute the data."),
        analysissample.SamplingParameter('sampling',
                                         tip="How to sample the domain.")
    ],
    tip="Compute Fields, Fluxes, etc. on the Mesh.",
    discussion=xmlmenudump.loadFile('DISCUSSIONS/engine/reg/bulkanalysis.xml'))
コード例 #24
0
    <link linkend='MenuItem-OOF.Skeleton.PinNodes'>Pin</link> the
    &nodes; at the ends of the currently selected &sgmts; in the given
    &skel;.
    </para> """)

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


class PinSelectedElements(PinNodesModifier):
    def __init__(self, coverage):
        self.coverage = coverage

    def __call__(self, skelcontext):
        skel = skelcontext.getObject()
        skelcontext.pinnednodes.start()
        exterior = self.coverage == "Exterior" or self.coverage == "All"
        interior = self.coverage == "Interior" or self.coverage == "All"
        skelcontext.pinnednodes.pinSelectedElements(
            skelcontext.elementselection.currentSelectionTracker(), skel,
            interior, exterior)


registeredclass.Registration(
    'Pin Selected Elements',
    PinNodesModifier,
    PinSelectedElements,
    ordering=5,
    params=[enum.EnumParameter('coverage', ooflib.engine.coverage.Coverage)],
    tip="Pin nodes of selected elements.",
    discussion=xmlmenudump.loadFile('DISCUSSIONS/engine/reg/pinelements.xml'))
コード例 #25
0
ファイル: outputDefs.py プロジェクト: song2001/OOF2
    tip = "Varieties of Energy."
    discussion = """<para>
    <classname>EnergyType</classname> indicates which energy is to be
    computed by the <xref linkend='Output-Scalar-Energy'/> Output.
    </para>"""


def _Energy_shortrepr(self):
    etype = self.findParam("etype").value
    return etype.string() + " Energy"


# ScalarPropertyOutputRegistration places the output in both the
# ScalarOutput and AggregateOutput trees.

propertyoutput.ScalarPropertyOutputRegistration(
    "Energy",
    parameters=[
        enum.EnumParameter("etype",
                           EnergyType,
                           default="Total",
                           tip='The type of energy to compute.')
    ],
    ordering=3,
    srepr=_Energy_shortrepr,
    tip='Compute an energy density.',
    discussion="""
      <para>Compute the energy density of the &fields; on the &mesh;.
      Different values of <varname>etype</varname> include different
      contributions to the energy.</para>""")