Ejemplo n.º 1
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 the initial wavefunction
            WaveFunction wf = WaveFunctionUtils.CreateGaussianWavePacket(
                m_params.GridSizeX, m_params.GridSizeY, m_params.LatticeSpacing, m_params.ParticleMass,
                m_params.InitialWavePacketCenter,
                m_params.InitialWavePacketSize,
                m_params.InitialWavePacketMomentum,
                m_params.MultiThread
                );

            // Save the initial wf as Frame 0
            wf.SaveToVtkFile(Path.Combine(m_outputDir, "Frame_0000.vtk"), m_params.SaveFormat);
            m_lastSavedFrame = 0;


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

            m_evolver = new Evolver(wf, m_params.TotalTime, m_params.TimeStep, V, false, m_params.ParticleMass, 1,
                                    m_params.DampingBorderWidth, m_params.DampingFactor, m_params.MultiThread);
            m_evolver.ProgressEvent   += Evolver_ProgressEvent;
            m_evolver.CompletionEvent += Evolver_CompletionEvent;

            m_evolver.RunInBackground();
        }
Ejemplo n.º 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, sx, sy) => { return(m_VBuilder.V(x, y, sx, sy)); };

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

            m_evolver.RunInBackground();
        }