Ejemplo n.º 1
0
        public GrainGrowthCellularAutomatonViewModel()
        {
            CellNeighborhoods.Add(CellNeighborhoodTypeModel.VonNeumann);
            CellNeighborhoods.Add(CellNeighborhoodTypeModel.Moore);
            CellNeighborhoods.Add(CellNeighborhoodTypeModel.RandomPentagonal);
            CellNeighborhoods.Add(CellNeighborhoodTypeModel.LeftHexagonal);
            CellNeighborhoods.Add(CellNeighborhoodTypeModel.RightHexagonal);
            CellNeighborhoods.Add(CellNeighborhoodTypeModel.RandomHexagonal);
            CellNeighborhoods.Add(CellNeighborhoodTypeModel.Radial);
            CellNeighborhoods.Add(CellNeighborhoodTypeModel.RadialWithCenterOfMass);

            BoundaryConditions.Add(BoundaryConditionModel.Absorbing);
            BoundaryConditions.Add(BoundaryConditionModel.Periodic);

            NucleationMethods.Add(NucleationMethodModel.Uniform);
            NucleationMethods.Add(NucleationMethodModel.Random);
            NucleationMethods.Add(NucleationMethodModel.RandomWithRadius);

            evolverAndDrawerDispatcherTimer          = new DispatcherTimer();
            evolverAndDrawerDispatcherTimer.Interval = TimeSpan.FromMilliseconds(timeInterval);
            evolverAndDrawerDispatcherTimer.Tick    += EvolverAndDrawer_Tick;

            cancellationTokenSource = new CancellationTokenSource();
            cancellationToken       = cancellationTokenSource.Token;
            ThreadPool.SetMinThreads(1, 1);
            ThreadPool.SetMaxThreads(1, 1);

            CreateGrainCellGridPreview();
            RunDrawerTask();
        }
        public ElementaryCellularAutomatonViewModel()
        {
            CellGridImageViewModel = new CellGridImageViewModel();

            BoundaryConditions.Add(BoundaryConditionModel.Absorbing);
            BoundaryConditions.Add(BoundaryConditionModel.CounterAbsorbing);
            BoundaryConditions.Add(BoundaryConditionModel.Periodic);
        }
Ejemplo n.º 3
0
        public LifeLikeCellularAutomatonViewModel()
        {
            CellNeighborhoods.Add(CellNeighborhoodTypeModel.Moore);
            CellNeighborhoods.Add(CellNeighborhoodTypeModel.VonNeumann);

            birthVonNeumannRulesSafe = new BindableCollection <NumberOfCellsForRulesModel>(vonNeumannRule.Birth.ToList());
            birthMooreRulesSafe      = new BindableCollection <NumberOfCellsForRulesModel>(mooreRule.Birth.ToList());

            survivalVonNeumannRulesSafe = new BindableCollection <NumberOfCellsForRulesModel>(vonNeumannRule.Survival.ToList());
            survivalMooreRulesSafe      = new BindableCollection <NumberOfCellsForRulesModel>(mooreRule.Survival.ToList());

            birthRules    = birthMooreRulesSafe;
            survivalRules = survivalMooreRulesSafe;

            birthRules[3].Chosen    = true;
            SurvivalRules[2].Chosen = true;
            SurvivalRules[3].Chosen = true;

            SelectedBirthRule    = birthRules[0];
            SelectedSurvivalRule = survivalRules[0];

            BoundaryConditions.Add(BoundaryConditionModel.Absorbing);
            BoundaryConditions.Add(BoundaryConditionModel.CounterAbsorbing);
            BoundaryConditions.Add(BoundaryConditionModel.Periodic);

            evolverAndDrawerDispatcherTimer          = new DispatcherTimer();
            evolverAndDrawerDispatcherTimer.Interval = TimeSpan.FromMilliseconds(timeIntervalInMilliseconds);
            evolverAndDrawerDispatcherTimer.Tick    += EvolverAndDrawer_Tick;

            cancellationTokenSource = new CancellationTokenSource();
            cancellationToken       = cancellationTokenSource.Token;
            ThreadPool.SetMinThreads(1, 1);
            ThreadPool.SetMaxThreads(1, 1);

            cellGrid = new CellGrid2DModel(columnCount, rowCount, selectedCellNeighborhood, mooreRule, SelectedBoundaryCondition);
            RunDrawerTask();
        }