Esempio n. 1
0
        /// <summary>
        /// Sets up all the properties of the aggregate necessary for generation, including
        /// lattice type, attractor type and the dimensions of the aggregate.
        /// </summary>
        private void SetUpAggregateProperties()
        {
            // get the selected dimension type
            ComboBoxItem selected_dimension = (ComboBoxItem)(dimension_ComboBox.SelectedValue);
            string       dimension_str      = (string)(selected_dimension.Content);

            // set corresponding lattice_dimension constant
            switch (dimension_str)
            {
            case "2D":
                lattice_dimension = LatticeDimension._2D;
                break;

            case "3D":
                lattice_dimension = LatticeDimension._3D;
                break;
            }
            // reset simulation view
            ResetViewButtonHandler(null, null);
            // switch on current lattice dimension constant
            switch (lattice_dimension)
            {
            case LatticeDimension._2D:
                dla_2d.SetCoeffStick(stickiness_slider.Value);
                // set the lattice type to current selected item
                // of latticeType_ComboBox ui element
                ComboBoxItem       selected_2DlatticeType = (ComboBoxItem)(latticeType_ComboBox.SelectedValue);
                string             lattice_type2D_str     = (string)(selected_2DlatticeType.Content);
                ManagedLatticeType lattice_type2D         = (ManagedLatticeType)Enum.Parse(typeof(ManagedLatticeType), lattice_type2D_str);
                dla_2d.SetLatticeType(lattice_type2D);
                // set the attractor type to current selected item
                // of attractorType_ComboBox ui element
                ComboBoxItem         selected_2DAttractorType = (ComboBoxItem)(attractorType_ComboBox.SelectedValue);
                string               attractor_type2D_str     = (string)(selected_2DAttractorType.Content);
                ManagedAttractorType attractor_type2D         = (ManagedAttractorType)Enum.Parse(typeof(ManagedAttractorType), attractor_type2D_str);
                dla_2d.SetAttractorType(attractor_type2D);
                break;

            case LatticeDimension._3D:
                dla_3d.SetCoeffStick(stickiness_slider.Value);
                // set the lattice type to current selected item
                // of latticeType_ComboBox ui element
                ComboBoxItem       selected_3DlatticeType = (ComboBoxItem)(latticeType_ComboBox.SelectedValue);
                string             lattice_type3D_str     = (string)(selected_3DlatticeType.Content);
                ManagedLatticeType lattice_type3D         = (ManagedLatticeType)Enum.Parse(typeof(ManagedLatticeType), lattice_type3D_str);
                dla_3d.SetLatticeType(lattice_type3D);
                // set the attractor type to current selected item
                // of attractorType_ComboBox ui element
                ComboBoxItem         selected_3DAttractorType = (ComboBoxItem)(attractorType_ComboBox.SelectedValue);
                string               attractor_type3D_str     = (string)(selected_3DAttractorType.Content);
                ManagedAttractorType attractor_type3D         = (ManagedAttractorType)Enum.Parse(typeof(ManagedAttractorType), attractor_type3D_str);
                dla_3d.SetAttractorType(attractor_type3D);
                break;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Sets up all the properties of the aggregate necessary for generation, including
        /// lattice type, attractor type and the dimensions of the aggregate.
        /// </summary>
        private void SetUpAggregateProperties(uint _nparticles, double _agg_sticky_coeff)
        {
            // reset simulation view
            ResetView();
            // pre-compute the color list for all particles
            if (!isContinuous)
            {
                ComputeColorList(_nparticles);
            }
            else
            {
                ComputeColorList(50000); // TODO: change this, don't like "magic" number
            }
            switch (chart_type)          // add new data series to focused chart type
            {
            case ChartType.NUMBERRADIUS:
                nrchart.AddDataSeries(_nparticles, _agg_sticky_coeff, lattice_type, isContinuous);
                nrchart.PollingInterval = 100U;
                nrchart.AddDataPoint(0, 0.0);     // set initial chart data point to origin
                break;

            case ChartType.RATEGENERATION:
                // TODO
                break;
            }
            Chart.LegendLocation = LegendLocation.Right;
            // set properties of aggregate corresponding to dimension
            switch (current_executing_dimension)
            {
            case LatticeDimension._2D:
                dla_2d.SetCoeffStick(_agg_sticky_coeff);
                dla_2d.SetLatticeType(lattice_type);
                dla_2d.SetAttractorType(attractor_type,
                                        (attractor_type == ManagedAttractorType.Point) ? 1U : (uint)attractorsize_slider.Value);
                dla_2d.ChangeContinuousFlag(isContinuous);
                break;

            case LatticeDimension._3D:
                dla_3d.SetCoeffStick(_agg_sticky_coeff);
                dla_3d.SetLatticeType(lattice_type);
                dla_3d.SetAttractorType(attractor_type,
                                        (attractor_type == ManagedAttractorType.Point) ? 1U : (uint)attractorsize_slider.Value);
                dla_3d.ChangeContinuousFlag(isContinuous);
                break;
            }
        }