Exemplo n.º 1
0
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
                val[it] = fi(coord)
                it.next()  # oof IteratorP from fieldindex.py
            ans.append(val)
        ## TODO: That was a real mess.  If OutputVal.getIterator
        ## returned a real Python iterator object, this could be
        ## rewritten as:
        ## f = (fx, fy)
        ## for coord in realcoords:
        ##     val = outputval.VectorOutputVal(2)
        ##     for i, fi in itertools.izip(val.getIterator(), f):
        ##         val[i] = fi(coord)
        ##     ans.append(val)
    return ans
Exemplo n.º 2
0
def vector_instancefn(self):
    return outputval.VectorOutputVal(config.dimension()).zero()
Exemplo n.º 3
0
 def zeroVal(self, output):
     return outputval.VectorOutputVal(config.dimension()).zero()
Exemplo n.º 4
0
 def _surfacenormal_instancefn(self):
     return outputval.VectorOutputVal(config.dimension()).zero()