Exemplo n.º 1
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        public MainLogic()
        {
            Disposed = false;
            Camera = new CCamera();
            DrawerAry = new CDrawerArrayField();
            World = new CFieldWorld();
            //FieldValueSetter = new CFieldValueSetter();
            //Ls = new CZLinearSystem();
            //Prec = new CZPreconditioner_ILU();
            EigenValueList = new List<Complex>();
            CadDrawerAry = new CDrawerArray();

            // Glutのアイドル時処理でなく、タイマーで再描画イベントを発生させる
            MyTimer.Tick += (sender, e) =>
            {
                if (IsTimerProcRun)
                {
                    return;
                }
                IsTimerProcRun = true;
                if (IsAnimation && BetaIndex != -1 && !IsCadShow)
                {
                    // 問題を解く
                    solveProblem(
                        ProbNo,
                        ref BetaIndex,
                        Beta1,
                        Beta2,
                        BetaDelta,
                        (BetaIndex == 0), // false,
                        WaveguideWidth,
                        WaveModeDv,
                        IsPCWaveguide,
                        LatticeA,
                        PeriodicDistance,
                        PCWaveguidePorts,
                        CalcModeIndex,
                        IsSVEA,
                        ref PrevModalVec,
                        IsShowAbsField,
                        MinNormalizedFreq,
                        MaxNormalizedFreq,
                        ref World,
                        FieldValId,
                        FieldLoopId,
                        FieldForceBcId,
                        FieldPortBcId1,
                        FieldPortBcId2,
                        Medias,
                        LoopDic,
                        EdgeDic,
                        ref EigenValueList,
                        ref DrawerAry,
                        Camera
                        );
                    if (BetaIndex != -1)
                    {
                        BetaIndex++;
                    }
                    //DEBUG
                    //Glut.glutPostRedisplay();
                    {
                        // POSTだとメッセージが1つにまとめられる場合がある?
                        // 直接描画する
                        int[] viewport = new int[4];
                        Gl.glGetIntegerv(Gl.GL_VIEWPORT, viewport);
                        int winW = viewport[2];
                        int winH = viewport[3];
                        Camera.SetWindowAspect((double)winW / winH);
                        Gl.glViewport(0, 0, winW, winH);
                        Gl.glMatrixMode(Gl.GL_PROJECTION);
                        Gl.glLoadIdentity();
                        DelFEM4NetCom.View.DrawerGlUtility.SetProjectionTransform(Camera);
                        myGlutDisplay();
                    }
                }
                IsTimerProcRun = false;
            };
            //MyTimer.Interval = 1000 / 60;
            MyTimer.Interval = 1000 / 10;
            //MyTimer.Interval = 2000;
        }
Exemplo n.º 2
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        public MainLogic()
        {
            Disposed = false;
            Camera = new CCamera();
            DrawerAry = new CDrawerArrayField();
            World = new CFieldWorld();
            //FieldValueSetter = new CFieldValueSetter();
            Ls = new CZLinearSystem();
            Prec = new CZPreconditioner_ILU();
            ScatterVecList = new List<IList<Complex[]>>();
            CadDrawerAry = new CDrawerArray();
            IsInitedCamera = true;

            // Glutのアイドル時処理でなく、タイマーで再描画イベントを発生させる
            MyTimer.Tick += (sender, e) =>
            {
                if (IsTimerProcRun)
                {
                    return;
                }
                IsTimerProcRun = true;
                if (IsAnimation && FreqIndex != -1 && !IsCadShow)
                {
                    // 問題を解く
                    bool ret = solveProblem(
                        (IsInitedCamera? false : true)
                        );
                    if (FreqIndex != -1)
                    {
                        FreqIndex++;
                    }
                    if (ret)
                    {
                        if (!IsInitedCamera)
                        {
                            IsInitedCamera = true;
                        }
                    }
                    //DEBUG
                    //Glut.glutPostRedisplay();
                    {
                        // POSTだとメッセージが1つにまとめられる場合がある?
                        // 直接描画する
                        int[] viewport = new int[4];
                        Gl.glGetIntegerv(Gl.GL_VIEWPORT, viewport);
                        int winW = viewport[2];
                        int winH = viewport[3];
                        Camera.SetWindowAspect((double)winW / winH);
                        Gl.glViewport(0, 0, winW, winH);
                        Gl.glMatrixMode(Gl.GL_PROJECTION);
                        Gl.glLoadIdentity();
                        DelFEM4NetCom.View.DrawerGlUtility.SetProjectionTransform(Camera);
                        myGlutDisplay();
                    }
                }
                IsTimerProcRun = false;
            };
            //MyTimer.Interval = 1000 / 60;
            MyTimer.Interval = 1000 / 10;
            //MyTimer.Interval = 2000;
        }