Beispiel #1
0
 def validValue(self, value):
     if type(value) is StringType:
         try:
             fn = strfunction.XYTStrFunction(value)
             return True
         except:
             return False
     return isinstance(value, strfunction.XYTStrFunction)
Beispiel #2
0

def _scalarFunction_shortrepr(self):
    return self.resolveAlias("f").value.string()


ScalarFunctionOutput = output.Output(
    name="Function",
    callback=_scalarFunctionOutput,
    otype=outputval.ScalarOutputValPtr,
    instancefn=scalar_instancefn,
    srepr=_scalarFunction_shortrepr,
    column_names=single_column_name,
    params=[
        strfunction.XYTStrFunctionParameter(
            "f", default=strfunction.XYTStrFunction('1.0'), tip=_tip)
    ])


def _vectorFunctionOutput(mesh, elements, coords, fx=None, fy=None, fz=None):
    ans = []
    for element, coordlist in itertools.izip(elements, coords):
        realcoords = map(element.from_master, coordlist)
        for coord in realcoords:
            val = outputval.VectorOutputVal(config.dimension())
            it = val.getIterator()
            # Although f has three components, the third one won't be
            # used if we're not in three dimensions.
            f = iter([fx, fy, fz])
            while not it.end():  # use size of val, not f!
                fi = f.next()  # python iterator
Beispiel #3
0
 def get_value(self):
     debug.mainthreadTest()
     return strfunction.XYTStrFunction(self.gtk.get_text().lstrip())
Beispiel #4
0
    _tip = "Function of x, y, z, and t."

def _scalarFunction_shortrepr(self):
    return self.resolveAlias("f").value.string()

ScalarFunctionOutput = output.Output(
    name="Function",
    callback=_scalarFunctionOutput,
    otype=outputval.ScalarOutputValPtr,
    instancefn=scalar_instancefn,
    srepr=_scalarFunction_shortrepr,
    column_names=single_column_name,
    params=[
        strfunction.XYTStrFunctionParameter(
            "f",
            default=strfunction.XYTStrFunction('1.0'),
            tip=_tip)
        ]
    )

def _vectorFunctionOutput(mesh, elements, coords, fx=None, fy=None, fz=None):
    ans = []
    for element, coordlist in itertools.izip(elements, coords):
        realcoords = map(element.from_master, coordlist)
        for coord in realcoords:
            val = outputval.VectorOutputVal(config.dimension())
            it = val.getIterator()
            # Although f has three components, the third one won't be
            # used if we're not in three dimensions.
            f = iter([fx, fy, fz])
            while not it.end(): # use size of val, not f!