X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=src%2Fmpiworld.cpp;h=3b4b99334348b789a5382f1df711cfb635b83976;hp=f5631f1e8c5a74a319c1464341a448e06f4a0d51;hb=2d39e823ba389fc68e5317c422b55be006094252;hpb=a95e41ac40cd2f3a4401d921618604cf33f2a904 diff --git a/src/mpiworld.cpp b/src/mpiworld.cpp index f5631f1..3b4b993 100644 --- a/src/mpiworld.cpp +++ b/src/mpiworld.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: mpiworld.cpp,v 1.1 2000/06/09 01:35:33 kevin Exp $ +** $Id: mpiworld.cpp,v 1.2 2000/06/22 10:17:28 kevin Exp $ ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License (version 2) as @@ -64,3 +64,21 @@ MPIWorld::setTotalWorkUnits(int totalWorkUnits) } +void +MPIWorld::BcastString (string& str) +{ + int len; + + if (m_myRank == 0) + len = str.length(); + m_comm.Bcast (&len, 1, MPI::INT, 0); + char buf [ len + 1]; + + if (m_myRank == 0) + strcpy (buf, str.c_str()); + + m_comm.Bcast (buf, len + 1, MPI::CHAR, 0); + + if (m_myRank > 0) + str = buf; +}