Tobias, what you describe seems a bug in the library and we should try to fix it. Maybe we can put it on the list for Heidelberg, though the code jam will find me in the air over the Atlantic Ocean.

Every deal.II function (ab)using user pointers or indices should do the following:

At beginning: figure out if indices, pointers or none have been used. Dump the data if necessary.
At end: depending on the test at the beginning, restore or clear the data.

Alternatively, we might think if it is not better to enable users to add arbitrary amounts of data and thus avoid the problem of dumping it.

Guido

Tobias Leicht wrote:
Hi Roman,

the problem is with the partitioning and does not depend on refinement directly.

As you said, the user indices and pointers are supposed to be only for the user. That's why any library functions store them first and restore them afterwards if they use them internally. That worked fine as long as only user pointers were available. Then user indices were introduced... Everything would still work fine if we just copied all relevant data as it is, including the information which type has been used lately. The actual implementation, however, loops over all lines and quads and hexes (in 3D) of the mesh using the accessor function to obtain the data and store it in a vector and set it again the same way afterwards. Here, you have to decide whether you use indices or pointers. The partitioning uses indices. If you used user indices before, then everything is fine and unchanged afterwards. However, if you had a clean triangulation with no indices and no pointers, after the partitioning you have all zero indices and cannot use pointers without clearing all user data first. On the other hand, if you had user pointers you cannot even partition the mesh as it will fail on retrieving the user index of the first line in the mesh.
We do not need a complicated example, by the way:

- take any mesh, set a user pointer and call partitioning -> fails

- take any mesh, partition and set a user pointer -> fails

Someone should implement a decent backup-and-restore functionality for general user data, not indices or pointers.

Best, Tobias


_______________________________________________
dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii

Reply via email to