コード例 #1
0
ファイル: Mesh2D_MeshFree.cs プロジェクト: wuxiaod1987/WCAE
        public static WElement2D[] Mesh_SingleRim(ref List <int> Nums, ref List <WPoint2D> Ps, ref WMesh2D_Para MP, string Name)
        {
            StreamWriter Sw = new System.IO.StreamWriter(MP.Path + Name + ".rim");
            List <int>   Ns = new List <int>();
            int          N  = 0;

            N = WMFuncs2D.NsID_App(ref Ps, ref Ns, N);                  /////形成节点编号
            WMFuncs2D.Ns_Out(ref Ps, ref Ns, false, 0, ref Sw);
            Sw.Close();
            Poly_SingleRim(Ps.Count, MP.Path, Name);
            WMesh2D_Mesh Mesh = Mesh2D_TriangleMesh.Triangle_Mesh(ref MP, Name);      /////调用

            if (Mesh == null)
            {
                return(null);
            }
            for (int i = 0; i < Mesh.QEs; i++)
            {
                if (Mesh.Elements[i].Kind == 4)
                {
                    Mesh.Elements[i] = new WElement2D(Mesh.Elements[i].Kind,
                                                      Nums[Mesh.Elements[i].N1], Nums[Mesh.Elements[i].N2],
                                                      Nums[Mesh.Elements[i].N3], Nums[Mesh.Elements[i].N4]);
                }
                else if (Mesh.Elements[i].Kind == 3)
                {
                    Mesh.Elements[i] = new WElement2D(Mesh.Elements[i].Kind,
                                                      Nums[Mesh.Elements[i].N1], Nums[Mesh.Elements[i].N2],
                                                      Nums[Mesh.Elements[i].N3], 0);
                }
            }
            return(Mesh.Elements.ToArray());
        }
コード例 #2
0
ファイル: Mesh2D_MeshFree.cs プロジェクト: wuxiaod1987/WCAE
        public static WMesh2D_Mesh Mesh_SingleRim(ref WEntity2D[] Rim, string Name, ref WMesh2D_Para MP)
        {
            WShapeRim2D Shape = Rim_Output(ref Rim, MP.Path, Name);

            if (Shape == null)
            {
                return(null);
            }
            Poly_SingleRim(Shape.Count, MP.Path, Name);
            WMesh2D_Mesh Mesh = Mesh2D_TriangleMesh.Triangle_Mesh(ref MP, Name);      /////调用

            if (Mesh == null)
            {
                return(null);
            }
            Mesh.Shapes.Add(Shape);
            Mesh.Input_Bound(Shape.Xmin, Shape.Xmax, Shape.Ymin, Shape.Ymax);
            return(Mesh);
        }
コード例 #3
0
ファイル: Mesh2D_MeshFree.cs プロジェクト: wuxiaod1987/WCAE
        public static int Mesh_DoubleRim(ref WEntity2D[] Rim_Outer, ref WEntity2D[] Rim_Inner, ref WMesh2D_Para MP, string Name)
        {
            int N       = 0;
            int Quan_In = Rim_Output(ref Rim_Inner, MP.Path, Name + "_Inner", N);

            if (Quan_In == -1)
            {
                return(-1);
            }
            N = Quan_In;
            int Quan_Out = Rim_Output(ref Rim_Outer, MP.Path, Name + "_Outer", N);

            if (Quan_Out == -1)
            {
                return(-1);
            }
            N += Quan_Out;
            ///
            double   xmin = double.MaxValue;
            double   xmax = double.MinValue;
            double   ymin = double.MaxValue;
            double   ymax = double.MinValue;
            WCurve2D C;

            for (int i = 0; i < Rim_Inner.Length; i++)
            {
                C    = (WCurve2D)Rim_Inner[i];
                xmin = Math.Min(xmin, C.Xmin);
                xmax = Math.Max(xmax, C.Xmax);
                ymin = Math.Min(ymin, C.Ymin);
                ymax = Math.Max(ymax, C.Ymax);
            }

            Poly_DoubleRim(Quan_In, Quan_Out, MP.Path, Name, new WPoint2D((xmin + xmax) / 2, (ymin + ymax) / 2));
            Mesh2D_TriangleMesh.Triangle_Mesh(Name, ref MP);      /////调用
            return(N);
        }