Commit 3a19369a authored by Mathieu Faverge's avatar Mathieu Faverge

Cleanup the parser for version -1 of the symbol files (including ranks)

parent cad67012
......@@ -18,10 +18,10 @@ static inline int32_t imax(int32_t a, int32_t b)
/* Macros */
#define memFree(ptr) free((void*)(ptr))
#define memFree_null(ptr) do \
{ \
memFree( ptr ); \
{ \
memFree( ptr ); \
(ptr) = nullptr; \
} while(0)
} while(0)
void symbol_matrix_init(symbol_matrix_t* matrix)
{
......
......@@ -6,22 +6,22 @@
typedef struct symbol_cblk_s
{
int32_t m_snodeid; // Id of the supernodes this cblk belongs to
int32_t m_fcolnum; // First column index
int32_t m_fcolnum; // First column index
int32_t m_lcolnum; // Last column index (inclusive)
int32_t m_bloknum; // First blok in column
int32_t m_flags; // Flags
int32_t m_bloknum; // First blok in column
int32_t m_flags; // Flags
float m_color;
} symbol_cblk_t;
typedef struct symbol_blok_s
{
int32_t m_frownum; // First row index
int32_t m_frownum; // First row index
int32_t m_lrownum; // Last row index (inclusive)
int32_t m_lcblknm; // Local column blok
int32_t m_fcblknm; // Facing column blok
uint32_t m_localization; // Localization
int32_t m_flags;
uint32_t m_localization; // Localization
int32_t m_flags;
float m_color;
} symbol_blok_t;
......
......@@ -30,7 +30,7 @@ Matrix_visualizer::Matrix_visualizer() {
s_plugin = this;
// For windows dev (pc: orange)
this->line_edit_symbol->setText("/home/mathieu/1-PaStiX/pastix/build/pastix-JLjWM5/symbgen");
this->line_edit_symbol->setText("/home/mathieu/1-PaStiX/pastix/build/symbol_rank");
}
Matrix_visualizer::~Matrix_visualizer(){
......
......@@ -14,11 +14,11 @@ int pastix_read_symbol(FILE* stream, symbol_matrix_t* matrix)
int32_t result = 0;
result += pastix_read_int(stream, &versval);
result += pastix_read_int(stream, &matrix->m_cblknbr);
result += pastix_read_int(stream, &matrix->m_bloknbr);
result += pastix_read_int(stream, &nodenbr);
result += pastix_read_int(stream, &matrix->m_baseval);
result += pastix_read_int(stream, &versval);
result += pastix_read_int(stream, &matrix->m_cblknbr);
result += pastix_read_int(stream, &matrix->m_bloknbr);
result += pastix_read_int(stream, &nodenbr);
result += pastix_read_int(stream, &matrix->m_baseval);
matrix->m_sndenbr = matrix->m_cblknbr;
if ((result != 5) ||
......@@ -90,16 +90,17 @@ int pastix_read_symbol(FILE* stream, symbol_matrix_t* matrix)
blok->m_localization = 0;
blok->m_flags = 0;
if (versval == -1) {
int32_t color;
result = pastix_read_int(stream, &color);
int32_t rk, rkmax;
result = pastix_read_int(stream, &rk);
result += pastix_read_int(stream, &rkmax);
if (result != 1)
if (result != 2)
{
Helper::log(LogStatus::FATAL, "Bad input while reading blok %d color !", bloknum);
Helper::log(LogStatus::FATAL, "Bad input while reading blok %d ranks !", bloknum);
return 1;
}
blok->m_color = (float)color;
blok->m_color = (double)(rkmax - rk) / (double)rkmax;
}
else {
blok->m_color = -1.f;
......@@ -116,35 +117,22 @@ int pastix_read_symbol(FILE* stream, symbol_matrix_t* matrix)
}
}
if (versval == -1) {
int32_t maxval;
result = pastix_read_int(stream, &(maxval));
symbol_blok_t *blok = matrix->m_bloktab;
int32_t bloknbr = matrix->m_bloknbr;
for (bloknum = 0; bloknum < bloknbr; ++bloknum, blok++)
{
blok->m_color = blok->m_color / (float)maxval;
}
fprintf(stderr, "Max rank reduction is %d\n", maxval);
}
matrix->m_dof = 1;
matrix->m_colsnbr = nodenbr;
matrix->m_rowsnbr = nodenbr;
Helper::log(LogStatus::MESSAGE,
"Loaded header:\n"
" File Version: %10d\n"
" Number of cblk: %10d\n"
" Number of rows: %10d\n"
" Number of blok: %10d\n"
" Number of nodes: %10d\n"
" Base value: %10d\n",
versval,
matrix->m_cblknbr, matrix->m_rowsnbr,
matrix->m_bloknbr, nodenbr,
matrix->m_baseval
"Loaded header:\n"
" File Version: %10d\n"
" Number of cblk: %10d\n"
" Number of rows: %10d\n"
" Number of blok: %10d\n"
" Number of nodes: %10d\n"
" Base value: %10d\n",
versval,
matrix->m_cblknbr, matrix->m_rowsnbr,
matrix->m_bloknbr, nodenbr,
matrix->m_baseval
);
return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment