X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=validparameter.cpp;fp=validparameter.cpp;h=1faa651cd85dea92784a7dcc20cfc1fd3a2a1a9d;hb=b4f80c1d2be78a8743a408a2b6d462b07f9f71ff;hp=e82a9e8d4446430d125c168d66e0ababc8651655;hpb=bbdb72971ea4cd171abe34985af89f97bc2a31d3;p=mothur.git diff --git a/validparameter.cpp b/validparameter.cpp index e82a9e8..1faa651 100644 --- a/validparameter.cpp +++ b/validparameter.cpp @@ -15,6 +15,20 @@ ValidParameters::ValidParameters() { try { m = MothurOut::getInstance(); initParameterRanges(); + commandName = ""; + } + catch(exception& e) { + m->errorOut(e, "ValidParameters", "ValidParameters"); + exit(1); + } +} +/***********************************************************************/ + +ValidParameters::ValidParameters(string c) { + try { + m = MothurOut::getInstance(); + initParameterRanges(); + commandName = c; } catch(exception& e) { m->errorOut(e, "ValidParameters", "ValidParameters"); @@ -214,6 +228,8 @@ string ValidParameters::validFile(map& container, string paramet MPI_Comm_rank(MPI_COMM_WORLD, &pid); //find out who we are MPI_Comm_size(MPI_COMM_WORLD, &processors); + if (commandName == "") { processors = 1; } + if (pid == 0) { #endif @@ -234,12 +250,26 @@ string ValidParameters::validFile(map& container, string paramet #ifdef USE_MPI for(int i = 1; i < processors; i++) { MPI_Send(&ableToOpen, 1, MPI_INT, i, 2001, MPI_COMM_WORLD); + + int length = container[parameter].length(); + MPI_Send(&length, 1, MPI_INT, i, 2001, MPI_COMM_WORLD); + MPI_Send(&(container[parameter][0]), length, MPI_CHAR, i, 2001, MPI_COMM_WORLD); + } }else { MPI_Recv(&ableToOpen, 1, MPI_INT, 0, 2001, MPI_COMM_WORLD, &status); + + int length; + MPI_Recv(&length, 1, MPI_INT, 0, 2001, MPI_COMM_WORLD, &status); + //recieve container + char* tempBuf = new char[length]; + MPI_Recv(&tempBuf[0], length, MPI_CHAR, 0, 2001, MPI_COMM_WORLD, &status); + + container[parameter] = tempBuf; + if (container[parameter].length() > length) { container[parameter] = container[parameter].substr(0, length); } + delete tempBuf; } - MPI_Barrier(MPI_COMM_WORLD); //make everyone wait - just in case #endif if (ableToOpen == 1) {