Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. string runMatrix(string stringA, string stringB, int positionA, int positionB){
  2. // Local variables
  3. // return string
  4. string ret;
  5. // copy both positions to be able to change them saving the previous result
  6. int posA = positionA-1;
  7. int posB = positionB-1;
  8.  
  9. // body
  10. // while the positions are in range
  11. while(posA >= 0 && posB >= 0){
  12. // if the chars match decrement both positions and add the char to the ret string
  13. if(stringA[posA] == stringB[posB]){
  14. if(posA == 0 && posB == 0){ //mandar para o bloco diagonal
  15. //if(){ ver quem é que está a enviar e quem está a receber
  16. MPI_Cart_rank(cart_comm, destinationCoords, &destinationId1);
  17. MPI_Send(dependencyListSide, dependencies, MPI_INT, destinationId1, destinationId1, MPI_COMM_WORLD);
  18. //}else{
  19. MPI_Cart_rank(cart_comm, sourceCoords, &sourceId);
  20. MPI_Recv(dependencyList, dependencies, MPI_INT, sourceId, id, MPI_COMM_WORLD, &status);
  21. //}
  22. }else{
  23. if(posA == 0){ //mandar para o bloco da esquerda
  24.  
  25. }else if(posB == 0){ //mandar para o bloco de cima
  26.  
  27. }else{
  28. ret = stringA[posA] + ret;
  29. posA--;
  30. posB--;
  31. }
  32. }
  33. } else{
  34. if(posA==0 && posB==0)
  35. break;
  36. }
  37. } // ends while loop
  38. // return ret string
  39. return ret;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement