/// <summary> /// Gets the permutation vector for the Reverse Cuthill-McKee numbering. /// </summary> /// <param name="mesh">The mesh.</param> /// <returns>Permutation vector.</returns> public int[] Renumber(AdjacencyMatrix matrix) { this.matrix = matrix; int bandwidth1 = matrix.Bandwidth(); var pcol = matrix.ColumnPointers; // Adjust column pointers (1-based indexing). Shift(pcol, true); // TODO: Make RCM work with 0-based matrix. // Compute the RCM permutation. int[] perm = GenerateRcm(); int[] perm_inv = PermInverse(perm); int bandwidth2 = PermBandwidth(perm, perm_inv); if (Log.Verbose) { Log.Instance.Info(String.Format("Reverse Cuthill-McKee (Bandwidth: {0} > {1})", bandwidth1, bandwidth2)); } // Adjust column pointers (0-based indexing). Shift(pcol, false); return perm_inv; }
/// <summary> /// Gets the permutation vector for the Reverse Cuthill-McKee numbering. /// </summary> /// <param name="mesh">The mesh.</param> /// <returns>Permutation vector.</returns> public int[] Renumber(Mesh mesh) { int bandwidth1, bandwidth2; this.node_num = mesh.vertices.Count; // Algorithm needs linear numbering of the nodes. mesh.Renumber(NodeNumbering.Linear); // Set up the adj_row adjacency pointer array. matrix = new AdjacencyMatrix(mesh); bandwidth1 = matrix.Bandwidth(); // Compute the RCM permutation. int[] perm = GenerateRcm(); int[] perm_inv = PermInverse(node_num, perm); bandwidth2 = PermBandwidth(perm, perm_inv); if (Behavior.Verbose) { SimpleLog.Instance.Info(String.Format("Reverse Cuthill-McKee (Bandwidth: {0} > {1})", bandwidth1, bandwidth2)); } return perm_inv; }
public int[] Renumber(Mesh mesh) { this.node_num = mesh.vertices.Count; mesh.Renumber(NodeNumbering.Linear); this.matrix = new AdjacencyMatrix(mesh); int num = this.matrix.Bandwidth(); int[] numArray = this.GenerateRcm(); int[] numArray1 = this.PermInverse(this.node_num, numArray); int num1 = this.PermBandwidth(numArray, numArray1); if (Behavior.Verbose) { SimpleLog.Instance.Info(string.Format("Reverse Cuthill-McKee (Bandwidth: {0} > {1})", num, num1)); } return(numArray1); }