Subject: [Viper-dev] Patch to let viper plot general cpp.Functions

From: Johan Hake <[email-masked]>
Date: Wed, 25 Mar 2009 12:23:41 +0100

...e.g. such that are also are ufl.Functions.

Johan
# HG changeset patch
# User "Johan Hake <[email-masked]>"
# Date 1237980122 -3600
# Node ID 376741cf5dbf94ce6d45ac22f5ed984e9800fc7a
# Parent  db1810b3a64a7cde97e1ee121b357b4d42137a51
Small fix for plotting of dolfin.cpp.Functions that make plotting of
  ufl based dolfin.Functions work.

diff -r db1810b3a64a -r 376741cf5dbf src/viper/viper_dolfin.py
--- a/src/viper/viper_dolfin.py	Wed Mar 25 11:11:07 2009 +0100
+++ b/src/viper/viper_dolfin.py	Wed Mar 25 12:22:02 2009 +0100
@@ -22,9 +22,11 @@
 
 from viper import Viper as ViperBase
 import dolfin
-from dolfin.cpp import Mesh, MeshFunctionInt, MeshFunctionUInt, MeshFunctionBool, MeshFunctionReal, Function, FunctionPlotData
+from dolfin.cpp import Mesh, MeshFunctionInt, MeshFunctionUInt, MeshFunctionBool, MeshFunctionReal, Function, FunctionSpace, FunctionPlotData
 import numpy
 import vtk
+
+import ffc
 
 _plotter = None
 
@@ -253,7 +255,7 @@
             self.interactive()
 
     def _dofs_pr_node(self, f):
-        element = f.function_space().element()
+        element = FunctionSpace.element(f.function_space())
         rank = element.value_rank()
         dpn = 1
         for i in xrange(rank):

---

From: Johan Hake <[email-masked]>
Date: Wed, 25 Mar 2009 12:44:55 +0100

> ...e.g. such that are also are ufl.Functions.

That made alot of sense, not :P

Johan

---

From: Ola Skavhaug <[email-masked]>
Date: Wed, 25 Mar 2009 13:39:55 +0100

> That made alot of sense, not :P

Lucky your patches are better than your English :)

Ola

> Johan
>
>> Johan
>
>
> _______________________________________________
> Viper-dev mailing list
> [email-masked]
> http://fenics.org/mailman/listinfo/viper-dev
>

-- 
Ola Skavhaug