Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

Problems with GetParentElement

More
2 years 3 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.111 seconds