abadp / tpzsimul

Automatically exported from code.google.com/p/tpzsimul
GNU General Public License v2.0
11 stars 12 forks source link

Routing problem for Torus network #8

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Dears,

Currently I am facing two problems as I am unable to understand below codes and 
it's purpose. Please help me.

1. What is the need of the getDiameter() function? what this function is 
actually doing?

2. In torus and also mesh network I found below lines...

   deltaX = (deltaX>=0) ? deltaX+1 : deltaX-1;
   deltaY = (deltaY>=0) ? deltaY+1 : deltaY-1;
   deltaZ = (deltaZ>=0) ? deltaZ+1 : deltaZ-1;

Which will add 1 with each direction. but later I found the below code at 
distance() function...

   return int( abs(deltaX) + abs(deltaY) + abs(deltaZ) - 3);

Where 3 has been minus from all 3 direction. Please explain me the reason.

Thanks

Mr. Faisal

Original issue reported on code.google.com by dipu.7...@gmail.com on 10 Sep 2013 at 4:47

GoogleCodeExporter commented 9 years ago
Dear All,

I have the same problems about Mr. Faisal, can anybody help?

Thanks.  

Original comment by yzg3...@gmail.com on 29 Oct 2013 at 1:52

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Hi Mr. Faisal,

For your first question, in my opinion, getDiameter() gives the daimetre of the 
network.

Second, the deltaX = (deltaX>=0) ? deltaX+1 : deltaX-1; is useful when the 
simultor caculates the route for a message. You can find that deltaX > +1, 
Xplus is chosen; deltaX < -1, Xminus is chosen. 

I think these can answer your questions.

Best regards,

Original comment by yzg3...@gmail.com on 29 Oct 2013 at 2:40

GoogleCodeExporter commented 9 years ago
Hi Mr. Faisal,

"-3 "is because if current node is (0,0,0), the destination node (1,1,1), then 
the deltaX=2, deltaY=2, deltaZ=2, while in original case the offset will be 
(1,1,1).
In fact, the distance is 2+2+2-3=3 which is euqtal to 1+1+1.

I think this exanple maybe useful for you to understand the "-3".

Best regards,
Zhigang Yu

Original comment by yzg3...@gmail.com on 29 Oct 2013 at 8:39

GoogleCodeExporter commented 9 years ago
 That -3 is required because delta=1 at destination. 

For this kind of questions use the list.

Original comment by vpue...@gmail.com on 31 Oct 2013 at 12:12