PaStiX Handbook  6.4.0
Sorted queue structure

Data Structures

struct  pastix_queue_item_s
 Queue item structure. More...
 
struct  pastix_queue_s
 Queue structure. More...
 

Typedefs

typedef struct pastix_queue_item_s pastix_queue_item_t
 Queue item structure.
 
typedef struct pastix_queue_s pastix_queue_t
 Queue structure.
 

Functions

int pqueueInit (pastix_queue_t *q, pastix_int_t size)
 Initialize the queue structure with an initial space to store the elements. More...
 
void pqueueExit (pastix_queue_t *q)
 Free the structure associated to the queue. More...
 
pastix_int_t pqueueSize (const pastix_queue_t *q)
 Return the size of the queue. More...
 
void pqueueClear (pastix_queue_t *q)
 Reset the number of used element to 0. More...
 
void pqueuePush2 (pastix_queue_t *q, pastix_int_t elt, double key1, double key2)
 Insert an element into the sorted queue. More...
 
pastix_int_t pqueueRead (const pastix_queue_t *q)
 Read the first element of the queue. More...
 
pastix_int_t pqueuePop2 (pastix_queue_t *q, double *key1, double *key2)
 Remove the first element of the queue and return its keys if needed. More...
 
void pqueuePrint (const pastix_queue_t *q)
 Print the queue. More...
 
static void pqueuePush1 (pastix_queue_t *q, pastix_int_t elt, double key1)
 Push an element with a single key. More...
 
static pastix_int_t pqueuePop (pastix_queue_t *q)
 Pop the head of the queue whithout returning the keys. More...
 
static pastix_int_t pqueuePop1 (pastix_queue_t *q, double *key1)
 Pop the head of the queue and get the associated first key. More...
 
static int pqueueItemComparison (const pastix_queue_item_t *item1, const pastix_queue_item_t *item2)
 Compare two items of the queue based on the couple (key1, key2). More...
 

Detailed Description

This module describes the queue structure used in the analyze part of the solver. The sorting is based on a balanced tree that is partially updated at insertion and suppression.


Data Type Documentation

◆ pastix_queue_item_s

struct pastix_queue_item_s

Queue item structure.

Definition at line 29 of file queue.h.

Data Fields
double key1

Key 1 of the element

double key2

Key 2 of the element

pastix_int_t eltptr

Pointer to the element

◆ pastix_queue_s

struct pastix_queue_s

Queue structure.

Definition at line 38 of file queue.h.

Data Fields
pastix_int_t size

Allocated memory size

volatile pastix_int_t used

Number of element in the queue

pastix_queue_item_t * elttab

Array of the element

pastix_atomic_lock_t lock

Lock for insertion and removal in shared memory

Function Documentation

◆ pqueueInit()

◆ pqueueExit()

◆ pqueueSize()

pastix_int_t pqueueSize ( const pastix_queue_t q)

Return the size of the queue.

Parameters
[in]qThe pointer to the queue.
Returns
The size of the queue.

Definition at line 135 of file queue.c.

References pastix_queue_s::used.

Referenced by faxCSRAmalgamate(), order_tasks(), orderSupernodes(), propMappSubtree(), simu_pushToReadyHeap(), and simuRun().

◆ pqueueClear()

void pqueueClear ( pastix_queue_t q)

Reset the number of used element to 0.

Parameters
[in,out]qThe pointer to the queue.

Definition at line 152 of file queue.c.

References pastix_queue_s::used.

◆ pqueuePush2()

void pqueuePush2 ( pastix_queue_t q,
pastix_int_t  elt,
double  key1,
double  key2 
)

Insert an element into the sorted queue.

Parameters
[in,out]qThe pointer to the queue.
[in]eltThe element to insert in the queue.
[in]key1The first key of the element.
[in]key2The second key of the element.

Definition at line 178 of file queue.c.

References pastix_queue_item_s::eltptr, pastix_queue_s::elttab, pastix_queue_item_s::key1, pastix_queue_item_s::key2, pastix_queue_s::lock, pastix_int_t, pqueueItemComparison(), pastix_queue_s::size, and pastix_queue_s::used.

Referenced by pqueuePush1(), propMappSubtree(), simu_pushToReadyHeap(), and simu_putInAllReadyQueues().

◆ pqueueRead()

pastix_int_t pqueueRead ( const pastix_queue_t q)

Read the first element of the queue.

Parameters
[in]qThe pointer to the queue.
Returns
The value of the first element sorted by (key1, key2).

Definition at line 239 of file queue.c.

References pastix_queue_item_s::eltptr, and pastix_queue_s::elttab.

Referenced by simu_pushToReadyHeap().

◆ pqueuePop2()

pastix_int_t pqueuePop2 ( pastix_queue_t q,
double *  key1,
double *  key2 
)

Remove the first element of the queue and return its keys if needed.

Parameters
[in,out]qThe pointer to the queue. On exit, the queue without its head.
[out]key1If key1 != NULL, stores the associated key1 to the first element on exit.
[out]key2If key2 != NULL, stores the associated key2 to the first element on exit.
Returns
The value of the first element sorted by (key1, key2).

Definition at line 268 of file queue.c.

References pastix_queue_item_s::eltptr, pastix_queue_s::elttab, pastix_queue_item_s::key1, pastix_queue_item_s::key2, pastix_queue_s::lock, pastix_int_t, pqueueItemComparison(), and pastix_queue_s::used.

Referenced by pqueuePop(), pqueuePop1(), and propMappSubtree().

◆ pqueuePrint()

void pqueuePrint ( const pastix_queue_t q)

Print the queue.

Print the queue elements for debug. They are not printed in a sorted order, but in the order they are stored in the queue.

Parameters
[in]qThe pointer to the queue.

Definition at line 334 of file queue.c.

References pastix_queue_item_s::eltptr, pastix_queue_s::elttab, pastix_queue_item_s::key1, pastix_queue_item_s::key2, pastix_int_t, and pastix_queue_s::used.

◆ pqueuePush1()

◆ pqueuePop()

◆ pqueuePop1()

static pastix_int_t pqueuePop1 ( pastix_queue_t q,
double *  key1 
)
inlinestatic

Pop the head of the queue and get the associated first key.

Parameters
[in,out]qThe queue structure.
[out]key1The first key of the element removed from the head of the queue.
Returns
The element at the head of the queue.

Definition at line 88 of file queue.h.

References pqueuePop2().

Referenced by faxCSRAmalgamate(), and order_tasks().

◆ pqueueItemComparison()

static int pqueueItemComparison ( const pastix_queue_item_t item1,
const pastix_queue_item_t item2 
)
inlinestatic

Compare two items of the queue based on the couple (key1, key2).

Parameters
[in]item1The first item to compare.
[in]item2The second item to compare.
Return values
1if item1 < item2
0otherwise

Definition at line 45 of file queue.c.

References pastix_queue_item_s::key1, and pastix_queue_item_s::key2.

Referenced by pqueuePop2(), and pqueuePush2().