예제 #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)
예제 #2
0
 def __init__(self,
              name,
              parameters=[],
              ordering=0,
              initializer=None,
              srepr=None,
              tip=None,
              discussion=None):
     ScalarPropertyOutputRegBase.__init__(self, name, parameters, ordering,
                                          initializer, srepr, tip,
                                          discussion)
     output.defineOutput(name, self.output, ordering=ordering)
예제 #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.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)
예제 #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=_threevector_srepr,
                        column_names=_threevector_column_names,
                        params=parameters,
                        tip=tip,
                        discussion=discussion,
                        symbol=symbol)
     NonArithmeticPropertyOutputRegistration.__init__(
         self, name, op, initializer)
     output.defineOutput(name, op, ordering=ordering)
예제 #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.defineOutput(name, op, ordering=ordering)
예제 #6
0
    name="difference",
    callback=_difference,
    otype=outputval.OutputValPtr,
    srepr=_difference_shortrepr,
    instancefn=_difference_instancefn,
    column_names=_aggdiff_column_names,
    params=[
        output.ValueOutputParameter(
            'minuend',
            tip='The quantity from which the subtrahend is subtracted.'),
        output.ValueOutputParameter(
            'subtrahend', tip='The quantity to subtract from the minuend.')
    ],
    tip="Compute the difference between two quantities.")

output.defineOutput('Difference', AggregateDifferenceOutput, ordering=1000)

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

# The Concatenate Output allows two Outputs to be printed on the same
# line of the output file.  Its value type is the
# ConcatenatedOutputVal class, which defines a bunch of arithmetic
# operations that it just passes through to the OutputVals that it's
# concatenating.  ConcatenatedOutputVal is itself *not* an OutputVal.
# Maybe it should be, but that would mean defining it in C++.

## TODO: Allow more than two outputs to be concatenated, so that it's
## not necesary to nest the concatenations.  We'll need a Parameter
## class for multiple Outputs, and a widget for it.
## ConcatenatedOutputVal can already handle more than two, but
## Concatenate can't.
예제 #7
0
# played by the MeshNodePosition class.

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

## Is there any point in outputting the surface normal?  Maybe if
## it were computed using displaced coordinates...
# output.defineOutput("Surface Normal",
#                              outputClones.SurfaceNormalOutput,
#                              ordering=500)
normalFluxOutput = outputClones.DotProduct.clone(
    name="Flux Normal"
)
normalFluxOutput.connect('a', outputClones.FluxOutput)
normalFluxOutput.connect('b', outputClones.SurfaceNormalOutput)
normalFluxOutput.aliasParam('a:flux', 'flux')
output.defineOutput("Flux:Normal:Value", normalFluxOutput, ordering=100)

normalFluxInvariantOutput = outputClones.InvariantOutput.clone(
    name="flux normal invariant",
    tip="Compute invariants of Flux normals at a surface.")
normalFluxInvariantOutput.connect("field", normalFluxOutput)
normalFluxInvariantOutput.aliasParam('field:flux', 'flux')
output.defineOutput("Flux:Normal:Invariant", normalFluxInvariantOutput,
                    ordering=101)

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

output.defineOutput('Field:Value', outputClones.FieldOutput,
                    ordering=1.0)
output.defineOutput('Field:Derivative:Value', outputClones.FieldDerivOutput,
                    ordering=1.1)
예제 #8
0
    name="difference",
    callback=_difference,
    otype=outputval.OutputValPtr,
    srepr=_difference_shortrepr,
    instancefn=_difference_instancefn,
    column_names=_aggdiff_column_names,
    params=[
        output.ValueOutputParameter(
            'minuend',
            tip='The quantity from which the subtrahend is subtracted.'),
        output.ValueOutputParameter(
            'subtrahend', tip='The quantity to subtract from the minuend.')
    ],
    tip="Compute the difference between two quantities.")

output.defineOutput('Difference', AggregateDifferenceOutput, ordering=1000)

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

# Scale values to lie between 0 and 1.


def _rescaleOutput(mesh, elements, coords, minimum, maximum, inputdata):
    minval = min(inputdata)
    maxval = max(inputdata)

    # TODO OPT: Doing this math in python on ScalarOutputVals is
    # inefficient.  Can it be done in C++ instead?  This is a low
    # priority until this function is actually used.
    def rescale(x, mn=minval, mx=maxval, tmin=minimum, tmax=maximum):
        if mx == mn: