← Back to team overview

dolfin team mailing list archive

Re: meshfuntion demo error

 

On Tue, May 08, 2007 at 10:26:36PM +0200, Ola Skavhaug wrote:
> Anders Logg skrev den 08/05-2007 følgende:
> > On Tue, May 08, 2007 at 09:21:29PM +0200, Ola Skavhaug wrote:
> > > When running src/demo/meshfunction/dolfin-meshfunction, I get the following
> > > (wrong) error message:
> > > 
> > > Reading mesh from file mesh2D.xml.gz.
> > > Reading real-valued mesh function from file meshfunction.xml.
> > > Reading mesh from file meshfunction.xml.
> > > *** Error: Size of mesh function (9) does not match size of mesh (1 entities
> > > of dimension 16) [XMLMeshFunction.cpp:162: readMeshFunction()]
> > > 
> > > 
> > > The meshfunction.xml file _is_ wrong, containing 9 entities of dimension 1,
> > > whereas there should be 16. The error message is, however, quite misleading.
> > > 
> > > The fixes should be trivial.
> > > 
> > > Ola
> > 
> > ok, I've fixed the meshfunction.xml file in the demo so it's defined
> > on cells (there are 8 cells). Running plot.py now gives
> > 
> >   File "/usr/lib/python2.5/site-packages/viper/viper_dolfin.py", line
> >   86, in plot_meshfunction
> >     raise RuntimeError, "Only vertex valued meshfunctions can be
> >     plotted"
> > RuntimeError: Only vertex valued meshfunctions can be plotted
> 
> Strange; I get the following error:
> Plotting MeshFunction, press q to continue...
> Reading mesh from file /tmp/filevT0M5b.xml.
> Reading uint-valued mesh function from file /tmp/filevT0M5b.xml.
> Reading mesh from file /tmp/filevT0M5b.xml.
> Unable to plot (PyDOLFIN or Viper plotter not available).
> 
> Difficult to debug, and I definitely have both installed. Have you experienced
> this behaviour yourself? If not, I'll start digging.
> 
> Ola

Did you run the demo in src/demo/mesh/partition or src/demo/meshfunction?
My guess is you tried the former.

The demo in src/demo/mesh/partition runs the plot() command from C++,
which will generate a temporary Python script looking something like

  try:
      from dolfin import *

      mesh = Mesh("/tmp/file4JSQcr.xml")
      f = MeshFunction("uint", mesh, "/tmp/file4JSQcr.xml")
      plot(f)
  except:
      exit(1)

DOLFIN will just see the exit 1 return signal and guess what went
wrong. To see the full Python traceback, simply edit the generated
script and run it. You can find out the name of the script by

    ls -rt /tmp/*.py | tail -1

Alternatively, you can run the plot.py script in src/demo/meshfunction
which does not hide the Python error message.

/Anders


References