//orchestrates public int WorkCycle(int procnum) { //not really sure if this does anything int processor = (int)procnum; Thread tr = Thread.CurrentThread; if (Environment.ProcessorCount > 1) { SetThreadAffinityMask(GetCurrentThread(), new IntPtr(1 << processor)); } working = true; //basic input for demo for (int w = blockWidth / 2; w < (blockWidth / 2) + 1; w++) { for (int h = blockHeight / 2; h < (blockHeight / 2) + 1; h++) { //activate nodes on the first layer nodeCube[(w) + blockWidth * ((h) + blockHeight * (0))].Activation = 1; nodeCube[(w) + blockWidth * ((h) + blockHeight * (0))].IsLoaded = true; //add them to the work queue _fireQueue.Enqueue(nodeCube[(w) + blockWidth * ((h) + blockHeight * (0))]); } } //This does the work. Cycles through the queue. //For each node, add connection weight to connection child, //return list of lines to be rendered, add them to glmananger queue int counter = 0; using (var locked = _fireQueue.Lock()) { while (locked.Count != 0) { var workNode = locked.Dequeue(); //maybe add a threshold to node, and use that instead of 1 if (workNode.IsLoaded && workNode.Activation >= 1) { _glmanager.AddQueue(_workGenerator.Generate(workNode)); counter++; } } } foreach (Node n in nodeCube) { foreach (RenderLine l in n.ChildrenLines) { //weaken all connections //l.strength *= .985f; } } working = false; return(counter); }