Пример #1
0
        /// <summary>
        /// Handles Progress events from the Evolver.
        /// </summary>
        void Evolver_ProgressEvent(TdseUtils.Proc sender)
        {
            // Update the progress bar
            Evolver evolver = (Evolver)sender;
            int     val     = (100 * evolver.CurrentTimeStepIndex) / (evolver.TotalNumTimeSteps);

            if (Main_ProgressBar.Value != val)
            {
                Main_ProgressBar.Value = val;                  // Workaround for slow ProgressBar updates
                Main_ProgressBar.Value = Math.Max(0, val - 1); //
                Main_ProgressBar.Value = val;                  //
            }
        }
Пример #2
0
        /// <summary>
        /// Evolves the wavefunction and saves keyframes to disk.
        /// </summary>
        private void CreateAnimationFrames()
        {
            // Get a fresh output directory
            m_outputDir = CreateOutputDir();

            // Write the run parameters to a file
            string paramsFile = Path.Combine(m_outputDir, "Params.txt");

            File.WriteAllText(paramsFile, m_params.ToString().Replace("\n", "\r\n"));

            // Create an Evolver and run it in the background
            Evolver.VDelegate V = (x, y, z, m, sx, sy, sz) => { return(m_VBuilder.V(x, y, z, m, sx, sy, sz)); };

            m_evolver = new Evolver(m_params, V, m_outputDir);
            m_evolver.ProgressEvent   += Evolver_ProgressEvent;
            m_evolver.CompletionEvent += Evolver_CompletionEvent;

            m_evolver.RunInBackground();
        }