p4est user pointer and distributed::triangulation

22 views
Skip to first unread message

Konrad Simon

unread,
May 13, 2021, 5:05:47 PM5/13/21
to deal.II User Group
Dear all, 

I am currently writing an interface to some p4est functions. The structure of p4est makes it often necessary to pass data around through a user pointer of whatever type (void*). When creating a new triangulation this pointer is set to „this“ (the triangulation itself), see for example


Is this pointer used in other interfaces somehow? p4est itself does not touch it so I am wondering if I can reset it to anything I‘d like.

Any Ideas?

Best,
Konrad

Wolfgang Bangerth

unread,
May 13, 2021, 6:42:48 PM5/13/21
to dea...@googlegroups.com
On 5/13/21 3:05 PM, Konrad Simon wrote:
>
> I am currently writing an interface to some p4est functions. The structure of
> p4est makes it often necessary to pass data around through a user pointer of
> whatever type (void*). When creating a new triangulation this pointer is set
> to „this“ (the triangulation itself), see for example
>
> https://www.dealii.org/current/doxygen/deal.II/distributed_2tria_8cc_source.html#l2989
> <https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.dealii.org%2Fcurrent%2Fdoxygen%2Fdeal.II%2Fdistributed_2tria_8cc_source.html%23l2989&data=04%7C01%7CWolfgang.Bangerth%40colostate.edu%7Cb4cadd28da84445fd29308d91652e2c3%7Cafb58802ff7a4bb1ab21367ff2ecfc8b%7C0%7C0%7C637565367510208994%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=v2G100jGfI6SbGwV35raSFjMxfnJMJurP2F2qAc61Ls%3D&reserved=0>
>
> Is this pointer used in other interfaces somehow? p4est itself does not touch
> it so I am wondering if I can reset it to anything I‘d like.

Konrad,
we use this user pointer in many of the functions that are called back from
p4est. Take a look at
RefineAndCoarsenList<dim, spacedim>::refine_callback
for example (line 761 of the file), and many other functions that you can find
by searching for
forest->user_pointer
in this file.

We consider the p4est forest object as internal to the p::d::T class, so I
would expect that you can't access it, or expect that you can use any of its
content for anything other than what the p::d::T class does with it.

Best
W.


--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/

Konrad Simon

unread,
May 14, 2021, 3:44:50 AM5/14/21
to deal.II User Group
Thank you, Wolfgang! This is exactly what I am looking for. I don‘t need to access the pointer from outside, I am trying to extend the p4est-interface itself.

Best,
Konrad

Reply all
Reply to author
Forward
0 new messages