1 /* ========================================================================== */
2 /* === UMF_apply_order ====================================================== */
3 /* ========================================================================== */
4 
5 /* -------------------------------------------------------------------------- */
6 /* UMFPACK Copyright (c) Timothy A. Davis, CISE,                              */
7 /* Univ. of Florida.  All Rights Reserved.  See ../Doc/License for License.   */
8 /* web: http://www.cise.ufl.edu/research/sparse/umfpack                       */
9 /* -------------------------------------------------------------------------- */
10 
11 /*
12     Apply post-ordering of supernodal elimination tree.
13 */
14 
15 #include "umf_internal.h"
16 
UMF_apply_order(Int Front[],const Int Order[],Int Temp[],Int nn,Int nfr)17 GLOBAL void UMF_apply_order
18 (
19     Int Front [ ],	    /* of size nn on input, size nfr on output */
20     const Int Order [ ],    /* Order [i] = k, i in the range 0..nn-1,
21 			     * and k in the range 0..nfr-1, means that node
22 			     * i is the kth node in the postordered tree. */
23     Int Temp [ ],	    /* workspace of size nfr */
24     Int nn,		    /* nodes are numbered in the range 0..nn-1 */
25     Int nfr		    /* the number of nodes actually in use */
26 )
27 {
28     Int i, k ;
29     for (i = 0 ; i < nn ; i++)
30     {
31 	k = Order [i] ;
32 	ASSERT (k >= EMPTY && k < nfr) ;
33 	if (k != EMPTY)
34 	{
35 	    Temp [k] = Front [i] ;
36 	}
37     }
38 
39     for (k = 0 ; k < nfr ; k++)
40     {
41 	Front [k] = Temp [k] ;
42     }
43 }
44