Exemple #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)
Exemple #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)
Exemple #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)
Exemple #4
0
        output.ScalarOutputParameter(
            'minuend',
            tip='The quantity from which the subtrahend is subtracted.'),
        output.ScalarOutputParameter(
            'subtrahend', tip='The quantity to subtract from the minuend.')
    ],
    srepr=_difference_shortrepr,
    tip="Compute the difference between two quantities.")

# It's important that the ordering parameter for
# ScalarDifferenceOutput and AggregateDifferenceOutput be greater than
# the ordering for at least one other Output in each category.
# Putting the difference outputs first in the list leads to infinite
# recursion when initializing Output widgets.

output.defineScalarOutput('Difference', ScalarDifferenceOutput, ordering=1000)


def _aggdiff_column_names(self):
    sr = self.shortrepr()
    inst = self.outputInstance()
    if inst.dim() == 1:
        return [sr]
    it = inst.getIterator()
    names = []
    while not it.end():
        names.append("%s[%s]" % (sr, it.shortstring()))
        it.next()
    return names

Exemple #5
0
                             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',
                          outputClones.FieldDerivCompOutput,
                          ordering=1.2)
output.defineScalarOutput('Field:Derivative:Invariant',
                          outputClones.FieldDerivInvariantOutput,
                          ordering=1.3)
output.defineScalarOutput('Flux:Component',
                          outputClones.FluxCompOutput,
                          ordering=2.0)
output.defineScalarOutput('Flux:Invariant',
                          outputClones.FluxInvariantOutput,
Exemple #6
0
        output.ScalarOutputParameter(
            'minuend',
            tip='The quantity from which the subtrahend is subtracted.'),
        output.ScalarOutputParameter(
            'subtrahend',
            tip='The quantity to subtract from the minuend.')],
    srepr=_difference_shortrepr,
    tip="Compute the difference between two quantities.")

# It's important that the ordering parameter for
# ScalarDifferenceOutput and AggregateDifferenceOutput be greater than
# the ordering for at least one other Output in each category.
# Putting the difference outputs first in the list leads to infinite
# recursion when initializing Output widgets.

output.defineScalarOutput('Difference', ScalarDifferenceOutput, ordering=1000)

def _aggdiff_column_names(self):
    sr = self.shortrepr()
    inst = self.outputInstance()
    if inst.dim() == 1:
        return [sr]
    it = inst.getIterator()
    names = []
    while not it.end():
        names.append("%s[%s]" % (sr, it.shortstring()))
        it.next()
    return names

AggregateDifferenceOutput = output.Output(
    name="difference",
Exemple #7
0
######################

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',
                          outputClones.FieldDerivCompOutput, ordering=1.2)
output.defineScalarOutput('Field:Derivative:Invariant',
                          outputClones.FieldDerivInvariantOutput, ordering=1.3)
output.defineScalarOutput('Flux:Component', outputClones.FluxCompOutput, 
                          ordering=2.0)
output.defineScalarOutput('Flux:Invariant', outputClones.FluxInvariantOutput, 
                          ordering=2.1)

from ooflib.common import strfunction
if config.dimension() == 2:
    xyfunc = outputClones.ScalarFunctionOutput.clone(
        tip='Compute an arbitrary scalar function of x and y.',