Segment-Based Routing: an Efficient Fault-Tolerant Routing Algorithm for Meshes and Tori