/// 初始化 public WGeometry2D() { Entities = new List <WEntity2D>(); Layers = new List <string>(); Bounds = new WBoundingBox(); PsList = new WGeos2D_PsList(); }
public static void Read_WMeshFile(string FileName, ref List <WNode2D> Nodes, ref List <WElement2D> Elements, ref WBoundingBox Bounds) { StreamReader sr = new StreamReader(FileName); sr.ReadLine(); sr.ReadLine(); sr.ReadLine(); sr.ReadLine(); string t = sr.ReadLine(); string[] t_1; int No = 0; ///获取节点信息 t = t.Split(' ')[1]; t_1 = t.Split(','); No++; Nodes.Add(new WNode2D(Convert.ToDouble(t_1[0]), Convert.ToDouble(t_1[1]))); Bounds.Update(Nodes[1].X, Nodes[1].Y); t = sr.ReadLine(); while (t != "") { t = t.Split(' ')[1]; t_1 = t.Split(','); No++; Nodes.Add(new WNode2D(Convert.ToDouble(t_1[0]), Convert.ToDouble(t_1[1]))); ///求取节点坐标范围 Bounds.Update(Nodes[No].X, Nodes[No].Y); t = sr.ReadLine(); } ///获取单元信息 sr.ReadLine(); sr.ReadLine(); int K; while (sr.Peek() != -1) { t_1 = sr.ReadLine().Split(' '); if (t_1[0] == "0") { continue; } K = Convert.ToInt16(t_1[0]); t_1 = t_1[1].Split(','); Elements.Add(new WElement2D(K, Convert.ToInt32(t_1[0]), Convert.ToInt32(t_1[1]), Convert.ToInt32(t_1[2]), Convert.ToInt32(t_1[3]))); } sr.Close(); sr.Dispose(); }