19 #include "order/order_internal.h"
60 if ( ordeptr == NULL ) {
69 if ( cblknbr > vertnbr ) {
139 for(i=0; i<vertnbr; i++, perm++, invp++) {
222 if ( ordeptr == NULL ) {
276 if ( ordeptr == NULL ) {
280 if (ordeptr->
permtab != NULL) {
281 memFree_null (ordeptr->
permtab);
283 if (ordeptr->
peritab != NULL) {
284 memFree_null (ordeptr->
peritab);
286 if (ordeptr->
rangtab != NULL) {
287 memFree_null (ordeptr->
rangtab);
289 if (ordeptr->
treetab != NULL) {
290 memFree_null (ordeptr->
treetab);
292 if (ordeptr->
selevtx != NULL) {
293 memFree_null (ordeptr->
selevtx);
295 if (ordeptr->
sndetab != NULL) {
296 memFree_null (ordeptr->
sndetab);
330 if ( ordeptr == NULL ) {
331 pastix_print_error(
"pastixOrderBase: ordeptr pointer is NULL" );
334 if ( (baseval != 0) &&
337 pastix_print_error(
"pastixOrderBase: baseval is incorrect, must be 0 or 1" );
341 baseadj = baseval - ordeptr->
baseval;
345 if (ordeptr->
permtab != NULL) {
346 for (vertnum = 0; vertnum < ordeptr->
vertnbr; vertnum ++) {
347 ordeptr->
permtab[vertnum] += baseadj;
350 if (ordeptr->
peritab != NULL) {
351 for (vertnum = 0; vertnum < ordeptr->
vertnbr; vertnum ++) {
352 ordeptr->
peritab[vertnum] += baseadj;
356 if (ordeptr->
rangtab != NULL) {
357 for (cblknum = 0; cblknum <= ordeptr->
cblknbr; cblknum ++) {
358 ordeptr->
rangtab[cblknum] += baseadj;
361 if (ordeptr->
treetab != NULL) {
362 for (cblknum = 0; cblknum < ordeptr->
cblknbr; cblknum ++) {
363 ordeptr->
treetab[cblknum] += baseadj;
366 if (ordeptr->
sndetab != NULL) {
368 for (sndenum = 0; sndenum <= ordeptr->
sndenbr; sndenum ++) {
369 ordeptr->
sndetab[sndenum] += baseadj;
397 const spmatrix_t *spm )
408 baseval = spm->baseval;
427 for (i=0; i<ordeptr->
vertnbr; i++)
429 if ( spm->dof <= 0 ) {
430 begin = dofs[ peritab[i] ] - baseval;
431 end = dofs[ peritab[i] + 1 ] - baseval;
434 begin = peritab[i] * spm->dof;
435 end = begin + spm->dof;
438 if ( i == rangtab[1] ) {
439 rangtab[1] = rangtab[0] + sum_rang;
443 if ( i == sndetab[1] ) {
444 sndetab[1] = sndetab[0] + sum_snde;
449 sum_rang += (end - begin);
450 sum_snde += (end - begin);
452 for ( j=begin; j<end; ++j, ++newperi ) {
456 rangtab[1] = rangtab[0] + sum_rang;
457 sndetab[1] = sndetab[0] + sum_snde;
460 memFree_null( peritab );
465 memFree_null( ordeptr->
permtab );
467 for( i=0; i<n; i++ ) {
495 const spmatrix_t *spm )
504 assert( ordeptr != NULL );
505 assert( spm != NULL );
506 assert( spm->gN == ordeptr->
vertnbr );
508 if ( spm->dof == 1 ) {
519 baseval_spm = spm->baseval;
520 baseval_ord = ordeptr->
baseval;
523 dofs = spm->dofs - baseval_ord;
526 for ( i = 0; i < ordeptr->
vertnbr; i++, peritab++ ) {
527 if ( spm->dof <= 0 ) {
528 begin = dofs[ peritab[0] ] - baseval_spm;
529 end = dofs[ peritab[0]+1 ] - baseval_spm;
532 begin = (peritab[0] - baseval_ord) * spm->dof;
533 end = begin + spm->dof;
535 for ( j = begin; j < end; ++j, ++peritab_exp ) {
574 if ( ordedst == NULL ) {
577 if ( ordesrc == NULL ) {
580 if ( ordesrc == ordedst ) {
589 if ( (ordedst->
permtab == NULL) &&
652 if ( pastix_data == NULL ) {
681 PASTIX_Comm pastix_comm )
686 MPI_Comm_rank( pastix_comm, &clustnum );
689 if ( clustnum != root ) {
702 if ( clustnum != root ) {
705 MPI_Bcast( ordemesh->
permtab, vertnbr, PASTIX_MPI_INT,
710 if ( clustnum != root ) {
713 MPI_Bcast( ordemesh->
peritab, vertnbr, PASTIX_MPI_INT,
718 if ( clustnum != root ) {
721 MPI_Bcast( ordemesh->
rangtab, cblknbr+1, PASTIX_MPI_INT,
726 if ( clustnum != root ) {
729 MPI_Bcast( ordemesh->
treetab, cblknbr, PASTIX_MPI_INT,
734 if ( clustnum != root ) {
735 MALLOC_INTERN( ordemesh->
selevtx, cblknbr, int8_t );
737 MPI_Bcast( ordemesh->
selevtx, cblknbr *
sizeof(int8_t), MPI_BYTE,
742 if ( clustnum != root ) {
745 MPI_Bcast( ordemesh->
sndetab, sndenbr+1, PASTIX_MPI_INT,
BEGIN_C_DECLS typedef int pastix_int_t
@ PASTIX_ERR_BADPARAMETER
pastix_int_t * peritab_exp
void pastixOrderExpand(pastix_order_t *ordeptr, const spmatrix_t *spm)
This routine expand the permutation arrays and the rangtab when the spm is using multiple dof per unk...
int pastixOrderAlloc(pastix_order_t *ordeptr, pastix_int_t vertnbr, pastix_int_t cblknbr)
Allocate the order structure.
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.
pastix_order_t * pastixOrderGet(const pastix_data_t *pastix_data)
This routine returns the pointer to the internal order structure to access permutation information.
pastix_int_t * orderGetExpandedPeritab(pastix_order_t *ordeptr, const spmatrix_t *spm)
This routine expand the peritab array for multi-dof matrices.
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.
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.
int pastixOrderCopy(pastix_order_t *ordedst, const pastix_order_t *ordesrc)
This routine copy a given ordering in a new one.
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.
void pastixOrderExit(pastix_order_t *ordeptr)
Free the arrays initialized in the order structure.
pastix_order_t * ordemesh
Main PaStiX data structure.