← Back to team overview

ufl team mailing list archive

Re: [HG UFL] Added __hash__ to Form, and caching of hash, repr and str so they are only

 

2008/9/6 Anders Logg <logg@xxxxxxxxx>:
> On Fri, Sep 05, 2008 at 10:58:08AM +0200, UFL wrote:
>> One or more new changesets pushed to the primary ufl repository.
>> A short summary of the last three changesets is included below.
>>
>> changeset:   224:4df4ffa5de1be81ed07fdea22569beb39e2e75f0
>> tag:         tip
>> user:        "Martin Sandve Alnæs <martinal@xxxxxxxxx>"
>> date:        Fri Sep 05 10:58:06 2008 +0200
>> files:       ufl/form.py
>> description:
>> Added __hash__ to Form, and caching of hash, repr and str so they are only
>> computed the first time str(form), repr(form) or hash(form) is called.
>
> Very nice. I have the same thing in FFC (JITObject) which wraps a form
> and remembers the signature for later reuse.
>
> One thing is that JITObject also includes the compiler flags
> (quadrature or tensor representation etc) in the signature. Would it
> be possible to add a mechanism like this to a Form so that it would
> already be included in the signature? It would amount to attaching
> a signature (for something else like compiler flags) to a Form that
> gets included in the signature for the Form itself.
>
> --
> Anders

Done. I guess adding a variable "_metadata" to Form which
UFL doesn't really care about doesn't hurt anyone.
But I guess the __hash__ would need to include _metadata
as well? What have you done about that?

--
Martin


Follow ups

References