Actual source code: spoolesOptions.c
1: /*$Id: spoolesOptions.c,v 1.10 2001/08/15 15:56:50 bsmith Exp $*/
2: /*
3: Default and runtime options used by seq and MPI Spooles' interface for both aij and sbaij mat objects
4: */
6: #include src/mat/impls/aij/seq/spooles/spooles.h
8: /* Set Spooles' default and runtime options */
11: int SetSpoolesOptions(Mat A, Spooles_options *options)
12: {
13: int ierr,indx;
14: const char *ordertype[]={"BestOfNDandMS","MMD","MS","ND"};
15: PetscTruth flg;
18: /* set default input parameters */
19: #if defined(PETSC_USE_COMPLEX)
20: options->typeflag = SPOOLES_COMPLEX;
21: #else
22: options->typeflag = SPOOLES_REAL;
23: #endif
24: options->msglvl = 0;
25: options->msgFile = 0;
26: options->tau = 100.;
27: options->seed = 10101;
28: options->ordering = 0; /* BestOfNDandMS */
29: options->maxdomainsize = 500;
30: options->maxzeros = 1000;
31: options->maxsize = 96;
32: options->FrontMtxInfo = PETSC_FALSE;
33: if ( options->symflag == SPOOLES_SYMMETRIC ) { /* || SPOOLES_HERMITIAN */
34: options->patchAndGoFlag = 0; /* no patch */
35: options->storeids = 1;
36: options->storevalues = 1;
37: options->toosmall = 1.e-9;
38: options->fudge = 1.e-9;
39:
40: }
42: /* get runtime input parameters */
43: PetscOptionsBegin(A->comm,A->prefix,"Spooles Options","Mat");
45: PetscOptionsReal("-mat_spooles_tau","tau (used for pivoting; \n\
46: all entries in L and U have magnitude no more than tau)","None",
47: options->tau,&options->tau,PETSC_NULL);
49: PetscOptionsInt("-mat_spooles_seed","random number seed, used for ordering","None",
50: options->seed,&options->seed,PETSC_NULL);
52: if (PetscLogPrintInfo) options->msglvl = 1;
53: PetscOptionsInt("-mat_spooles_msglvl","msglvl","None",
54: options->msglvl,&options->msglvl,0);
55: if (options->msglvl > 0) {
56: options->msgFile = fopen("spooles.msgFile", "a");
57: PetscPrintf(PETSC_COMM_SELF,"\n Spooles' output is written into the file 'spooles.msgFile' \n\n");
58: }
60: PetscOptionsEList("-mat_spooles_ordering","ordering type","None",ordertype,4,ordertype[0],&indx,&flg);
61: if (flg) {options->ordering = indx;}
62:
63: PetscOptionsInt("-mat_spooles_maxdomainsize","maxdomainsize","None",\
64: options->maxdomainsize,&options->maxdomainsize,PETSC_NULL);
65: PetscOptionsInt("-mat_spooles_maxzeros ","maxzeros","None",\
66: options->maxzeros,&options->maxzeros,PETSC_NULL);
67: PetscOptionsInt("-mat_spooles_maxsize","maxsize","None",\
68: options->maxsize,&options->maxsize,PETSC_NULL);
69: PetscOptionsLogical("-mat_spooles_FrontMtxInfo","FrontMtxInfo","None",PETSC_FALSE,&flg,0);
70: if (flg) options->FrontMtxInfo = PETSC_TRUE;
72: if ( options->symflag == SPOOLES_SYMMETRIC ) {
73: PetscOptionsInt("-mat_spooles_symmetryflag","matrix type","None", \
74: options->symflag,&options->symflag,PETSC_NULL);
76: PetscOptionsInt("-mat_spooles_patchAndGoFlag","patchAndGoFlag","None", \
77: options->patchAndGoFlag,&options->patchAndGoFlag,PETSC_NULL);
78:
79: PetscOptionsReal("-mat_spooles_fudge","fudge","None", \
80: options->fudge,&options->fudge,PETSC_NULL);
81: PetscOptionsReal("-mat_spooles_toosmall","toosmall","None", \
82: options->toosmall,&options->toosmall,PETSC_NULL);
83: PetscOptionsInt("-mat_spooles_storeids","storeids","None", \
84: options->storeids,&options->storeids,PETSC_NULL);
85: PetscOptionsInt("-mat_spooles_storevalues","storevalues","None", \
86: options->storevalues,&options->storevalues,PETSC_NULL);
87: }
88: PetscOptionsEnd();
90: return(0);
91: }
93: /* used by -ksp_view */
96: int MatFactorInfo_Spooles(Mat A,PetscViewer viewer)
97: {
98: Mat_Spooles *lu = (Mat_Spooles*)A->spptr;
99: int ierr,size;
100: char *s;
103: MPI_Comm_size(A->comm,&size);
104:
105: PetscViewerASCIIPrintf(viewer,"Spooles run parameters:\n");
106: switch (lu->options.symflag) {
107: case 0: s = "SPOOLES_SYMMETRIC"; break;
108: case 1: s = "SPOOLES_HERMITIAN"; break;
109: case 2: s = "SPOOLES_NONSYMMETRIC"; break; }
110: PetscViewerASCIIPrintf(viewer," symmetryflag: %s \n",s);
112: switch (lu->options.pivotingflag) {
113: case 0: s = "SPOOLES_NO_PIVOTING"; break;
114: case 1: s = "SPOOLES_PIVOTING"; break; }
115: PetscViewerASCIIPrintf(viewer," pivotingflag: %s \n",s);
117: PetscViewerASCIIPrintf(viewer," tau: %g \n",lu->options.tau);
118: PetscViewerASCIIPrintf(viewer," seed: %d \n",lu->options.seed);
119: PetscViewerASCIIPrintf(viewer," msglvl: %d \n",lu->options.msglvl);
121: switch (lu->options.ordering) {
122: case 0: s = "BestOfNDandMS"; break;
123: case 1: s = "MMD"; break;
124: case 2: s = "MS"; break;
125: case 3: s = "ND"; break;
126: }
127: PetscViewerASCIIPrintf(viewer," ordering: %s \n",s);
128: PetscViewerASCIIPrintf(viewer," maxdomainsize: %d \n",lu->options.maxdomainsize);
129: PetscViewerASCIIPrintf(viewer," maxzeros: %d \n",lu->options.maxzeros);
130: PetscViewerASCIIPrintf(viewer," maxsize: %d \n",lu->options.maxsize);
131: PetscViewerASCIIPrintf(viewer," FrontMtxInfo: %d \n",lu->options.FrontMtxInfo);
133: if ( lu->options.symflag == SPOOLES_SYMMETRIC ) {
134: PetscViewerASCIIPrintf(viewer," patchAndGoFlag: %d \n",lu->options.patchAndGoFlag);
135: if ( lu->options.patchAndGoFlag > 0 ) {
136: PetscViewerASCIIPrintf(viewer," fudge: %g \n",lu->options.fudge);
137: PetscViewerASCIIPrintf(viewer," toosmall: %g \n",lu->options.toosmall);
138: PetscViewerASCIIPrintf(viewer," storeids: %d \n",lu->options.storeids);
139: PetscViewerASCIIPrintf(viewer," storevalues: %d \n",lu->options.storevalues);
140: }
141: }
142: return(0);
143: }