Subject: [Viper-dev] constant functions

From: "Garth N. Wells" <[email-masked]>
Date: Mon, 25 Jun 2007 23:07:17 +0200

When I try to plot a DOLFIN function which is spatially constant, I'm 
just getting a white window. I can't even view the mesh using the key 
'w'. If the function is not constant, everything works as expected. Any 
ideas?

Garth

---

From: Ola Skavhaug <[email-masked]>
Date: Mon, 25 Jun 2007 23:12:55 +0200

> 'w'. If the function is not constant, everything works as expected. Any 

Could you please provide me with an example?

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

---

From: "Garth N. Wells" <[email-masked]>
Date: Tue, 26 Jun 2007 08:40:27 +0200

> Could you please provide me with an example?

Looks like a DOLFIN issue. If I plot the attached function through Python,

   from dolfin import *
   mesh = Mesh("constant.xml")
   plot(mesh)

it looks fine. Through DOLFIN,

   #include <dolfin.h>
   using namespace dolfin;

   int main()
   {
     Function function("constant.xml");
     plot(function);
     return 0;
   }

I get the white window.

Garth

>> Garth

<?xml version="1.0" encoding="UTF-8"?>

<dolfin xmlns:dolfin="http://www.fenics.org/dolfin/">
  <function> 
  <mesh celltype="triangle" dim="2">
    <vertices size="9">
      <vertex index="0" x="0" y="0"/>
      <vertex index="1" x="0.5" y="0"/>
      <vertex index="2" x="1" y="0"/>
      <vertex index="3" x="0" y="0.5"/>
      <vertex index="4" x="0.5" y="0.5"/>
      <vertex index="5" x="1" y="0.5"/>
      <vertex index="6" x="0" y="1"/>
      <vertex index="7" x="0.5" y="1"/>
      <vertex index="8" x="1" y="1"/>
    </vertices>
    <cells size="8">
      <triangle index="0" v0="0" v1="1" v2="4"/>
      <triangle index="1" v0="0" v1="3" v2="4"/>
      <triangle index="2" v0="1" v1="2" v2="5"/>
      <triangle index="3" v0="1" v1="4" v2="5"/>
      <triangle index="4" v0="3" v1="4" v2="7"/>
      <triangle index="5" v0="3" v1="6" v2="7"/>
      <triangle index="6" v0="4" v1="5" v2="8"/>
      <triangle index="7" v0="4" v1="7" v2="8"/>
    </cells>
  </mesh>
  <vector size="9"> 
    <entry row="0" value="50"/>
    <entry row="1" value="50"/>
    <entry row="2" value="50"/>
    <entry row="3" value="50"/>
    <entry row="4" value="50"/>
    <entry row="5" value="50"/>
    <entry row="6" value="50"/>
    <entry row="7" value="50"/>
    <entry row="8" value="50"/>
  </vector>
  <finiteelement signature="Lagrange finite element of degree 1 on a triangle"/>
  <dofmap signature="FFC dof map for Lagrange finite element of degree 1 on a triangle"/>
  </function> 
</dolfin>

---

From: Ola Skavhaug <[email-masked]>
Date: Tue, 26 Jun 2007 13:55:41 +0200

>   mesh = Mesh("constant.xml")

Here, you only plot the mesh, not the function. Viper might have a bug in the
Function plotting and still plot meshes perfectly.

What does the file constant.xml look like? A constant value and a mesh?

Ola

---

From: "Garth N. Wells" <[email-masked]>
Date: Tue, 26 Jun 2007 14:01:01 +0200

> Function plotting and still plot meshes perfectly.

Sorry about that. I should have done

    from dolfin import *
    function = Function("constant.xml")
    plot(function)

The above code gives a white screen. If I perturb one of the vector 
values in constant.xml by hand, plotting works fine.

> What does the file constant.xml look like? A constant value and a mesh?

It has a mesh and a list of vector values (it was attached to my 
previous post). It's a simple mesh with eight cells and a constant 
values of 50. Perhaps viper has trouble choosing a colour map when all 
values are constant?

Garth