X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=mothurout.cpp;h=a56a6217a8c136e1fcb9f3f3078c5418547220fa;hb=f06fdb807822f8e06db003ed809c87250905cfc8;hp=3205ae794165a5b8c045c473403d8a66b1b54f90;hpb=a150db3c2bfd7b76420048a1e94ebe397f2c6045;p=mothur.git diff --git a/mothurout.cpp b/mothurout.cpp index 3205ae7..a56a621 100644 --- a/mothurout.cpp +++ b/mothurout.cpp @@ -247,6 +247,53 @@ void MothurOut::mothurOutEndLine() { } } /*********************************************************************************************/ +void MothurOut::mothurOut(string output, ofstream& outputFile) { + try { + +#ifdef USE_MPI + int pid; + MPI_Comm_rank(MPI_COMM_WORLD, &pid); + + if (pid == 0) { //only one process should output to screen +#endif + + cout << output; + out << output; + outputFile << output; + +#ifdef USE_MPI + } +#endif + } + catch(exception& e) { + errorOut(e, "MothurOut", "MothurOut"); + exit(1); + } +} +/*********************************************************************************************/ +void MothurOut::mothurOutEndLine(ofstream& outputFile) { + try { +#ifdef USE_MPI + int pid; + MPI_Comm_rank(MPI_COMM_WORLD, &pid); + + if (pid == 0) { //only one process should output to screen +#endif + + cout << endl; + out << endl; + outputFile << endl; + +#ifdef USE_MPI + } +#endif + } + catch(exception& e) { + errorOut(e, "MothurOut", "MothurOutEndLine"); + exit(1); + } +} +/*********************************************************************************************/ void MothurOut::mothurOutJustToLog(string output) { try { #ifdef USE_MPI @@ -1229,6 +1276,33 @@ float MothurOut::ceilDist(float dist, int precision){ exit(1); } } +/**********************************************************************************************************************/ +int MothurOut::readNames(string namefile, map& nameMap) { + try { + + //open input file + ifstream in; + openInputFile(namefile, in); + + while (!in.eof()) { + if (control_pressed) { break; } + + string firstCol, secondCol; + in >> firstCol >> secondCol; gobble(in); + + nameMap[firstCol] = secondCol; + } + in.close(); + + return 0; + + } + catch(exception& e) { + errorOut(e, "MothurOut", "readNames"); + exit(1); + } +} + /**********************************************************************************************************************/ map MothurOut::readNames(string namefile) { try {