Coarse to Fine and Fine to Coarse Mappings

Hi everyone,

is there a way to after I’ve called the Refine(adaptive=True) method on a Netgen mesh to extract the coarse to fine and fine to coarse mappings ?
In particular, can I do this is entirely in Netgen ?

Best,
Umberto

Hi Umberto,

the topologic information (vertex is between two parents, element is child of parent element, …) is on the Netgen-side, however linear operators (prolongation) is on the NGSolve side, see
Multigrid

best,
Joachim

Hi Joachim,
do you know where can I find the infromation: element is child of a certein parent, in the netgen side ?
I’m sorry I can’t seem to be able to figure this out.
Best,
Umberto

Hi Umberto,
in netgen MeshClass (libsrc/meshing/meshclass.hpp) the mlparentelement carries this information.

In a bisected mesh one child has the same element number as in the parent, the second element gets a new one. For the new one the mlparentelements points to the element number of the parent. This array is oldstyle (therefore 1-based) 0 means it was always the 1st brother in any refinement (or not refined at all). This should be enough info to rebuild a refinement map if needed.

This is for elements, if you want edge, face, … info it is in topology, but here it is different, here the refined mesh also has the coarse nodes (but “deactivated”) and you can access maps in meshclass->topology->GetParentEdges / GetParentFaces. Note that you have to set SetBuildParentEdges / SetBuildParentFaces flags to true on the topology before update so that these maps are built.

Best
Christopher

Hi Christopher,

Thank you very much ! I’ll get working on multigrid support for a Netgen mesh in Firedrake.

Best,
Umberto

sounds good, maybe we want to wrap some of this info to python (@joachim )? or is cpp interface fine?

It would be super usefult to wrap some info in Python, I’ve started doing this here: GitHub - firedrakeproject/netgen.
I can open a PR on the TU Gitlab repo, would this work ?

sorry for the late reply. I think it would be nice to expose the array memory directly without copying. Wanted to start this but realized they are old style netgen arrays that are not exposed to python. @joachim should we expose them or rewrite to ngcore arrays?