private void NucleateMCBtn_Click(object sender, RoutedEventArgs e)
 {
     int Q = int.Parse(NumberOfStatesTextBox.Text);
     MonteCarlo.GenerateListOfColors(Q);
     grainMCList = Grain.NumberOfFeeeCells(null);
     MonteCarlo.GenerateGrains();
     PaintPane();
 }
Exemplo n.º 2
0
        public static List <Grain> NewRSXMCList()
        {
            List <Grain> RSXMCgrains = new List <Grain>();

            foreach (Grain g in MainWindow.GrainTable)
            {
                if (NeighbourRecrystalized(g) && !g.Recrystalized)
                {
                    RSXMCgrains.Add(g);
                }
            }
            RSXMCgrains = RSXMCgrains.Distinct().ToList();
            RSXMCgrains = MonteCarlo.ShuffleList(RSXMCgrains);
            return(RSXMCgrains);
        }
Exemplo n.º 3
0
        public static List <Grain> GetNewMCList()
        {
            List <Grain> list = new List <Grain>();

            foreach (Grain g in MainWindow.GrainTable)
            {
                if (Inclusions.IsOnTheEdge(g, 1, MainWindow.XNumOfCells, MainWindow.YNumOfCells))
                {
                    if (g.Inclusion == false)
                    {
                        list.Add(new Grain(g));
                    }
                }
            }
            list = MonteCarlo.ShuffleList(list);
            return(list);
        }
        private void Update(object sender, EventArgs e)
        {
            if (!monteCarlo && !SRXMC)
            {
                for (int i = 0; i < XNumOfCells; i++)
                {
                    for (int j = 0; j < YNumOfCells; j++)
                    {
                        if (!Growth.Moore(i, j, XNumOfCells, YNumOfCells))
                        {
                            if (!Growth.NearestMoore(i, j, XNumOfCells, YNumOfCells))
                            {
                                if (!Growth.FutherMoore(i, j, XNumOfCells, YNumOfCells))
                                {
                                    Growth.RuleFour(i, j, XNumOfCells, YNumOfCells);
                                }
                            }
                        }
                    }
                }
                Growth.Replace(GrainTable, TempGrainTable, XNumOfCells, YNumOfCells);
            }
            else if(monteCarlo)
            {
                while (grainMCList.Any())
                {
                    MonteCarlo.ChangeGrains();
                }
                grainMCList = MonteCarlo.GetNewMCList();
                NumberOfMCIterations++;
                NumberOfIterationsTextBox.Text = (NumberOfIterationFromGUI - NumberOfMCIterations).ToString();

                if (NumberOfMCIterations >= NumberOfIterationFromGUI)
                {
                    monteCarlo = false;
                    StartMCBtn.Content = "START MC";
                    timer.Stop();
                    NumberOfMCIterations = 0;
                }
            }
            else
            {
                while (RSXMCList.Any())
                {
                    MonteCarlo.ChangeRSXGrains();
                }
                RSXMCList = RSXMC.NewRSXMCList();
                NumberOfMCIterations++;
                NumberOfIterationsTextBox.Text = (NumberOfIterationFromGUI - NumberOfMCIterations).ToString();

                if (NumberOfMCIterations >= NumberOfIterationFromGUI)
                {
                    monteCarlo = false;
                    StartMCBtn.Content = "START MC";
                    timer.Stop();
                    NumberOfMCIterations = 0;
                }
            }

            
            PaintPane();
        }