> On 30 Mar 2019, at 15:35, Yuri Barros <[email protected]> wrote:
> 
> This at least needs to be in a FAQ in gmsh's manual. 
> 

Good idea - I've added an entry in the FAQ about it, which links to an example.

> These kinds of algorithms may be well known to people in mesh generation 
> field, but people starting in numerical methods find it hard because either 
> the software does it all under the hood in the equation solving or it doesn't 
> do at all. It could be useful if there were some software in between or some 
> place to look to find good algorithms.
> 
> My initial objective was not to ask for having this functionality at GMSH's 
> core, but to ask people in the field for a good algorithm because the 
> algorithms that I managed to develop are slow. I could take my time to 
> develop the algorithm from scratch but I think that it's reasonable to 
> consider that someone in the community already has a good algorithm. My 
> algorithm is already very heavy, I am looking anywhere I can to save 
> computational power.

Give the Python example a try: you'll see it's very simple.

> 
> I will try to implement this algorithm, I wonder if it can be adapted for n-d 
> delaunay triangulations?
> 

Sure, it's just topological.

Christophe

> Anyway, maybe a community-driven wiki could be useful for these secondary 
> topics after mesh generation... just a thought.
> 
> Thanks for the help!
> 
> Em sáb, 30 de mar de 2019 às 10:38, Christophe Geuzaine <[email protected]> 
> escreveu:
> 
> Hi guys,
> 
> I think I probably have said this before: each numerical method will have its 
> own needs: you might want neighbouring elements connected by a node, an edge 
> or a face; you might want a single layer or multiple layers; you might want 
> to include elements of lower dimension (boundaries) or not; you might want to 
> go through geometrical entities, or mesh partitions, or not... and so on... 
> So it's really better to compute this in your code to suit your needs.
> 
> Here's a small example in Python, using the Gmsh API to compute neighbouring 
> tetrahedra connected by a face (you can make this code more compact, but this 
> is to illustrate how simple it is):
> 
> ```
> import gmsh
> 
> gmsh.initialize()
> 
> gmsh.model.add("my test model");
> gmsh.model.occ.addBox(0,0,0, 1,1,1);
> gmsh.model.occ.synchronize()
> gmsh.model.mesh.generate(3)
> 
> # get tets and faces
> tets, _ = gmsh.model.mesh.getElementsByType(4)
> faces = gmsh.model.mesh.getElementFaceNodes(4, 3)
> 
> # compute face x tet incidence
> fxt = {}
> for i in range(0, len(faces), 3):
>     f = tuple(sorted(faces[i:i+3]))
>     t = tets[i/12]
>     if not f in fxt:
>         fxt[f] = [t]
>     else:
>         fxt[f].append(t)
> 
> # compute neighbors by face
> txt = {}
> for i in range(0, len(faces), 3):
>     f = tuple(sorted(faces[i:i+3]))
>     t = tets[i/12]
>     if not t in txt:
>         txt[t] = set()
>     for tt in fxt[f]:
>         if tt != t:
>             txt[t].add(tt)
> 
> print("neighbors by face: ", txt)
> 
> gmsh.finalize()
> 
> ```
> 
> We could add this in the demos/api directory if you think it's useful.
> 
> Christophe
> 
> 
> 
> 
> 
> > On 30 Mar 2019, at 10:51, Jeremy Theler <[email protected]> wrote:
> > 
> > Hey Yuri
> > 
> > I asked the same question back in 2011:
> > 
> > http://onelab.info/pipermail/gmsh/2011/006878.html
> > 
> > All I got is a loose reference to Lohner's book:
> > 
> > http://onelab.info/pipermail/gmsh/2011/006881.html
> > 
> > Someone asked it again in 2012 with no response:
> > 
> > http://onelab.info/pipermail/gmsh/2012/007480.html
> > 
> > I went in again in 2013, again with no luck:
> > 
> > http://onelab.info/pipermail/gmsh/2013/008183.html
> > 
> > Something similar came back in 2014:
> > 
> > http://onelab.info/pipermail/gmsh/2014/008808.html
> > 
> > And again FVM:
> > 
> > http://onelab.info/pipermail/gmsh/2014/008908.html
> > http://onelab.info/pipermail/gmsh/2014/009237.html
> > 
> > In 2017 I already mentioned that this was unsolved:
> > 
> > http://onelab.info/pipermail/gmsh/2017/011248.html
> > 
> > One more time in 2018:
> > 
> > http://onelab.info/pipermail/gmsh/2018/012120.html
> > 
> > 
> > So... is this enough to have something in Gmsh's core?
> > I proposed to add an optional section like $ElementNeighbour$ or something 
> > like this, listing the tag of the neighbours each elements has (including 
> > surface elements for volumetric elements so boundary conditions in FEM can 
> > be more efficiently written). I have somewhere a tool that reads a .msh and 
> > adds such a section, if somebody is interested I can dig into my archives 
> > and prepare a repository.
> > 
> > I bet the neighbour list can be generated in O(n) inside Gmsh, which should 
> > beat any complex O(n log n) or naive O(n^2) implementention outside Gmsh.
> > 
> > Regards
> > --
> > jeremy theler
> > www.seamplex.com
> > 
> > 
> > On Fri, 2019-03-29 at 16:00 -0300, Yuri Barros wrote:
> >> Hi all,
> >> 
> >> I am trying to optimize my finite volume formulation and one thing that is 
> >> taking too much computational time is to find adjacent cells. Is there any 
> >> way I can extract from GMSH the adjacent elements of a given element in 
> >> the local face order? Or is there any algorithm that people use routinely 
> >> for this task?
> >> 
> >> Thanks in advance!
> >> _______________________________________________
> >> gmsh mailing list
> >> 
> >> [email protected]
> >> http://onelab.info/mailman/listinfo/gmsh
> > _______________________________________________
> > gmsh mailing list
> > [email protected]
> > http://onelab.info/mailman/listinfo/gmsh
> 
> — 
> Prof. Christophe Geuzaine
> University of Liege, Electrical Engineering and Computer Science 
> http://www.montefiore.ulg.ac.be/~geuzaine
> 
> 
> 
> _______________________________________________
> gmsh mailing list
> [email protected]
> http://onelab.info/mailman/listinfo/gmsh

— 
Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science 
http://www.montefiore.ulg.ac.be/~geuzaine




_______________________________________________
gmsh mailing list
[email protected]
http://onelab.info/mailman/listinfo/gmsh

Reply via email to