- if(rank>0) of.open( (fulldir + "/rank" + cRank + ".tmp").c_str() );
- else of.open( (fulldir + "/" + signature + ".dat").c_str() );
+ if (rank == 0) {
+ timestamp = time(NULL);
+
+ while (true) {
+ fulldir = wdir + "/" + longToStr(timestamp) + "." + longToStr(iseq) + "_" + signature + ".tmp";
+ if ( mkdir(fulldir.c_str(), 0775) == 0 )
+ break;
+ else if ( errno != EEXIST ) {
+ cerr << "WRITEOUT: Could not create outdir!" << endl << flush;
+ break;
+ }
+ iseq++;
+ }
+
+#ifndef MPI_DISABLED
+ for(int idest=1; idest<numprocs; idest++) {
+ MPI_Send(×tamp, 1, MPI_LONG, idest, 123, MPI_COMM_WORLD);
+ MPI_Send(&iseq, 1, MPI_LONG, idest, 124, MPI_COMM_WORLD);
+ }
+#endif
+
+ }