The documentation for MeshFunctions cite this as an example of its use.
"A MeshFunction may for example be used to store a global numbering scheme for the entities of a (parallel) mesh"
How would one accomplish this?
Thanks,
Ben
You can get the global index of an entity with the global_index() method:
for c in cells(mesh): print c.index(), c.global_index()
If you want, you could put this in a MeshFunction.
Ok, I'm having trouble creating a meshfunction in c++. Could you give me an example of how to create and initialize a meshfunction? It seems I am failing to provide the compiler with a proper template.
It depends what you want to use it for.
CellFunction<std::size_t> cell_fn(mesh); // don't set values VertexFunction<bool> vertex_fn(mesh, false); // Initialise to all false for (CellIterator c(mesh); !c.end(); ++c) cell_fn[*c] = c->index();
Thank you! Very helpful. I'm finding the jump into c++ syntax very difficult. Sometimes the path from reading the docs to getting a small example working is very tricky (for someone with my level of experience in c++, anyway).
brk888, for what it's worth I had the same trouble. I know c++ well but my python is weak - tracking the underlying c++ through the swig interface can be tricky. I found the demos which are in both c++ and python very helpful.