On Tue, 27 Oct 2009, Vijay S. Mahadevan wrote: >> Not quite. I'd rather fix this once and for all, not just fix it in >> Gmsh now, then in XDR after that, then in Exodus after that, etc. We >> ought to have something that gets called by MeshBase itself, probably >> in prepare_for_use, to keep the id count consistent after a file is >> loaded. > > That should work if you want to go over all elements again and then > create a simple list of the subdomain id's to update the n_subdomains > variable. If you just want to abstract this out, it looks like you > would be wasting time doing an extra loop over the mesh when you can > update this information as and when you read the mesh. Eventhough it > sounds bad, it still might be the right way to go since the mesh > reader already knows this information. Just my 2 cents.
I'm tempted to ignore the cost of an extra loop when it's in the context of file I/O. Why worry about the cost of redundantly accessing RAM when we've just spent much more time accessing disk? But I suppose we can avoid that cost without killing the abstraction, if we're smart about it... If add_elem() inserted subdomain ids into a std::set, for example, then we'd just have to do a parallel union of that set during prepare_for_use, which is O(N_subdomains_per_proc * N_proc) instead of O(N_elem). It would be cheap to keep the set around afterward, too, enabling O(log(N_subdomains)) MeshBase::have_subdomain(id) queries. Anyone doing element destruction would be in charge of un-screwing-up the subdomain count afterwards, but all our current delete_elem uses are in contexts like coarsening, all_tri, delete_remote_elems, and other such methods that won't change the subdomain count. I'd be tempted to use a vector<bool> instead of a set, but that could backfire nastily if someone decided that their two subdomains should be numbered "1" and "1000000000". Thoughts? --- Roy ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Libmesh-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/libmesh-users
