[firedrake] operations on matrices
Lawrence Mitchell
lawrence.mitchell at imperial.ac.uk
Wed Jan 7 09:36:29 GMT 2015
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 07/01/15 08:46, Colin Cotter wrote:
> Ignoring the issue of acting on global matrices for a minute, what
> would be the way to do the following:
>
> 1) assemble a local matrix from a UFL expression 2) modify local
> matrix entries a_ij making use of field values f_i and f_j, 3)
> insert the modified local matrix into a global matrix
>
> This involves code generation for 1) but hand-tooling for (2-3).
So (1) produces a kernel that assembles a single element tensor. (3)
is just normal element tensor insertion.
So the difficulty is inserting (2) between (1) and (3) to modify the
element tensor as a result of f_i and f_j. I'm going to guess here
that you're unable to express the action of (2) in terms of UFL
expressions.
So one hacky way to do this is as follows (but, it's hacky, there are
probably better ways):
1. Generate the kernel for (1)
2. Generate the kernel that takes the output of (1), an nxm element
tensor and reads field values to modify the element tensor.
3. Construct a "super-kernel" that takes all the argument from (1) and
the additional field arguments from (2) which calls first 1., then 2.
to generate the correctly modified element tensor.
4. Use the kernel from 3. as your assembly kernel in a par_loop
(rather than the kernel from 1.)
Lawrence
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with undefined - http://www.enigmail.net/
iQEcBAEBAgAGBQJUrP4dAAoJECOc1kQ8PEYviXgH/0fPeNVA9Z8QMEmqBUlUjUH/
2fGlyICoYmxmMPJ2d0x2BzSCtiGvo3nMfjejQC7+lPyKlSjdMnkv/K5rLKCD4UZQ
nsHU3Vtwv10c9doa/hjXsIohqPu5vmUvmjRr4O+A9/+HknfReXdg7VByTDiQIpTg
glKDQRAGWdzGfroom8b5Jd4mwXr7GkHNHKFTU33PhBi4tYrJHDSGh0AY4ZcbfzvG
Ql6o1+RAYKXR3njPhQFvwZLYyZ9OFy1xEOmauSb/DxPNDHf8UZ7gLdIVSa/HTwd/
z3WqXRrapCCLXhgDezFXyUXsEQcJhPHPHZ/3+P1HQ6fBkiu3p7qtcTySLBpBG60=
=icRz
-----END PGP SIGNATURE-----
More information about the firedrake
mailing list