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/aij.h
7: #include src/mat/impls/sbaij/seq/sbaij.h
9: #if defined(PETSC_HAVE_SPOOLES) && !defined(PETSC_USE_SINGLE) && !defined(PETSC_USE_COMPLEX)
10: #include src/mat/impls/aij/seq/spooles.h
12: /* Set Spooles' default and runtime options */
13: #undef __FUNCT__
15: int SetSpoolesOptions(Mat A, Spooles_options *options)
16: {
17: int ierr;
18: char buff[32],*ordertype[]={"BestOfNDandMS","MMD","MS","ND"};
19: PetscTruth flg;
22: /* set default input parameters */
23: options->msglvl = 0;
24: options->msgFile = 0;
25: options->tau = 100.;
26: options->seed = 10101;
27: options->ordering = 0; /* BestOfNDandMS */
28: options->maxdomainsize = 500;
29: options->maxzeros = 1000;
30: options->maxsize = 96;
31: options->FrontMtxInfo = PETSC_FALSE;
32: if ( options->symflag == SPOOLES_SYMMETRIC ) {
33: options->patchAndGoFlag = 0; /* no patch */
34: options->storeids = 1;
35: options->storevalues = 1;
36: options->toosmall = 1.e-9;
37: options->fudge = 1.e-9;
38:
39: }
41: /* get runtime input parameters */
42: PetscOptionsBegin(A->comm,A->prefix,"Spooles Options","Mat");
44: PetscOptionsReal("-mat_spooles_tau","tau (used for pivoting; n
45: all entries in L and U have magnitude no more than tau)","None",
46: options->tau,&options->tau,PETSC_NULL);
48: PetscOptionsInt("-mat_spooles_seed","random number seed, used for ordering","None",
49: options->seed,&options->seed,PETSC_NULL);
51: if (PetscLogPrintInfo) options->msglvl = 1;
52: PetscOptionsInt("-mat_spooles_msglvl","msglvl","None",
53: options->msglvl,&options->msglvl,0);
54: if (options->msglvl > 0) {
55: options->msgFile = fopen("spooles.msgFile", "a");
56: PetscPrintf(PETSC_COMM_SELF,"n Spooles' output is written into the file 'spooles.msgFile' nn");
57: }
59: PetscOptionsEList("-mat_spooles_ordering","ordering type","None",
60: ordertype,4,ordertype[0],buff,32,&flg);
61: while (flg) {
62: PetscStrcmp(buff,"BestOfNDandMS",&flg);
63: if (flg) {
64: options->ordering = 0;
65: break;
66: }
67: PetscStrcmp(buff,"MMD",&flg);
68: if (flg) {
69: options->ordering = 1;
70: break;
71: }
72: PetscStrcmp(buff,"MS",&flg);
73: if (flg) {
74: options->ordering = 2;
75: break;
76: }
77: PetscStrcmp(buff,"ND",&flg);
78: if (flg) {
79: options->ordering = 3;
80: break;
81: }
82: SETERRQ1(1,"Unknown Spooles's ordering %s",buff);
83: }
84:
85: PetscOptionsInt("-mat_spooles_maxdomainsize","maxdomainsize","None", 86: options->maxdomainsize,&options->maxdomainsize,PETSC_NULL);
87: PetscOptionsInt("-mat_spooles_maxzeros ","maxzeros","None", 88: options->maxzeros,&options->maxzeros,PETSC_NULL);
89: PetscOptionsInt("-mat_spooles_maxsize","maxsize","None", 90: options->maxsize,&options->maxsize,PETSC_NULL);
91: PetscOptionsLogical("-mat_spooles_FrontMtxInfo","FrontMtxInfo","None",PETSC_FALSE,&flg,0);
92: if (flg) options->FrontMtxInfo = PETSC_TRUE;
94: if ( options->symflag == SPOOLES_SYMMETRIC ) {
95: PetscOptionsInt("-mat_spooles_patchAndGoFlag","patchAndGoFlag","None", 96: options->patchAndGoFlag,&options->patchAndGoFlag,PETSC_NULL);
97:
98: PetscOptionsReal("-mat_spooles_fudge","fudge","None", 99: options->fudge,&options->fudge,PETSC_NULL);
100: PetscOptionsReal("-mat_spooles_toosmall","toosmall","None", 101: options->toosmall,&options->toosmall,PETSC_NULL);
102: PetscOptionsInt("-mat_spooles_storeids","storeids","None", 103: options->storeids,&options->storeids,PETSC_NULL);
104: PetscOptionsInt("-mat_spooles_storevalues","storevalues","None", 105: options->storevalues,&options->storevalues,PETSC_NULL);
106: }
107: PetscOptionsEnd();
109: return(0);
110: }
112: /* used by -sles_view */
113: extern int MatSolve_SeqAIJ_Spooles(Mat,Vec,Vec);
114: extern int MatSolve_MPIAIJ_Spooles(Mat,Vec,Vec);
115: #undef __FUNCT__
117: int MatFactorInfo_Spooles(Mat A,PetscViewer viewer)
118: {
119: Mat_Spooles *lu = (Mat_Spooles*)A->spptr;
120: int ierr,size;
121: char *s;
124: MPI_Comm_size(PETSC_COMM_WORLD,&size);
125:
126: /* check if matrix is spooles type */
127: if (size == 1){
128: if (A->ops->solve != MatSolve_SeqAIJ_Spooles) return(0);
129: } else {
130: if (A->ops->solve != MatSolve_MPIAIJ_Spooles) return(0);
131: }
133: switch (lu->options.symflag) {
134: case 0: s = "SPOOLES_SYMMETRIC"; break;
135: case 2: s = "SPOOLES_NONSYMMETRIC"; break; }
136: PetscViewerASCIIPrintf(viewer," symmetryflag: %s n",s);
138: switch (lu->options.pivotingflag) {
139: case 0: s = "SPOOLES_NO_PIVOTING"; break;
140: case 1: s = "SPOOLES_PIVOTING"; break; }
141: PetscViewerASCIIPrintf(viewer," pivotingflag: %s n",s);
143: PetscViewerASCIIPrintf(viewer," tau: %g n",lu->options.tau);
144: PetscViewerASCIIPrintf(viewer," seed: %d n",lu->options.seed);
145: PetscViewerASCIIPrintf(viewer," msglvl: %d n",lu->options.msglvl);
147: switch (lu->options.ordering) {
148: case 0: s = "BestOfNDandMS"; break;
149: case 1: s = "MMD"; break;
150: case 2: s = "MS"; break;
151: case 3: s = "ND"; break;
152: }
153: PetscViewerASCIIPrintf(viewer," ordering: %s n",s);
154: PetscViewerASCIIPrintf(viewer," maxdomainsize: %d n",lu->options.maxdomainsize);
155: PetscViewerASCIIPrintf(viewer," maxzeros: %d n",lu->options.maxzeros);
156: PetscViewerASCIIPrintf(viewer," maxsize: %d n",lu->options.maxsize);
157: PetscViewerASCIIPrintf(viewer," FrontMtxInfo: %d n",lu->options.FrontMtxInfo);
159: if ( lu->options.symflag == SPOOLES_SYMMETRIC ) {
160: PetscViewerASCIIPrintf(viewer," patchAndGoFlag: %d n",lu->options.patchAndGoFlag);
161: if ( lu->options.patchAndGoFlag > 0 ) {
162: PetscViewerASCIIPrintf(viewer," fudge: %g n",lu->options.fudge);
163: PetscViewerASCIIPrintf(viewer," toosmall: %g n",lu->options.toosmall);
164: PetscViewerASCIIPrintf(viewer," storeids: %d n",lu->options.storeids);
165: PetscViewerASCIIPrintf(viewer," storevalues: %d n",lu->options.storevalues);
166: }
167: }
168: return(0);
169: }
171: #endif