On Fri, 5 Aug 2016, Shayan Hoshyari wrote:

> Is there any functionality in libMesh for renumbering the elements in a
> SerialMesh? Given that I already know the mapping old_id -> new_id ?

The renumber_elem() API is probably what you're looking for.  You may
need to use a "placeholder" number, though, to avoid overwrites.  E.g.
if you wanted to swap elements 0 and 1 in a 2 element mesh then you'd
need
renumber_elem(0,2);
renumber_elem(1,0);
renumber_elem(2,1);

Because if you just tried "renumber_elem(0,1);" then you'd fail an
assert in devel mode or have a corrupt mesh in opt mode.

You'll also want to set allow_renumbering(false) on the mesh so
libMesh doesn't override your preferences during any subsequent
reinits.

We'd appreciate bug reports if that doesn't work and/or unit tests if
it does work; AFAIK renumber_elem() is currently only used internally.
---
Roy

------------------------------------------------------------------------------
_______________________________________________
Libmesh-users mailing list
Libmesh-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to