Commit 9600e343 authored by Mathieu Faverge's avatar Mathieu Faverge

Add supernode array, and fix issue with open/close/open window

parent bb05352a
......@@ -11,9 +11,6 @@ Zooming::Zooming(symbol_matrix_t* matrix)
Zooming::~Zooming()
{
// Destroy quadtree
symbol_matrix_deinit(m_matrix);
delete m_matrix;
}
GLfloat Zooming::getColor(int x, int y)
......@@ -66,21 +63,21 @@ void Zooming::move(double xStart, double xEnd, double yStart, double yEnd)
cblk = m_matrix->m_cblktab;
for (i = 0; i < m_matrix->m_cblknbr; ++i, cblk++)
{
if ( (cblk->m_fcolnum <= startCol) && (cblk->m_lcolnum >= startCol) )
if ( (cblk->m_fcolnum <= startCol) && (startCol <= cblk->m_lcolnum) )
{
startCblk = i;
startCol = cblk->m_fcolnum;
}
if ( (cblk->m_fcolnum <= startRow) && (cblk->m_lcolnum >= startRow) )
if ( (cblk->m_fcolnum <= startRow) && (startRow <= cblk->m_lcolnum) )
{
startRow = cblk->m_fcolnum;
}
if ( (cblk->m_fcolnum <= endCol) && (cblk->m_lcolnum >= endCol) )
if ( (cblk->m_fcolnum <= endCol) && (endCol <= cblk->m_lcolnum) )
{
endCblk = i;
endCblk = i+1;
endCol = cblk->m_lcolnum;
}
if ( (cblk->m_fcolnum <= endRow) && (cblk->m_lcolnum >= endRow) )
if ( (cblk->m_fcolnum <= endRow) && (endRow <= cblk->m_lcolnum) )
{
endRow = cblk->m_lcolnum;
}
......@@ -89,8 +86,6 @@ void Zooming::move(double xStart, double xEnd, double yStart, double yEnd)
int nb_cols = endCol - startCol + 1;
int nb_rows = endRow - startRow + 1;
int diffCblk = endCblk - startCblk;
for (i = 0; i < DEFAULT_LEVEL_POWER_2; ++i)
{
for (j = 0; j < DEFAULT_LEVEL_POWER_2; ++j)
......@@ -103,10 +98,10 @@ void Zooming::move(double xStart, double xEnd, double yStart, double yEnd)
float yCoeff = (float)DEFAULT_LEVEL_POWER_2 / ((float)nb_rows);
cblk = m_matrix->m_cblktab + startCblk;
for (i = startCblk; i <= endCblk; ++i, cblk++)
for (i = startCblk; i < endCblk; ++i, cblk++)
{
int fbloknum = cblk->m_bloknum;
int lbloknum = (i + 1 != m_matrix->m_cblknbr ? cblk[1].m_bloknum : m_matrix->m_bloknbr);
int fbloknum = cblk[0].m_bloknum;
int lbloknum = cblk[1].m_bloknum;
// Get first block size in col from x to xEnd
int x = (cblk->m_fcolnum - startCol) * xCoeff;
......@@ -116,7 +111,7 @@ void Zooming::move(double xStart, double xEnd, double yStart, double yEnd)
for (j = fbloknum; j < lbloknum; ++j, blok++)
{
if ( (blok->m_frownum >= startRow) &&
(blok->m_frownum <= endRow ) )
(blok->m_lrownum <= endRow ) )
{
// Get first block size in row from y to yEnd
int y = (blok->m_frownum - startRow) * yCoeff;
......
......@@ -20,7 +20,7 @@ static inline int32_t imax(int32_t a, int32_t b)
#define memFree_null(ptr) do \
{ \
memFree( ptr ); \
(ptr) = NULL; \
(ptr) = nullptr; \
} while(0)
void symbol_matrix_init(symbol_matrix_t* matrix)
......@@ -31,6 +31,10 @@ void symbol_matrix_init(symbol_matrix_t* matrix)
void symbol_matrix_deinit(symbol_matrix_t* matrix)
{
if (matrix->m_sndetab != nullptr)
{
memFree_null(matrix->m_sndetab);
}
if (matrix->m_cblktab != nullptr)
{
memFree_null(matrix->m_cblktab);
......@@ -56,13 +60,14 @@ void symbol_matrix_print_stats(symbol_matrix_t* matrix)
symbol_cblk_t* cblk;
symbol_blok_t* blok;
int32_t itercblk, dof;
int32_t cblknbr, bloknbr;
int32_t sndenbr, cblknbr, bloknbr;
int32_t cblkmin, cblkmax;
int32_t blokmin, blokmax;
double cblkavg1, blokavg1;
double cblkavg2, blokavg2;
size_t mem = 0;
sndenbr = matrix->m_sndenbr;
cblknbr = matrix->m_cblknbr;
bloknbr = matrix->m_bloknbr;
cblkmin = INT32_MAX;
......@@ -127,6 +132,7 @@ void symbol_matrix_print_stats(symbol_matrix_t* matrix)
Helper::set_infos(
"Symbol Matrix statistics:\n"
" Number of superndoes %10ld\n"
" Number of cblk %10ld\n"
" Number of blok %10ld\n"
" Cblk width min %10ld\n"
......@@ -138,7 +144,7 @@ void symbol_matrix_print_stats(symbol_matrix_t* matrix)
" Blok height avg %11.2lf\n"
" Blok height stdev %11.2lf\n"
" Matrix structure space %11.2lf %cB\n",
(long)cblknbr, (long)bloknbr,
(long)sndenbr, (long)cblknbr, (long)bloknbr,
(long)cblkmin, (long)cblkmax, cblkavg1, cblkavg2,
(long)blokmin, (long)blokmax, blokavg1, blokavg2,
print_get_value( mem ), print_get_units( mem ) );
......
......@@ -5,8 +5,9 @@
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_lcolnum; // Last column index (exclusive)
int32_t m_lcolnum; // Last column index (inclusive)
int32_t m_bloknum; // First blok in column
int32_t m_flags; // Flags
} symbol_cblk_t;
......@@ -14,7 +15,7 @@ typedef struct symbol_cblk_s
typedef struct symbol_blok_s
{
int32_t m_frownum; // First row index
int32_t m_lrownum; // Last row index (exclusive)
int32_t m_lrownum; // Last row index (inclusive)
int32_t m_lcblknm; // Local column blok
int32_t m_fcblknm; // Facing column blok
......@@ -47,11 +48,13 @@ typedef struct symbol_matrix_s
int32_t m_baseval;
int32_t m_dof;
int32_t m_cblknbr;
int32_t m_bloknbr;
int32_t m_colsnbr;
int32_t m_rowsnbr;
int32_t m_sndenbr; // Supernodes number (= cblknbr if no order file)
int32_t m_cblknbr; // Column blocks number
int32_t m_bloknbr; // Block number
int32_t m_colsnbr; // Column number
int32_t m_rowsnbr; // Row number
int32_t* m_sndetab;
symbol_cblk_t* m_cblktab;
symbol_blok_t* m_bloktab;
int32_t* m_browtab;
......
......@@ -30,7 +30,7 @@ Matrix_visualizer::Matrix_visualizer() {
s_plugin = this;
// For windows dev (pc: orange)
this->line_edit_symbol->setText("/home/mathieu/svn/pastix/pastix/build/symbol_rank");
this->line_edit_symbol->setText("/home/mathieu/1-PaStiX/pastix/build/pastix-JLjWM5/symbgen");
}
Matrix_visualizer::~Matrix_visualizer(){
......@@ -73,13 +73,14 @@ int Matrix_visualizer::update_matrix( QString filepath )
return -1;
}
Helper::log(LogStatus::MESSAGE, "Successfully read symbol file");
symbol_matrix_print_stats( s_matrix );
if ( s_matrix != nullptr ) {
symbol_matrix_deinit( s_matrix );
}
s_matrix = new_matrix;
Helper::log(LogStatus::MESSAGE, "Successfully read symbol file");
symbol_matrix_print_stats( s_matrix );
return 0;
}
......
......@@ -19,6 +19,7 @@ int pastix_read_symbol(FILE* stream, symbol_matrix_t* matrix)
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) ||
(versval < 0) ||
......@@ -32,10 +33,13 @@ int pastix_read_symbol(FILE* stream, symbol_matrix_t* matrix)
}
Helper::log(LogStatus::MESSAGE, "Version %d", versval);
matrix->m_sndetab = (int32_t*) malloc((matrix->m_sndenbr + 1) * sizeof(int32_t) );
matrix->m_cblktab = (symbol_cblk_t*)malloc((matrix->m_cblknbr + 1) * sizeof(symbol_cblk_t));
matrix->m_bloktab = (symbol_blok_t*)malloc(matrix->m_bloknbr * sizeof(symbol_blok_t));
matrix->m_bloktab = (symbol_blok_t*)malloc( matrix->m_bloknbr * sizeof(symbol_blok_t));
if (matrix->m_cblktab == nullptr || matrix->m_bloktab == nullptr)
if ( (matrix->m_sndetab == nullptr) ||
(matrix->m_cblktab == nullptr) ||
(matrix->m_bloktab == nullptr) )
{
Helper::log(LogStatus::FATAL, "Out of memory while allocating tabs !");
......@@ -43,9 +47,9 @@ int pastix_read_symbol(FILE* stream, symbol_matrix_t* matrix)
}
symbol_cblk_t *cblk = matrix->m_cblktab;
int32_t *snde = matrix->m_sndetab;
int32_t cblknbr = matrix->m_cblknbr;
int32_t maxcol = 0;
for (cblknum = 0; cblknum < cblknbr; ++cblknum, ++cblk)
for (cblknum = 0; cblknum < cblknbr; ++cblknum, ++cblk, ++snde)
{
result = pastix_read_int(stream, &(cblk->m_fcolnum));
result += pastix_read_int(stream, &(cblk->m_lcolnum));
......@@ -59,22 +63,16 @@ int pastix_read_symbol(FILE* stream, symbol_matrix_t* matrix)
return 1;
}
if (cblk->m_lcolnum > maxcol)
{
maxcol = cblk->m_lcolnum;
}
cblk->m_flags = 0;
cblk->m_lcolnum++;
*snde = 0;
}
/* Extra cblk and supernode */
cblk->m_fcolnum = cblk->m_lcolnum = nodenbr + matrix->m_baseval;
cblk->m_bloknum = matrix->m_bloknbr + matrix->m_baseval;
matrix->m_colsnbr = maxcol + 1;
*snde = cblknum;
symbol_blok_t *blok = matrix->m_bloktab;
int32_t bloknbr = matrix->m_bloknbr;
int32_t maxrow = 0;
for (bloknum = 0; bloknum < bloknbr; ++bloknum, ++blok)
{
result = pastix_read_int(stream, &(blok->m_frownum));
......@@ -88,11 +86,6 @@ int pastix_read_symbol(FILE* stream, symbol_matrix_t* matrix)
return 1;
}
if (blok->m_lrownum > maxrow)
{
maxrow = blok->m_lrownum;
}
blok->m_lrownum++;
blok->m_localization = 0;
blok->m_flags = 0;
......@@ -108,11 +101,12 @@ int pastix_read_symbol(FILE* stream, symbol_matrix_t* matrix)
}
matrix->m_dof = 1;
matrix->m_rowsnbr = maxrow + 1;
matrix->m_colsnbr = nodenbr;
matrix->m_rowsnbr = nodenbr;
Helper::log(LogStatus::MESSAGE,
"Loaded header:\n"
" Version: %10d\n"
" File Version: %10d\n"
" Number of cblk: %10d\n"
" Number of rows: %10d\n"
" Number of blok: %10d\n"
......
This diff is collapsed.
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