-/*
- * m->mothurOut.cpp
- * Mothur
- *
- * Created by westcott on 2/25/10.
- * Copyright 2010 Schloss Lab. All rights reserved.
- *
- */
-
-#include "mothurout.h"
-
-/******************************************************/
-MothurOut* MothurOut::getInstance() {
- if( _uniqueInstance == 0) {
- _uniqueInstance = new MothurOut();
- }
- return _uniqueInstance;
-}
-/*********************************************************************************************/
-void MothurOut::setFileName(string filename) {
- try {
- logFileName = filename;
- openOutputFile(filename, out);
- }
- catch(exception& e) {
- errorOut(e, "MothurOut", "setFileName");
- exit(1);
- }
-}
-/*********************************************************************************************/
-MothurOut::~MothurOut() {
- try {
- _uniqueInstance = 0;
- out.close();
- }
- catch(exception& e) {
- errorOut(e, "MothurOut", "MothurOut");
- exit(1);
- }
-}
-
-/*********************************************************************************************/
-void MothurOut::mothurOut(string output) {
- try {
-
- cout << output;
- out << output;
-
- }
- catch(exception& e) {
- errorOut(e, "MothurOut", "MothurOut");
- exit(1);
- }
-}
-/*********************************************************************************************/
-void MothurOut::mothurOutEndLine() {
- try {
- cout << endl;
- out << endl;
- }
- catch(exception& e) {
- errorOut(e, "MothurOut", "MothurOutEndLine");
- exit(1);
- }
-}
-/*********************************************************************************************/
-void MothurOut::mothurOutJustToLog(string output) {
- try {
- out << output;
- }
- catch(exception& e) {
- errorOut(e, "MothurOut", "MothurOutJustToLog");
- exit(1);
- }
-}
-/*********************************************************************************************/
-void MothurOut::errorOut(exception& e, string object, string function) {
- mothurOut("Error: ");
- mothurOut(toString(e.what()));
- mothurOut(" has occurred in the " + object + " class function " + function + ". Please contact Pat Schloss at mothur.bugs@gmail.com, and be sure to include the mothur.logFile with your inquiry.");
- mothurOutEndLine();
-}
-/*********************************************************************************************/
-
-
-
-
-
+/*\r
+ * m->mothurOut.cpp\r
+ * Mothur\r
+ *\r
+ * Created by westcott on 2/25/10.\r
+ * Copyright 2010 Schloss Lab. All rights reserved.\r
+ *\r
+ */\r
+\r
+#include "mothurout.h"\r
+\r
+/******************************************************/\r
+MothurOut* MothurOut::getInstance() {\r
+ if( _uniqueInstance == 0) {\r
+ _uniqueInstance = new MothurOut();\r
+ }\r
+ return _uniqueInstance;\r
+}\r
+/*********************************************************************************************/\r
+void MothurOut::setFileName(string filename) {\r
+ try {\r
+ logFileName = filename;\r
+ \r
+ #ifdef USE_MPI\r
+ int pid;\r
+ MPI_Comm_rank(MPI_COMM_WORLD, &pid); \r
+ \r
+ if (pid == 0) { //only one process should output to screen\r
+ #endif\r
+ \r
+ openOutputFile(filename, out);\r
+ \r
+ #ifdef USE_MPI\r
+ }\r
+ #endif\r
+ }\r
+ catch(exception& e) {\r
+ errorOut(e, "MothurOut", "setFileName");\r
+ exit(1);\r
+ }\r
+}\r
+/*********************************************************************************************/\r
+void MothurOut::closeLog() {\r
+ try {\r
+ \r
+ #ifdef USE_MPI\r
+ int pid;\r
+ MPI_Comm_rank(MPI_COMM_WORLD, &pid); \r
+ \r
+ if (pid == 0) { //only one process should output to screen\r
+ #endif\r
+ \r
+ out.close();\r
+ \r
+ #ifdef USE_MPI\r
+ }\r
+ #endif\r
+ }\r
+ catch(exception& e) {\r
+ errorOut(e, "MothurOut", "closeLog");\r
+ exit(1);\r
+ }\r
+}\r
+\r
+/*********************************************************************************************/\r
+MothurOut::~MothurOut() {\r
+ try {\r
+ _uniqueInstance = 0;\r
+ \r
+ }\r
+ catch(exception& e) {\r
+ errorOut(e, "MothurOut", "MothurOut");\r
+ exit(1);\r
+ }\r
+}\r
+/*********************************************************************************************/\r
+void MothurOut::mothurOut(string output) {\r
+ try {\r
+ \r
+ #ifdef USE_MPI\r
+ int pid;\r
+ MPI_Comm_rank(MPI_COMM_WORLD, &pid); \r
+ \r
+ if (pid == 0) { //only one process should output to screen\r
+ #endif\r
+ \r
+ cout << output;\r
+ out << output;\r
+ \r
+ #ifdef USE_MPI\r
+ }\r
+ #endif\r
+ }\r
+ catch(exception& e) {\r
+ errorOut(e, "MothurOut", "MothurOut");\r
+ exit(1);\r
+ }\r
+}\r
+/*********************************************************************************************/\r
+void MothurOut::mothurOutEndLine() {\r
+ try {\r
+ #ifdef USE_MPI\r
+ int pid;\r
+ MPI_Comm_rank(MPI_COMM_WORLD, &pid); \r
+ \r
+ if (pid == 0) { //only one process should output to screen\r
+ #endif\r
+ \r
+ cout << endl;\r
+ out << endl;\r
+ \r
+ #ifdef USE_MPI\r
+ }\r
+ #endif\r
+ }\r
+ catch(exception& e) {\r
+ errorOut(e, "MothurOut", "MothurOutEndLine");\r
+ exit(1);\r
+ }\r
+}\r
+/*********************************************************************************************/\r
+void MothurOut::mothurOutJustToLog(string output) {\r
+ try {\r
+ #ifdef USE_MPI\r
+ int pid;\r
+ MPI_Comm_rank(MPI_COMM_WORLD, &pid); \r
+ \r
+ if (pid == 0) { //only one process should output to screen\r
+ #endif\r
+ \r
+ out << output;\r
+ \r
+ #ifdef USE_MPI\r
+ }\r
+ #endif\r
+ }\r
+ catch(exception& e) {\r
+ errorOut(e, "MothurOut", "MothurOutJustToLog");\r
+ exit(1);\r
+ }\r
+}\r
+/*********************************************************************************************/\r
+void MothurOut::errorOut(exception& e, string object, string function) {\r
+ mothurOut("Error: ");\r
+ mothurOut(toString(e.what()));\r
+ mothurOut(" has occurred in the " + object + " class function " + function + ". Please contact Pat Schloss at mothur.bugs@gmail.com, and be sure to include the mothur.logFile with your inquiry.");\r
+ mothurOutEndLine();\r
+}\r
+/*********************************************************************************************/\r
+\r
+\r
+\r
+\r
+\r