LWisteria.StudiesOfOpenTK.SimpleCloo.ComputerCpu.ComputerCpu C# (CSharp) Method

ComputerCpu() public method

CPUでの計算プログラムを作成する
public ComputerCpu ( double maxDt, double a, double omega ) : System
maxDt double 初期時間刻み
a double 振幅
omega double 角速度
return System
        public ComputerCpu(double maxDt, double a, double omega)
            : base(maxDt, a, omega)
        {
            // 粒子群を初期化
            this.particles = new Particle[0];

            // 準備処理は何もしない
            this.prepare = () => { };

            // 粒子が追加された時に
            base.ParticleAdded += (sender, e) =>
            {
                // 準備処理の時の処理を実装
                this.prepare = () =>
                {
                    // 新しい粒子群配列を生成
                    var newParticles = new Particle[this.particles.Length + this.inputParticles.Count];

                    // 古い粒子群を新しい粒子群に複製
                    this.particles.CopyTo(newParticles, 0);

                    // 入力粒子群を新しい粒子群に複製
                    this.inputParticles.CopyTo(newParticles, this.particles.Length);

                    // 新しい粒子群を今の粒子群とする
                    this.particles = newParticles;

                    // 入力粒子群を空にする
                    this.inputParticles.Clear();

                    // 準備処理は空
                    this.prepare = () => { };
                };
            };
        }