← Back to team overview

ufl team mailing list archive

[HG UFL] Implemented MultiFunction class, using a mechanism similar to

 

One or more new changesets pushed to the primary ufl repository.
A short summary of the last three changesets is included below.

changeset:   635:b7eaefbec3752735142acaafab6e491a979c5632
tag:         tip
user:        "Martin Sandve Alnæs <martinal@xxxxxxxxx>"
date:        Tue Feb 24 13:43:25 2009 +0100
files:       ufl/algorithms/graph.py ufl/algorithms/pdiffs.py ufl/algorithms/transformations.py
description:
Implemented MultiFunction class, using a mechanism similar to
the one in Transformer to dispatch calls to different functions
based on the type of their first argument. Unlike Transformer,
not intended for recursive calls on the expression tree
but single calls. Example:

class MyFunction(MultiFunction):
    def __init__(self):
        MultiFunction.__init__(self)
    def expr(self, o):
        print "Got an expr of type %s" % type(o)
        return 1
    def function(self, o):
        print "Got a function!"
        return 2

# Guess what these will print:
f = MyFunction()
one = f(something_not_a_function)
two = f(some_function)


Using this for PartialDerivativeComputer which will
be used for reverse mode AD in the future, and for
figuring out dependencies based on type in graph
partitioning.


changeset:   634:8d1f9fd1a28be2db33bb72ac4127af5810395d7d
user:        "Martin Sandve Alnæs <martinal@xxxxxxxxx>"
date:        Tue Feb 24 11:57:13 2009 +0100
files:       ufl/algorithms/graph.py
description:
Some work on graph tools.
Implemented a preliminary partitioning algorithm
for finding partitions with different dependencies.


changeset:   633:46fae2775ab647ff9b9c0165f8ba62339d022b41
parent:      632:19f1c06b5d8505e5564396a8d13905f796260e0d
parent:      631:ea820764c60b62593da68a2797560d028c297af5
user:        "Martin Sandve Alnæs <martinal@xxxxxxxxx>"
date:        Mon Feb 23 23:29:21 2009 +0100
files:       
description:
merge

----------------------------------------------------------------------
For more details, visit http://www.fenics.org/hg/ufl