Esempio n. 1
0
        /// <summary>
        /// Updates a 3D aggregate based on current batch list of dla_3d buffer, processing this list
        /// and adding its contents to the simulation view.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        /// <param name="total_particles"></param>
        private void Update3DAggregateOnTimedEvent(object source, ElapsedEventArgs e, uint total_particles)
        {
            lock (locker) {
                List <Tuple <int, int, int> > buffer = new List <Tuple <int, int, int> >();
                buffer = dla_3d.ConsumeBuffer((current_particles == 0) ? 0 : current_particles - 1);
                foreach (var p in buffer)
                {
                    aggregate_manager.AddParticle(new Point3D(p.Item1, p.Item2, p.Item3), colour_list[(int)current_particles], 1.0);
                    ++current_particles;
                    Dispatcher.Invoke(() => {
                        aggregate_manager.Update();
                        DynamicParticleLabel.Content = "Particles: " + current_particles;
                        AggMissesLabel.Content       = "Aggregate Misses: " + dla_3d.GetAggregateMisses();
                        if (current_particles % 100 == 0)
                        {
                            FracDimLabel.Content = "Est. Fractal Dimension: " + Math.Round(dla_3d.EstimateFractalDimension(), 3);
                        }
                        switch (chart_type)
                        {
                        case ChartType.NUMBERRADIUS:
                            if (current_particles % nrchart.PollingInterval == 0)
                            {
                                double agg_radius = Math.Sqrt(dla_3d.GetAggregateSpanningDistance());
                                if (agg_radius >= nrchart.YAxisMax)
                                {
                                    nrchart.YAxisMax += 20.0;
                                }
                                nrchart.AddDataPoint(current_particles, agg_radius);
                            }
                            if (current_particles >= nrchart.XAxisMax && current_particles != total_particles)
                            {
                                nrchart.XAxisStep += 200;
                                nrchart.XAxisMax  += 2000;
                            }
                            break;

                        case ChartType.RATEGENERATION:
                            break;
                        }
                    });
                }
            }
        }