]> git.donarmstrong.com Git - mothur.git/blobdiff - distancecommand.cpp
a few modifications for 1.9
[mothur.git] / distancecommand.cpp
index 58302ddfbbc9e07de80747544217e79937c387ba..10a99dd240ee862884d59b8570581ebbe129ef32 100644 (file)
@@ -200,11 +200,14 @@ int DistanceCommand::execute(){
                        MPI_File outMPI;
                        int amode=MPI_MODE_CREATE|MPI_MODE_WRONLY; 
 
-                       char* filename = new char[outputFile.length()];\r
-                       memcpy(filename, outputFile.c_str(), outputFile.length());
+                       //char* filename = new char[outputFile.length()];
+                       //memcpy(filename, outputFile.c_str(), outputFile.length());
+                       
+                       char filename[1024];
+                       strcpy(filename, outputFile.c_str());
                        
                        MPI_File_open(MPI_COMM_WORLD, filename, amode, MPI_INFO_NULL, &outMPI);
-                       delete filename;
+                       //delete filename;
 
                        if (pid == 0) { //you are the root process 
                        
@@ -249,11 +252,14 @@ int DistanceCommand::execute(){
                                MPI_File outMPI;
                                MPI_File inMPI;
 
-                               char* filename = new char[outputFile.length()];\r
-                               memcpy(filename, outputFile.c_str(), outputFile.length());
-                       
+                               //char* filename = new char[outputFile.length()];
+                               //memcpy(filename, outputFile.c_str(), outputFile.length());
+                               
+                               char filename[1024];
+                               strcpy(filename, outputFile.c_str());
+
                                MPI_File_open(MPI_COMM_SELF, filename, amode, MPI_INFO_NULL, &outMPI);
-                               delete filename;
+                               //delete filename;
 
                                //wait on chidren
                                for(int b = 1; b < processors; b++) { 
@@ -265,7 +271,7 @@ int DistanceCommand::execute(){
                                        
                                        string outTemp = outputFile + toString(b) + ".temp";
 
-                                       char* buf = new char[outTemp.length()];\r
+                                       char* buf = new char[outTemp.length()];
                                        memcpy(buf, outTemp.c_str(), outTemp.length());
                                        
                                        MPI_File_open(MPI_COMM_SELF, buf, MPI_MODE_DELETE_ON_CLOSE|MPI_MODE_RDONLY, MPI_INFO_NULL, &inMPI);
@@ -488,7 +494,7 @@ int DistanceCommand::driverMPI(int startLine, int endLine, MPI_File& outMPI, flo
                        //send results to parent
                        int length = outputString.length();
 
-                       char* buf = new char[length];\r
+                       char* buf = new char[length];
                        memcpy(buf, outputString.c_str(), length);
                        
                        MPI_File_write_shared(outMPI, buf, length, MPI_CHAR, &status);
@@ -515,11 +521,14 @@ int DistanceCommand::driverMPI(int startLine, int endLine, string file, long& si
                MPI_File outMPI;
                int amode=MPI_MODE_CREATE|MPI_MODE_WRONLY; 
 
-               char* filename = new char[file.length()];\r
-               memcpy(filename, file.c_str(), file.length());
+               //char* filename = new char[file.length()];
+               //memcpy(filename, file.c_str(), file.length());
                
+               char filename[1024];
+               strcpy(filename, file.c_str());
+
                MPI_File_open(MPI_COMM_SELF, filename, amode, MPI_INFO_NULL, &outMPI);
-               delete filename;
+               //delete filename;
 
                int startTime = time(NULL);
                
@@ -557,7 +566,7 @@ int DistanceCommand::driverMPI(int startLine, int endLine, string file, long& si
                        
                        //send results to parent
                        int length = outputString.length();
-                       char* buf = new char[length];\r
+                       char* buf = new char[length];
                        memcpy(buf, outputString.c_str(), length);
                        
                        MPI_File_write(outMPI, buf, length, MPI_CHAR, &status);