PaStiX Handbook  6.3.2
order.h
Go to the documentation of this file.
1 /**
2  *
3  * @file order.h
4  *
5  * PaStiX order structure routines
6  *
7  * @copyright 2004-2023 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
8  * Univ. Bordeaux. All rights reserved.
9  *
10  * @version 6.3.2
11  * @author Francois Pellegrini
12  * @author Mathieu Faverge
13  * @author Gregoire Pichon
14  * @author Pierre Ramet
15  * @date 2023-07-21
16  *
17  *
18  * @addtogroup pastix_order
19  * @{
20  * @brief Functions to generate and manipulate the order structure.
21  *
22  * This module provides the set of function to prepare the order structure
23  * associated to a given sparse matrix. It is possible to call Scotch,
24  * PT-Scotch, Metis and ParMetis to build a new ordering that minimize the
25  * fill-in and maximize the level of parallelism.
26  *
27  **/
28 #ifndef _pastix_order_h_
29 #define _pastix_order_h_
30 
31 #include "pastix/config.h"
32 #include "pastix/datatypes.h"
33 
34 BEGIN_C_DECLS
35 
36 #ifndef DOXYGEN_SHOULD_SKIP_THIS
37 struct etree_s;
38 typedef struct etree_s EliminTree;
39 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
40 
41 /**
42  * @brief Order structure.
43  *
44  * This structure stores the permutation (and inverse permutation) associated to the ordering.
45  * It also stores the partitioning tree and the set of supernodes.
46  */
47 typedef struct pastix_order_s {
48  pastix_int_t baseval; /**< base value used for numbering */
49  pastix_int_t vertnbr; /**< Number of vertices */
50  pastix_int_t cblknbr; /**< Number of column blocks */
51  pastix_int_t *permtab; /**< Permutation array of size vertnbr [based] */
52  pastix_int_t *peritab; /**< Inverse permutation array of size vertnbr [based] */
53  pastix_int_t *rangtab; /**< Supernode array of size cblknbr+1 [based,+1] */
54  pastix_int_t *treetab; /**< Partitioning tree of size cblknbr+1 [based] */
55  int8_t *selevtx; /**< Selected vertices for low-rank clustering of size cblknbr */
56  pastix_int_t sndenbr; /**< The number of original supernodes before clustering */
57  pastix_int_t *sndetab; /**< Original supernode array of size sndenbr [based,+1] */
58  pastix_int_t *peritab_exp; /**< Computed field that should not be modified by the user */
60 
61 /**
62  * @name Order basic subroutines
63  * @{
64  */
65 int pastixOrderInit( pastix_order_t *ordeptr,
66  pastix_int_t baseval,
67  pastix_int_t vertnbr,
68  pastix_int_t cblknbr,
69  pastix_int_t *perm,
70  pastix_int_t *invp,
71  pastix_int_t *rang,
72  pastix_int_t *tree );
73 
74 int pastixOrderAlloc( pastix_order_t *ordeptr,
75  pastix_int_t vertnbr,
76  pastix_int_t cblknbr );
77 
79  pastix_int_t vertnbr );
80 
81 void pastixOrderExit( pastix_order_t *ordeptr );
82 
83 void pastixOrderBase( pastix_order_t *ordeptr,
84  pastix_int_t baseval );
85 
86 int pastixOrderCheck( const pastix_order_t *ordeptr );
87 
88 void pastixOrderExpand( pastix_order_t *ordeptr,
89  const spmatrix_t *spm );
90 
91 int pastixOrderCopy( pastix_order_t *ordedst,
92  const pastix_order_t *ordesrc );
93 
94 pastix_order_t *pastixOrderGet( const pastix_data_t *pastix_data );
95 
96 void pastixOrderBcast( pastix_order_t *ordemesh,
97  int root,
98  PASTIX_Comm pastix_comm );
99 
100 int pastixOrderGrid( pastix_order_t **myorder,
101  pastix_int_t nx,
102  pastix_int_t ny,
103  pastix_int_t nz );
104 
105 /**
106  * @}
107  * @name Order IO subroutines
108  * @{
109  */
110 int pastixOrderLoad( const pastix_data_t *pastix_data,
111  pastix_order_t *ordeptr );
112 
113 int pastixOrderSave( pastix_data_t *pastix_data,
114  const pastix_order_t *ordeptr );
115 
116 /**
117  * @}
118  */
119 
120 END_C_DECLS
121 
122 #endif /* _pastix_order_h_ */
123 
124 /**
125  * @}
126  */
BEGIN_C_DECLS typedef int pastix_int_t
Definition: datatypes.h:51
Elimination tree.
Definition: elimintree.h:39
pastix_int_t baseval
Definition: order.h:48
pastix_int_t * peritab_exp
Definition: order.h:58
pastix_int_t * treetab
Definition: order.h:54
pastix_int_t * sndetab
Definition: order.h:57
int8_t * selevtx
Definition: order.h:55
pastix_int_t * permtab
Definition: order.h:51
pastix_int_t * peritab
Definition: order.h:52
pastix_int_t cblknbr
Definition: order.h:50
pastix_int_t sndenbr
Definition: order.h:56
pastix_int_t * rangtab
Definition: order.h:53
pastix_int_t vertnbr
Definition: order.h:49
void pastixOrderExpand(pastix_order_t *ordeptr, const spmatrix_t *spm)
This routine expand the permutation arrays and the rangtab when the spm is using multiple dof per unk...
Definition: order.c:396
int pastixOrderAlloc(pastix_order_t *ordeptr, pastix_int_t vertnbr, pastix_int_t cblknbr)
Allocate the order structure.
Definition: order.c:55
void pastixOrderBase(pastix_order_t *ordeptr, pastix_int_t baseval)
This routine sets the base of the given ordering structure to the given base value.
Definition: order.c:322
BEGIN_C_DECLS struct pastix_order_s pastix_order_t
Order structure.
int pastixOrderSave(pastix_data_t *pastix_data, const pastix_order_t *ordeptr)
Save an ordering to a file.
Definition: order_io.c:293
pastix_order_t * pastixOrderGet(const pastix_data_t *pastix_data)
This routine returns the pointer to the internal order structure to access permutation information.
Definition: order.c:649
int pastixOrderGrid(pastix_order_t **myorder, pastix_int_t nx, pastix_int_t ny, pastix_int_t nz)
Definition: order_grids.c:307
void pastixOrderBcast(pastix_order_t *ordemesh, int root, PASTIX_Comm pastix_comm)
This routine broadcast the ordemesh structure from node root to all the other nodes.
Definition: order.c:679
int pastixOrderInit(pastix_order_t *ordeptr, pastix_int_t baseval, pastix_int_t vertnbr, pastix_int_t cblknbr, pastix_int_t *perm, pastix_int_t *invp, pastix_int_t *rang, pastix_int_t *tree)
Initialize the order structure with the given values.
Definition: order.c:212
int pastixOrderCheck(const pastix_order_t *ordeptr)
This routine checks the correctness of the ordering structure.
Definition: order_check.c:39
int pastixOrderCopy(pastix_order_t *ordedst, const pastix_order_t *ordesrc)
This routine copy a given ordering in a new one.
Definition: order.c:570
int pastixOrderAllocId(pastix_order_t *ordeptr, pastix_int_t vertnbr)
Allocate the order structure for a given number of vertices with no cblk, and id permutation.
Definition: order.c:123
void pastixOrderExit(pastix_order_t *ordeptr)
Free the arrays initialized in the order structure.
Definition: order.c:273
int pastixOrderLoad(const pastix_data_t *pastix_data, pastix_order_t *ordeptr)
Load an ordering from a file.
Definition: order_io.c:132
Order structure.
Definition: order.h:47
Main PaStiX data structure.
Definition: pastixdata.h:67