/// <summary> /// Copy constructor /// </summary> /// <param name="ToCopy"></param> public Connection(Connection ToCopy) { First = ToCopy.First; Second = ToCopy.Second; PermeabilityDirection = ToCopy.PermeabilityDirection; Distance1 = ToCopy.Distance1; Distance2 = ToCopy.Distance2; Area = ToCopy.Area; CosineAngle = ToCopy.CosineAngle; }
/// <summary> /// Reads in Mesh information from a stream. Does not look back in the stream /// </summary> /// <param name="StreamWithMeshInfo"></param> private void ReadMesh() { elements = new ElementCollection(); connections = new List<Connection>(); using (StreamReader StreamWithMeshInfo = new StreamReader(FileName)) { while (!StreamWithMeshInfo.EndOfStream) { string word = StreamWithMeshInfo.ReadLine().Trim().ToUpper(); if (word.StartsWith("ELEME")) { word = StreamWithMeshInfo.ReadLine().Trim(); while (word != string.Empty) { Elements.Add(new Element(word)); word = StreamWithMeshInfo.ReadLine().Trim(); } } else if (word.StartsWith("CONNE")) { word = StreamWithMeshInfo.ReadLine().Trim(); while (word != string.Empty & word != "+++") { Connection C = new Connection(word, Elements); Connections.Add(C); word = StreamWithMeshInfo.ReadLine().Trim(); } } } } }
public void AdjustMesh2() { Mesh m = new Mesh(@"C:\Flemming\Model\ToughReact\Radial_CoarseModel\mesh"); List<Connection> NewConnections = new List<Connection>(); int i = 1; foreach (var v in m.Connections) { if (v.First.Name.StartsWith("A1") & v.Second.Name.StartsWith("A2") & i<25) { Connection c = new Connection(v); c.Second = m.Elements.Single(el =>el.Name=="AIR11"); NewConnections.Add(c); i++; } } m.Connections.AddRange(NewConnections); m.SaveAs(@"C:\Flemming\Model\ToughReact\Radial_CoarseModel\mesh"); }
public void AdjustMesh() { Mesh m = new Mesh(@"C:\Jacob\Projects\Flemming\Model\2DFracture\mesh"); Element atm = new Element("ATM11",3,0); m.Elements.Add(atm); foreach (var v in m.Elements) { if (v.Z < -3) v.Material = 2; else v.Material = 1; if (v.X < 1.5000E-02) v.Material = 2; if (v.Z>-0.3) { Connection c = new Connection(m.Connections[1]); c.First = atm; c.Second = v; m.Connections.Add(c); } } atm.Material = 3; m.Save(); }