Exemplo n.º 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.defineAggregateOutput(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.defineScalarOutput(name+":Component", compout, ordering=ordering)
Exemplo n.º 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.defineScalarOutput(name, self.output, ordering=ordering)
     output.defineAggregateOutput(name, self.output, ordering=ordering)
Exemplo n.º 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.defineAggregateOutput(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.defineScalarOutput(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.defineScalarOutput(name+":Invariant", invout, ordering=ordering)
        output.defineAggregateOutput(name+":Invariant", invout, 
                                     ordering=ordering)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 6
0
    callback=_difference,
    otype=outputval.OutputValPtr,
    srepr=_difference_shortrepr,
    instancefn=_difference_instancefn,
    column_names=_aggdiff_column_names,
    params=[
        output.AggregateOutputParameter(
            'minuend',
            tip='The quantity from which the subtrahend is subtracted.'),
        output.AggregateOutputParameter(
            'subtrahend', tip='The quantity to subtract from the minuend.')
    ],
    tip="Compute the difference between two quantities.")

output.defineAggregateOutput('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.
Exemplo n.º 7
0
    tip='Displaced position.',
    discussion=xmlmenudump.loadFile(
        'DISCUSSIONS/engine/output/actualPosOutput.xml'))

originalPosition = outputClones.posOutput.clone(
    discussion=xmlmenudump.loadFile(
        'DISCUSSIONS/engine/output/originalPosOutput.xml'))

output.definePositionOutput('original', originalPosition)
output.definePositionOutput('actual', actualPosition)
output.definePositionOutput('enhanced', enhancedPosition)

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

output.defineAggregateOutput('Field:Value',
                             outputClones.FieldOutput,
                             ordering=1.0)
output.defineAggregateOutput('Field:Derivative',
                             outputClones.FieldDerivOutput,
                             ordering=1.1)
output.defineAggregateOutput('Field:Invariant',
                             outputClones.FieldInvariantOutput,
                             ordering=1.2)
output.defineAggregateOutput('Flux:Value',
                             outputClones.FluxOutput,
                             ordering=2.0)
output.defineAggregateOutput('Flux:Invariant',
                             outputClones.FluxInvariantOutput,
                             ordering=2.1)

output.defineScalarOutput('Field:Component',
Exemplo n.º 8
0
AggregateDifferenceOutput = output.Output(
    name="difference",
    callback=_difference,
    otype=outputval.OutputValPtr,
    srepr=_difference_shortrepr,
    instancefn=_difference_instancefn,
    column_names=_aggdiff_column_names,
    params=[
        output.AggregateOutputParameter('minuend',
            tip='The quantity from which the subtrahend is subtracted.'),
        output.AggregateOutputParameter(
            'subtrahend',
            tip='The quantity to subtract from the minuend.')],
    tip="Compute the difference between two quantities.")

output.defineAggregateOutput('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:
            return 0.5*(tmin + tmax)    # arbitrary
Exemplo n.º 9
0
    name='actual position',
    params=dict(factor=1.0),
    tip='Displaced position.',
    discussion=xmlmenudump.loadFile('DISCUSSIONS/engine/output/actualPosOutput.xml')
    )

originalPosition = outputClones.posOutput.clone(
    discussion=xmlmenudump.loadFile('DISCUSSIONS/engine/output/originalPosOutput.xml'))

output.definePositionOutput('original', originalPosition)
output.definePositionOutput('actual', actualPosition)
output.definePositionOutput('enhanced', enhancedPosition)

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

output.defineAggregateOutput('Field:Value', outputClones.FieldOutput,
                             ordering=1.0)
output.defineAggregateOutput('Field:Derivative', outputClones.FieldDerivOutput,
                             ordering=1.1)
output.defineAggregateOutput('Field:Invariant',
                             outputClones.FieldInvariantOutput,
                             ordering=1.2)
output.defineAggregateOutput('Flux:Value', outputClones.FluxOutput,
                             ordering=2.0)
output.defineAggregateOutput('Flux:Invariant', outputClones.FluxInvariantOutput,
                             ordering=2.1)

output.defineScalarOutput('Field:Component', outputClones.FieldCompOutput, 
                          ordering=1.0)
output.defineScalarOutput('Field:Invariant', outputClones.FieldInvariantOutput,
                          ordering=1.1)
output.defineScalarOutput('Field:Derivative:Component',