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;
14: char buff[32],*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",
61: ordertype,4,ordertype[0],buff,32,&flg);
62: while (flg) {
63: PetscStrcmp(buff,"BestOfNDandMS",&flg);
64: if (flg) {
65: options->ordering = 0;
66: break;
67: }
68: PetscStrcmp(buff,"MMD",&flg);
69: if (flg) {
70: options->ordering = 1;
71: break;
72: }
73: PetscStrcmp(buff,"MS",&flg);
74: if (flg) {
75: options->ordering = 2;
76: break;
77: }
78: PetscStrcmp(buff,"ND",&flg);
79: if (flg) {
80: options->ordering = 3;
81: break;
82: }
83: SETERRQ1(1,"Unknown Spooles's ordering %s",buff);
84: }
85:
86: PetscOptionsInt("-mat_spooles_maxdomainsize","maxdomainsize","None",\
87: options->maxdomainsize,&options->maxdomainsize,PETSC_NULL);
88: PetscOptionsInt("-mat_spooles_maxzeros ","maxzeros","None",\
89: options->maxzeros,&options->maxzeros,PETSC_NULL);
90: PetscOptionsInt("-mat_spooles_maxsize","maxsize","None",\
91: options->maxsize,&options->maxsize,PETSC_NULL);
92: PetscOptionsLogical("-mat_spooles_FrontMtxInfo","FrontMtxInfo","None",PETSC_FALSE,&flg,0);
93: if (flg) options->FrontMtxInfo = PETSC_TRUE;
95: if ( options->symflag == SPOOLES_SYMMETRIC ) {
96: PetscOptionsInt("-mat_spooles_symmetryflag","matrix type","None", \
97: options->symflag,&options->symflag,PETSC_NULL);
99: PetscOptionsInt("-mat_spooles_patchAndGoFlag","patchAndGoFlag","None", \
100: options->patchAndGoFlag,&options->patchAndGoFlag,PETSC_NULL);
101:
102: PetscOptionsReal("-mat_spooles_fudge","fudge","None", \
103: options->fudge,&options->fudge,PETSC_NULL);
104: PetscOptionsReal("-mat_spooles_toosmall","toosmall","None", \
105: options->toosmall,&options->toosmall,PETSC_NULL);
106: PetscOptionsInt("-mat_spooles_storeids","storeids","None", \
107: options->storeids,&options->storeids,PETSC_NULL);
108: PetscOptionsInt("-mat_spooles_storevalues","storevalues","None", \
109: options->storevalues,&options->storevalues,PETSC_NULL);
110: }
111: PetscOptionsEnd();
113: return(0);
114: }
116: /* used by -sles_view */
119: int MatFactorInfo_Spooles(Mat A,PetscViewer viewer)
120: {
121: Mat_Spooles *lu = (Mat_Spooles*)A->spptr;
122: int ierr,size;
123: char *s;
126: MPI_Comm_size(A->comm,&size);
127:
128: switch (lu->options.symflag) {
129: case 0: s = "SPOOLES_SYMMETRIC"; break;
130: case 1: s = "SPOOLES_HERMITIAN"; break;
131: case 2: s = "SPOOLES_NONSYMMETRIC"; break; }
132: PetscViewerASCIIPrintf(viewer," symmetryflag: %s \n",s);
134: switch (lu->options.pivotingflag) {
135: case 0: s = "SPOOLES_NO_PIVOTING"; break;
136: case 1: s = "SPOOLES_PIVOTING"; break; }
137: PetscViewerASCIIPrintf(viewer," pivotingflag: %s \n",s);
139: PetscViewerASCIIPrintf(viewer," tau: %g \n",lu->options.tau);
140: PetscViewerASCIIPrintf(viewer," seed: %d \n",lu->options.seed);
141: PetscViewerASCIIPrintf(viewer," msglvl: %d \n",lu->options.msglvl);
143: switch (lu->options.ordering) {
144: case 0: s = "BestOfNDandMS"; break;
145: case 1: s = "MMD"; break;
146: case 2: s = "MS"; break;
147: case 3: s = "ND"; break;
148: }
149: PetscViewerASCIIPrintf(viewer," ordering: %s \n",s);
150: PetscViewerASCIIPrintf(viewer," maxdomainsize: %d \n",lu->options.maxdomainsize);
151: PetscViewerASCIIPrintf(viewer," maxzeros: %d \n",lu->options.maxzeros);
152: PetscViewerASCIIPrintf(viewer," maxsize: %d \n",lu->options.maxsize);
153: PetscViewerASCIIPrintf(viewer," FrontMtxInfo: %d \n",lu->options.FrontMtxInfo);
155: if ( lu->options.symflag == SPOOLES_SYMMETRIC ) {
156: PetscViewerASCIIPrintf(viewer," patchAndGoFlag: %d \n",lu->options.patchAndGoFlag);
157: if ( lu->options.patchAndGoFlag > 0 ) {
158: PetscViewerASCIIPrintf(viewer," fudge: %g \n",lu->options.fudge);
159: PetscViewerASCIIPrintf(viewer," toosmall: %g \n",lu->options.toosmall);
160: PetscViewerASCIIPrintf(viewer," storeids: %d \n",lu->options.storeids);
161: PetscViewerASCIIPrintf(viewer," storevalues: %d \n",lu->options.storevalues);
162: }
163: }
164: return(0);
165: }