Exemplo n.º 1
0
        public static Neighborhood NewNeighborList(ShardID myAddr, Int3 extent, bool forceAllLinksPassive)
        {
            List <Link> neighbors = new List <Link>();
            Int3        at        = Int3.Zero;

            for (at.X = myAddr.X - 1; at.X <= myAddr.X + 1; at.X++)
            {
                for (at.Y = myAddr.Y - 1; at.Y <= myAddr.Y + 1; at.Y++)
                {
                    for (at.Z = myAddr.Z - 1; at.Z <= myAddr.Z + 1; at.Z++)
                    {
                        if (at == myAddr.XYZ)
                        {
                            continue;
                        }

                        if ((at >= Int3.Zero).All && (at < extent).All)
                        {
                            int linear = neighbors.Count;
                            neighbors.Add(new Link(new ShardID(at, myAddr.ReplicaLevel), at.OrthographicCompare(myAddr.XYZ) > 0 && !forceAllLinksPassive, linear, false));
                        }
                    }
                }
            }
            return(new Neighborhood(neighbors));
        }