Example #1
0
    def __init__(self,
                 name,
                 parameters=[],
                 ordering=0,
                 initializer=None,
                 srepr=None,
                 tip=None,
                 discussion=None):
        op = output.Output(name=name,
                           callback=self.opfunc,
                           otype=outputval.OutputValPtr,
                           instancefn=self.instancefn,
                           params=parameters,
                           srepr=srepr,
                           tip=tip,
                           discussion=discussion)
        ArithmeticPropertyOutputRegistration.__init__(self, name, op,
                                                      initializer)
        output.defineOutput(name, op, ordering=ordering)

        compout = outputClones.ComponentOutput.clone(
            name=name + " Component",
            tip='Compute components of %s' % name,
            discussion="""
            <para>Compute the specified component of <link
            linkend='Output-%s'>%s</link> on a &mesh;.</para>
            """ % (name, name))
        compout.connect('field', op)
        for param in parameters:
            compout.aliasParam('field:' + param.name, param.name)
        output.defineOutput(name + ":Component", compout, ordering=ordering)
Example #2
0
    def __init__(self,
                 name,
                 parameters=[],
                 ordering=0,
                 initializer=None,
                 srepr=None,
                 tip=None,
                 discussion=None):
        op = output.Output(name=name,
                           callback=self.opfunc,
                           otype=outputval.OutputValPtr,
                           instancefn=self.instancefn,
                           srepr=srepr,
                           column_names=_symmmatrix3_column_names,
                           params=parameters,
                           tip=tip,
                           discussion=discussion)
        ArithmeticPropertyOutputRegistration.__init__(self, name, op,
                                                      initializer)
        output.defineOutput(name + ":Value", op, ordering=ordering)

        def comprepr(s):
            comp = s.resolveAlias("component").value
            # We have to pass s to op.shortrepr so that the shortrepr
            # will be computed for the actual Output, not the Output
            # defined above.  The actual output will be a clone of the
            # one defined there.
            return "%s[%s]" % (op.shortrepr(s), comp)

        compout = outputClones.ComponentOutput.clone(
            name=name + " Component",
            tip='Compute components of %s' % name,
            srepr=comprepr,
            discussion="""
            <para>Compute the specified component of %s on a &mesh;.</para>
            """ % name)
        compout.connect('field', op)
        for param in parameters:
            compout.aliasParam('field:' + param.name, param.name)
        output.defineOutput(name + ":Component", compout, ordering=ordering)

        def invariantrepr(s):
            invariant = s.resolveAlias("invariant").value.shortrepr()
            # See comment above about op.shortrepr(s)
            return "%s(%s)" % (invariant, op.shortrepr(s))

        invout = outputClones.InvariantOutput.clone(
            name=name + " Invariant",
            srepr=invariantrepr,
            tip='Compute invariants of %s' % name,
            discussion="""
            <para>Compute the specified invariant of %s on a &mesh;.</para>
            """ % name)
        invout.connect('field', op)
        for param in parameters:
            invout.aliasParam('field:' + param.name, param.name)
        output.defineOutput(name + ":Invariant", invout, ordering=ordering)
        output.defineOutput(name + ":Invariant", invout, ordering=ordering)
Example #3
0
 def __init__(self, name, parameters=[], ordering=0,
              initializer=None,
              srepr=None, tip=None, discussion=None):
     op = output.Output(name=name,
                        callback=self.opfunc,
                        otype=outputval.ScalarOutputValPtr,
                        instancefn=self.instancefn,
                        column_names=outputClones.single_column_name,
                        params=parameters,
                        srepr=srepr, tip=tip, discussion=discussion)
     ArithmeticPropertyOutputRegistration.__init__(self, name, op,
                                                   initializer)
Example #4
0
 def __init__(self, name, symbol, parameters=[], initializer=None,
              ordering=1,tip=None, discussion=None):
     self.symbol = symbol
     op = output.Output(name=name,
                        callback=self.opfunc,
                        otype=outputval.ListOutputValPtr,
                        instancefn=self.instancefn,
                        srepr=_twovector_srepr,
                        column_names=_twovector_column_names,
                        params=parameters,
                        tip=tip, discussion=discussion,
                        symbol=symbol)
     NonArithmeticPropertyOutputRegistration.__init__(self, name, op,
                                                      initializer)
     output.defineAggregateOutput(name, op, ordering=ordering)
Example #5
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)
Example #6
0
def _pos(mesh, elements, coords):
    # The argument "elements" is a list of Elements or Edges, possibly
    # mixed together. The argument "coords" is a list of lists.  Each
    # Element in the elements list corresponds to a list of
    # MasterCoords in the coords list, and each Edge corresponds to a
    # list of doubles (ie, master coords for the Edge, in the range
    # [0,1)).
    return utils.flatten1([
        element.position(coordList)
        for element, coordList in zip(elements, coords)
    ])


posOutput = output.Output(name="original position",
                          otype=(primitives.Point, coord.Coord),
                          callback=_pos)

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


class SpaceComponent(enum.EnumClass('x', 'y', 'z')):
    tip = 'Components of vectors.'
    discussion = """<para>
    <classname>SpaceComponent</classname> is used by various
    <link
    linkend='Section-Output'><classname>Outputs</classname></link> to
    choose one of the components of a vector quantity.
    </para>"""

Example #7
0
disp1 = iter.cloneIndex()

displacementFieldOutput = outputClones.FieldOutput.clone(
    name="displacement field", params=dict(field=Displacement))

# displacementOutput produces the Displacement Field as a set of Points.


def _disp2point(mesh, elements, coords, field):
    # Convert displacement field OutputVals to Points
    return [primitives.Point(f[disp0], f[disp1]) for f in field]


displacementOutput = output.Output(
    name="dispPoint",
    otype=primitives.Point,
    callback=_disp2point,
    inputs=[outputval.OutputValParameter('field')])
displacementOutput.connect('field', displacementFieldOutput)

# Enhanced position is scalefactor*Displacement + original position

enhancedPosition = outputClones.PointSumOutput.clone(
    name='enhanced position',
    params=dict(b=1),
    tip='Exaggerated displacement field.',
    discussion=xmlmenudump.loadFile(
        'DISCUSSIONS/engine/output/enhancedPosOutput.xml'))
enhancedPosition.connect('point1', displacementOutput)
enhancedPosition.connect('point2', outputClones.posOutput)
enhancedPosition.aliasParam('a',