Many thanks
Pietro
========================================
#include<dolfin.h>
#include "Test.h"
using namespace dolfin;
int main()
{
const int dim = 2; // dimension
// Create mesh
Rectangle mesh(0.0, 0.0, 1.0, 1.0, 10, 10);
// Create function space
Test::FunctionSpace V(mesh);
// Set up forms
Test::BilinearForm a(V, V);
Test::LinearForm L(V);
// Access mesh geometry
MeshGeometry& geometry = mesh.geometry();
// Associate a vertex to a specific cell
double x0, x1;
Array<double> *xy;
Vector volt(mesh.num_vertices());
double block[mesh.num_vertices()];
dolfin::uint rows[mesh.num_vertices()];
int i = 0;
for (VertexIterator vertex(mesh); !vertex.end(); ++vertex) {
xy = new Array<double>(dim, geometry.x(vertex->index()));
x0 = (*xy)[0];
x1 = (*xy)[1];
if (x0<= 0.4)
block[i] = 40;
else
block[i] = -86;
++i;
}
// Indices of the row of the vector to set
for (unsigned int i = 0; i< mesh.num_vertices(); ++i)
rows[i] = i;
// Output file in VTK format
File file("test_out.pvd");
volt.set(block, mesh.num_vertices(), rows);
Function u(V, volt);
file<< u;
plot(u);
}
=================================================