librelist archives

« back to archive

p4est_iterate() over one specified level only

p4est_iterate() over one specified level only

From:
Date:
2015-03-23 @ 11:05
Hi,

I am trying to use the p4est-library for algorithms that require multiple 
iterations over deeper levels in the tree. My algorithm also requires to 
iterate over the deeper levels first and gradually go to the lower levels.


I have tried to find API calls that manage to do this, however 
p4est_iterate() is doing the z-index approach and p4est_search() is doing 
a top-down approach. Is there a API call that can iterate from the finer 
levels towards the less refined ones?

Kind regards,
Sten

Re: [p4est] p4est_iterate() over one specified level only

From:
Alex Fikl
Date:
2015-03-23 @ 13:31
Hello,

On Mon, Mar 23, 2015 at 6:05 AM,  <s.a.reijers@utwente.nl> wrote:
> Hi,
>
> I am trying to use the p4est-library for algorithms that require 
multiple iterations over deeper levels in the tree. My algorithm also 
requires to iterate over the deeper levels first and gradually go to the 
lower levels.
>
> I have tried to find API calls that manage to do this, however 
p4est_iterate() is doing the z-index approach and p4est_search() is doing 
a top-down approach. Is there a API call that can iterate from the finer 
levels towards the less refined ones?

The only way to do this that I can think of is by using p4est_mesh.
The quad_level member of p4est_mesh contains a list of lists of
per-level quadrant IDs that you can iterate over (see
example/mesh/mesh2.c for the most basic example).
Note that you have to use p4est_mesh_new_ext from p4est_extended with
the two extra arguments set to 1 to fill up these lists, as they are
not generated by default.

Iterating this way, you won't get useful neighborhood information like
from p4est_iter_*_info directly, but you can use other members of
p4est_mesh to achieve the same effect.

Hope that helps!
Alex

> Kind regards,
> Sten