cscd_utils_intern.h

Summary
cscd_utils_intern.h
add_two_floatsAdds two integers.
keep_firstReturns first integer.
keep_lastReturns last integer.
get_maxReturns maximum value from two integers.
get_minReturns minimum value from two integers.
cscd_addlocal_int
cscd_redispatch_intRedistribute the first cscd into a new one using dl2g.
cscd_symgraph_int
cscd_build_g2lConstruct global to local tabular containing local number of global columns if one column is local, and -owner if column is not local.
cscd_noDiagRemoves diagonal elements from a CSCD.
cscd_checksymCheck if the CSCD graph is symetric.
cscd2csc_intTransform a cscd to a csc.
cscd_redispatch_scotchRenumber the columns to have first columns on first proc for Scotch

add_two_floats

FLOAT add_two_floats(FLOAT a,
FLOAT b)

Adds two integers.

Parameters : a - first integer b - second integer

Returns: a + b

keep_first

FLOAT keep_first(FLOAT a,
FLOAT b)

Returns first integer.

Parameters : a - first integer b - second integer

Returns: a

keep_last

FLOAT keep_last(FLOAT a,
FLOAT b)

Returns last integer.

Parameters : a - first integer b - second integer

Returns: b

get_max

FLOAT get_max(FLOAT a,
FLOAT b)

Returns maximum value from two integers.

Parameters : a - first integer b - second integer

Returns: MAX(a,b)

get_min

FLOAT get_min(FLOAT a,
FLOAT b)

Returns minimum value from two integers.

Parameters : a - first integer b - second integer

Returns: MIN(a,b)

cscd_addlocal_int

int cscd_addlocal_int(INT ,
INT * ia ,
INT * ja ,
FLOAT * ,
INT *l2g,
INT addn,
INT *addia,
INT *addja,
FLOAT *adda,
INT *addl2g,
INT *newn,
INT **newia,
INT **newja,
FLOAT **newa,
FLOAT (*add_fct)(FLOAT , FLOAT),
int dof,
int malloc_flag)

cscd_redispatch_int

int cscd_redispatch_int(INT n,
INT *ia,
INT *ja,
FLOAT *a,
FLOAT *rhs,
INT *l2g,
INT dn,
INT **dia,
INT **dja,
FLOAT **da,
FLOAT **drhs,
INT *dl2g,
int malloc_flag,
MPI_Comm comm)

Redistribute the first cscd into a new one using dl2g.

  • gather all new loc2globs on all processors.
  • allocate dia, dja and da.
  • Create new CSC for each processor and send it.
  • Merge all new CSC to the new local CSC with cscd_addlocal_int.

If communicator size is one, check that n = dn and l2g = dl2g and simply create a copy of the first cscd.

Parameters

nNumber of local columns
iaFirst cscd starting index of each column in ja and a
jaRow of each element in first CSCD
avalue of each cscd in first CSCD (can be NULL)
rhsright-hand-side member corresponding to the first CSCD (can be NULL)
l2glocal 2 global column numbers for first cscd
dnNumber of local columns
diaNew cscd starting index of each column in ja and a
djaRow of each element in new CSCD
davalue of each cscd in new CSCD
rhsright-hand-side member corresponding to the new CSCD
dl2glocal 2 global column numbers for new cscd
malloc_flagInternal (API_YES) or external (API_NO) malloc use.
commMPI communicator

Returns

EXIT_SUCCESSIf all goes well
EXIT_FAILUREIf commsize = 1 and n != dn or l2g != dl2g.

cscd_symgraph_int

int cscd_symgraph_int(INT n,
INT *ia,
INT *ja,
FLOAT *a,
INT *newn,
INT **newia,
INT **newja,
FLOAT **newa,
INT *l2g,
MPI_Comm comm,
int malloc_flag)

cscd_build_g2l

int cscd_build_g2l(INT ncol,
INT *loc2glob,
MPI_Comm comm,
INT *gN,
INT **g2l)

Construct global to local tabular containing local number of global columns if one column is local, and -owner if column is not local.

For i in 0, gN g2l[i] = i local number if i is local g2l[i] = -p if p is the owner of the column i

Parameters

nNumber of local columns
colptrStarting index of each columns in ja
rowsRow of each element.
valuesValue of each element.
l2gglobal number of each local column.
correctFlag indicating if we can correct the symmetry.
dofNumber of degrees of freedom.
commMPI communicator

cscd_noDiag

int cscd_noDiag(INT n,
INT *ia,
INT *ja,
FLOAT *a,
INT *l2g)

Removes diagonal elements from a CSCD.  ja and a can be reallocated to ia[n]-1 elements after this call.

Parameters

nNumber of local columns
iaFirst cscd starting index of each column in ja and a
jaRow of each element in first CSCD
avalue of each cscd in first CSCD (can be NULL)
l2glocal 2 global column numbers for first cscd

cscd_checksym

int cscd_checksym(INT n,
INT *colptr,
INT **rows,
FLOAT **values,
INT *l2g,
int correct,
int alloc,
int dof,
MPI_Comm comm)

Check if the CSCD graph is symetric.

Parameters

nNumber of local columns
iaStarting index of each columns in ja
jaRow of each element.
l2gglobal number of each local column.
correctFlag indicating if we can correct the symmetry.
allocindicate if allocation on CSC uses internal malloc.
dofNumber of degrees of freedom.
commMPI communicator

cscd2csc_int

void cscd2csc_int(INT lN,
INT *lcolptr,
INT *lrow,
FLOAT *lavals,
FLOAT *lrhs,
INT *lperm,
INT *linvp,
INT *gN,
INT **gcolptr,
INT **grow,
FLOAT **gavals,
FLOAT **grhs,
INT **gperm,
INT **ginvp,
INT *loc2glob,
MPI_Comm pastix_comm,
int intern_flag)

Transform a cscd to a csc. colptr2, row2, avals2, rhs2, perm2, invp2 are allocated here.

External function, allocation are not of the internal type.

Parameters

lNnumber of local column.
lcolptrstarting index of each local column in row and avals. lrow _ row number of each local element.
lavalsvalues of each local element.
lrhslocal part of the right hand side.
lpermlocal part of the permutation tabular.
linvpMeans nothing, to suppress.
gNglobal number of columns (output).
gcolptrstarting index of each column in row2 and avals2 (output).
growrow number of each element (output).
gavalsvalues of each element (output).
grhsglobal right hand side (output).
gpermglobal permutation tabular (output).
ginvpglobal reverse permutation tabular (output).
loc2globglobal number of each local column.
pastix_commPaStiX MPI communicator.
intern_flagDecide if malloc will use internal or external macros.

cscd_redispatch_scotch

int cscd_redispatch_scotch(INT n,
INT *ia,
INT *ja,
FLOAT *a,
INT *l2g,
INT *dn,
INT **dia,
INT **dja,
FLOAT **da,
INT **dl2g,
MPI_Comm comm)

Renumber the columns to have first columns on first proc for Scotch

Parameters

nNumber of local columns
iaFirst cscd starting index of each column in ja and a
jaRow of each element in first CSCD
avalue of each cscd in first CSCD (can be NULL)
l2glocal 2 global column numbers for first cscd
dnNumber of local columns
diaFirst cscd starting index of each column in ja and a
djaRow of each element in first CSCD
davalue of each cscd in first CSCD (can be NULL)
l2glocal 2 global column numbers for first cscd
commMPI communicator

Returns

EXIT_SUCCESS if already well distributed, 2 if redistributed

FLOAT add_two_floats(FLOAT a,
FLOAT b)
Adds two integers.
FLOAT keep_first(FLOAT a,
FLOAT b)
Returns first integer.
FLOAT keep_last(FLOAT a,
FLOAT b)
Returns last integer.
FLOAT get_max(FLOAT a,
FLOAT b)
Returns maximum value from two integers.
FLOAT get_min(FLOAT a,
FLOAT b)
Returns minimum value from two integers.
int cscd_addlocal_int(INT ,
INT * ia ,
INT * ja ,
FLOAT * ,
INT *l2g,
INT addn,
INT *addia,
INT *addja,
FLOAT *adda,
INT *addl2g,
INT *newn,
INT **newia,
INT **newja,
FLOAT **newa,
FLOAT (*add_fct)(FLOAT , FLOAT),
int dof,
int malloc_flag)
int cscd_redispatch_int(INT n,
INT *ia,
INT *ja,
FLOAT *a,
FLOAT *rhs,
INT *l2g,
INT dn,
INT **dia,
INT **dja,
FLOAT **da,
FLOAT **drhs,
INT *dl2g,
int malloc_flag,
MPI_Comm comm)
Redistribute the first cscd into a new one using dl2g.
int cscd_symgraph_int(INT n,
INT *ia,
INT *ja,
FLOAT *a,
INT *newn,
INT **newia,
INT **newja,
FLOAT **newa,
INT *l2g,
MPI_Comm comm,
int malloc_flag)
int cscd_build_g2l(INT ncol,
INT *loc2glob,
MPI_Comm comm,
INT *gN,
INT **g2l)
Construct global to local tabular containing local number of global columns if one column is local, and -owner if column is not local.
int cscd_noDiag(INT n,
INT *ia,
INT *ja,
FLOAT *a,
INT *l2g)
Removes diagonal elements from a CSCD.
int cscd_checksym(INT n,
INT *colptr,
INT **rows,
FLOAT **values,
INT *l2g,
int correct,
int alloc,
int dof,
MPI_Comm comm)
Check if the CSCD graph is symetric.
void cscd2csc_int(INT lN,
INT *lcolptr,
INT *lrow,
FLOAT *lavals,
FLOAT *lrhs,
INT *lperm,
INT *linvp,
INT *gN,
INT **gcolptr,
INT **grow,
FLOAT **gavals,
FLOAT **grhs,
INT **gperm,
INT **ginvp,
INT *loc2glob,
MPI_Comm pastix_comm,
int intern_flag)
Transform a cscd to a csc.
int cscd_redispatch_scotch(INT n,
INT *ia,
INT *ja,
FLOAT *a,
INT *l2g,
INT *dn,
INT **dia,
INT **dja,
FLOAT **da,
INT **dl2g,
MPI_Comm comm)
Renumber the columns to have first columns on first proc for Scotch
Close