//Cells are equal iff jCell matches public override bool Equals(object obj) { //If parameter cannot be cast to Cell return false: MarchingCell p = obj as MarchingCell; if ((object)p == null) { return(false); } //Return true if the Cell indices match: return(p.jCell == jCell); }
/// <summary> /// Firstorder Reinit of <paramref name="Phi"/> on <paramref name="ReinitField"/> field. /// The order in which each cell is initialized is determined by fast marching. /// Locally, each cell is initialized by the localSolver specified in the constructor. /// </summary> /// <param name="Phi">Field to reinitialize</param> /// <param name="Accepted">Start values</param> /// <param name="ReinitField">Specific Domain, e.g. whole domain or nearField</param> public void Reinit(SinglePhaseField Phi, CellMask Accepted, CellMask ReinitField) { //Build Marcher IFastMarchingQueue <IMarchingNode> Heap = new MarchingHeap(this.gridDat.Cells.NoOfCells); Fastmarcher Solver = new Fastmarcher(Heap); //Initialize Graph for Marching and build initial accepted nodes MarchingCell.Initialize(localSolver, Phi, gridDat, ReinitField); MarchingCell[] AcceptedCells = MarchingCell.BuildInitialAcceptedCells(Accepted); //Solve Solver.march(AcceptedCells); }
//Create an array of Cells from the Accepted CellMask. public static MarchingCell[] BuildInitialAcceptedCells(CellMask Accepted) { int[] AcceptedCells_Indices = Accepted.ItemEnum.ToArray(); int AcceptedCells_Total = AcceptedCells_Indices.Length; MarchingCell[] AcceptedCells = new MarchingCell[AcceptedCells_Total]; for (int i = 0; i < AcceptedCells_Total; ++i) { int jCell = AcceptedCells_Indices[i]; double phi_average = phi.GetMeanValue(jCell); AcceptedCells[i] = new MarchingCell(jCell, phi_average); AcceptedCells[i].Accept(); } return(AcceptedCells); }