On Tue, Oct 30, 2012 at 6:06 AM, Kirk, Benjamin (JSC-EG311) <benjamin.kirk-1@nasa.gov> wrote:
A simple but less elegant solution would be to pack two contiguous arrays - one of the string lengths in an integer vector and another of all the strings concatenated into a vector<char> and broadcast both. Of course you could hide all this cruft inside a broadcast(vector<string>) specialization, which does the packing and unpacking.

Actually now that I think about it, those strings come out of the Exodus API as char arrays anyway.  We convert them to strings after the fact.  This solution really isn't that bad especially since we can just leave them in their native formats long enough to distribute.



On Oct 29, 2012, at 5:41 PM, "Roy Stogner" <roystgnr@ices.utexas.edu> wrote:

> On Mon, 29 Oct 2012, Derek Gaston wrote:
>> Is there a way to broadcast a vector of strings?
> Easily?  Not currently.
>> /Users/gastdr/projects/libmesh/include/libmesh/parallel.h:285: error: ‘libMesh::Parallel::StandardType<T>::StandardType(const T*) [with T =
>> std::basic_string<char, std::char_traits<char>, std::allocator<char> >]’ is private
>> /Users/gastdr/projects/libmesh/include/libmesh/parallel.h:3696: error: within this context
>> Which obviously means that this is a datatype that no one has worked with yet.
>> So... any ideas?  Should I go ahead and implement a datatype for this... or is there a better way?
> I'm afraid implementing a datatype won't work - that's a mechanism for
> constant-size objects.
> For sending variable-size objects our best idiom right now is the
> "packed_range" code.  See "parallel_node.h" or "parallel_elem.h" for
> examples, which (fortunately or unfortunately depending on your point
> of view) are much much more complicated than the corresponding code
> for std::basic_string<T> would need to be.
> I'm working on refactoring parallel.h right now, actually.  Could you
> keep a "parallel_string.h" separate the way the node/elem packing is?
> ---
> Roy
> ------------------------------------------------------------------------------
> The Windows 8 Center - In partnership with Sourceforge
> Your idea - your app - 30 days.
> Get started!
> http://windows8center.sourceforge.net/
> what-html-developers-need-to-know-about-coding-windows-8-metro-style-apps/
> _______________________________________________
> Libmesh-devel mailing list
> Libmesh-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/libmesh-devel
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
Libmesh-devel mailing list