On Tue, 14 Sep 2010, Roy Stogner wrote: > On Tue, 14 Sep 2010, Tim Kroeger wrote: > >> For a dof of a vector the corresponds to a System, I need to know the >> maximal subdomain_id of all elements which contain this dof. > >> While it is principally possible to determine this on the fly (via >> Elem::find_point_neighbor() and then a loop over the resulting >> elements and a loop over their respective dofs), this seems to be >> very slow (I guess too slow). > > It also might be incorrect, depending on your definition of "contain". > Are you looking at just all elements which have a shape function > associated with this DoF, or are you also including every element > which supports an associated basis function? In the former case it's > enough to find elements which point to this DoF's node; in the latter > case in an adapted mesh you've also got to check for other DoFs which > are constrained by this one.
Good point, I didn't think of this. I'll try to sort things in my brain and see which of these is what I want. I see that in the latter case, I can use DofMap::constrain_nothing() to get the correct dof list, right? > But when you want to cache it: > >> std::map<unsigned int, unsigned char>: Seems to be the best solution >> that I can currently think of. Can also be extended to >> std::map<unsigned int,std::pair<unsigned char,unsigned char> > so that >> minimal and maximal subdomain_id are stored in one structure. >> >> Any suggestions? > > If efficiency is important, put the local dofs in a vector and just > the ghost dofs in a map. > > If efficiency is really important, try both map and hash_map. Grep for > HASH_MAP and you'll find two places where we're using them for > multimap containers (in one of 7 incarnations depending on how up to > date your compiler is), and you can use the same #if defined() tests > to find a supported hash_map type or fallback. > > If you want to be awesome, add this as a GHOSTED option to the > DistributedVector class. PETSc may not want to play with multiple > scalar types but it'd be no problem for us to add additional > instantiations like DistributedVector<unsigned int>. Thank you for your suggestions. I will try with std::map first and see whether it takes some significant computation time in my application. If it does, I'll extend the DistributedVector class appropriately using one of the more efficient suggestions that you made. Best Regards, Tim -- Dr. Tim Kroeger CeVis -- Center of Complex Systems and Visualization University of Bremen [email protected] Universitaetsallee 29 [email protected] D-28359 Bremen Phone +49-421-218-7710 Germany Fax +49-421-218-4236 ------------------------------------------------------------------------------ Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev _______________________________________________ Libmesh-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/libmesh-users
