On Tue, Jan 6, 2009 at 4:46 PM, Anders Logg <[email protected]> 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 <[email protected]> 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? Ola > > -- > Anders > > >> > >> >> The case viper is not available, I guess you need some logic anyway. >> >> Plot muting when an environment variable is set could be placed in >> >> viper, but that would only be a duplicate of what you need anyway, so >> >> I suggest you keep that (or a better version of the IgnorePlot). >> > >> > It would be helpful if there were an environment variable, perhaps >> > NOPLOT that Viper looked at. Then we can remove that part too from the >> > wrapper. Maybe it's also good for Viper to have a plotless mode for >> > unit testing? >> > >> > The release of DOLFIN 0.9.0 is planned to come out today, so it would >> > be good if we could wait with any changes in the interface until after >> > the release. >> > >> > Can you make a Viper release today that matches the current DOLFIN? >> > There have been a few bug fixes since last time I think. There will >> > also be a new FFC release. Then Johannes can make a release of >> > fenics-2009-01. :-) >> > >> > >> > -----BEGIN PGP SIGNATURE----- >> > Version: GnuPG v1.4.9 (GNU/Linux) >> > >> > iEYEARECAAYFAklhwFMACgkQTuwUCDsYZdGUFACbB3vaOadgI8OcqKFcnXdSeXCS >> > Jd8AniNeO/k3JAPv0CLlOU1UmGdn6h9q >> > =9+nD >> > -----END PGP SIGNATURE----- >> > >> > _______________________________________________ >> > Viper-dev mailing list >> > [email protected] >> > http://fenics.org/mailman/listinfo/viper-dev >> > >> > >> >> >> > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > > iEYEARECAAYFAkljtRkACgkQTuwUCDsYZdFeqwCePHm3XzE5AjHySSaYfqNKk99q > eeEAn3KjfMhENAqz04ODnZFM+ZMi3fKu > =9rvo > -----END PGP SIGNATURE----- > > -- Ola Skavhaug _______________________________________________ DOLFIN-dev mailing list [email protected] http://www.fenics.org/mailman/listinfo/dolfin-dev
