Example #1
0
        /// <summary>
        /// 問題を設定する
        /// </summary>
        /// <returns></returns>
        private bool setNewProblem()
        {
            bool success = false;

            try
            {
                if ( ProbNo == 0 )
                {
                    using (CCadObj2D cad2d = new CCadObj2D())
                    using (CMesh3D_Extrude msh3d = new CMesh3D_Extrude())
                    {    // 形を作る
                        IList<CVector2D> pts = new List<CVector2D>();
                        pts.Add( new CVector2D(0.0,0.0) );
                        pts.Add( new CVector2D(5.0,0.0) );
                        pts.Add( new CVector2D(5.0,1.0) );
                        pts.Add( new CVector2D(0.0,1.0) );
                        cad2d.AddPolygon( pts );
                        msh3d.Extrude( new CMesher2D(cad2d,0.4), 1.0, 0.4 );// 突き出しによって3次元メッシュを作る
                        World.Clear();
                        Id_base = World.AddMesh( msh3d );
                    }
                    CIDConvEAMshCad conv = World.GetIDConverter(Id_base);
                    Solid.SetDomain_Field(Id_base,World);
                    Solid.SetYoungPoisson(250, 0.3);// ヤング率とポアソン比の設定
                    //Solid.SetGeometricalNonLinear();// 幾何学的非線形性を考慮する
                    Solid.UnSetGeometricalNonLinear();
                    Solid.SetStationary();
                    Dt = 0.1;
                    Solid.SetTimeIntegrationParameter(Dt,0.6);
                    //Solid.SetSaveStiffMat();

                    //uint id_field_bc0 = Solid.AddFixElemAry(7,World);
                    uint id_field_bc1 = Solid.AddFixElemAry(conv.GetIdEA_fromCad(2,CAD_ELEM_TYPE.EDGE,2),World);
                    FieldValueSetter = new CFieldValueSetter(id_field_bc1,World);
                    FieldValueSetter.SetMathExp("sin(5*sin(0.1*t))", 1,FIELD_DERIVATION_TYPE.VALUE, World);// bc1_fieldのy座標に単振動を追加
                    FieldValueSetter.SetMathExp("cos(5*sin(0.1*t))", 2,FIELD_DERIVATION_TYPE.VALUE, World);// bc1_fieldのy座標に単振動を追加
                    // 描画オブジェクトの登録
                    DrawerAry.Clear();
                    Id_field_disp = Solid.GetIdField_Disp();
                    DrawerAry.PushBack( new CDrawerFace(Id_field_disp,false,World) );
                    DrawerAry.PushBack( new CDrawerEdge(Id_field_disp,false,World) );
                    DrawerAry.PushBack( new CDrawerEdge(Id_field_disp,true ,World) );
                    DrawerAry.InitTrans(Camera);
                }
                else if ( ProbNo == 1 )
                {
                    Solid.UnSetStationary();
                    Solid.UnSetGeometricalNonLinear();// 幾何学的非線形性を考慮しない
                    Solid.UnSetSaveStiffMat();// 全剛性行列を保存する.
                }
                else if ( ProbNo == 2 )
                {
                    Solid.SetGeometricalNonLinear();
                }
                else if ( ProbNo == 3 )
                {
                    CIDConvEAMshCad conv = World.GetIDConverter(Id_base);
                    uint id_field_bc0 = Solid.AddFixElemAry(conv.GetIdEA_fromCad(4,CAD_ELEM_TYPE.EDGE,2),World);
                    Solid.SetStationary();
                }
                else if ( ProbNo == 4 )
                {
                    Solid.UnSetStationary();
                }
                else if ( ProbNo == 5 )
                {
                    string mshfn = "../../../input_file/cylinder_tet.msh";
                    if (File.Exists(mshfn))
                    {
                        using (CMesher3D mesh3d = new CMesher3D())
                        {
                            mesh3d.ReadFromFile_GiDMsh(mshfn);
                            World.Clear();
                            Id_base = World.AddMesh( mesh3d );
                        }
                        Solid.SetDomain_Field(Id_base,World);
                        Solid.SetYoungPoisson(200, 0.43);// ヤング率とポアソン比の設定
                        Solid.UnSetGeometricalNonLinear();// 幾何学的非線形性を考慮しない.
                        Solid.UnSetStationary();
                        Solid.UnSetSaveStiffMat();
                        uint id_field_bc0 = Solid.AddFixElemAry(3,World);
                        uint id_field_bc1 = Solid.AddFixElemAry(4,World);
                        FieldValueSetter = new CFieldValueSetter(id_field_bc1,World);
                        FieldValueSetter.SetMathExp("5*sin(2*t)^2", 0, FIELD_DERIVATION_TYPE.VALUE, World);// bc1_fieldのy座標に単振動を追加
                        // 描画オブジェクトの登録
                        DrawerAry.Clear();
                        Id_field_disp = Solid.GetIdField_Disp();
                        DrawerAry.PushBack( new CDrawerFace(Id_field_disp,false,World) );
                        DrawerAry.PushBack( new CDrawerEdge(Id_field_disp,false,World) );
                        DrawerAry.PushBack( new CDrawerEdge(Id_field_disp,true ,World) );
                        DrawerAry.InitTrans(Camera);
                    }
                    else
                    {
                        Console.WriteLine("not exist:{0}", mshfn);
                        MessageBox.Show(string.Format("メッシュファイル:{0}がありません", mshfn));
                    }
                }
                else if ( ProbNo == 6 )
                {
                    Solid.SetStationary();
                }
                else if ( ProbNo == 7 )
                {
                    string mshfn = "../../../input_file/rect_quad.msh";
                    if (File.Exists(mshfn))
                    {
                        using (CMesher2D mesh2d = new CMesher2D())
                        using (CMesh3D_Extrude mesh3d = new CMesh3D_Extrude())
                        {
                            mesh2d.ReadFromFile_GiDMsh(mshfn);
                            mesh3d.Extrude(mesh2d, 5.0, 0.5 );
                            World.Clear();
                            Id_base = World.AddMesh(mesh3d);
                        }
                        CIDConvEAMshCad conv = World.GetIDConverter(Id_base);
                        Solid.SetDomain_Field(Id_base,World);
                        Solid.SetYoungPoisson(100, 0.3);// ヤング率とポアソン比の設定
                        Solid.UnSetSaveStiffMat();
                        Solid.UnSetStationary();
                        Dt = 0.1;
                        Solid.SetTimeIntegrationParameter(Dt,0.52);
                        //Solid.SetGeometricalNonLinear();// 幾何学的非線形性を考慮する.
                        Solid.UnSetGeometricalNonLinear();// 幾何学的非線形性を考慮しない.
                        uint id_field_bc0 = Solid.AddFixElemAry(conv.GetIdEA_fromMshExtrude(1,1),World);
                        uint id_field_bc1 = Solid.AddFixElemAry(conv.GetIdEA_fromMshExtrude(3,2),World);
                        FieldValueSetter = new CFieldValueSetter(id_field_bc1,World);
                        FieldValueSetter.SetMathExp("2*sin(t)", 0,FIELD_DERIVATION_TYPE.VALUE, World);// bc1_fieldのy座標に単振動を追加
                        // 描画オブジェクトの登録
                        DrawerAry.Clear();
                        Id_field_disp = Solid.GetIdField_Disp();
                        DrawerAry.PushBack( new CDrawerFace(Id_field_disp,false,World) );
                        DrawerAry.PushBack( new CDrawerEdge(Id_field_disp,false,World) );
                        DrawerAry.PushBack( new CDrawerEdge(Id_field_disp,true ,World) );
                        DrawerAry.InitTrans(Camera);
                    }
                    else
                    {
                        Console.WriteLine("not exist:{0}", mshfn);
                        MessageBox.Show(string.Format("メッシュファイル:{0}がありません", mshfn));
                    }
                }
                else if ( ProbNo == 8 )
                {
                    Solid.UnSetGeometricalNonLinear(); // 幾何学的非線形性を考慮しない
                    Solid.SetStationary();
                }
                success = true;

            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.Message + " " + exception.StackTrace);
            }

            ProbNo++;
            if (ProbNo == ProbCnt) ProbNo = 0;
            return success;
        }
Example #2
0
        /// <summary>
        /// 問題を設定する
        /// </summary>
        /// <returns></returns>
        private bool setNewProblem()
        {
            bool success = false;

            try
            {
                if (ProbNo == 0)
                {
                    Id_base = 0;
                    using(CCadObj2D cad2d = new CCadObj2D())
                    {
                        IList<CVector2D> pts = new List<CVector2D>();
                        pts.Add( new CVector2D(-0.5,-0.5) );
                        pts.Add( new CVector2D( 0.5,-0.5) );
                        pts.Add( new CVector2D( 0.5, 0.5) );
                        pts.Add( new CVector2D(-0.5, 0.5) );
                        uint id_l0 = cad2d.AddPolygon( pts ).id_l_add;
                        World.Clear();
                        Id_base = World.AddMesh( new CMesher2D(cad2d,0.02) );
                    }
                    Id_field_val = World.MakeField_FieldElemDim(Id_base, 2, FIELD_TYPE.SCALAR);
                    System.Diagnostics.Debug.Assert( World.IsIdField(Id_field_val) );
                    clearFieldValueSetterAry(FieldValueSetterAry);
                    {
                        CFieldValueSetter fvs = new CFieldValueSetter(Id_field_val, World);
                        fvs.SetMathExp("sin(10*sqrt(x^2+y^2)-2*PI*t)", 0, FIELD_DERIVATION_TYPE.VALUE, World);
                        FieldValueSetterAry.Add(fvs);
                    }
                    DrawerAry.Clear();
                    DrawerAry.PushBack( new CDrawerFace(Id_field_val, true, World, Id_field_val, -1.0, 1.0) );
                    DrawerAry.InitTrans( Camera );
                }
                else if( ProbNo == 1 )
                {
                    clearFieldValueSetterAry(FieldValueSetterAry);
                    CFieldValueSetter fvs = new CFieldValueSetter(Id_field_val, World);
                    fvs.SetMathExp("sin(2*PI*x-t)*sin(2*PI*y-t)", 0, FIELD_DERIVATION_TYPE.VALUE, World);
                    FieldValueSetterAry.Add(fvs);
                }
                else if( ProbNo == 2 )
                {
                    string mshfn = "../../../input_file/rect_quad.msh";
                    //string mshfn = "../../../input_file/hexa_tri.msh";
                    if (File.Exists(mshfn))
                    {
                        using(CMesher2D msh2d = new CMesher2D())
                        {
                            msh2d.ReadFromFile_GiDMsh(mshfn);
                            World.Clear();
                            Id_base = World.AddMesh( msh2d );
                            Id_field_val = World.MakeField_FieldElemDim(Id_base,2,FIELD_TYPE.SCALAR);
                            clearFieldValueSetterAry(FieldValueSetterAry);
                            {
                                CFieldValueSetter fvs = new CFieldValueSetter(Id_field_val, World);
                                fvs.SetMathExp("sin(0.5*sqrt((x+1)^2+y^2)-0.1*t)", 0, FIELD_DERIVATION_TYPE.VALUE, World);
                                FieldValueSetterAry.Add(fvs);
                            }
                            DrawerAry.Clear();
                            DrawerAry.PushBack( new CDrawerFace(Id_field_val, true, World, Id_field_val, -1.0, 1.0) );
                            DrawerAry.InitTrans( Camera);
                        }
                    }
                    else
                    {
                        Console.WriteLine("not exist:{0}", mshfn);
                        MessageBox.Show(string.Format("メッシュファイル:{0}がありません", mshfn));
                    }
                }
                else if( ProbNo == 3 )
                {
                    using(CCadObj2D cad2d = new CCadObj2D())
                    {
                        IList<CVector2D> pts = new List<CVector2D>();
                        pts.Add( new CVector2D(-0.5,-0.5) );
                        pts.Add( new CVector2D( 0.5,-0.5) );
                        pts.Add( new CVector2D( 0.5, 0.5) );
                        pts.Add( new CVector2D(-0.5, 0.5) );
                        uint id_l0 = cad2d.AddPolygon( pts ).id_l_add;
                        using(CMesher2D mesh2d = new CMesher2D(cad2d, 0.07))
                        using(CMesh3D_Extrude mesh3d = new CMesh3D_Extrude())
                        {
                            mesh3d.Extrude(mesh2d, 1.0, 0.07);
                            World.Clear();
                            Id_base = World.AddMesh( mesh3d );
                        }
                    }
                    Id_field_val = World.MakeField_FieldElemDim(Id_base,2,FIELD_TYPE.SCALAR);
                    clearFieldValueSetterAry(FieldValueSetterAry);
                    {
                        CFieldValueSetter fvs = new CFieldValueSetter(Id_field_val,World);
                        fvs.SetMathExp("sin(10*sqrt(x^2+y^2+z^2)-PI*t)", 0, FIELD_DERIVATION_TYPE.VALUE,World);
                        FieldValueSetterAry.Add(fvs);
                    }
                    DrawerAry.Clear();
                    DrawerAry.PushBack( new CDrawerFace(Id_field_val, true, World, Id_field_val, -1.0, 1.0) );
                    DrawerAry.InitTrans( Camera );
                }
                else if( ProbNo == 4 )
                {
                    string mshfn = "../../../input_file/hexa_tri.msh";
                    if (File.Exists(mshfn))
                    {
                        using(CMesher2D mesh2d = new CMesher2D())
                        using(CMesh3D_Extrude mesh3d = new CMesh3D_Extrude())
                        {
                            mesh2d.ReadFromFile_GiDMsh(mshfn);
                            mesh3d.Extrude(mesh2d, 5.0, 0.5);
                            World.Clear();
                            Id_base = World.AddMesh( mesh3d );
                        }
                        Id_field_val = World.MakeField_FieldElemDim(Id_base, 2, FIELD_TYPE.SCALAR);
                        clearFieldValueSetterAry(FieldValueSetterAry);
                        {
                            CFieldValueSetter fvs = new CFieldValueSetter(Id_field_val,World);
                            fvs.SetMathExp("sin(1.0*sqrt(x^2+y^2+z^2)-2*PI*t)", 0, FIELD_DERIVATION_TYPE.VALUE, World);
                            FieldValueSetterAry.Add(fvs);
                        }
                        DrawerAry.Clear();
                        DrawerAry.PushBack( new CDrawerFace(Id_field_val, true, World, Id_field_val, -1.0, 1.0) );
                        DrawerAry.InitTrans( Camera );
                    }
                    else
                    {
                        Console.WriteLine("not exist:{0}", mshfn);
                        MessageBox.Show(string.Format("メッシュファイル:{0}がありません", mshfn));
                    }
                }
                else if( ProbNo == 5 )
                {
                    using(CCadObj2D cad2d = new CCadObj2D())
                    {
                        IList<CVector2D> pts = new List<CVector2D>();
                        pts.Add( new CVector2D(-0.5,-0.5) );
                        pts.Add( new CVector2D( 0.5,-0.5) );
                        pts.Add( new CVector2D( 0.5, 0.5) );
                        pts.Add( new CVector2D(-0.5, 0.5) );
                        uint id_l0 = cad2d.AddPolygon( pts ).id_l_add;
                        cad2d.AddVertex(CAD_ELEM_TYPE.EDGE, 1, new CVector2D(0.0, -0.5) );
                        cad2d.AddVertex(CAD_ELEM_TYPE.EDGE, 3, new CVector2D(0.0,  0.5) );
                        cad2d.ConnectVertex_Line(5,6);
                        World.Clear();
                        Id_base = World.AddMesh( new CMesher2D(cad2d,0.02) );
                    }
                    CIDConvEAMshCad conv = World.GetIDConverter(Id_base);
                    Id_field_val = World.MakeField_FieldElemDim(Id_base, 2, FIELD_TYPE.SCALAR);
                    System.Diagnostics.Debug.Assert( World.IsIdField(Id_field_val) );
                    {
                        uint id_field0 = World.GetPartialField(Id_field_val, conv.GetIdEA_fromCad(1, CAD_ELEM_TYPE.LOOP));
                        System.Diagnostics.Debug.Assert( World.IsIdField(id_field0) );
                        uint id_field1 = World.GetPartialField(Id_field_val, conv.GetIdEA_fromCad(2, CAD_ELEM_TYPE.LOOP));
                        System.Diagnostics.Debug.Assert( World.IsIdField(id_field1) );

                        clearFieldValueSetterAry(FieldValueSetterAry);
                        CFieldValueSetter fvs0 = new CFieldValueSetter(id_field0, World);
                        fvs0.SetMathExp("sin(10*sqrt((x+0.5)^2+y^2)-2*PI*t)", 0, FIELD_DERIVATION_TYPE.VALUE, World);
                        FieldValueSetterAry.Add(fvs0);
                        CFieldValueSetter fvs1 = new CFieldValueSetter(id_field1, World);
                        fvs1.SetMathExp("sin(10*sqrt((x-0.5)^2+y^2)-2*PI*t)", 0, FIELD_DERIVATION_TYPE.VALUE, World);
                        FieldValueSetterAry.Add(fvs1);
                    }
                    DrawerAry.Clear();
                    DrawerAry.PushBack( new CDrawerFace(Id_field_val, true, World, Id_field_val, -1.0, 1.0) );
                    DrawerAry.InitTrans( Camera );
                }
                else if( ProbNo == 6 )
                {
                    using(CCadObj2D cad2d = new CCadObj2D())
                    {
                        IList<CVector2D> pts = new List<CVector2D>();
                        pts.Add( new CVector2D(-0.5,-0.5) );
                        pts.Add( new CVector2D( 0.5,-0.5) );
                        pts.Add( new CVector2D( 0.5, 0.5) );
                        pts.Add( new CVector2D(-0.5, 0.5) );
                        cad2d.AddPolygon( pts );
                        cad2d.AddVertex(CAD_ELEM_TYPE.EDGE, 1, new CVector2D(0.0, -0.5) );
                        cad2d.AddVertex(CAD_ELEM_TYPE.EDGE, 3, new CVector2D(0.0,  0.5) );
                        cad2d.ConnectVertex_Line(5,6);
                        World.Clear();
                        Id_base = World.AddMesh( new CMesher2D(cad2d, 0.05) );
                    }
                    CIDConvEAMshCad conv = World.GetIDConverter(Id_base);
                    Id_field_val = World.MakeField_FieldElemAry(Id_base, conv.GetIdEA_fromCad(1, CAD_ELEM_TYPE.LOOP), FIELD_TYPE.SCALAR, FIELD_DERIVATION_TYPE.VALUE, ELSEG_TYPE.CORNER);
                    clearFieldValueSetterAry(FieldValueSetterAry);
                    {
                        CFieldValueSetter fvs = new CFieldValueSetter(Id_field_val,World);
                        fvs.SetMathExp("sin(10*sqrt((x+0.5)^2+y^2)-2*PI*t)", 0, FIELD_DERIVATION_TYPE.VALUE,World);
                        FieldValueSetterAry.Add(fvs);
                    }
                    DrawerAry.Clear();
                    DrawerAry.PushBack( new CDrawerFace(Id_field_val, true, World, Id_field_val, -1.0, 1.0) );
                    //DrawerAry.PushBack( new CDrawerFace(Id_field_val, true, World) );
                    DrawerAry.InitTrans( Camera );
                }
                else if( ProbNo == 7 )
                {
                    uint id_field_grad = World.MakeField_FieldElemDim(Id_field_val, 2, FIELD_TYPE.VECTOR2,FIELD_DERIVATION_TYPE.VALUE, ELSEG_TYPE.BUBBLE);
                    {
                        CFieldValueSetter fvs = new CFieldValueSetter(id_field_grad, World);
                        fvs.SetMathExp("0.1*sin(t)", 0, FIELD_DERIVATION_TYPE.VALUE, World);
                        fvs.SetMathExp("0.1*cos(t)", 1, FIELD_DERIVATION_TYPE.VALUE, World);
                        FieldValueSetterAry.Add(fvs);
                    }
                    DrawerAry.PushBack( new CDrawerVector(id_field_grad, World) );
                    DrawerAry.InitTrans( Camera );
                }
                else if( ProbNo == 8 )
                {
                    string mshfn = "../../../input_file/cylinder_tet.msh";
                    if (File.Exists(mshfn))
                    {
                        using(CMesher3D mesh3d = new CMesher3D())
                        {
                            mesh3d.ReadFromFile_GiDMsh(mshfn);
                            World.Clear();
                            Id_base = World.AddMesh( mesh3d );
                        }
                        Id_field_val = World.MakeField_FieldElemDim(Id_base, 3, FIELD_TYPE.SCALAR);
                        uint id_field_grad = World.MakeField_FieldElemDim(Id_field_val, 3, FIELD_TYPE.VECTOR3, FIELD_DERIVATION_TYPE.VALUE, ELSEG_TYPE.BUBBLE);
                        clearFieldValueSetterAry(FieldValueSetterAry);
                        {
                            CFieldValueSetter fvs = new CFieldValueSetter(Id_field_val,World);
                            fvs.SetMathExp("sin(t+0.5*x)", 0, FIELD_DERIVATION_TYPE.VALUE, World);
                            FieldValueSetterAry.Add(fvs);
                        }
                        {
                            CFieldValueSetter fvs = new CFieldValueSetter(id_field_grad, World);
                            fvs.SetGradient(Id_field_val, World);
                            FieldValueSetterAry.Add(fvs);
                        }
                        DrawerAry.Clear();
                        //DrawerAry.PushBack( new CDrawerFaceContour(Id_field_val,World,-1.0,1.0) );
                        DrawerAry.PushBack( new CDrawerVector(id_field_grad,World) );
                        DrawerAry.PushBack( new CDrawerEdge(id_field_grad,true,World) );
                        DrawerAry.InitTrans( Camera );
                    }
                    else
                    {
                        Console.WriteLine("not exist:{0}", mshfn);
                        MessageBox.Show(string.Format("メッシュファイル:{0}がありません", mshfn));
                    }
                }
                else if( ProbNo == 9 )
                {
                    string mshfn = "../../../input_file/cylinder_hex.msh";
                    if (File.Exists(mshfn))
                    {
                        using(CMesher3D mesh3d = new CMesher3D())
                        {
                            mesh3d.ReadFromFile_GiDMsh(mshfn);
                            World.Clear();
                            Id_base = World.AddMesh( mesh3d );
                        }
                        Id_field_val = World.MakeField_FieldElemDim(Id_base, 3, FIELD_TYPE.SCALAR);
                        uint id_field_grad = World.MakeField_FieldElemDim(Id_field_val, 3, FIELD_TYPE.VECTOR3, FIELD_DERIVATION_TYPE.VALUE, ELSEG_TYPE.BUBBLE);
                        clearFieldValueSetterAry(FieldValueSetterAry);
                        {
                            CFieldValueSetter fvs = new CFieldValueSetter(Id_field_val, World);
                            fvs.SetMathExp("sin(t+0.5*x)", 0, FIELD_DERIVATION_TYPE.VALUE, World);
                            FieldValueSetterAry.Add(fvs);
                        }
                        {
                            CFieldValueSetter fvs = new CFieldValueSetter(id_field_grad, World);
                            fvs.SetGradient(Id_field_val, World);
                            FieldValueSetterAry.Add(fvs);
                        }
                        DrawerAry.Clear();
                        DrawerAry.PushBack( new CDrawerVector(id_field_grad, World) );
                        DrawerAry.PushBack( new CDrawerEdge(id_field_grad,true, World) );
                        DrawerAry.InitTrans( Camera );
                    }
                    else
                    {
                        Console.WriteLine("not exist:{0}", mshfn);
                        MessageBox.Show(string.Format("メッシュファイル:{0}がありません", mshfn));
                    }
                }
                else if( ProbNo == 10 )
                {
                    //string mshfn = "../../../input_file/rect_quad.msh";
                    string mshfn = "../../../input_file/hexa_tri.msh";
                    if (File.Exists(mshfn))
                    {
                        using(CMesher2D msh2d = new CMesher2D())
                        {
                            msh2d.ReadFromFile_GiDMsh(mshfn);
                            World.Clear();
                            Id_base = World.AddMesh( msh2d );
                        }
                        Id_field_val = World.MakeField_FieldElemDim(Id_base, 2, FIELD_TYPE.SCALAR, FIELD_DERIVATION_TYPE.VALUE, ELSEG_TYPE.BUBBLE);
                        clearFieldValueSetterAry(FieldValueSetterAry);
                        {
                            CFieldValueSetter fvs = new CFieldValueSetter(Id_field_val, World);
                            fvs.SetMathExp("sin(x+y-0.1*t)", 0, FIELD_DERIVATION_TYPE.VALUE, World);
                            FieldValueSetterAry.Add(fvs);
                        }
                        DrawerAry.Clear();
                        DrawerAry.PushBack( new CDrawerFace(Id_field_val,true,World,Id_field_val,-1.0,1.0) );
                        DrawerAry.InitTrans(Camera);
                    }
                    else
                    {
                        Console.WriteLine("not exist:{0}", mshfn);
                        MessageBox.Show(string.Format("メッシュファイル:{0}がありません", mshfn));
                    }
                }
                else if( ProbNo == 11 )
                {
                    //string mshfn = "../../../input_file/rect_quad.msh";
                    string mshfn = "../../../input_file/hexa_tri.msh";
                    if (File.Exists(mshfn))
                    {
                        using(CMesher2D msh2d  = new CMesher2D())
                        using(CMesh3D_Extrude mesh3d = new CMesh3D_Extrude())
                        {
                            msh2d.ReadFromFile_GiDMsh(mshfn);
                            mesh3d.Extrude(msh2d, 5.0, 1);
                            World.Clear();
                            Id_base = World.AddMesh( mesh3d );
                        }
                        Id_field_val = World.MakeField_FieldElemDim(Id_base, 3, FIELD_TYPE.SCALAR, FIELD_DERIVATION_TYPE.VALUE, ELSEG_TYPE.BUBBLE);
                        clearFieldValueSetterAry(FieldValueSetterAry);
                        {
                            CFieldValueSetter fvs = new CFieldValueSetter(Id_field_val, World);
                            fvs.SetMathExp("sin(0.5*sqrt(x^2+y^2+z^2)-2*PI*t)", 0, FIELD_DERIVATION_TYPE.VALUE, World);
                            FieldValueSetterAry.Add(fvs);
                        }
                        DrawerAry.Clear();
                        DrawerAry.PushBack( new CDrawerFace(Id_field_val,true,World, Id_field_val,-1.0,1.0) );
                        //DrawerAry.PushBack( new CDrawerFace(Id_field_val,true,World) );
                        DrawerAry.InitTrans(Camera);
                    }
                    else
                    {
                        Console.WriteLine("not exist:{0}", mshfn);
                        MessageBox.Show(string.Format("メッシュファイル:{0}がありません", mshfn));
                    }
                }
                else if( ProbNo == 12 )
                {
                    // scalar field and vector field
                    using(CCadObj2D cad2d = new CCadObj2D())
                    {
                        IList<CVector2D> pts = new List<CVector2D>();
                        pts.Add( new CVector2D(-0.5,-0.5) );
                        pts.Add( new CVector2D( 0.5,-0.5) );
                        pts.Add( new CVector2D( 0.5, 0.5) );
                        pts.Add( new CVector2D(-0.5, 0.5) );
                        uint id_l0 = cad2d.AddPolygon( pts ).id_l_add;
                        World.Clear();
                        Id_base = World.AddMesh( new CMesher2D(cad2d, 0.1) );
                    }
                    Id_field_val = World.MakeField_FieldElemDim(Id_base, 2, FIELD_TYPE.SCALAR, FIELD_DERIVATION_TYPE.VALUE, ELSEG_TYPE.CORNER|ELSEG_TYPE.BUBBLE);
                    System.Diagnostics.Debug.Assert( World.IsIdField(Id_field_val) );
                    uint id_field_vec = World.MakeField_FieldElemDim(Id_base, 2, FIELD_TYPE.VECTOR2, FIELD_DERIVATION_TYPE.VALUE, ELSEG_TYPE.CORNER|ELSEG_TYPE.BUBBLE);
                    System.Diagnostics.Debug.Assert( World.IsIdField(id_field_vec) );
                    clearFieldValueSetterAry(FieldValueSetterAry);
                    {
                        CFieldValueSetter fvs = new CFieldValueSetter(Id_field_val, World);
                        fvs.SetMathExp("sin(10*sqrt(x^2+y^2)-2*PI*t)", 0, FIELD_DERIVATION_TYPE.VALUE, World);
                        FieldValueSetterAry.Add(fvs);
                    }
                    {
                        CFieldValueSetter fvs = new CFieldValueSetter(id_field_vec, World);
                        fvs.SetMathExp("0.05*sin(t)", 0, FIELD_DERIVATION_TYPE.VALUE, World);
                        fvs.SetMathExp("0.05*cos(t)", 1, FIELD_DERIVATION_TYPE.VALUE, World);
                        FieldValueSetterAry.Add(fvs);
                    }
                    DrawerAry.Clear();
                    DrawerAry.PushBack( new CDrawerFace(Id_field_val, true, World, Id_field_val, -1.0, 1.0) );
                    DrawerAry.PushBack( new CDrawerVector(id_field_vec, World) );
                    DrawerAry.InitTrans( Camera );
                }

                success = true;

            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.Message + " " + exception.StackTrace);
            }

            ProbNo++;
            if (ProbNo == ProbCnt) ProbNo = 0;
            return success;
        }
Example #3
0
        /// <summary>
        /// 問題を設定する
        /// </summary>
        /// <returns></returns>
        private bool setNewProblem()
        {
            bool success = false;
            try
            {
                if( ProbNo == 0 )
                {
                    CMesher2D mesh2d = null;
                    using(CCadObj2D cad2d = new CCadObj2D())
                    {
                        IList<CVector2D> pts = new List<CVector2D>();
                        pts.Add( new CVector2D(0.0,0.0) );
                        pts.Add( new CVector2D(1.0,0.0) );
                        pts.Add( new CVector2D(1.0,0.2) );
                        pts.Add( new CVector2D(0.5,0.2) );
                        pts.Add( new CVector2D(0.5,0.8) );
                        pts.Add( new CVector2D(1.0,0.8) );
                        pts.Add( new CVector2D(1.0,1.0) );
                        pts.Add( new CVector2D(0.0,1.0) );
                        cad2d.AddPolygon( pts );
                        cad2d.ConnectVertex_Line(6,3);
                        mesh2d = new CMesher2D(cad2d,0.05);
                        ////
                        using(CMesher2D msh_tmp = (CMesher2D)mesh2d.Clone())
                        {
                            mesh2d.Clear();
                            mesh2d.Dispose();
                            mesh2d = (CMesher2D)msh_tmp.Clone();
                        }
                    }
                    using(CSerializer fout = new CSerializer("hoge.txt", false))
                    {
                        // write file
                        mesh2d.Serialize(fout);
                    }
                    using(CSerializer fin = new CSerializer("hoge.txt", true))
                    {    // load file
                        mesh2d.Serialize(fin);
                    }
                    ////
                    DrawerAry.Clear();
                    DrawerAry.PushBack( new CDrawerMsh2D(mesh2d) );
                    DrawerAry.InitTrans( Camera );
                    mesh2d.Clear();
                    mesh2d.Dispose();
                }
                else if( ProbNo == 1 )
                {
                    string mshfn = "../../../input_file/hexa_tri.msh";
                    if (File.Exists(mshfn))
                    {
                        using(CMesher2D mesh2d = new CMesher2D())
                        {
                            mesh2d.ReadFromFile_GiDMsh(mshfn);
                            using(CSerializer fout = new CSerializer("hoge.txt", false))
                            {
                                // write file
                                mesh2d.Serialize(fout);
                            }
                            using(CSerializer fin = new CSerializer("hoge.txt", true))
                            {    // load file
                                mesh2d.Serialize(fin);
                            }
                            DrawerAry.Clear();
                            DrawerAry.PushBack( new CDrawerMsh2D(mesh2d) );
                            DrawerAry.InitTrans( Camera );
                        }
                    }
                    else
                    {
                        Console.WriteLine("not exist:{0}", mshfn);
                        MessageBox.Show(string.Format("メッシュファイル:{0}がありません", mshfn));
                    }
                }
                else if( ProbNo == 2 )
                {
                    string mshfn = "../../../input_file/rect_quad.msh";
                    if (File.Exists(mshfn))
                    {
                        using(CMesher2D mesh2d = new CMesher2D())
                        {
                            mesh2d.ReadFromFile_GiDMsh(mshfn);
                            using(CSerializer fout = new CSerializer("hoge.txt", false))
                            {
                                // write file
                                mesh2d.Serialize(fout);
                            }
                            using(CSerializer fin = new CSerializer("hoge.txt", true))
                            {    // load file
                                mesh2d.Serialize(fin);
                            }
                            DrawerAry.Clear();
                            DrawerAry.PushBack( new CDrawerMsh2D(mesh2d) );
                            DrawerAry.InitTrans( Camera );
                        }
                    }
                    else
                    {
                        Console.WriteLine("not exist:{0}", mshfn);
                        MessageBox.Show(string.Format("メッシュファイル:{0}がありません", mshfn));
                    }
                }
                else if( ProbNo == 3 )
                {
                    using(CCadObj2D cad2d = new CCadObj2D())
                    {
                        IList<CVector2D> pts = new List<CVector2D>();
                        pts.Add( new CVector2D(0.0,0.0) );
                        pts.Add( new CVector2D(1.0,0.0) );
                        pts.Add( new CVector2D(1.0,0.5) );
                        pts.Add( new CVector2D(0.5,0.5) );
                        pts.Add( new CVector2D(0.5,1.0) );
                        pts.Add( new CVector2D(0.0,1.0) );
                        cad2d.AddPolygon( pts );
                        using(CMesher2D mesh2d = new CMesher2D(cad2d, 0.1))
                        using(CMesh3D_Extrude mesh3d = new CMesh3D_Extrude())
                        {
                            mesh3d.Extrude(mesh2d, 0.5, 0.1 );
                            using(CSerializer fout = new CSerializer("hoge.txt", false))
                            {
                                // write file
                                mesh3d.Serialize(fout);
                            }
                            using(CSerializer fin = new CSerializer("hoge.txt", true))
                            {    // load file
                                mesh3d.Serialize(fin);
                            }
                            DrawerAry.Clear();
                            DrawerAry.PushBack( new CDrawerMsh3D(mesh3d) );
                            DrawerAry.InitTrans( Camera );
                        }
                    }
                }
                else if( ProbNo == 4 )    // load mesh of GiD
                {
                    string mshfn = "../../../input_file/hexa_tri.msh";
                    if (File.Exists(mshfn))
                    {
                        using(CMesher2D mesh2d = new CMesher2D())
                        using(CMesh3D_Extrude mesh3d = new CMesh3D_Extrude())
                        {
                            mesh2d.ReadFromFile_GiDMsh(mshfn);
                            mesh3d.Extrude(mesh2d, 5.0, 0.5 );
                            DrawerAry.Clear();
                            DrawerAry.PushBack( new CDrawerMsh3D(mesh3d) );
                            DrawerAry.InitTrans( Camera );
                        }
                    }
                    else
                    {
                        Console.WriteLine("not exist:{0}", mshfn);
                        MessageBox.Show(string.Format("メッシュファイル:{0}がありません", mshfn));
                    }
                }
                else if( ProbNo == 5 )
                {
                    string mshfn = "../../../input_file/cylinder_hex.msh";
                    if (File.Exists(mshfn))
                    {
                        using(CMesher3D mesh3d = new CMesher3D())
                        {
                            mesh3d.ReadFromFile_GiDMsh(mshfn);
                            using(CSerializer fout = new CSerializer("hoge.txt", false))
                            {
                                // write file
                                mesh3d.Serialize(fout);
                            }
                            using(CSerializer fin = new CSerializer("hoge.txt", true))
                            {    // load file
                                mesh3d.Serialize(fin);
                            }
                            DrawerAry.Clear();
                            DrawerAry.PushBack( new CDrawerMsh3D(mesh3d) );
                            DrawerAry.InitTrans( Camera );
                        }
                    }
                    else
                    {
                        Console.WriteLine("not exist:{0}", mshfn);
                        MessageBox.Show(string.Format("メッシュファイル:{0}がありません", mshfn));
                    }
                }
                else if( ProbNo == 6 )
                {
                    string mshfn = "../../../input_file/cylinder_tet.msh";
                    if (File.Exists(mshfn))
                    {
                        using(CMesher3D mesh3d = new CMesher3D())
                        {
                            mesh3d.ReadFromFile_GiDMsh(mshfn);
                            using(CSerializer fout = new CSerializer("hoge.txt", false))
                            {
                                // write file
                                mesh3d.Serialize(fout);
                            }
                            using(CSerializer fin = new CSerializer("hoge.txt", true))
                            {    // load file
                                mesh3d.Serialize(fin);
                            }
                            DrawerAry.Clear();
                            DrawerAry.PushBack( new CDrawerMsh3D(mesh3d) );
                            DrawerAry.InitTrans( Camera );
                        }
                    }
                    else
                    {
                        Console.WriteLine("not exist:{0}", mshfn);
                        MessageBox.Show(string.Format("メッシュファイル:{0}がありません", mshfn));
                    }
                }
                else if( ProbNo == 7 )
                {
                    string mshfn = "../../../input_file/rect_quad.msh";
                    if (File.Exists(mshfn))
                    {
                        using(CMesher2D mesh2d = new CMesher2D())
                        using(CMesh3D_Extrude mesh3d = new CMesh3D_Extrude())
                        {
                            mesh2d.ReadFromFile_GiDMsh(mshfn);
                            mesh3d.Extrude(mesh2d, 5.0, 0.5 );
                            DrawerAry.Clear();
                            DrawerAry.PushBack( new CDrawerMsh3D(mesh3d) );
                            DrawerAry.InitTrans( Camera );
                        }
                    }
                    else
                    {
                        Console.WriteLine("not exist:{0}", mshfn);
                        MessageBox.Show(string.Format("メッシュファイル:{0}がありません", mshfn));
                    }
                }
                else if( ProbNo == 8 )
                {
                    using(CCadObj2D cad2d = new CCadObj2D())
                    {
                        uint id_l = 0;
                        {
                            IList<CVector2D> pts = new List<CVector2D>();
                            pts.Add( new CVector2D(0.0,0.0) );
                            pts.Add( new CVector2D(1.0,0.0) );
                            pts.Add( new CVector2D(1.0,1.0) );
                            pts.Add( new CVector2D(0.0,1.0) );
                            id_l = cad2d.AddPolygon( pts ).id_l_add;
                        }

                        cad2d.AddVertex(CAD_ELEM_TYPE.LOOP,id_l, new CVector2D(0.8,0.6) );
                        cad2d.AddVertex(CAD_ELEM_TYPE.LOOP,id_l, new CVector2D(0.6,0.6) );
                        cad2d.AddVertex(CAD_ELEM_TYPE.LOOP,id_l, new CVector2D(0.4,0.6) );
                        cad2d.AddVertex(CAD_ELEM_TYPE.LOOP,id_l, new CVector2D(0.2,0.6) );
                        cad2d.AddVertex(CAD_ELEM_TYPE.LOOP,id_l, new CVector2D(0.8,0.4) );
                        cad2d.AddVertex(CAD_ELEM_TYPE.LOOP,id_l, new CVector2D(0.6,0.4) );
                        cad2d.AddVertex(CAD_ELEM_TYPE.LOOP,id_l, new CVector2D(0.4,0.4) );
                        cad2d.AddVertex(CAD_ELEM_TYPE.LOOP,id_l, new CVector2D(0.2,0.4) );
                        using(CMesher2D mesh2d = new CMesher2D(cad2d, 0.02))
                        {
                            using(CSerializer fout = new CSerializer("hoge.txt", false))
                            {
                                // write file
                                mesh2d.Serialize(fout);
                            }
                            using(CSerializer fin = new CSerializer("hoge.txt", true))
                            {    // load file
                                mesh2d.Serialize(fin);
                            }
                            DrawerAry.Clear();
                            DrawerAry.PushBack( new CDrawerMsh2D(mesh2d) );
                            DrawerAry.InitTrans( Camera );
                        }
                    }
                }
                else if( ProbNo == 9 )
                {
                    using(CCadObj2D cad2d = new CCadObj2D())
                    {
                        {
                            IList<CVector2D> pts = new List<CVector2D>();
                            pts.Add( new CVector2D(0.0,0.0) );
                            pts.Add( new CVector2D(1.0,0.0) );
                            pts.Add( new CVector2D(1.0,1.0) );
                            pts.Add( new CVector2D(0.0,1.0) );
                            cad2d.AddPolygon( pts );
                        }
                        cad2d.SetCurve_Arc(1,true, -0.5);
                        cad2d.SetCurve_Arc(2,false,-0.5);
                        cad2d.SetCurve_Arc(3,true, -0.5);
                        cad2d.SetCurve_Arc(4,false,-0.5);

                        using(CMesher2D mesh2d = new CMesher2D(cad2d, 0.05))
                        {
                            using(CSerializer fout = new CSerializer("hoge.txt", false))
                            {
                                // write file
                                mesh2d.Serialize(fout);
                            }
                            using(CSerializer fin = new CSerializer("hoge.txt", true))
                            {    // load file
                                mesh2d.Serialize(fin);
                            }
                            DrawerAry.Clear();
                            DrawerAry.PushBack( new CDrawerMsh2D(mesh2d) );
                            DrawerAry.InitTrans( Camera );
                        }
                    }
                }
                else if( ProbNo == 10 )
                {
                    using(CCadObj2D cad2d = new CCadObj2D())
                    {
                        {
                            IList<CVector2D> pts = new List<CVector2D>();
                            pts.Add( new CVector2D(0.0,0.0) );
                            pts.Add( new CVector2D(1.0,0.0) );
                            pts.Add( new CVector2D(1.0,1.0) );
                            pts.Add( new CVector2D(0.0,1.0) );
                            uint id_l = cad2d.AddPolygon( pts ).id_l_add;
                            uint id_v1 = cad2d.AddVertex(CAD_ELEM_TYPE.LOOP,id_l, new CVector2D(0.3,0.2)).id_v_add;
                            uint id_v2 = cad2d.AddVertex(CAD_ELEM_TYPE.LOOP,id_l, new CVector2D(0.7,0.2)).id_v_add;
                            uint id_v3 = cad2d.AddVertex(CAD_ELEM_TYPE.LOOP,id_l, new CVector2D(0.7,0.8)).id_v_add;
                            uint id_v4 = cad2d.AddVertex(CAD_ELEM_TYPE.LOOP,id_l, new CVector2D(0.3,0.8)).id_v_add;
                            cad2d.ConnectVertex_Line(id_v1,id_v2);
                            cad2d.ConnectVertex_Line(id_v2,id_v3);
                            cad2d.ConnectVertex_Line(id_v3,id_v4);
                            cad2d.ConnectVertex_Line(id_v4,id_v1);
                        }

                        using(CMesher2D mesh2d = new CMesher2D())
                        {
                            mesh2d.AddIdLCad_CutMesh(1);    // cut mesh to loop whitch have id 1
                            mesh2d.SetMeshingMode_ElemLength(0.05);
                            mesh2d.Meshing(cad2d);

                            DrawerAry.Clear();
                            DrawerAry.PushBack( new CDrawerMsh2D(mesh2d) );
                            DrawerAry.InitTrans( Camera );
                        }
                    }
                }
                else if( ProbNo == 11 )    // mesh with cut
                {
                    using(CCadObj2D cad2d = new CCadObj2D())
                    {
                        uint id_l;
                        uint id_e1, id_e2, id_e3, id_e4, id_e5;
                        {
                            IList<CVector2D> pts = new List<CVector2D>();
                            pts.Add( new CVector2D(0.0,0.0) );
                            pts.Add( new CVector2D(0.3,0.0) );
                            pts.Add( new CVector2D(1.0,0.0) );
                            pts.Add( new CVector2D(1.0,1.0) );
                            pts.Add( new CVector2D(0.0,1.0) );
                            id_l = cad2d.AddPolygon( pts ).id_l_add;
                            uint id_v1 = cad2d.AddVertex(CAD_ELEM_TYPE.LOOP, id_l, new CVector2D(0.3,0.5) ).id_v_add;
                            id_e1 = cad2d.ConnectVertex_Line(2,id_v1).id_e_add;
                            uint id_v2 = cad2d.AddVertex(CAD_ELEM_TYPE.LOOP, id_l, new CVector2D(0.7,0.5) ).id_v_add;
                            uint id_v3 = cad2d.AddVertex(CAD_ELEM_TYPE.LOOP, id_l, new CVector2D(0.7,0.2) ).id_v_add;
                            uint id_v4 = cad2d.AddVertex(CAD_ELEM_TYPE.LOOP, id_l, new CVector2D(0.7,0.8) ).id_v_add;
                            uint id_v5 = cad2d.AddVertex(CAD_ELEM_TYPE.LOOP, id_l, new CVector2D(0.5,0.5) ).id_v_add;
                            uint id_v6 = cad2d.AddVertex(CAD_ELEM_TYPE.LOOP, id_l, new CVector2D(0.9,0.5) ).id_v_add;
                            id_e2 = cad2d.ConnectVertex_Line(id_v2,id_v3).id_e_add;
                            id_e3 = cad2d.ConnectVertex_Line(id_v2,id_v4).id_e_add;
                            id_e4 = cad2d.ConnectVertex_Line(id_v2,id_v5).id_e_add;
                            id_e5 = cad2d.ConnectVertex_Line(id_v2,id_v6).id_e_add;
                        }
                        using(CMesher2D mesh2d = new CMesher2D(cad2d, 0.2))
                        {
                            IList<uint> aIdMsh_Inc = new List<uint>();
                            aIdMsh_Inc.Add( mesh2d.GetElemID_FromCadID(id_l,CAD_ELEM_TYPE.LOOP) );

                            IList<uint> aIdMshBar_Cut = new List<uint>();
                            aIdMshBar_Cut.Add( mesh2d.GetElemID_FromCadID(id_e1,CAD_ELEM_TYPE.EDGE) );
                            aIdMshBar_Cut.Add( mesh2d.GetElemID_FromCadID(id_e2,CAD_ELEM_TYPE.EDGE) );
                            aIdMshBar_Cut.Add( mesh2d.GetElemID_FromCadID(id_e3,CAD_ELEM_TYPE.EDGE) );
                            aIdMshBar_Cut.Add( mesh2d.GetElemID_FromCadID(id_e4,CAD_ELEM_TYPE.EDGE) );
                            aIdMshBar_Cut.Add( mesh2d.GetElemID_FromCadID(id_e5,CAD_ELEM_TYPE.EDGE) );
                            ////////////////
                            IList< IList<int> > aLnods = new List<IList<int>>();
                            IList<uint> mapVal2Co = new List<uint>();
                            mesh2d.GetClipedMesh(out aLnods, out mapVal2Co, aIdMsh_Inc, aIdMshBar_Cut);

                            DrawerAry.Clear();
                            DrawerAry.PushBack( new CDrawerMsh2D(mesh2d) );
                            DrawerAry.InitTrans( Camera );
                        }
                    }
                }
                else if( ProbNo == 12 )    // mesh with cut
                {
                    using(CCadObj2D cad2d = new CCadObj2D())
                    {
                        uint id_l1, id_l2;
                        uint id_e3, id_e4;
                        {
                            IList<CVector2D> pts = new List<CVector2D>();
                            pts.Add( new CVector2D(0.0, 0.0) );
                            pts.Add( new CVector2D(1.0, 0.0) );
                            pts.Add( new CVector2D(1.5, 0.0) );
                            pts.Add( new CVector2D(2.0, 0.0) );
                            pts.Add( new CVector2D(2.0, 1.0) );
                            pts.Add( new CVector2D(1.5, 1.0) );
                            pts.Add( new CVector2D(1.0, 1.0) );
                            pts.Add( new CVector2D(0.0, 1.0) );
                            uint id_l0 = cad2d.AddPolygon( pts ).id_l_add;
                            uint id_v1 = cad2d.AddVertex(CAD_ELEM_TYPE.LOOP,id_l0, new CVector2D(0.5,0.5) ).id_v_add;
                            uint id_e1 = cad2d.ConnectVertex_Line(2,7).id_e_add;
                            uint id_e2 = cad2d.ConnectVertex_Line(3,6).id_e_add;
                            uint id_v2 = cad2d.AddVertex(CAD_ELEM_TYPE.EDGE,id_e1, new CVector2D(1.0,0.5) ).id_v_add;
                            uint id_v3 = cad2d.AddVertex(CAD_ELEM_TYPE.EDGE,1, new CVector2D(0.5,0.0) ).id_v_add;
                            id_e3 = cad2d.ConnectVertex_Line(id_v1,id_v2).id_e_add;
                            id_e4 = cad2d.ConnectVertex_Line(id_v1,id_v3).id_e_add;
                            id_l1 = 1;
                            id_l2 = 2;
                        }
                        using(CMesher2D mesh2d = new CMesher2D(cad2d, 0.2))
                        {
                            IList<uint> aIdMsh_Inc = new List<uint>();
                            aIdMsh_Inc.Add( mesh2d.GetElemID_FromCadID(id_l1,CAD_ELEM_TYPE.LOOP) );
                            aIdMsh_Inc.Add( mesh2d.GetElemID_FromCadID(id_l2,CAD_ELEM_TYPE.LOOP) );

                            IList<uint> aIdMshBar_Cut = new List<uint>();
                            //aIdMshBar_Cut.Add( mesh2d.GetElemID_FromCadID(id_e3,CAD_ELEM_TYPE.EDGE) );
                            aIdMshBar_Cut.Add( mesh2d.GetElemID_FromCadID(id_e4,CAD_ELEM_TYPE.EDGE) );
                            ////////////////
                            IList< IList<int> > aLnods = new List<IList<int>>();
                            IList<uint> mapVal2Co = new List<uint>();
                            mesh2d.GetClipedMesh(out aLnods, out mapVal2Co, aIdMsh_Inc, aIdMshBar_Cut);

                            DrawerAry.Clear();
                            DrawerAry.PushBack( new CDrawerMsh2D(mesh2d) );
                            DrawerAry.InitTrans( Camera );
                        }
                    }
                }
                else if( ProbNo == 13 )
                {
                    using(CCadObj2D cad2d = new CCadObj2D())
                    {
                        {
                            IList<CVector2D> pts = new List<CVector2D>();
                            pts.Add( new CVector2D(0.0, 0.0) );    // 1
                            pts.Add( new CVector2D(1.5, 0.0) );    // 2
                            pts.Add( new CVector2D(1.5, 0.4) );    // 3
                            pts.Add( new CVector2D(1.0, 0.4) );    // 4
                            pts.Add( new CVector2D(1.0, 0.5) );    // 5
                            pts.Add( new CVector2D(2.0, 0.5) );    // 6
                            pts.Add( new CVector2D(2.0, 1.0) );    // 7
                            pts.Add( new CVector2D(0.0, 1.0) );    // 8
                            pts.Add( new CVector2D(0.0, 0.5) );    // 9
                            uint id_l0 = cad2d.AddPolygon( pts ).id_l_add;
                            uint id_e1 = cad2d.ConnectVertex_Line(5,9).id_e_add;
                            cad2d.ShiftLayer_Loop(id_l0,true);
                            double[] col = new double[3] { 0.9, 0.4, 0.4 };
                            cad2d.SetColor_Loop(id_l0, col);
                            cad2d.AddVertex(CAD_ELEM_TYPE.EDGE,3, new CVector2D(1.3,0.5));
                        }
                        using(CMesher2D mesh2d = new CMesher2D(cad2d, 0.05))
                        {
                            DrawerAry.Clear();
                            DrawerAry.PushBack( new CDrawerMsh2D(mesh2d) );
                            DrawerAry.InitTrans( Camera );
                        }
                    }
                }
                else if( ProbNo == 14 )
                {
                    string svgfn = "../../../input_file/shape2d_0.svg";
                    if (File.Exists(svgfn))
                    {
                        CCadObj2D cad2d = null;
                        CCadSVG.ReadSVG_AddLoopCad(svgfn, out cad2d);
                        using (CMesher2D mesh2d = new CMesher2D())
                        {
                            mesh2d.SetMeshingMode_ElemSize(400);
                            mesh2d.AddIdLCad_CutMesh(1);
                            mesh2d.Meshing(cad2d);

                            DrawerAry.Clear();
                            DrawerAry.PushBack(new CDrawerMsh2D(mesh2d));
                            DrawerAry.InitTrans(Camera);
                        }
                        cad2d.Clear();
                        cad2d.Dispose();
                    }
                    else
                    {
                        Console.WriteLine("not exist:{0}", svgfn);
                        MessageBox.Show(string.Format("SVGファイル:{0}がありません", svgfn));
                    }
                }
                success = true;
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.Message + " " + exception.StackTrace);
            }

            Gl.glMatrixMode(Gl.GL_PROJECTION);
            Gl.glLoadIdentity();
            DrawerGlUtility.SetProjectionTransform(Camera);
            Glut.glutPostRedisplay();
            ProbNo++;
            if (ProbNo == ProbCnt) ProbNo = 0;
            return success;
        }