PaStiX Handbook  6.2.1
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-2021 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
8  * Univ. Bordeaux. All rights reserved.
9  *
10  * @version 6.2.0
11  * @author Francois Pellegrini
12  * @author Mathieu Faverge
13  * @author Gregoire Pichon
14  * @author Pierre Ramet
15  * @date 2021-01-14
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 struct etree_s;
37 typedef struct etree_s EliminTree;
38 
39 /**
40  * @brief Order structure.
41  *
42  * This structure stores the permutation (and inverse permutation) associated to the ordering.
43  * It also stores the partitioning tree and the set of supernodes.
44  */
45 typedef struct pastix_order_s {
46  pastix_int_t baseval; /**< base value used for numbering */
47  pastix_int_t vertnbr; /**< Number of vertices */
48  pastix_int_t cblknbr; /**< Number of column blocks */
49  pastix_int_t *permtab; /**< Permutation array of size vertnbr [based] */
50  pastix_int_t *peritab; /**< Inverse permutation array of size vertnbr [based] */
51  pastix_int_t *rangtab; /**< Supernode array of size cblknbr+1 [based,+1] */
52  pastix_int_t *treetab; /**< Partitioning tree of size cblknbr+1 [based] */
53  int8_t *selevtx; /**< Selected vertices for low-rank clustering of size cblknbr */
54  pastix_int_t sndenbr; /**< The number of original supernodes before clustering */
55  pastix_int_t *sndetab; /**< Original supernode array of size sndenbr [based,+1] */
57 
58 /**
59  * @name Order basic subroutines
60  * @{
61  */
62 int pastixOrderInit ( pastix_order_t *ordeptr,
63  pastix_int_t baseval,
64  pastix_int_t vertnbr,
65  pastix_int_t cblknbr,
66  pastix_int_t *perm,
67  pastix_int_t *invp,
68  pastix_int_t *rang,
69  pastix_int_t *tree );
70 int pastixOrderAlloc ( pastix_order_t *ordeptr,
71  pastix_int_t vertnbr,
72  pastix_int_t cblknbr );
74  pastix_int_t vertnbr );
75 void pastixOrderExit ( pastix_order_t *ordeptr );
76 void pastixOrderBase ( pastix_order_t *ordeptr,
77  pastix_int_t baseval );
78 int pastixOrderCheck ( const pastix_order_t *ordeptr );
79 void pastixOrderExpand( pastix_order_t *ordeptr,
80  spmatrix_t *spm);
81 int pastixOrderCopy ( pastix_order_t *ordedst,
82  const pastix_order_t *ordesrc );
83 
84 pastix_order_t *pastixOrderGet( const pastix_data_t *pastix_data );
85 
86 void pastixOrderBcast( pastix_order_t *ordemesh,
87  int root,
88  PASTIX_Comm pastix_comm );
89 
90 int pastixOrderGrid( pastix_order_t **myorder, pastix_int_t nx,
91  pastix_int_t ny, pastix_int_t nz );
92 
93 /**
94  * @}
95  * @name Order IO subroutines
96  * @{
97  */
98 int pastixOrderLoad( const pastix_data_t *pastix_data, pastix_order_t *ordeptr );
99 int pastixOrderSave( pastix_data_t *pastix_data, const pastix_order_t *ordeptr );
100 
101 /**
102  * @}
103  */
104 
105 END_C_DECLS
106 
107 #endif /* _pastix_order_h_ */
108 
109 /**
110  * @}
111  */
pastix_order_s::cblknbr
pastix_int_t cblknbr
Definition: order.h:48
pastixOrderSave
int pastixOrderSave(pastix_data_t *pastix_data, const pastix_order_t *ordeptr)
Save an ordering to a file.
Definition: order_io.c:293
etree_s
Elimination tree.
Definition: elimintree.h:39
pastixOrderAllocId
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
pastix_order_t
struct pastix_order_s pastix_order_t
Order structure.
pastix_order_s::peritab
pastix_int_t * peritab
Definition: order.h:50
pastix_order_s::permtab
pastix_int_t * permtab
Definition: order.h:49
pastixOrderExit
void pastixOrderExit(pastix_order_t *ordeptr)
Free the arrays initialized in the order structure.
Definition: order.c:273
pastix_order_s::treetab
pastix_int_t * treetab
Definition: order.h:52
pastix_order_s
Order structure.
Definition: order.h:45
pastix_order_s::selevtx
int8_t * selevtx
Definition: order.h:53
pastixOrderBcast
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:605
pastixOrderGet
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:575
pastix_order_s::vertnbr
pastix_int_t vertnbr
Definition: order.h:47
pastixOrderGrid
int pastixOrderGrid(pastix_order_t **myorder, pastix_int_t nx, pastix_int_t ny, pastix_int_t nz)
Definition: order_grids.c:307
pastixOrderCopy
int pastixOrderCopy(pastix_order_t *ordedst, const pastix_order_t *ordesrc)
This routine copy a given ordering in a new one.
Definition: order.c:496
pastixOrderCheck
int pastixOrderCheck(const pastix_order_t *ordeptr)
This routine checks the correctness of the ordering structure.
Definition: order_check.c:39
pastixOrderBase
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:319
pastixOrderAlloc
int pastixOrderAlloc(pastix_order_t *ordeptr, pastix_int_t vertnbr, pastix_int_t cblknbr)
Allocate the order structure.
Definition: order.c:55
pastix_order_s::baseval
pastix_int_t baseval
Definition: order.h:46
pastixOrderExpand
void pastixOrderExpand(pastix_order_t *ordeptr, spmatrix_t *spm)
This routine expand the permutation arrays and the rangtab when the spm is using multiple dof per unk...
Definition: order.c:393
pastixOrderInit
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
pastix_order_s::rangtab
pastix_int_t * rangtab
Definition: order.h:51
pastixOrderLoad
int pastixOrderLoad(const pastix_data_t *pastix_data, pastix_order_t *ordeptr)
Load an ordering from a file.
Definition: order_io.c:132
pastix_order_s::sndenbr
pastix_int_t sndenbr
Definition: order.h:54
pastix_order_s::sndetab
pastix_int_t * sndetab
Definition: order.h:55