dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #04812
Re: [Viper-dev] Plotting vector field
On Sat, Apr 28, 2007 at 11:46:16PM +0200, Ola Skavhaug wrote:
> Anders Logg skrev den 28/04-2007 følgende:
>
> [snip]
>
> > > Thanks, that fixed the first error. The second seems to be a missing file.
> > >
> > > Ola
> >
> > Fixed. Sorry about this.
>
> Thanks, now, pydolfin does not compile:
>
> dolfin_wrap.cpp: In function 'PyObject* _wrap_new_Function__SWIG_5(PyObject*,
> PyObject*)':
> dolfin_wrap.cpp:16769: error: no matching function for call to
> 'dolfin::SubFunction::SubFunction()'
> ../../src/kernel/function/dolfin/SubFunction.h:33: note: candidates are:
> dolfin::SubFunction::SubFunction(dolfin::DiscreteFunction*, dolfin::uint)
> ../../src/kernel/function/dolfin/SubFunction.h:29: note:
> dolfin::SubFunction::SubFunction(const dolfin::SubFunction&)
> make[1]: *** [_dolfin_la-dolfin_wrap.lo] Error 1
>
> Ola
It's the old touch dolfin.i problem as usual... This should be fixed
now.
I tested two different ways of calling plot. Just calling plot(u)
gives
File "plot.py", line 7, in ?
plot(u)
File "/usr/lib/python2.4/site-packages/viper/viper_dolfin.py", line
83, in plot
viper = Viper(data, *args, **kwargs)
File "/usr/lib/python2.4/site-packages/viper/viper_dolfin.py", line
13, in __init__
self.plot(data, *args, **kwargs)
File "/usr/lib/python2.4/site-packages/viper/viper_dolfin.py", line
20, in plot
self.plot_function(data, *args, **kwargs)
File "/usr/lib/python2.4/site-packages/viper/viper_dolfin.py", line
60, in plot_function
(self.iren, self.renWin, self.ren) =
self.vector_plotter(self.vtkgrid, self.mesh.coordinates(), self.x,
self.x.min(), self.x.max(), wireframe=False)
File "/usr/lib/python2.4/site-packages/viper/viper.py", line 392, in
vector_plotter
vectors = self._vectors_from_numpy(coords, x)
File "/usr/lib/python2.4/site-packages/viper/viper.py", line 348, in
_vectors_from_numpy
directions_3d[:,:m] = directions
Adding mode="vectorfield" gives
File "plot.py", line 8, in ?
plot(u, mode="vectorfield")
File "/usr/lib/python2.4/site-packages/viper/viper_dolfin.py", line
83, in plot
viper = Viper(data, *args, **kwargs)
File "/usr/lib/python2.4/site-packages/viper/viper_dolfin.py", line
13, in __init__
self.plot(data, *args, **kwargs)
File "/usr/lib/python2.4/site-packages/viper/viper_dolfin.py", line
20, in plot
self.plot_function(data, *args, **kwargs)
File "/usr/lib/python2.4/site-packages/viper/viper_dolfin.py", line
69, in plot_function
self.iren.Initialize()
AttributeError: 'Viper' object has no attribute 'iren'
Perhaps mode="vectorfield" should be the default option for
vector-valued functions?
By the way, mode="displacement" seems to give something reasonable for
the Stokes demo. (It's not reasonable to plot the velocity field as a
displacement but the output looks to be what you would expect.)
/Anders
Follow ups
References