From: Tim Kroeger <tim.kroeger@ce...>  20091029 15:02:40

On Thu, 29 Oct 2009, Roy Stogner wrote: > On Thu, 29 Oct 2009, Tim Kroeger wrote: >> >> Is there any easy way to loop over all elems that are neighbors of a >> given elem accross either a face or an edge? As fas as I understand, >> Elem::neighbor() only cares about neighbors accross faces. On the >> other hand, Elem::find_point_neighbors() does too much. I think, it >> should be easy to implement a method Elem::find_edge_neighbors() >> analogously to Elem::find_point_neighbors(), where just each call to >> Elem::contains_vertex_of() is replaced with a call to >> Elem::contains_edge_of(), the latter is implemented analogously to >> Elem::contains_vertex_of() with the only difference that for returning >> true, it requires at least *two* vertices of the one element contained >> to be contained in the other. What do you guys think? If you agree >> that this would be correct, I'd be happy to do this (easy and >> straightforward) task. > > Sounds good... > > Something that needs thought, though: there's a limitation in > find_point_neighbors() which will become a more significant limitation > in find_edge_neighbors(): behavior on adaptive meshes. > > With find_point_neighbors, an elem can share a point with its neighbor > without sharing any nodes with its neighbor, for some firstorder elements > two levels apart or some secondorder elements three levels apart. > This is only a minor problem for our patch recovery estimator, which > doesn't quite grow patches in the most optimal way, so I never worried > about it. Hmm... There seems to be some misunderstanding either on my side or on yours. To check whether two elems (say, A and B) have a common point, Elem::find_point_neighbors calls A.contains_point(nB) for all nodes nB of B and B.contains_point(nA) for all nodes nA of A. The method Elem::contains_point(), however, does *not* check whether the given point is a node of the respective element; rather it uses an inverse map to check whether the point is contained in the element. Hence, if I understand correctly what you mean, these cases are caught correctly (and would be by Elem::find_edge_neighbors() the same way). Or did you mean something different? Best Regards, Tim  Dr. Tim Kroeger tim.kroeger@... Phone +494212187710 tim.kroeger@... Fax +494212184236 Fraunhofer MEVIS, Institute for Medical Image Computing Universitaetsallee 29, 28359 Bremen, Germany 