X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=src%2Fmpiworld.cpp;h=3b4b99334348b789a5382f1df711cfb635b83976;hb=3fba6928127cd65870bdcd96c8114ad5894247ae;hp=f5631f1e8c5a74a319c1464341a448e06f4a0d51;hpb=2451ac413848718a1dd666ce6f6464e974680f47;p=ctsim.git 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; +}