Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string runMatrix(string stringA, string stringB, int positionA, int positionB){
- // Local variables
- // return string
- string ret;
- // copy both positions to be able to change them saving the previous result
- int posA = positionA-1;
- int posB = positionB-1;
- // body
- // while the positions are in range
- while(posA >= 0 && posB >= 0){
- // if the chars match decrement both positions and add the char to the ret string
- if(stringA[posA] == stringB[posB]){
- if(posA == 0 && posB == 0){ //mandar para o bloco diagonal
- //if(){ ver quem é que está a enviar e quem está a receber
- MPI_Cart_rank(cart_comm, destinationCoords, &destinationId1);
- MPI_Send(dependencyListSide, dependencies, MPI_INT, destinationId1, destinationId1, MPI_COMM_WORLD);
- //}else{
- MPI_Cart_rank(cart_comm, sourceCoords, &sourceId);
- MPI_Recv(dependencyList, dependencies, MPI_INT, sourceId, id, MPI_COMM_WORLD, &status);
- //}
- }else{
- if(posA == 0){ //mandar para o bloco da esquerda
- }else if(posB == 0){ //mandar para o bloco de cima
- }else{
- ret = stringA[posA] + ret;
- posA--;
- posB--;
- }
- }
- } else{
- if(posA==0 && posB==0)
- break;
- }
- } // ends while loop
- // return ret string
- return ret;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement