public unsafe IslandProtoConstraintBatch(Solver solver, BufferPool pool) { pool.SpecializeFor <int>().Take(solver.TypeProcessors.Length, out TypeIdToIndex); Unsafe.InitBlockUnaligned(TypeIdToIndex.Memory, 0xFF, (uint)(TypeIdToIndex.Length * sizeof(int))); QuickList <IslandProtoTypeBatch, Buffer <IslandProtoTypeBatch> > .Create(pool.SpecializeFor <IslandProtoTypeBatch>(), solver.TypeProcessors.Length, out TypeBatches); ReferencedBodyHandles = new HandleSet(pool, solver.bodies.HandlePool.HighestPossiblyClaimedId + 1); }
bool EnqueueUnvisitedNeighbors <TTraversalPredicate>(int bodyHandle, ref QuickList <int, Buffer <int> > bodyHandles, ref QuickList <int, Buffer <int> > constraintHandles, ref HandleSet consideredBodies, ref HandleSet consideredConstraints, ref QuickList <int, Buffer <int> > visitationStack, ref ConstraintBodyEnumerator bodyEnumerator, ref BufferPool <int> intPool, ref TTraversalPredicate predicate) where TTraversalPredicate : IPredicate <int> { var bodyIndex = bodies.HandleToLocation[bodyHandle].Index; bodyEnumerator.SourceIndex = bodyIndex; ref var list = ref bodies.ActiveSet.Constraints[bodyIndex];
bool PushBody <TTraversalPredicate>(int bodyIndex, ref HandleSet consideredBodies, ref QuickList <int, Buffer <int> > bodyIndices, ref QuickList <int, Buffer <int> > visitationStack, ref BufferPool <int> intPool, ref TTraversalPredicate predicate) where TTraversalPredicate : IPredicate <int> { if (predicate.Matches(ref bodyIndex)) { if (!consideredBodies.Contains(bodyIndex)) { //This body has not yet been traversed. Push it onto the stack. bodyIndices.Add(bodyIndex, intPool); consideredBodies.AddUnsafely(bodyIndex); visitationStack.Add(bodyIndex, intPool); } return(true); } return(false); }