~ubuntu-branches/ubuntu/wily/freefem++/wily

« back to all changes in this revision

Viewing changes to .pc/src-Graphics-sansgraph-cpp.patch/src/Graphics/sansrgraph.cpp

  • Committer: Package Import Robot
  • Author(s): Dimitrios Eftaxiopoulos, Dimitrios Eftaxiopoulos, Christophe Trophime
  • Date: 2013-09-12 00:02:58 UTC
  • mfrom: (1.2.1) (11.1.1 experimental)
  • Revision ID: package-import@ubuntu.com-20130912000258-aclq2zfa1svt0p3x
Tags: 3.25-1
[ Dimitrios Eftaxiopoulos ]
* Imported Upstream version 3.25 (Closes: #701161 #706714)
* Change installation directory of header-like *.idp files
  from /usr/lib/freefem++ to /usr/include/freefem++, in order
  to fix a lintian warning
* Update patch to examples++-load/Makefile.am in order to enable
  functioning of load *.so and include *.idp commands in *.edp
  scripts
* Delete patches to src/Graphics/sansgraph.cpp and
  src/Graphics/xglrgraph.cpp because they are not needed any more
* Fix lintian warning about missing LDFLAGS
* Override dh_auto_test in debian/rules, such that in case it is 
  used, it completes executing all *.edp example files, regardless
  of aborting on some of them
* Add libmetis-dev to build-deps in d/control
* Remove libparmetis-dev from build deps
* Add --parallel option to dh $@ in debian/rules
* Add hardening compilation flags to mpic++
* Allow testing of compiling and running the example files after build

[ Christophe Trophime ]
* update C. Trophime email
* add support for nlopt, ipopt - simplify debian/rules
* upload CT changes to 3.20
* add patch for configure
* add patch for examples++-mpi
* fix bamg install
* add corrected scripts to build plugins
* add patch for properly build examples++-load
* add lintian overrides for libfreefem++
* add some missing files
* update patches
* update rules
* reorder BuildDepends - comment out unsupported libs

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// -*- Mode : c++ -*-
2
 
//
3
 
// SUMMARY  :      
4
 
// USAGE    :        
5
 
// ORG      : 
6
 
// AUTHOR   : Frederic Hecht
7
 
// E-MAIL   : hecht@ann.jussieu.fr
8
 
//
9
 
 
10
 
/*
11
 
 
12
 
 This file is part of Freefem++
13
 
 
14
 
 Freefem++ is free software; you can redistribute it and/or modify
15
 
 it under the terms of the GNU Lesser General Public License as published by
16
 
 the Free Software Foundation; either version 2.1 of the License, or
17
 
 (at your option) any later version.
18
 
 
19
 
 Freefem++  is distributed in the hope that it will be useful,
20
 
 but WITHOUT ANY WARRANTY; without even the implied warranty of
21
 
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
 
 GNU Lesser General Public License for more details.
23
 
 
24
 
 You should have received a copy of the GNU Lesser General Public License
25
 
 along with Freefem++; if not, write to the Free Software
26
 
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
27
 
 */
28
 
#define FF_GRAPH_SET_PTR
29
 
using namespace std;
30
 
#include <ctime>
31
 
#include <cstdlib>
32
 
#include <cstdio>
33
 
#include <cstring>
34
 
#include <iostream>
35
 
#include <cassert>
36
 
#include "rgraph.hpp"
37
 
 
38
 
#include "error.hpp"
39
 
#ifdef macintoshxx
40
 
#include <ConditionalMacros.h>
41
 
#include <unix.h>
42
 
#else
43
 
#include <sys/stat.h>
44
 
#endif
45
 
#ifdef xTARGET_CARBON
46
 
#include <Navigation.h>
47
 
int pStrCopy (StringPtr p1, char * p2)
48
 
/* copies a pascal string `p1 into a C string */
49
 
{
50
 
        int len,i;
51
 
        
52
 
        len = (*p1++) %256;
53
 
        for(i=1;i<=len;i++) *p2++=*p1++;
54
 
        *p2 = 0;
55
 
        return 0;
56
 
}
57
 
 
58
 
int getprog(char* fn,int argc, char** argvptr)
59
 
{
60
 
   OSErr anErr;
61
 
 
62
 
  NavDialogOptions dialogOptions;
63
 
  NavReplyRecord reply;
64
 
  
65
 
  anErr=NavGetDefaultDialogOptions(&  dialogOptions);
66
 
  if( anErr != noErr)  return -1;
67
 
  anErr =NavChooseFile(0,&reply,&dialogOptions,0,0,0,0,0) ;  
68
 
  if (anErr == noErr && reply.validRecord)
69
 
   {
70
 
                //  Deal with multiple file selection
71
 
                long    count;
72
 
                
73
 
                anErr = AECountItems(&(reply.selection), &count);
74
 
                // Set up index for file list
75
 
                if (anErr == noErr)
76
 
                {
77
 
                    long index;
78
 
                    
79
 
                    for (index = 1; index <= count; index++)
80
 
                    {
81
 
                        AEKeyword   theKeyword;
82
 
                        DescType    actualType;
83
 
                        Size        actualSize;
84
 
                        FSSpec      documentFSSpec;
85
 
                        
86
 
                        // Get a pointer to selected file
87
 
                        anErr = AEGetNthPtr(&(reply.selection), index,
88
 
                                            typeFSS, &theKeyword,
89
 
                                            &actualType,&documentFSSpec,
90
 
                                            sizeof(documentFSSpec),
91
 
                                            &actualSize);
92
 
                        if (anErr == noErr)
93
 
                         {  
94
 
                           anErr = HSetVol(0,documentFSSpec.vRefNum,documentFSSpec.parID);
95
 
                           pStrCopy(documentFSSpec.name, fn);
96
 
                         }
97
 
                    }
98
 
                }
99
 
                //  Dispose of NavReplyRecord, resources, descriptors
100
 
                anErr = NavDisposeReply(&reply);
101
 
     
102
 
   }
103
 
        return (2);
104
 
}
105
 
#else
106
 
#include "getprog-unix.hpp"
107
 
#endif
108
 
 
109
 
 
110
 
template<class T> inline T Min (const T &a,const T &b){return a < b ? a : b;}
111
 
template<class T> inline T Max (const T &a,const T & b){return a > b ? a : b;}
112
 
 
113
 
 
114
 
static  long  cube6[7][3] ={ { 65535,32000,32000},{ 65535, 65535,0},{0, 65535,0},{0, 65535, 65535},{0,0, 65535}
115
 
     , { 65535,0, 65535},{ 32000,0,0} }; 
116
 
static  long grey6[2][3] ={ {65534,65534,65534},{0,0,0} }; 
117
 
 
118
 
static bool grey=false;
119
 
static FILE *psfile = 0;
120
 
static FILE *psfile_save = 0;
121
 
static int LastColor=2;  //  pour est en couleur par defaut
122
 
 
123
 
const float fMinPixel = -32000;
124
 
const float fMaxPixel = +32000;
125
 
#define reel float 
126
 
 typedef struct XColor { 
127
 
  unsigned short red,green,blue;
128
 
} XColor;
129
 
static XColor *colortable;
130
 
static int ncolortable,fcolor;
131
 
static reel echx,echy,rxmin,rxmax,rymin,rymax;
132
 
static int  lacouleur=0, width, height, currx=0, curry=0;
133
 
#define call(i) i
134
 
static int INITGRAPH=0;
135
 
void myend();
136
 
void myend()
137
 
{
138
 
 if (INITGRAPH)
139
 
   closegraphique();
140
 
  cout << "the end" <<endl;
141
 
//  ExitToShell();
142
 
}
143
 
void myexit(int err) { 
144
 
  cout << " The End err=" << err << endl;
145
 
  exit(err);}
146
 
 
147
 
const char * edpfilenamearg=0;          
148
 
bool  waitatend=false;
149
 
 
150
 
#ifdef FREEFEM
151
 
#include <fstream.h>
152
 
#include <new.h>
153
 
 
154
 
void out_of_memory ();
155
 
void myexit(int );
156
 
void compile(char *fname);
157
 
 
158
 
 
159
 
int main (int argc, char **argv)
160
 
{
161
 
  atexit(myend);
162
 
  int OPTION = 0;
163
 
  if (argc == 2)
164
 
    {
165
 
       printf ("PROGRAM  FreeFem 1.0 %s \n",argv[1]);
166
 
       initgraphique();
167
 
       compile (argv[1]);
168
 
       closegraphique();
169
 
    }
170
 
  else
171
 
    printf ("To launch freefem you must type freefem  and a file name\n");
172
 
  return 0;
173
 
}
174
 
#else
175
 
void doatexitff();
176
 
void doatexitff()
177
 
{
178
 
#ifdef WIN32
179
 
  bool err=true;
180
 
  if(edpfilenamearg)
181
 
        {
182
 
        cout << " try getConsole " << edpfilenamearg << endl; 
183
 
        string fn = edpfilenamearg;
184
 
        err=GetConsoleBuff(fn);
185
 
        }       
186
 
  if( waitatend &&  err)
187
 
    {
188
 
      char c;  
189
 
      cout << "wait enter ? ";
190
 
      cin.get();
191
 
    }
192
 
#endif
193
 
 
194
 
}
195
 
extern int mymain(int argc,char **argv);
196
 
int main (int argc, char **argv)
197
 
{
198
 
  atexit(doatexitff);
199
 
  int ret=mymain(argc,argv);
200
 
  return ret;
201
 
}
202
 
 
203
 
 
204
 
#endif
205
 
void message(char *s);
206
 
void message(char *s)
207
 
{  printf("%s   \n",s);}
208
 
 
209
 
void erreur(char *s)
210
 
{ message(s); exit(0);}
211
 
void *safecalloc(size_t nb, size_t  size);
212
 
void *safecalloc(size_t nb, size_t  size)
213
 
{
214
 
  void* p=NULL;
215
 
  p = calloc(nb, size);
216
 
  if (p == NULL) printf("Run out of Memory!\n");
217
 
  return p;
218
 
}
219
 
void safefree(void** f);
220
 
void safefree(void** f)
221
 
{
222
 
  if(*f){ free((char*) *f); *f=NULL;}
223
 
}
224
 
void rflush();
225
 
void rflush()
226
 
{
227
 
}
228
 
 
229
 
 
230
 
int LaCouleur() {return  lacouleur;}
231
 
 
232
 
void couleur(int c)
233
 
234
 
  if ( lacouleur == c) // small optim
235
 
    return;
236
 
 
237
 
  c= c > LastColor ? 1 : c; // c=Min(c,LastColor); pour noir et blanc
238
 
 lacouleur = c;
239
 
    float r=1,g=1,b=1;
240
 
    if (colortable) {
241
 
      if (c>0 && c < ncolortable)
242
 
        {
243
 
          r =  (float) colortable[c].red /65535.;
244
 
          g =  (float) colortable[c].green /65535.;
245
 
          b =  (float) colortable[c].blue /65535.;
246
 
        }
247
 
    }
248
 
    else if (c!=0)
249
 
      r=g=b=0;
250
 
    if(psfile)
251
 
    fprintf(psfile,"%.3f %.3f %.3f C\n",r,g,b);
252
 
  
253
 
}
254
 
 
255
 
static XColor DefColorSansG( int k,int nb, bool hsv,bool ggrey,int nbcolors,float *colors)
256
 
{
257
 
 XColor C;
258
 
 float r,g,b;
259
 
extern void DefColor(float & r, float & g, float & b,
260
 
              int k,int nb, bool hsv,bool ggrey,int nbcolors,float *colors);
261
 
 DefColor(r,g,b,   k,nb,hsv,ggrey,nbcolors,colors);
262
 
 C.red= (short unsigned int) (65535*r);
263
 
 C.green=(short unsigned int)(65535*g);
264
 
 C.blue= (short unsigned int) (65535*b);
265
 
 return C;
266
 
267
 
void SetColorTable1(int nb,bool hsv,int nbcolors,float *colors)
268
 
{
269
 
  static bool greyo = !grey;
270
 
  static float *colorso =0;
271
 
  if(!INITGRAPH) return;
272
 
   if (ncolortable == nb && greyo == grey && colorso == colors ) return;// optim
273
 
   greyo = grey;
274
 
   colorso=colors;
275
 
   if (nbcolors && nb>2) 
276
 
     { 
277
 
       if(colortable) delete [] colortable;
278
 
       colortable = new XColor[nb];
279
 
       ncolortable = nb;
280
 
       if(LastColor>1) LastColor=nb-1;
281
 
        for (int i0=0;i0<nb;i0++)
282
 
         {  
283
 
           colortable[i0]=DefColorSansG(i0,nb,hsv,grey,nbcolors,colors);           
284
 
          }
285
 
        
286
 
       }
287
 
     else 
288
 
      ncolortable  =0;
289
 
}
290
 
void SetColorTable(int nb)
291
 
{
292
 
   if (fcolor  && nb>2 && nb < 256) 
293
 
     { 
294
 
       nb = Max(nb,8);
295
 
       if (ncolortable == nb) return;// optim
296
 
       if(colortable) delete [] colortable;
297
 
       colortable = new XColor[nb];
298
 
       ncolortable = nb;
299
 
       if(LastColor>1) LastColor=nb-1;
300
 
      // cout << "SetColorTable "<< nb << endl;
301
 
       int k=0;
302
 
       colortable[k].red= 65535;
303
 
       colortable[k].green= 65535;
304
 
       colortable[k].blue= 65535;
305
 
       k++;
306
 
       colortable[k].red=0;
307
 
       colortable[k].green=0;
308
 
       colortable[k].blue=0;
309
 
       k++;
310
 
       nb = nb -2;
311
 
       for (long i0=0;i0<nb;i0++,k++)
312
 
         {  
313
 
           //     long  i1 = nb - i0;
314
 
           long  i6 = i0*6;
315
 
           long  j0 = i6/nb;// in 0..6
316
 
           long  j1 = j0+1;// in 1..6
317
 
           long  k0 = i0 - (nb*j0)/6L;
318
 
           long  k1 = (nb*j1)/6L-i0;
319
 
           long  kk = k0+k1;
320
 
           //        cout <<k << " " << i0 << " " << j0 << " " << j1 << " " << k0 << " " << k1  << endl;
321
 
           if ( kk <= 0)
322
 
             { cerr << kk << " " << nb << " " << k0 << " " << k1 << " " << endl;
323
 
             assert(kk);
324
 
             }
325
 
      /*     colortable[k].red   = (unsigned short) ((long) (cube6[j1][0]*k0+cube6[j0][0]*k1)/kk);
326
 
           colortable[k].green = (unsigned short) ((long)  (cube6[j1][1]*k0+cube6[j0][1]*k1)/kk);
327
 
           colortable[k].blue  = (unsigned short) ((long) (cube6[j1][2]*k0+cube6[j0][2]*k1)/kk);*/
328
 
           if (! grey)
329
 
         {
330
 
           colortable[k].red   = (unsigned short) ((long) (cube6[j1][0]*k0+cube6[j0][0]*k1)/kk);
331
 
           colortable[k].green = (unsigned short) ((long)  (cube6[j1][1]*k0+cube6[j0][1]*k1)/kk);
332
 
           colortable[k].blue  = (unsigned short) ((long) (cube6[j1][2]*k0+cube6[j0][2]*k1)/kk);
333
 
           }
334
 
          else 
335
 
           {
336
 
           kk=nb-1;
337
 
           k1 =  i0;
338
 
           k0 = nb - i0 -1;
339
 
           j0=1;
340
 
           j1=0;
341
 
           colortable[k].red   = (unsigned short) ((long) (grey6[j1][0]*k0+grey6[j0][0]*k1)/kk);
342
 
           colortable[k].green = (unsigned short) ((long)  (grey6[j1][1]*k0+grey6[j0][1]*k1)/kk);
343
 
           colortable[k].blue  = (unsigned short) ((long) (grey6[j1][2]*k0+grey6[j0][2]*k1)/kk);
344
 
           }
345
 
           
346
 
           
347
 
           assert(k<ncolortable);
348
 
           //   cout <<colortable[k].pixel 
349
 
           //   << " r=" <<  colortable[k].red 
350
 
           //   << " g=" <<  colortable[k].green
351
 
           //   << " b=" <<colortable[k].blue <<endl;
352
 
          }
353
 
  }
354
 
 
355
 
 
356
 
// a faire 
357
 
}
358
 
void FlushEvent()
359
 
{
360
 
361
 
 
362
 
void initgraphique()
363
 
{
364
 
  colortable=0;
365
 
  ncolortable=0;
366
 
  LastColor=2;// En couleur par default
367
 
  fcolor=1;  /* des couleurs */
368
 
  SetColorTable(8);
369
 
  INITGRAPH = 1;
370
 
  width = 10000;// change FH mai 2012 to have more precis graphic for F.  Ortegon 
371
 
  height =  7071; // aspect ratio  \sqrt(2)
372
 
}
373
 
 
374
 
void closegraphique()
375
 
{
376
 
  if (INITGRAPH)
377
 
    {
378
 
      INITGRAPH = 0;
379
 
      delete [] colortable;
380
 
      closePS();
381
 
    }
382
 
}
383
 
 
384
 
void cadre(reel xmin,reel xmax,reel ymin,reel ymax)
385
 
{
386
 
  rxmin = xmin;
387
 
  rxmax = xmax;
388
 
  rymin = ymin;
389
 
  rymax = ymax;
390
 
 
391
 
  echx = width / (xmax - xmin);
392
 
  echy = height / (ymax - ymin);
393
 
}
394
 
 
395
 
void getcadre(reel &xmin,reel &xmax,reel &ymin,reel &ymax)
396
 
{
397
 
  xmin = rxmin;
398
 
  xmax = rxmax;
399
 
  ymin = rymin;
400
 
  ymax = rymax;
401
 
 
402
 
}
403
 
 
404
 
 
405
 
int InRecScreen(reel x1, reel y1,reel x2, reel y2)
406
 
{  
407
 
 
408
 
  return (Max(x1,x2)>= rxmin) && (Min(x1,x2) <= rxmax) && (Max(y1,y2) >= rymin) && (Min(y1,y2)  <= rymax);
409
 
}
410
 
int InPtScreen( reel x, reel y)
411
 
{
412
 
  return (x >= rxmin) && (x <= rxmax) && (y >= rymin) && (y <= rymax);
413
 
}
414
 
 
415
 
 
416
 
float scali(int i);
417
 
float scalj(int i);
418
 
float scalx(int i);
419
 
float scaly(int i);
420
 
float scali(int i)
421
 
{
422
 
  return i/echx  + rxmin;
423
 
}
424
 
float scalj(int j)
425
 
{
426
 
  return -j/echy  + rymax;
427
 
}
428
 
int scalx(reel x)
429
 
{
430
 
  return (int) Min(fMaxPixel,Max(fMinPixel,((x - rxmin) * echx)));
431
 
432
 
int scaly(reel y)
433
 
{
434
 
  return (int)Min(fMaxPixel,Max(fMinPixel,((rymax - y) * echy)));
435
 
}
436
 
 
437
 
void pointe(reel , reel )
438
 
{
439
 
}
440
 
 
441
 
void rmoveto(reel x, reel y)
442
 
{
443
 
  currx = scalx(x);
444
 
  curry = scaly(y);
445
 
}
446
 
 
447
 
void rlineto(reel x, reel y)
448
 
{
449
 
  int newx = scalx(x), newy = scaly(y);
450
 
  if (psfile)
451
 
    fprintf(psfile,"%d %d %d %d L\n",currx, height-curry, newx, height-newy);
452
 
  currx = newx; curry = newy;
453
 
}
454
 
 
455
 
void cadreortho(reel centrex, reel centrey, reel rayon)
456
 
{
457
 
 
458
 
  if (height < width)
459
 
  {
460
 
    rymin = centrey - rayon;
461
 
    rymax = centrey + rayon;
462
 
    echx = echy= height / (2 * rayon);
463
 
    rxmin= centrex - width / (2 * echx);
464
 
    rxmax= centrex + width / (2 * echx);
465
 
  }
466
 
  else
467
 
  {
468
 
    rxmin = centrex - rayon;
469
 
    rxmax = centrex + rayon;
470
 
    echx = echy = width / (2 * rayon);
471
 
    rymin = centrey - height / (2 * echy);
472
 
    rymax = centrey + height / (2 * echy);
473
 
  }
474
 
}
475
 
 
476
 
void plotstring (const char *  string)
477
 
{ //int l = strlen(string);
478
 
 if(psfile) fprintf(psfile,"(%s) %d %d  S\n",string,currx,height-curry);
479
 
}
480
 
 
481
 
void showgraphic()
482
 
{
483
 
}
484
 
void x11draw3(int * ptype);
485
 
 
486
 
void x11draw3(int * ptype)
487
 
{
488
 
  int type;
489
 
 
490
 
  type=  *ptype;
491
 
 
492
 
  if (psfile) 
493
 
    switch (type) {
494
 
    case 0  : {fprintf(psfile,"[] setdash\n");break;}
495
 
    case 1  : {fprintf(psfile,"[3]  setdash\n");break;}
496
 
    default : {fprintf(psfile,"[4 1] setdash\n");break;}
497
 
    }
498
 
 
499
 
}  
500
 
 
501
 
void penthickness(int pepais)
502
 
{
503
 
  if (psfile) fprintf(psfile,"%d setlinewidth\n",pepais*2);
504
 
}
505
 
 
506
 
void x11linsrn(int * ,int * ,int * ,int * );
507
 
void x11linsrn(int * ,int * ,int * ,int * )
508
 
  //int *x1,*x2,*y1,*y2;
509
 
{   
510
 
}
511
 
 
512
 
   
513
 
void viderbuff()
514
 
{
515
 
}
516
 
 
517
 
 
518
 
void cercle(reel , reel , reel );
519
 
void cercle(reel , reel , reel )
520
 
{
521
 
  //int r = (int) (rayon * echx);
522
 
}
523
 
void reffecran()
524
 
{
525
 
}
526
 
 
527
 
void fillpoly(int n, float *poly)
528
 
{
529
 
  int i;
530
 
   if (psfile) 
531
 
    {
532
 
     fprintf(psfile,"bF ");
533
 
     for (i=0;i<n;i++)
534
 
      fprintf(psfile,"%d %d ", scalx(poly[2*i]),height-scaly( poly[2*i+1]));
535
 
     fprintf(psfile,"eF\n");
536
 
    }
537
 
 
538
 
}
539
 
 
540
 
 
541
 
int  execute (const char * str)
542
 
543
 
 cout << "exec: " << str << endl;
544
 
 return  system(str);
545
 
}
546
 
 
547
 
char Getijc(int *x1,int *y1);
548
 
char Getijc(int *x1,int *y1)
549
 
{
550
 
  //char char1;
551
 
  *x1=0;
552
 
  *y1=0;
553
 
  //cout << "entre un caractere ? ";
554
 
  //cin >>char1 ;
555
 
  return 0;// char1;
556
 
}
557
 
   
558
 
char Getxyc(float &x,float &y)
559
 
560
 
  //  cout << " in Getxyc" << endl;
561
 
  char c;
562
 
  int i,j;
563
 
  c = Getijc( &i,&j);
564
 
  x = scali(i);
565
 
  y = scalj(j);
566
 
  //  cout << " out  Getxyc" << x << " " << y << " " << c << endl;
567
 
 
568
 
  return c;
569
 
}
570
 
void rattente(int )
571
 
{
572
 
}
573
 
 void GetScreenSize(int &ix,int &iy)
574
 
{
575
 
  ix = width;
576
 
  iy = height;
577
 
}
578
 
void openPS(const char *filename )
579
 
580
 
  char ffff[32];
581
 
  int count=0;
582
 
  if(psfile_save) closePS();
583
 
  time_t t_loc;
584
 
  int  widthA4PS=596;
585
 
  //int heightA4PS=842;
586
 
  float s= (double)widthA4PS/width;
587
 
  char  username[10];
588
 
  /*if (!cuserid(username)) */ strcpy(username,"inconnue");
589
 
  time(&t_loc);
590
 
  bool notfound;
591
 
  if( !filename) 
592
 
   do {
593
 
      struct stat buf;
594
 
      sprintf(ffff,"rgraph_%.3d.ps",count++);
595
 
      volatile int r= stat(ffff,&buf) ;
596
 
      notfound = r !=0;
597
 
      if(count>1000) break;
598
 
    } while ( !notfound );
599
 
   
600
 
 
601
 
  const char *fps (filename?filename:ffff);
602
 
 
603
 
  
604
 
  psfile=fopen(fps,"w");
605
 
  if(psfile) {
606
 
    psfile_save=psfile;
607
 
    fprintf(psfile,"%%!PS-Adobe-2.0 EPSF-2.0\n%%%%Creator: %s\n%%%%Title: FreeFem++\n","user");
608
 
    fprintf(psfile,"%%%%CreationDate: %s",ctime(&t_loc));
609
 
    fprintf(psfile,"%%%%Pages: 1\n");
610
 
    fprintf(psfile,"%%%%BoundingBox:       0 0 %d %d\n",int(width*s),int(height*s));
611
 
    fprintf(psfile,"%%%%EndComments\n");
612
 
    fprintf(psfile," /L {newpath moveto lineto stroke} def\n");
613
 
    fprintf(psfile," /C {setrgbcolor} def\n");
614
 
    fprintf(psfile," /rec {newpath 4 copy 8 1 roll moveto 3 -1 roll lineto 4 2 roll exch lineto lineto closepath} def\n");
615
 
    fprintf(psfile," %f %f  scale \n",s,s);
616
 
    fprintf(psfile," 0 %d 0 %d rec clip\n",int(width),int(height));
617
 
    fprintf(psfile," /Helvetica findfont 24 scalefont setfont\n");
618
 
    fprintf(psfile," /S {moveto show} def\n");
619
 
    fprintf(psfile," /bF  { mark} def \n");
620
 
    fprintf(psfile," /eF {newpath moveto counttomark 2 idiv {lineto} repeat closepath fill cleartomark} def\n");
621
 
    fprintf(psfile," /P { /yy exch def /xx exch def   xx xx 1 add yy yy 1 add  rec  fill } def\n");
622
 
    fprintf(psfile," 2 setlinewidth\n");
623
 
  }
624
 
  else 
625
 
    cerr << " Err openning postscript file " << fps << endl;
626
 
}
627
 
void closePS(void)
628
 
{
629
 
  if(psfile_save) {
630
 
    fprintf(psfile_save,"showpage\n");
631
 
    fclose(psfile_save);
632
 
  }
633
 
  psfile_save=0;
634
 
  psfile=0;
635
 
}
636
 
 void coutmode(short )  {}
637
 
// bof bof --- 
638
 
 float  GetHeigthFont()
639
 
640
 
  return 15./echy;
641
 
}
642
 
  void Commentaire(const char * c)  
643
 
  {
644
 
  if(psfile)   {
645
 
    fprintf(psfile,"%% %s\n",c);
646
 
   }
647
 
  }
648
 
  void NoirEtBlanc(int NB)
649
 
  {
650
 
    if(NB) LastColor=1;
651
 
    else LastColor=ncolortable?ncolortable:2;
652
 
  }
653
 
 
654
 
  void MettreDansPostScript(int in)
655
 
   {
656
 
     if(in)  psfile=psfile_save;     
657
 
     else   psfile=0;
658
 
   }
659
 
 
660
 
static void     FillRect(float x0,float y0, float x1, float y1)
661
 
 {
662
 
     float r[8];
663
 
     r[0]=x0;r[1]=y0;
664
 
     r[2]=x1;r[3]=y0;
665
 
     r[4]=x1;r[5]=y1;
666
 
     r[6]=x0;r[7]=y1;
667
 
     fillpoly(4,r);
668
 
 }
669
 
int PutLevel(int lineno, float xf, int col);
670
 
int PutLevel(int lineno, float xf, int col)
671
 
{
672
 
  float xmin,xmax,ymin,ymax;
673
 
  getcadre(xmin,xmax,ymin,ymax);
674
 
  float xleft = xmax - (xmax-xmin)*0.1;
675
 
  float ytop  = ymax;
676
 
  float ydelta = (ymax-ymin)/40;
677
 
  ydelta=GetHeigthFont();
678
 
  xleft = xmax - 6*ydelta;  
679
 
  ytop -= ydelta*(col+2);
680
 
  couleur(col);
681
 
  FillRect(xleft+ydelta/8.,ytop+ydelta/8.,xleft+ydelta*7./8.,ytop+ydelta*7./8.);
682
 
  rmoveto(xleft+ydelta*1.4,ytop+ydelta/4);
683
 
  char buf[30];
684
 
  sprintf(buf,"%g",xf);
685
 
  couleur(1);
686
 
  plotstring(buf);
687
 
 
688
 
   return lineno;
689
 
}
690
 
 void ShowHelp(const char * s,int k)
691
 
{
692
 
  if(k) {
693
 
    MettreDansPostScript(0);
694
 
    couleur(1);
695
 
    float xmin,xmax,ymin,ymax;
696
 
    getcadre(xmin,xmax,ymin,ymax);
697
 
    rmoveto(xmin+(xmax-xmin)/100,ymax-(k)*(ymax-ymin)/30);
698
 
    plotstring(s);
699
 
    MettreDansPostScript(1);
700
 
       //  couleur(1);  
701
 
  }
702
 
}
703
 
 
704
 
  void setgrey(bool gg ){grey=gg;}
705
 
  int getgrey(){ return grey;}
706
 
 
707
 
class Grid;
708
 
void SaveMesh(Grid &);
709
 
void SavePlot(int , Grid& , double *);
710
 
void SavePlot(int , Grid& , float *);
711
 
 
712
 
void SaveMesh(Grid &){}
713
 
void SavePlot(int , Grid& , double *){}
714
 
void SavePlot(int , Grid& , float *){}
715