On Fri, Nov 15, 2013 at 7:13 AM, Kirk, Benjamin (JSC-EG311) <
benjamin.k...@nasa.gov> wrote:

> On Nov 15, 2013, at 12:15 AM, John Peterson <jwpeter...@gmail.com>
>  wrote:
>
> > Would it be possible to have the mesh_inserter_iterator do something
> other than call mesh.add_node(n)?  I think if it did something with logic
> more similar to Mesh::add_point(), which inserts a node with a valid ID in
> the appropriate location of the _nodes vector,
> MeshCommunication::broadcast() might actually just work...  Thoughts?
>
> The serial mesh has a long history of expecting contiguous node numbers,
> and that (nodes[i]->id() == i).  This was required *way* back when elements
> stored the indices of their nodes rather than pointers to them.
>
> Relaxing this while still using a vector as underlying storage should be
> technically possible, we just need some synchronization to (i) sort the
> nodes vector based on node->id(), and then (ii) implement a binary search
> lookup instead of direct access by id.  This would be a pretty big change
> though.  Am  I understanding you, that for some reason this is important?
>

I think I'd still like to maintain the nodes[i]->id() == i assumption for
now.  The holey Exodus numbering certainly wastes a lot of 8-byte pointers,
but you really have to waste _a lot_ of those before it even becomes
noticeable in the overall memory usage...

All I'm proposing at the moment is to try and make sure that various parts
of the library are working OK with _nodes and _elements vectors that have
NULLs in them.  MeshCommunication::broadcast() was just the first issue
that arose for us.

By the way, ParallelMesh currently has an "insert_node()" interface (Oct.
2007) but it seems a little unsafe?  If n->id() == invalid_id it will still
add the Node... I only bring it up since I was going to add a
MeshBase::insert_node() interface and came across this in the process.

  2277    benkirk Node* ParallelMesh::insert_node (Node* n)
  2277    benkirk {
  2286    benkirk   // If we already have this node we cannot
  2286    benkirk   // simply delete it, because we may have elements
  2286    benkirk   // which are attached to its address.
  2286    benkirk   //
  2361    benkirk   // Instead, call the Node = Point assignment operator
  2361    benkirk   // to overwrite the spatial coordinates (but keep its
  2361    benkirk   // address), delete the provided node, and return the
  2361    benkirk   // address of the one we already had.
  2286    benkirk   if (_nodes.count(n->id()))
  2286    benkirk     {
  2286    benkirk       Node *my_n = _nodes[n->id()];
  2277    benkirk
  2361    benkirk       *my_n = static_cast<Point>(*n);
  2286    benkirk       delete n;
  2286    benkirk       n = my_n;
  2286    benkirk     }
  2286    benkirk   else
  2286    benkirk     _nodes[n->id()] = n;
  2277    benkirk
  2277    benkirk   return n;
  2277    benkirk }


-- 
John
------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
Libmesh-devel mailing list
Libmesh-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmesh-devel

Reply via email to