r117: *** empty log message ***
[ctsim.git] / src / mpiworld.cpp
index f5631f1e8c5a74a319c1464341a448e06f4a0d51..3b4b99334348b789a5382f1df711cfb635b83976 100644 (file)
@@ -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;
+}