← Back to team overview

dolfin team mailing list archive

Re: [Viper-dev] plot.py

 

Here's one that calls project:

  demo/function/projection-interpolation/python/demo.py

And here's one that plots and object that needs to be projected before
plotted:

  demo/pde/nonlinear-poisson/python/demo.py

-- 
Anders


On Tue, Jan 06, 2009 at 05:33:39PM -0300, Ola Skavhaug wrote:
> A demo, unit test or whatever. Something that tests this functionlity
> of dolfin. I've run almost all demos, and I can't trigger the project
> code. Hence, it looks dead to me.
> 
> Ola
> 
> On Tue, Jan 6, 2009 at 5:18 PM, Anders Logg <logg@xxxxxxxxx> wrote:
> > On Tue, Jan 06, 2009 at 05:13:25PM -0300, Ola Skavhaug wrote:
> >> On Tue, Jan 6, 2009 at 4:46 PM, Anders Logg <logg@xxxxxxxxx> wrote:
> >> > On Tue, Jan 06, 2009 at 11:45:46AM -0300, Ola Skavhaug wrote:
> >> >> On Mon, Jan 5, 2009 at 5:09 AM, Anders Logg <logg@xxxxxxxxx> wrote:
> >> >> > On Sat, Jan 03, 2009 at 09:27:04PM -0300, Ola Skavhaug wrote:
> >> >> >> What's the purpose of dolfin_plot? It just calls viper_plot for all
> >> >> >> types, except when the object is unknown, in which case it tries
> >> >> >>  to project something, without knowing what it is. This should be put
> >> >> >> into viper instead of in this almost empty wrapper. What is the type
> >> >> >> of object if project can handle it?
> >> >> >
> >> >> > The type of object is any expression like grad(u), u + u, div(u) etc.
> >> >> > but it can also be anything else (like an int or float) that FFC can
> >> >> > interpret as a Form. The easiest test is probably the one that's there
> >> >> > now in plot.py (try: project).
> >> >>
> >> >> I don't understand. I don't see any tests where project is used. Can
> >> >> you point me to the appropriate test?
> >> >>
> >> >> Ola
> >> >
> >> > I mean the following tests:
> >> >
> >> >    # Plot mesh
> >> >    if isinstance(object, cpp.Mesh):
> >> >        return viper_plot(object, *args, **kwargs)
> >> >
> >> >    # Plot mesh function
> >> >    if isinstance(object, cpp.MeshFunctionUInt) or \
> >> >       isinstance(object, cpp.MeshFunctionInt)  or \
> >> >       isinstance(object, cpp.MeshFunctionReal):
> >> >        return viper_plot(object, *args, **kwargs)
> >> >
> >> >    # Plot function
> >> >    if isinstance(object, cpp.Function):
> >> >        return viper_plot(object, *args, **kwargs)
> >> >
> >> >    # Try projecting function
> >> >    from project import project
> >> >    try:
> >> >        print "Object cannot be plotted directly, projecting to
> >> >        piecewise linears."
> >> >        u = project(object)
> >> >        return plot(u, *args, **kwargs)
> >> >    except:
> >> >        raise RuntimeError, ("Don't know how to plot given object and
> >> >        projection failed: " + str(object))
> >> >
> >> > This tests for any object that DOLFIN knows that Viper can handle and
> >> > otherwise tries to project the object to a Function and then calls
> >> > Viper with the Function.
> >> >
> >> > So: first check for everything that Viper knows how to plot and
> >> > otherwise try to project it.
> >>
> >> I know this code, but this is not a test. This is dolfin code. I'm
> >> talking about a test of this functionality. Since object is unknown,
> >> there is no simple way for me to test that I don't break anything when
> >> coding.
> >>
> >> See?
> >
> > No... What kind of test do you want?
> >
> >
> > -----BEGIN PGP SIGNATURE-----
> > Version: GnuPG v1.4.9 (GNU/Linux)
> >
> > iEYEARECAAYFAkljvKQACgkQTuwUCDsYZdGCAACfUs+Q539im2UEeNn5jucKOyXk
> > mpgAni3Bu75cVq3jrhNsOBiIklYMUQu6
> > =+uf1
> > -----END PGP SIGNATURE-----
> >
> >
> 
> 
> 

Attachment: signature.asc
Description: Digital signature


Follow ups

References