Xujun, The full data structure is populated all at once so finding them one by one really isn't an issue. If you are working with an unstructured mesh there's not really a better way.
Cody On Fri, Oct 30, 2015 at 10:39 AM Xujun Zhao <xzha...@gmail.com> wrote: > Maybe it is more clear to illustrate it in another way: > My original aim is to build springs between all the nodes and their > connected neighbors. Each spring has its own equilibrium length at which > the spring force is zero. Is it possible to directly build these spring > connections instead of find the nodal neighbors one by one? > > Thanks, > Xujun > > > On Fri, Oct 30, 2015 at 11:25 AM, Xujun Zhao <xzha...@gmail.com> wrote: > > > Hi John, > > > > I also found these two functions. I am working on it ;-) > > Thank you very much. > > > > Cheers, > > Xujun > > > > On Fri, Oct 30, 2015 at 11:22 AM, John Peterson <jwpeter...@gmail.com> > > wrote: > > > >> > >> > >> On Fri, Oct 30, 2015 at 9:50 AM, Xujun Zhao <xzha...@gmail.com> wrote: > >> > >>> Hi all, > >>> > >>> I want to find the neighboring nodes that are connected with an > specific > >>> node i. Does libMesh have functions to do this? Thank you very much. > >> > >> > >> Yes. > >> > >> // find_nodal_neighbors() needs a data structure which is prepared by > >> another function > >> std::vector<std::vector<const Elem*> > nodes_to_elem_map; > >> MeshTools::build_nodes_to_elem_map(mesh, nodes_to_elem_map); > >> > >> // Then you can call (*node is a reference to the node whose neighbors > >> you want): > >> std::vector<const Node*> neighbors; > >> MeshTools::find_nodal_neighbors(mesh, *node, nodes_to_elem_map, > >> neighbors); > >> > >> -- > >> John > >> > > > > > > ------------------------------------------------------------------------------ > _______________________________________________ > Libmesh-users mailing list > Libmesh-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/libmesh-users > ------------------------------------------------------------------------------ _______________________________________________ Libmesh-users mailing list Libmesh-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libmesh-users