21 #ifndef DOXYGEN_SHOULD_SKIP_THIS
23 #define SOLVER_PSDPI 72
24 #define SOLVER_PSPICTSIZE 6.6
59 const char *directory )
67 pictsize = (double) (solvptr->nodenbr + 1);
69 fprintf (stream,
"%%!PS-Adobe-2.0 EPSF-2.0\n");
70 fprintf (stream,
"%%%%Title: pastixSymbolmatrix (%ld,%ld,%ld)\n",
71 (
long) solvptr->cblknbr, (
long) solvptr->bloknbr, (
long)solvptr->nodenbr);
72 fprintf (stream,
"%%%%Creator: pastixSymbolDraw (LaBRI, Universite Bordeaux I)\n");
73 fprintf (stream,
"%%%%CreationDate: %s", ctime (&picttime));
74 fprintf (stream,
"%%%%BoundingBox: 0 0 %ld %ld\n",
75 (
long) (SOLVER_PSPICTSIZE * SOLVER_PSDPI),
76 (
long) (SOLVER_PSPICTSIZE * SOLVER_PSDPI));
77 fprintf (stream,
"%%%%Pages: 0\n");
78 fprintf (stream,
"%%%%EndComments\n");
79 fprintf (stream,
"/c { 4 2 roll pop pop newpath 2 copy 2 copy moveto dup lineto dup lineto closepath fill } bind def\n");
80 fprintf (stream,
"/d { 4 2 roll pop pop newpath 2 copy 2 copy moveto dup lineto dup lineto closepath } bind def\n");
81 fprintf (stream,
"/b { 4 copy 2 index exch moveto lineto dup 3 index lineto exch lineto closepath fill pop } bind def\n");
82 fprintf (stream,
"/a { 4 copy 2 index exch moveto lineto dup 3 index lineto exch lineto closepath pop } bind def\n");
83 fprintf (stream,
"/r { setrgbcolor } bind def\n");
84 fprintf (stream,
"/g { setgray } bind def\n");
86 fprintf (stream,
"0 setlinecap\n");
87 fprintf (stream,
"%f dup scale\n",
88 (
double) SOLVER_PSDPI * SOLVER_PSPICTSIZE / pictsize);
89 fprintf (stream,
"/Times-Roman 70 selectfont\n");
90 fprintf (stream,
"[ 1 0 0 -1 0 %d ] concat\n",
91 (
int) (solvptr->nodenbr + 1));
93 fprintf (stream,
"0 0\n");
94 for (cblknum = 0; cblknum < solvptr->cblknbr; cblknum ++) {
105 if ((coloval[0] == coloval[1]) &&
106 (coloval[1] == coloval[2])) {
107 fprintf (stream,
"%.2g g ",
111 fprintf (stream,
"%.2g %.2g %.2g r \n",
112 (
float) coloval[0], (
float) coloval[1], (
float) coloval[2]);
115 fprintf (stream,
"%ld\t%ld\tc\n",
116 (
long) (cblk->
fcolnum - solvptr->baseval),
117 (
long) (cblk->
lcolnum - solvptr->baseval + 1));
120 for (; blok<lblok; blok++)
122 if ( !(cblk->
cblktype & CBLK_COMPRESSED) ) {
123 fprintf (stream,
"%.2g %.2g %.2g r \n",
128 pastix_int_t conso_dense = 2*nrows*ncols;
129 pastix_int_t conso_LR = 0;
133 conso_LR += (((nrows+ncols) * blok->
LRblock[0]->
rk));
136 conso_LR += nrows*ncols;
139 conso_LR += (((nrows+ncols) * blok->
LRblock[1]->
rk));
142 conso_LR += nrows*ncols;
145 gain = 1.0 * conso_dense / conso_LR;
149 fprintf(stream,
"%.2g %.2g %.2g r \n",
153 else if (gain < 5.) {
154 fprintf(stream,
"%.2g %.2g %.2g r \n",
159 float color = 0.5 + (gain-5) / 10.;
163 fprintf(stream,
"%.2g %.2g %.2g r \n",
168 fprintf (stream,
"%ld\t%ld\tb\n",
169 (
long) (blok->
frownum - solvptr->baseval),
170 (
long) (blok->
lrownum - solvptr->baseval + 1));
178 FILE *fd1, *fd2, *fd3;
179 int original_cblk = 1;
181 int factoLU = (solvptr->factotype ==
PastixFactLU) ? 1 : 0;
187 fprintf(fd3,
"%ld\n", (
long)(solvptr->bloknbr-solvptr->cblknbr));
189 fprintf (stream,
"0 0\n");
190 for (cblknum = 0; cblknum < solvptr->cblknbr; cblknum ++) {
191 int unused, nb_contrib;
192 SolverCblk *cblk = &solvptr->cblktab[cblknum];
196 if ( 3 != fscanf(fd2,
"%d %d %d\n", &unused, &nb_contrib, &original_cblk) ) {
197 fclose(fd1); fclose(fd2); fclose(fd3);
200 fprintf (stream,
"%.2g g %ld\t%ld\tc\n",
202 (
long) (cblk->
fcolnum - solvptr->baseval),
203 (
long) (cblk->
lcolnum - solvptr->baseval + 1));
204 if ( cblk->
cblktype & CBLK_COMPRESSED ) {
205 fprintf (stream,
"%ld\t%ld\t4 copy 3 index exch moveto [ 1 0 0 -1 0 0 ] concat 0.0 0.0 0.0 setrgbcolor (%d) show [ 1 0 0 -1 0 0 ] concat pop\n",
206 (
long) (cblk->
fcolnum - solvptr->baseval),
207 (
long) (cblk->
lcolnum - solvptr->baseval + 1),
212 for (; blok<lblok; blok++)
214 int unused, nb_contrib;
217 if ( 2 != fscanf(fd1,
"%d %d\n", &unused, &nb_contrib) ) {
218 fclose(fd1); fclose(fd2); fclose(fd3);
221 fprintf (stream,
"%ld\t%ld\ta\n",
222 (
long) (blok->
frownum - solvptr->baseval),
223 (
long) (blok->
lrownum - solvptr->baseval + 1));
224 if ( cblk->
cblktype & CBLK_COMPRESSED ) {
226 pastix_int_t conso_dense = 2*nrows*ncols;
227 pastix_int_t conso_LR = 0;
228 fprintf (stream,
"%ld\t%ld\t4 copy 3 index exch moveto [ 1 0 0 -1 0 0 ] concat 1.0 1.0 1.0 setrgbcolor (%d) show [ 1 0 0 -1 0 0 ] concat pop\n",
229 (
long) (blok->
frownum - solvptr->baseval),
230 (
long) (blok->
lrownum - solvptr->baseval + 1),
234 conso_LR += (((nrows+ncols) * blok->
LRblock[0]->
rk));
237 conso_LR += nrows*ncols;
241 conso_LR += (((nrows+ncols) * blok->
LRblock[1]->
rk));
244 conso_LR += nrows*ncols;
248 gain = 1.0 * conso_dense / conso_LR;
252 fprintf(fd3,
"%d\n%f\n", nb_contrib, gain);
255 if (original_cblk == 0){
270 fprintf (stream,
"pop pop\n");
271 o = fprintf (stream,
"showpage\n");
274 return ((o != EOF) ? 0 : 1);
int solverDraw(const SolverMatrix *const solvptr, FILE *const stream, int verbose, const char *directory)
Writes a PostScript picture of the low-rank solver matrix.
FILE * pastix_fopenw(const char *dirname, const char *filename, const char *mode)
Open a file in the unique directory of the pastix instance.
static pastix_int_t blok_rownbr(const SolverBlok *blok)
Compute the number of rows of a block.
static pastix_int_t cblk_colnbr(const SolverCblk *cblk)
Compute the number of columns in a column block.
pastix_lrblock_t * LRblock[2]
Solver column block structure.