private void ClearMemory() { IniX = null; Ut = null; Dut = null; Res = null; Dut = null; BCFlag = null; Mat = null; }
public CadEdge2DPolyline() { EI = 30.0; ARho = 1; AE = 100000.0; //// No = 0; //// Ut = null; IniX = null; BCFlag = null; Dut = null; Res = null; Mat = null; }
public void SetCadEdge(CadObject2D cad2D, uint eId, OpenTK.Vector2d pickPos) { this.PickPos = pickPos; this.ECadId = eId; ClearMemory(); IList <double> relCoPolys = new List <double>(); { System.Diagnostics.Debug.Assert(cad2D.IsElementId(CadElementType.Edge, eId)); Edge2D e = cad2D.GetEdge(eId); relCoPolys = e.GetCurveRelPoint(); } IList <double> xys = new List <double>(); uint ndiv = (uint)(relCoPolys.Count / 2 + 1); No = ndiv + 1; for (int i = 0; i < No * 2; i++) { xys.Add(0); } uint sVId = cad2D.GetEdgeVertexId(eId, true); uint eVId = cad2D.GetEdgeVertexId(eId, false); OpenTK.Vector2d sV = cad2D.GetVertexCoord(sVId); OpenTK.Vector2d eV = cad2D.GetVertexCoord(eVId); OpenTK.Vector2d hse = eV - sV; OpenTK.Vector2d vse = new OpenTK.Vector2d(-hse.Y, hse.X); xys.Add(sV.X); xys.Add(sV.Y); for (int i = 0; i < ndiv - 1; i++) { OpenTK.Vector2d v = sV + relCoPolys[i * 2 + 0] * hse + relCoPolys[i * 2 + 1] * vse; xys.Add(v.X); xys.Add(v.Y); } xys.Add(eV.X); xys.Add(eV.Y); ////////////////////////////////////// Mat = new TriDiaMat3(No); IniX = new double[No * 2]; Ut = new double[No * 3]; Res = new double[No * 3]; Dut = new double[No * 3]; BCFlag = new int[No * 3]; //// for (int i = 0; i < No * 2; i++) { IniX[i] = xys[i]; } for (int i = 0; i < No * 3; i++) { Ut[i] = 0; } for (int i = 0; i < No * 3; i++) { BCFlag[i] = 0; } ////////////////////////////////////// SetFixedBoundaryFlag(0, 0); SetFixedBoundaryFlag(0, 1); SetFixedBoundaryFlag(No - 1, 0); SetFixedBoundaryFlag(No - 1, 1); double alpha; double ndist; double normX; double normY; ProjectPoint(pickPos.X, pickPos.Y, ref PickedDivIndex, out alpha, out ndist, out normX, out normY); if (PickedDivIndex == -1) { return; } SetFixedBoundaryFlag((uint)PickedDivIndex, 0); SetFixedBoundaryFlag((uint)PickedDivIndex, 1); SetFixedBoundaryFlag((uint)PickedDivIndex + 1, 0); SetFixedBoundaryFlag((uint)PickedDivIndex + 1, 1); }