Problems with GetParentElement

More
2 years 10 months ago #4165 by Schwering
Hello everybody,

I'm new to netgen/ngsolve and I have some troubles with the mesh.GetParentElement function. For my purpose, for each element in a fine mesh, I need the number of the parent element in the coarse grid (the fine mesh is constructed by mesh.Refine() from the coarse mesh). I wrote a simple function which should return me the wanted number:

def SimpleGetParentElementNr(element, CoarseGridElemNr, mesh):
if element.nr < CoarseGridElemNr:
return element.nr
else:
ParentElemNr = mesh.GetParentElement(element).nr
if ParentElemNr < CoarseGridElemNr:
return ParentElemNr
else:
return mesh.GetParentElement(mesh[ElementId(VOL,ParentElemNr)]).nr

Do you think this function will work?

Thanks!
Time to create page: 0.096 seconds