On Thu, May 14, 2009 at 09:15:08AM +0100, Garth N. Wells wrote:
Ola Skavhaug wrote:
On Thu, May 14, 2009 at 9:36 AM, Garth N. Wells <gnw20@xxxxxxxxx> wrote:
Something in the recent change sets has broken some demos, for example
demo/pde/advection-diffusion/cpp
Garth
OK, I think I know what's breaking it. The dofmap gets the wrong
global dimension, and we are changing some of the logic there. I will
need to dig a little deeper.
The problem is that the code
// Initialize mesh entities used by dof map
for (uint d = 0; d <= mesh.topology().dim(); d++)
if (ufc_dof_map->needs_mesh_entities(d))
{
mesh.init(d);
if (d > 0 && parallel)
MeshPartitioning::number_entities(const_cast<Mesh&>(mesh), d);
}
inside DofMap::init(const Mesh& mesh) has been commented out. Mesh
entities which are required for the dof map are not being initialised.
Can this code just be 'turned' back on?
The plan is for this to happen in the constructor of FunctionSpace
instead. There are now two different constructors, one const and one
non-const.
The non-const version should check which entities are needed and if they
are not there compute them. This means calling mesh.init(d) and if
running in parallel also number_entities which computes global indices
for all entities. The global indices are stored in MeshData with keys
"global entity indices 0", "global entity indices 1" etc.
The const version should check which entities are needed and if they
are not there give an error message.
This will require modifying the generated DOLFIN wrapper code (in
dolfin_utils) to generate both constructors.
When this works, we can remove the const-casts for init() in Mesh.