PaStiX Handbook 6.4.0
Loading...
Searching...
No Matches
symbol_draw_map.c
Go to the documentation of this file.
1/**
2 *
3 * @file symbol_draw_map.c
4 *
5 * PaStiX symbol routines to print the .map files of the cblks
6 *
7 * @copyright 2004-2024 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
8 * Univ. Bordeaux. All rights reserved.
9 *
10 * @version 6.4.0
11 * @author Gregoire Pichon
12 * @author Mathieu Faverge
13 * @date 2024-07-05
14 *
15 */
16#ifndef DOXYGEN_SHOULD_SKIP_THIS
17#define _GNU_SOURCE 1
18#endif /* DOXYGEN_SHOULD_SKIP_THIS */
19#include "common.h"
20#include "order/order_internal.h"
21#include "symbol/symbol.h"
22
23/**
24 *******************************************************************************
25 *
26 * @ingroup pastix_symbol
27 *
28 * @brief Dump a separator mapping into a map file.
29 *
30 *******************************************************************************
31 *
32 * @param[inout] pastix_data
33 * The pastix data structure that holds the symbol and the ordering.
34 * On exit the output directories may be initialized, if not previously.
35 *
36 * @param[in] extname
37 * Filename extension to specify the .map file if multiple.
38 *
39 * @param[in] sndeidx
40 * The index of the supernode to dump into file.
41 *
42 *******************************************************************************/
43void
45 const char *extname,
46 pastix_int_t sndeidx )
47{
48 char *fname;
49 FILE *file;
50 const pastix_order_t *order = pastix_data->ordemesh;
51 const symbol_matrix_t *symbmtx = pastix_data->symbmtx;
52 const symbol_cblk_t *symbcblk = symbmtx->cblktab;
53 pastix_int_t ibeg, iend, size;
54 pastix_int_t i, j;
55 pastix_int_t color = 0;
56 int rc;
57
58 assert( order != NULL );
59 assert( order->sndetab != NULL );
60 assert( symbmtx != NULL );
61
62 ibeg = order->sndetab[sndeidx];
63 iend = order->sndetab[sndeidx+1];
64 size = iend - ibeg;
65
66 pastix_gendirectories( pastix_data );
67
68 if ( extname ) {
69 rc = asprintf( &fname, "part.%ld.%s.map",
70 (long)sndeidx, extname );
71 }
72 else {
73 rc = asprintf( &fname, "part.%ld.map",
74 (long)sndeidx );
75 }
76 assert( rc != -1 );
77 file = pastix_fopenw( pastix_data->dir_global, fname, "w" );
78 free( fname );
79
80 fprintf( file, "%ld\n", (long)size );
81
82 /*
83 * Look for the last cblk implied in the original supernode
84 * The search is down backward to have more coherent coloring from one
85 * version to another, and because we usually draw the last supernode
86 * and no more.
87 */
88 i = symbmtx->cblknbr;
89 while ( (i > 0) && (symbcblk[i].fcolnum > iend) ) {
90 i--;
91 }
92 i--;
93
94 for (; i>0; i--) {
95 pastix_int_t fnode = symbcblk[i].fcolnum;
96 pastix_int_t lnode = symbcblk[i].lcolnum;
97
98 if ( fnode < ibeg ) {
99 assert( lnode < ibeg );
100 break;
101 }
102
103 for (j=fnode; j<=lnode; j++) {
104 fprintf( file, "%ld %ld\n",
105 (long)(j - ibeg), (long)color );
106 }
107 color++;
108 }
109 fclose( file );
110
111 (void)rc;
112}
BEGIN_C_DECLS typedef int pastix_int_t
Definition datatypes.h:51
FILE * pastix_fopenw(const char *dirname, const char *filename, const char *mode)
Open a file in the unique directory of the pastix instance.
Definition api.c:251
void pastix_gendirectories(pastix_data_t *pastix_data)
Generate a unique temporary directory to store output files.
Definition api.c:85
pastix_int_t * sndetab
Definition order.h:57
Order structure.
Definition order.h:47
symbol_cblk_t * cblktab
Definition symbol.h:83
pastix_int_t fcolnum
Definition symbol.h:46
pastix_int_t lcolnum
Definition symbol.h:47
pastix_int_t cblknbr
Definition symbol.h:79
void pastixSymbolDrawMap(pastix_data_t *pastix_data, const char *extname, pastix_int_t sndeidx)
Dump a separator mapping into a map file.
Symbol column block structure.
Definition symbol.h:45
Symbol matrix structure.
Definition symbol.h:77
pastix_order_t * ordemesh
Definition pastixdata.h:98
symbol_matrix_t * symbmtx
Definition pastixdata.h:100
char * dir_global
Definition pastixdata.h:110
Main PaStiX data structure.
Definition pastixdata.h:68