/hpc_kernel_samples/sparse_linear_algebra/casestudies/pagerank-petsc/petsc-2.3.2-p10/src/sys/draw/impls/x/xops.c.html
HTML | 528 lines | 454 code | 74 blank | 0 comment | 0 complexity | 1558f133b350c104c31d1f9eb941cd7c MD5 | raw file
- <center><a href="xops.c">Actual source code: xops.c</a></center><br>
- <html>
- <head>
- <title></title>
- <meta name="generator" content="c2html 0.9.5">
- <meta name="date" content="2007-03-29T00:17:43+00:00">
- </head>
- <body bgcolor="#FFFFFF">
- <pre width="80">
- <a name="line2"> 2: </a><font color="#B22222">/*</font>
- <a name="line3"> 3: </a><font color="#B22222"> Defines the operations for the X <A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> implementation.</font>
- <a name="line4"> 4: </a><font color="#B22222">*/</font>
- <a name="line6"> 6: </a> #include <A href="../../../../../src/sys/draw/impls/x/ximpl.h.html">src/sys/draw/impls/x/ximpl.h</A>
- <a name="line8"> 8: </a><font color="#B22222">/*</font>
- <a name="line9"> 9: </a><font color="#B22222"> These macros transform from the users coordinates to the </font>
- <a name="line10"> 10: </a><font color="#B22222"> X-window pixel coordinates.</font>
- <a name="line11"> 11: </a><font color="#B22222">*/</font>
- <a name="line12"> 12: </a><strong><font color="#228B22">#define XTRANS(draw,xwin,x) \</font></strong>
- <a name="line13"> 13: </a><strong><font color="#228B22"> (int)(((xwin)->w)*((draw)->port_xl + (((x - (draw)->coor_xl)*\</font></strong>
- <a name="line14"> 14: </a><strong><font color="#228B22"> ((draw)->port_xr - (draw)->port_xl))/\</font></strong>
- <a name="line15"> 15: </a><strong><font color="#228B22"> ((draw)->coor_xr - (draw)->coor_xl))))</font></strong>
- <a name="line16"> 16: </a><strong><font color="#228B22">#define YTRANS(draw,xwin,y) \</font></strong>
- <a name="line17"> 17: </a><strong><font color="#228B22"> (int)(((xwin)->h)*(1.0-(draw)->port_yl - (((y - (draw)->coor_yl)*\</font></strong>
- <a name="line18"> 18: </a><strong><font color="#228B22"> ((draw)->port_yr - (draw)->port_yl))/\</font></strong>
- <a name="line19"> 19: </a><strong><font color="#228B22"> ((draw)->coor_yr - (draw)->coor_yl))))</font></strong>
- <a name="line23"> 23: </a><strong><font color="#4169E1"><a name="PetscDrawLine_X"></a><A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawLine_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> xl,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> yl,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> xr,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> yr,int cl)</font></strong>
- <a name="line24"> 24: </a>{
- <a name="line25"> 25: </a> PetscDraw_X* XiWin = (PetscDraw_X*)draw->data;
- <a name="line26"> 26: </a> int x1,y_1,x2,y2;
- <a name="line29"> 29: </a> XiSetColor(XiWin,cl);
- <a name="line30"> 30: </a> x1 = XTRANS(draw,XiWin,xl); x2 = XTRANS(draw,XiWin,xr);
- <a name="line31"> 31: </a> y_1 = YTRANS(draw,XiWin,yl); y2 = YTRANS(draw,XiWin,yr);
- <a name="line32"> 32: </a> XDrawLine(XiWin->disp,XiDrawable(XiWin),XiWin->gc.set,x1,y_1,x2,y2);
- <a name="line33"> 33: </a> <font color="#4169E1">return</font>(0);
- <a name="line34"> 34: </a>}
- <a name="line38"> 38: </a><strong><font color="#4169E1"><a name="PetscDrawPoint_X"></a>static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawPoint_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> x,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> y,int c)</font></strong>
- <a name="line39"> 39: </a>{
- <a name="line40"> 40: </a> int xx,yy;
- <a name="line41"> 41: </a> PetscDraw_X* XiWin = (PetscDraw_X*)draw->data;
- <a name="line44"> 44: </a> xx = XTRANS(draw,XiWin,x); yy = YTRANS(draw,XiWin,y);
- <a name="line45"> 45: </a> XiSetColor(XiWin,c);
- <a name="line46"> 46: </a> XDrawPoint(XiWin->disp,XiDrawable(XiWin),XiWin->gc.set,xx,yy);
- <a name="line47"> 47: </a> <font color="#4169E1">return</font>(0);
- <a name="line48"> 48: </a>}
- <a name="line52"> 52: </a><strong><font color="#4169E1"><a name="PetscDrawRectangle_X"></a>static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawRectangle_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> xl,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> yl,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> xr,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> yr,int c1,int c2,int c3,int c4)</font></strong>
- <a name="line53"> 53: </a>{
- <a name="line54"> 54: </a> PetscDraw_X* XiWin = (PetscDraw_X*)draw->data;
- <a name="line55"> 55: </a> int x1,y_1,w,h,c = (c1 + c2 + c3 + c4)/4;
- <a name="line58"> 58: </a> XiSetColor(XiWin,c);
- <a name="line59"> 59: </a> x1 = XTRANS(draw,XiWin,xl); w = XTRANS(draw,XiWin,xr) - x1;
- <a name="line60"> 60: </a> y_1 = YTRANS(draw,XiWin,yr); h = YTRANS(draw,XiWin,yl) - y_1;
- <a name="line61"> 61: </a> <font color="#4169E1">if</font> (w <= 0) w = 1; <font color="#4169E1">if</font> (h <= 0) h = 1;
- <a name="line62"> 62: </a> XFillRectangle(XiWin->disp,XiDrawable(XiWin),XiWin->gc.set,x1,y_1,w,h);
- <a name="line63"> 63: </a> <font color="#4169E1">return</font>(0);
- <a name="line64"> 64: </a>}
- <a name="line68"> 68: </a><strong><font color="#4169E1"><a name="PetscDrawEllipse_X"></a>static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawEllipse_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> Win, <A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> x, <A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> y, <A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> a, <A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> b, int c)</font></strong>
- <a name="line69"> 69: </a>{
- <a name="line70"> 70: </a> PetscDraw_X* XiWin = (PetscDraw_X*) Win->data;
- <a name="line71"> 71: </a> int xA, yA, w, h;
- <a name="line74"> 74: </a> XiSetColor(XiWin, c);
- <a name="line75"> 75: </a> xA = XTRANS(Win, XiWin, x - a/2.0); w = XTRANS(Win, XiWin, x + a/2.0) - xA;
- <a name="line76"> 76: </a> yA = YTRANS(Win, XiWin, y + b/2.0); h = YTRANS(Win, XiWin, y - b/2.0) - yA;
- <a name="line77"> 77: </a> XFillArc(XiWin->disp, XiDrawable(XiWin), XiWin->gc.set, xA, yA, w, h, 0, 23040);
- <a name="line78"> 78: </a> <font color="#4169E1">return</font>(0);
- <a name="line79"> 79: </a>}
- <a name="line81"> 81: </a><strong><font color="#4169E1">EXTERN <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawInterpolatedTriangle_X(PetscDraw_X*,int,int,int,int,int,int,int,int,int)</font></strong>;
- <a name="line85"> 85: </a><strong><font color="#4169E1"><a name="PetscDrawTriangle_X"></a>static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawTriangle_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> X1,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> Y_1,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> X2,</font></strong>
- <a name="line86"> 86: </a><strong><font color="#4169E1"> <A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> Y2,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> X3,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> Y3,int c1,int c2,int c3)</font></strong>
- <a name="line87"> 87: </a>{
- <a name="line88"> 88: </a> PetscDraw_X* XiWin = (PetscDraw_X*)draw->data;
- <a name="line92"> 92: </a> <font color="#4169E1">if</font> (c1 == c2 && c2 == c3) {
- <a name="line93"> 93: </a> XPoint pt[3];
- <a name="line94"> 94: </a> XiSetColor(XiWin,c1);
- <a name="line95"> 95: </a> pt[0].x = XTRANS(draw,XiWin,X1);
- <a name="line96"> 96: </a> pt[0].y = YTRANS(draw,XiWin,Y_1);
- <a name="line97"> 97: </a> pt[1].x = XTRANS(draw,XiWin,X2);
- <a name="line98"> 98: </a> pt[1].y = YTRANS(draw,XiWin,Y2);
- <a name="line99"> 99: </a> pt[2].x = XTRANS(draw,XiWin,X3);
- <a name="line100">100: </a> pt[2].y = YTRANS(draw,XiWin,Y3);
- <a name="line101">101: </a> XFillPolygon(XiWin->disp,XiDrawable(XiWin),XiWin->gc.set,pt,3,Convex,CoordModeOrigin);
- <a name="line102">102: </a> } <font color="#4169E1">else</font> {
- <a name="line103">103: </a> int x1,y_1,x2,y2,x3,y3;
- <a name="line104">104: </a> x1 = XTRANS(draw,XiWin,X1);
- <a name="line105">105: </a> y_1 = YTRANS(draw,XiWin,Y_1);
- <a name="line106">106: </a> x2 = XTRANS(draw,XiWin,X2);
- <a name="line107">107: </a> y2 = YTRANS(draw,XiWin,Y2);
- <a name="line108">108: </a> x3 = XTRANS(draw,XiWin,X3);
- <a name="line109">109: </a> y3 = YTRANS(draw,XiWin,Y3);
- <a name="line110">110: </a> PetscDrawInterpolatedTriangle_X(XiWin,x1,y_1,c1,x2,y2,c2,x3,y3,c3);
- <a name="line111">111: </a> }
- <a name="line112">112: </a> <font color="#4169E1">return</font>(0);
- <a name="line113">113: </a>}
- <a name="line117">117: </a><strong><font color="#4169E1"><a name="PetscDrawString_X"></a>static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawString_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> x,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> y,int c,const char chrs[])</font></strong>
- <a name="line118">118: </a>{
- <a name="line120">120: </a> int xx,yy;
- <a name="line121">121: </a> size_t len;
- <a name="line122">122: </a> PetscDraw_X *XiWin = (PetscDraw_X*)draw->data;
- <a name="line123">123: </a> char *substr;
- <a name="line124">124: </a> <A href="../../../../../docs/manualpages/Sys/PetscToken.html#PetscToken">PetscToken</A> *token;
- <a name="line127">127: </a> xx = XTRANS(draw,XiWin,x); yy = YTRANS(draw,XiWin,y);
- <a name="line128">128: </a> XiSetColor(XiWin,c);
- <a name="line129">129: </a>
- <a name="line130">130: </a> <A href="../../../../../docs/manualpages/Sys/PetscTokenCreate.html#PetscTokenCreate">PetscTokenCreate</A>(chrs,'\n',&token);
- <a name="line131">131: </a> <A href="../../../../../docs/manualpages/Sys/PetscTokenFind.html#PetscTokenFind">PetscTokenFind</A>(token,&substr);
- <a name="line132">132: </a> <A href="../../../../../docs/manualpages/Sys/PetscStrlen.html#PetscStrlen">PetscStrlen</A>(substr,&len);
- <a name="line133">133: </a> XDrawString(XiWin->disp,XiDrawable(XiWin),XiWin->gc.set,xx,yy - XiWin->font->font_descent,substr,len);
- <a name="line134">134: </a> <A href="../../../../../docs/manualpages/Sys/PetscTokenFind.html#PetscTokenFind">PetscTokenFind</A>(token,&substr);
- <a name="line135">135: </a> <font color="#4169E1">while</font> (substr) {
- <a name="line136">136: </a> yy += 4*XiWin->font->font_descent;
- <a name="line137">137: </a> <A href="../../../../../docs/manualpages/Sys/PetscStrlen.html#PetscStrlen">PetscStrlen</A>(substr,&len);
- <a name="line138">138: </a> XDrawString(XiWin->disp,XiDrawable(XiWin),XiWin->gc.set,xx,yy - XiWin->font->font_descent,substr,len);
- <a name="line139">139: </a> <A href="../../../../../docs/manualpages/Sys/PetscTokenFind.html#PetscTokenFind">PetscTokenFind</A>(token,&substr);
- <a name="line140">140: </a> }
- <a name="line141">141: </a> <A href="../../../../../docs/manualpages/Sys/PetscTokenDestroy.html#PetscTokenDestroy">PetscTokenDestroy</A>(token);
- <a name="line143">143: </a> <font color="#4169E1">return</font>(0);
- <a name="line144">144: </a>}
- <a name="line146">146: </a><strong><font color="#4169E1">EXTERN <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> XiFontFixed(PetscDraw_X*,int,int,XiFont **)</font></strong>;
- <a name="line150">150: </a><strong><font color="#4169E1"><a name="PetscDrawStringSetSize_X"></a>static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawStringSetSize_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> x,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> y)</font></strong>
- <a name="line151">151: </a>{
- <a name="line152">152: </a> PetscDraw_X* XiWin = (PetscDraw_X*)draw->data;
- <a name="line154">154: </a> int w,h;
- <a name="line157">157: </a> w = (int)((XiWin->w)*x*(draw->port_xr - draw->port_xl)/(draw->coor_xr - draw->coor_xl));
- <a name="line158">158: </a> h = (int)((XiWin->h)*y*(draw->port_yr - draw->port_yl)/(draw->coor_yr - draw->coor_yl));
- <a name="line159">159: </a> <A href="../../../../../docs/manualpages/Sys/PetscFree.html#PetscFree">PetscFree</A>(XiWin->font);
- <a name="line160">160: </a> XiFontFixed(XiWin,w,h,&XiWin->font);
- <a name="line161">161: </a> <font color="#4169E1">return</font>(0);
- <a name="line162">162: </a>}
- <a name="line166">166: </a><strong><font color="#4169E1"><a name="PetscDrawStringGetSize_X"></a><A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawStringGetSize_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> *x,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> *y)</font></strong>
- <a name="line167">167: </a>{
- <a name="line168">168: </a> PetscDraw_X* XiWin = (PetscDraw_X*)draw->data;
- <a name="line169">169: </a> <A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> w,h;
- <a name="line172">172: </a> w = XiWin->font->font_w; h = XiWin->font->font_h;
- <a name="line173">173: </a> *x = w*(draw->coor_xr - draw->coor_xl)/(XiWin->w)*(draw->port_xr - draw->port_xl);
- <a name="line174">174: </a> *y = h*(draw->coor_yr - draw->coor_yl)/(XiWin->h)*(draw->port_yr - draw->port_yl);
- <a name="line175">175: </a> <font color="#4169E1">return</font>(0);
- <a name="line176">176: </a>}
- <a name="line180">180: </a><strong><font color="#4169E1"><a name="PetscDrawStringVertical_X"></a><A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawStringVertical_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> x,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> y,int c,const char chrs[])</font></strong>
- <a name="line181">181: </a>{
- <a name="line183">183: </a> int xx,yy;
- <a name="line184">184: </a> PetscDraw_X *XiWin = (PetscDraw_X*)draw->data;
- <a name="line185">185: </a> char tmp[2];
- <a name="line186">186: </a> <A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> tw,th;
- <a name="line187">187: </a> size_t i,n;
- <a name="line188">188: </a>
- <a name="line190">190: </a> <A href="../../../../../docs/manualpages/Sys/PetscStrlen.html#PetscStrlen">PetscStrlen</A>(chrs,&n);
- <a name="line191">191: </a> tmp[1] = 0;
- <a name="line192">192: </a> XiSetColor(XiWin,c);
- <a name="line193">193: </a> PetscDrawStringGetSize_X(draw,&tw,&th);
- <a name="line194">194: </a> xx = XTRANS(draw,XiWin,x);
- <a name="line195">195: </a> <font color="#4169E1">for</font> (i=0; i<n; i++) {
- <a name="line196">196: </a> tmp[0] = chrs[i];
- <a name="line197">197: </a> yy = YTRANS(draw,XiWin,y-th*i);
- <a name="line198">198: </a> XDrawString(XiWin->disp,XiDrawable(XiWin),XiWin->gc.set,
- <a name="line199">199: </a> xx,yy - XiWin->font->font_descent,tmp,1);
- <a name="line200">200: </a> }
- <a name="line201">201: </a> <font color="#4169E1">return</font>(0);
- <a name="line202">202: </a>}
- <a name="line206">206: </a><strong><font color="#4169E1"><a name="PetscDrawFlush_X"></a>static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawFlush_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw)</font></strong>
- <a name="line207">207: </a>{
- <a name="line208">208: </a> PetscDraw_X* XiWin = (PetscDraw_X*)draw->data;
- <a name="line211">211: </a> <font color="#4169E1">if</font> (XiWin->drw) {
- <a name="line212">212: </a> XCopyArea(XiWin->disp,XiWin->drw,XiWin->win,XiWin->gc.set,0,0,XiWin->w,XiWin->h,0,0);
- <a name="line213">213: </a> }
- <a name="line214">214: </a> XFlush(XiWin->disp); XSync(XiWin->disp,False);
- <a name="line215">215: </a> <font color="#4169E1">return</font>(0);
- <a name="line216">216: </a>}
- <a name="line220">220: </a><strong><font color="#4169E1"><a name="PetscDrawSynchronizedFlush_X"></a>static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawSynchronizedFlush_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw)</font></strong>
- <a name="line221">221: </a>{
- <a name="line223">223: </a> <A href="../../../../../docs/manualpages/Sys/PetscMPIInt.html#PetscMPIInt">PetscMPIInt</A> <A href="../../../../../docs/manualpages/Sys/rank.html#rank">rank</A>;
- <a name="line224">224: </a> PetscDraw_X* XiWin = (PetscDraw_X*)draw->data;
- <a name="line227">227: </a> XFlush(XiWin->disp);
- <a name="line228">228: </a> <font color="#4169E1">if</font> (XiWin->drw) {
- <a name="line229">229: </a> <A href="http://www.mcs.anl.gov/mpi/www/www3/MPI_Comm_rank.html#MPI_Comm_rank">MPI_Comm_rank</A>(draw-><A href="../../../../../docs/manualpages/Sys/comm.html#comm">comm</A>,&<A href="../../../../../docs/manualpages/Sys/rank.html#rank">rank</A>);
- <a name="line230">230: </a> <font color="#B22222">/* make sure data has actually arrived at server */</font>
- <a name="line231">231: </a> XSync(XiWin->disp,False);
- <a name="line232">232: </a> <A href="http://www.mcs.anl.gov/mpi/www/www3/MPI_Barrier.html#MPI_Barrier">MPI_Barrier</A>(draw-><A href="../../../../../docs/manualpages/Sys/comm.html#comm">comm</A>);
- <a name="line233">233: </a> <font color="#4169E1">if</font> (!<A href="../../../../../docs/manualpages/Sys/rank.html#rank">rank</A>) {
- <a name="line234">234: </a> XCopyArea(XiWin->disp,XiWin->drw,XiWin->win,XiWin->gc.set,0,0,XiWin->w,XiWin->h,0,0);
- <a name="line235">235: </a> XFlush(XiWin->disp);
- <a name="line236">236: </a> }
- <a name="line237">237: </a> XSync(XiWin->disp,False);
- <a name="line238">238: </a> <A href="http://www.mcs.anl.gov/mpi/www/www3/MPI_Barrier.html#MPI_Barrier">MPI_Barrier</A>(draw-><A href="../../../../../docs/manualpages/Sys/comm.html#comm">comm</A>);
- <a name="line239">239: </a> } <font color="#4169E1">else</font> {
- <a name="line240">240: </a> <A href="http://www.mcs.anl.gov/mpi/www/www3/MPI_Barrier.html#MPI_Barrier">MPI_Barrier</A>(draw-><A href="../../../../../docs/manualpages/Sys/comm.html#comm">comm</A>);
- <a name="line241">241: </a> XSync(XiWin->disp,False);
- <a name="line242">242: </a> <A href="http://www.mcs.anl.gov/mpi/www/www3/MPI_Barrier.html#MPI_Barrier">MPI_Barrier</A>(draw-><A href="../../../../../docs/manualpages/Sys/comm.html#comm">comm</A>);
- <a name="line243">243: </a> }
- <a name="line244">244: </a> <font color="#4169E1">return</font>(0);
- <a name="line245">245: </a>}
- <a name="line249">249: </a><strong><font color="#4169E1"><a name="PetscDrawSetViewport_X"></a>static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawSetViewport_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> xl,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> yl,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> xr,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> yr)</font></strong>
- <a name="line250">250: </a>{
- <a name="line251">251: </a> PetscDraw_X* XiWin = (PetscDraw_X*)draw->data;
- <a name="line252">252: </a> XRectangle box;
- <a name="line255">255: </a> box.x = (int)(xl*XiWin->w); box.y = (int)((1.0-yr)*XiWin->h);
- <a name="line256">256: </a> box.width = (int)((xr-xl)*XiWin->w);box.height = (int)((yr-yl)*XiWin->h);
- <a name="line257">257: </a> XSetClipRectangles(XiWin->disp,XiWin->gc.set,0,0,&box,1,Unsorted);
- <a name="line258">258: </a> <font color="#4169E1">return</font>(0);
- <a name="line259">259: </a>}
- <a name="line263">263: </a><strong><font color="#4169E1"><a name="PetscDrawClear_X"></a>static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawClear_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw)</font></strong>
- <a name="line264">264: </a>{
- <a name="line265">265: </a> PetscDraw_X* XiWin = (PetscDraw_X*)draw->data;
- <a name="line266">266: </a> int x, y, w, h;
- <a name="line269">269: </a> x = (int)(draw->port_xl*XiWin->w);
- <a name="line270">270: </a> w = (int)((draw->port_xr - draw->port_xl)*XiWin->w);
- <a name="line271">271: </a> y = (int)((1.0-draw->port_yr)*XiWin->h);
- <a name="line272">272: </a> h = (int)((draw->port_yr - draw->port_yl)*XiWin->h);
- <a name="line273">273: </a> XiSetPixVal(XiWin,XiWin->background);
- <a name="line274">274: </a> XFillRectangle(XiWin->disp,XiDrawable(XiWin),XiWin->gc.set,x,y,w,h);
- <a name="line275">275: </a> <font color="#4169E1">return</font>(0);
- <a name="line276">276: </a>}
- <a name="line280">280: </a><strong><font color="#4169E1"><a name="PetscDrawSynchronizedClear_X"></a>static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawSynchronizedClear_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw)</font></strong>
- <a name="line281">281: </a>{
- <a name="line283">283: </a> <A href="../../../../../docs/manualpages/Sys/PetscMPIInt.html#PetscMPIInt">PetscMPIInt</A> <A href="../../../../../docs/manualpages/Sys/rank.html#rank">rank</A>;
- <a name="line284">284: </a> PetscDraw_X* XiWin = (PetscDraw_X*)draw->data;
- <a name="line287">287: </a> <A href="http://www.mcs.anl.gov/mpi/www/www3/MPI_Barrier.html#MPI_Barrier">MPI_Barrier</A>(draw-><A href="../../../../../docs/manualpages/Sys/comm.html#comm">comm</A>);
- <a name="line288">288: </a> <A href="http://www.mcs.anl.gov/mpi/www/www3/MPI_Comm_rank.html#MPI_Comm_rank">MPI_Comm_rank</A>(draw-><A href="../../../../../docs/manualpages/Sys/comm.html#comm">comm</A>,&<A href="../../../../../docs/manualpages/Sys/rank.html#rank">rank</A>);
- <a name="line289">289: </a> <font color="#4169E1">if</font> (!<A href="../../../../../docs/manualpages/Sys/rank.html#rank">rank</A>) {
- <a name="line290">290: </a> PetscDrawClear_X(draw);
- <a name="line291">291: </a> }
- <a name="line292">292: </a> XFlush(XiWin->disp);
- <a name="line293">293: </a> <A href="http://www.mcs.anl.gov/mpi/www/www3/MPI_Barrier.html#MPI_Barrier">MPI_Barrier</A>(draw-><A href="../../../../../docs/manualpages/Sys/comm.html#comm">comm</A>);
- <a name="line294">294: </a> XSync(XiWin->disp,False);
- <a name="line295">295: </a> <A href="http://www.mcs.anl.gov/mpi/www/www3/MPI_Barrier.html#MPI_Barrier">MPI_Barrier</A>(draw-><A href="../../../../../docs/manualpages/Sys/comm.html#comm">comm</A>);
- <a name="line296">296: </a> <font color="#4169E1">return</font>(0);
- <a name="line297">297: </a>}
- <a name="line301">301: </a><strong><font color="#4169E1"><a name="PetscDrawSetDoubleBuffer_X"></a>static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawSetDoubleBuffer_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw)</font></strong>
- <a name="line302">302: </a>{
- <a name="line303">303: </a> PetscDraw_X* win = (PetscDraw_X*)draw->data;
- <a name="line305">305: </a> <A href="../../../../../docs/manualpages/Sys/PetscMPIInt.html#PetscMPIInt">PetscMPIInt</A> <A href="../../../../../docs/manualpages/Sys/rank.html#rank">rank</A>;
- <a name="line308">308: </a> <font color="#4169E1">if</font> (win->drw) <font color="#4169E1">return</font>(0);
- <a name="line310">310: </a> <A href="http://www.mcs.anl.gov/mpi/www/www3/MPI_Comm_rank.html#MPI_Comm_rank">MPI_Comm_rank</A>(draw-><A href="../../../../../docs/manualpages/Sys/comm.html#comm">comm</A>,&<A href="../../../../../docs/manualpages/Sys/rank.html#rank">rank</A>);
- <a name="line311">311: </a> <font color="#4169E1">if</font> (!<A href="../../../../../docs/manualpages/Sys/rank.html#rank">rank</A>) {
- <a name="line312">312: </a> win->drw = XCreatePixmap(win->disp,win->win,win->w,win->h,win->depth);
- <a name="line313">313: </a> }
- <a name="line314">314: </a> <font color="#B22222">/* try to make sure it is actually done before passing info to all */</font>
- <a name="line315">315: </a> XSync(win->disp,False);
- <a name="line316">316: </a> <A href="http://www.mcs.anl.gov/mpi/www/www3/MPI_Bcast.html#MPI_Bcast">MPI_Bcast</A>(&win->drw,1,MPI_UNSIGNED_LONG,0,draw-><A href="../../../../../docs/manualpages/Sys/comm.html#comm">comm</A>);
- <a name="line317">317: </a> <font color="#4169E1">return</font>(0);
- <a name="line318">318: </a>}
- <a name="line320">320: </a><font color="#A020F0">#include <X11/cursorfont.h></font>
- <a name="line324">324: </a><strong><font color="#4169E1"><a name="PetscDrawGetMouseButton_X"></a>static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawGetMouseButton_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw,<A href="../../../../../docs/manualpages/Draw/PetscDrawButton.html#PetscDrawButton">PetscDrawButton</A> *button,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A>* x_user,</font></strong>
- <a name="line325">325: </a><strong><font color="#4169E1"> <A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> *y_user,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> *x_phys,<A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> *y_phys)</font></strong>
- <a name="line326">326: </a>{
- <a name="line327">327: </a> XEvent report;
- <a name="line328">328: </a> PetscDraw_X* win = (PetscDraw_X*)draw->data;
- <a name="line329">329: </a> Window root,child;
- <a name="line330">330: </a> int root_x,root_y,px,py;
- <a name="line331">331: </a> unsigned int keys_button;
- <a name="line332">332: </a> Cursor cursor = 0;
- <a name="line335">335: </a> <font color="#B22222">/* change cursor to indicate input */</font>
- <a name="line336">336: </a> <font color="#4169E1">if</font> (!cursor) {
- <a name="line337">337: </a> cursor = XCreateFontCursor(win->disp,XC_hand2);
- <a name="line338">338: </a> <font color="#4169E1">if</font> (!cursor) <A href="../../../../../docs/manualpages/Sys/SETERRQ.html#SETERRQ">SETERRQ</A>(PETSC_ERR_LIB,<font color="#666666">"Unable to create X cursor"</font>);
- <a name="line339">339: </a> }
- <a name="line340">340: </a> XDefineCursor(win->disp,win->win,cursor);
- <a name="line342">342: </a> XSelectInput(win->disp,win->win,ButtonPressMask | ButtonReleaseMask);
- <a name="line344">344: </a> <font color="#4169E1">while</font> (XCheckTypedEvent(win->disp,ButtonPress,&report));
- <a name="line345">345: </a> XMaskEvent(win->disp,ButtonReleaseMask,&report);
- <a name="line346">346: </a> <font color="#4169E1">switch</font> (report.xbutton.button) {
- <a name="line347">347: </a> <font color="#4169E1">case</font> Button1:
- <a name="line348">348: </a> <font color="#4169E1">if</font> (report.xbutton.state & ShiftMask)
- <a name="line349">349: </a> *button = BUTTON_LEFT_SHIFT;
- <a name="line350">350: </a> <font color="#4169E1">else</font>
- <a name="line351">351: </a> *button = BUTTON_LEFT;
- <a name="line352">352: </a> <font color="#4169E1">break</font>;
- <a name="line353">353: </a> <font color="#4169E1">case</font> Button2:
- <a name="line354">354: </a> <font color="#4169E1">if</font> (report.xbutton.state & ShiftMask)
- <a name="line355">355: </a> *button = BUTTON_CENTER_SHIFT;
- <a name="line356">356: </a> <font color="#4169E1">else</font>
- <a name="line357">357: </a> *button = BUTTON_CENTER;
- <a name="line358">358: </a> <font color="#4169E1">break</font>;
- <a name="line359">359: </a> <font color="#4169E1">case</font> Button3:
- <a name="line360">360: </a> <font color="#4169E1">if</font> (report.xbutton.state & ShiftMask)
- <a name="line361">361: </a> *button = BUTTON_RIGHT_SHIFT;
- <a name="line362">362: </a> <font color="#4169E1">else</font>
- <a name="line363">363: </a> *button = BUTTON_RIGHT;
- <a name="line364">364: </a> <font color="#4169E1">break</font>;
- <a name="line365">365: </a> }
- <a name="line366">366: </a> XQueryPointer(win->disp,report.xmotion.window,&root,&child,&root_x,&root_y,&px,&py,&keys_button);
- <a name="line368">368: </a> <font color="#4169E1">if</font> (x_phys) *x_phys = ((double)px)/((double)win->w);
- <a name="line369">369: </a> <font color="#4169E1">if</font> (y_phys) *y_phys = 1.0 - ((double)py)/((double)win->h);
- <a name="line371">371: </a> <font color="#4169E1">if</font> (x_user) *x_user = draw->coor_xl + ((((double)px)/((double)win->w)-draw->port_xl))*
- <a name="line372">372: </a> (draw->coor_xr - draw->coor_xl)/(draw->port_xr - draw->port_xl);
- <a name="line373">373: </a> <font color="#4169E1">if</font> (y_user) *y_user = draw->coor_yl +
- <a name="line374">374: </a> ((1.0 - ((double)py)/((double)win->h)-draw->port_yl))*
- <a name="line375">375: </a> (draw->coor_yr - draw->coor_yl)/(draw->port_yr - draw->port_yl);
- <a name="line377">377: </a> XUndefineCursor(win->disp,win->win);
- <a name="line378">378: </a> XFlush(win->disp); XSync(win->disp,False);
- <a name="line379">379: </a> <font color="#4169E1">return</font>(0);
- <a name="line380">380: </a>}
- <a name="line384">384: </a><strong><font color="#4169E1"><a name="PetscDrawPause_X"></a>static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawPause_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw)</font></strong>
- <a name="line385">385: </a>{
- <a name="line389">389: </a> <font color="#4169E1">if</font> (draw->pause > 0) <A href="../../../../../docs/manualpages/Sys/PetscSleep.html#PetscSleep">PetscSleep</A>(draw->pause);
- <a name="line390">390: </a> <font color="#4169E1">else</font> <font color="#4169E1">if</font> (draw->pause < 0) {
- <a name="line391">391: </a> <A href="../../../../../docs/manualpages/Draw/PetscDrawButton.html#PetscDrawButton">PetscDrawButton</A> button;
- <a name="line392">392: </a> <A href="../../../../../docs/manualpages/Sys/PetscMPIInt.html#PetscMPIInt">PetscMPIInt</A> <A href="../../../../../docs/manualpages/Sys/rank.html#rank">rank</A>;
- <a name="line393">393: </a> <A href="http://www.mcs.anl.gov/mpi/www/www3/MPI_Comm_rank.html#MPI_Comm_rank">MPI_Comm_rank</A>(draw-><A href="../../../../../docs/manualpages/Sys/comm.html#comm">comm</A>,&<A href="../../../../../docs/manualpages/Sys/rank.html#rank">rank</A>);
- <a name="line394">394: </a> <font color="#4169E1">if</font> (!<A href="../../../../../docs/manualpages/Sys/rank.html#rank">rank</A>) {
- <a name="line395">395: </a> <A href="../../../../../docs/manualpages/Draw/PetscDrawGetMouseButton.html#PetscDrawGetMouseButton">PetscDrawGetMouseButton</A>(draw,&button,0,0,0,0);
- <a name="line396">396: </a> <font color="#4169E1">if</font> (button == BUTTON_CENTER) draw->pause = 0;
- <a name="line397">397: </a> }
- <a name="line398">398: </a> <A href="http://www.mcs.anl.gov/mpi/www/www3/MPI_Bcast.html#MPI_Bcast">MPI_Bcast</A>(&draw->pause,1,MPI_INT,0,draw-><A href="../../../../../docs/manualpages/Sys/comm.html#comm">comm</A>);
- <a name="line399">399: </a> }
- <a name="line400">400: </a> <font color="#4169E1">return</font>(0);
- <a name="line401">401: </a>}
- <a name="line405">405: </a><strong><font color="#4169E1"><a name="PetscDrawGetPopup_X"></a>static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawGetPopup_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw,<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> *popup)</font></strong>
- <a name="line406">406: </a>{
- <a name="line408">408: </a> PetscDraw_X* win = (PetscDraw_X*)draw->data;
- <a name="line411">411: </a> <A href="../../../../../docs/manualpages/Draw/PetscDrawOpenX.html#PetscDrawOpenX">PetscDrawOpenX</A>(draw-><A href="../../../../../docs/manualpages/Sys/comm.html#comm">comm</A>,<A href="../../../../../docs/manualpages/Sys/PETSC_NULL.html#PETSC_NULL">PETSC_NULL</A>,<A href="../../../../../docs/manualpages/Sys/PETSC_NULL.html#PETSC_NULL">PETSC_NULL</A>,win->x,win->y+win->h+36,150,220,popup);
- <a name="line412">412: </a> draw->popup = *popup;
- <a name="line413">413: </a> <font color="#4169E1">return</font>(0);
- <a name="line414">414: </a>}
- <a name="line418">418: </a><strong><font color="#4169E1"><a name="PetscDrawSetTitle_X"></a>static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawSetTitle_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw,const char title[])</font></strong>
- <a name="line419">419: </a>{
- <a name="line420">420: </a> PetscDraw_X *win = (PetscDraw_X*)draw->data;
- <a name="line421">421: </a> XTextProperty prop;
- <a name="line423">423: </a> size_t len;
- <a name="line426">426: </a> XGetWMName(win->disp,win->win,&prop);
- <a name="line427">427: </a> prop.value = (unsigned char *)title;
- <a name="line428">428: </a> <A href="../../../../../docs/manualpages/Sys/PetscStrlen.html#PetscStrlen">PetscStrlen</A>(title,&len);
- <a name="line429">429: </a> prop.nitems = (long) len;
- <a name="line430">430: </a> XSetWMName(win->disp,win->win,&prop);
- <a name="line431">431: </a> <font color="#4169E1">return</font>(0);
- <a name="line432">432: </a>}
- <a name="line436">436: </a><strong><font color="#4169E1"><a name="PetscDrawResizeWindow_X"></a>static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawResizeWindow_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw,int w,int h)</font></strong>
- <a name="line437">437: </a>{
- <a name="line438">438: </a> PetscDraw_X *win = (PetscDraw_X*)draw->data;
- <a name="line439">439: </a> unsigned int ww,hh,border,depth;
- <a name="line440">440: </a> int x,y;
- <a name="line442">442: </a> Window root;
- <a name="line445">445: </a> XResizeWindow(win->disp,win->win,w,h);
- <a name="line446">446: </a> XGetGeometry(win->disp,win->win,&root,&x,&y,&ww,&hh,&border,&depth);
- <a name="line447">447: </a> <A href="../../../../../docs/manualpages/Draw/PetscDrawCheckResizedWindow.html#PetscDrawCheckResizedWindow">PetscDrawCheckResizedWindow</A>(draw);
- <a name="line448">448: </a> <font color="#4169E1">return</font>(0);
- <a name="line449">449: </a>}
- <a name="line453">453: </a><strong><font color="#4169E1"><a name="PetscDrawCheckResizedWindow_X"></a>static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawCheckResizedWindow_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw)</font></strong>
- <a name="line454">454: </a>{
- <a name="line455">455: </a> PetscDraw_X *win = (PetscDraw_X*)draw->data;
- <a name="line457">457: </a> int x,y;
- <a name="line458">458: </a> <A href="../../../../../docs/manualpages/Sys/PetscMPIInt.html#PetscMPIInt">PetscMPIInt</A> <A href="../../../../../docs/manualpages/Sys/rank.html#rank">rank</A>;
- <a name="line459">459: </a> Window root;
- <a name="line460">460: </a> unsigned int w,h,border,depth,geo[2];
- <a name="line461">461: </a> <A href="../../../../../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A> xl,xr,yl,yr;
- <a name="line462">462: </a> XRectangle box;
- <a name="line465">465: </a> <A href="http://www.mcs.anl.gov/mpi/www/www3/MPI_Comm_rank.html#MPI_Comm_rank">MPI_Comm_rank</A>(draw-><A href="../../../../../docs/manualpages/Sys/comm.html#comm">comm</A>,&<A href="../../../../../docs/manualpages/Sys/rank.html#rank">rank</A>);
- <a name="line466">466: </a> <font color="#4169E1">if</font> (!<A href="../../../../../docs/manualpages/Sys/rank.html#rank">rank</A>) {
- <a name="line467">467: </a> XSync(win->disp,False);
- <a name="line468">468: </a> XGetGeometry(win->disp,win->win,&root,&x,&y,geo,geo+1,&border,&depth);
- <a name="line469">469: </a> }
- <a name="line470">470: </a> <A href="http://www.mcs.anl.gov/mpi/www/www3/MPI_Bcast.html#MPI_Bcast">MPI_Bcast</A>(geo,2,MPI_INT,0,draw-><A href="../../../../../docs/manualpages/Sys/comm.html#comm">comm</A>);
- <a name="line471">471: </a> w = geo[0];
- <a name="line472">472: </a> h = geo[1];
- <a name="line473">473: </a> <font color="#4169E1">if</font> (w == (unsigned int) win->w && h == (unsigned int) win->h) <font color="#4169E1">return</font>(0);
- <a name="line475">475: </a> <font color="#B22222">/* record new window sizes */</font>
- <a name="line477">477: </a> win->h = h; win->w = w;
- <a name="line479">479: </a> <font color="#B22222">/* Free buffer space and create new version (only first processor does this) */</font>
- <a name="line480">480: </a> <font color="#4169E1">if</font> (win->drw) {
- <a name="line481">481: </a> win->drw = XCreatePixmap(win->disp,win->win,win->w,win->h,win->depth);
- <a name="line482">482: </a> }
- <a name="line483">483: </a> <font color="#B22222">/* reset the clipping */</font>
- <a name="line484">484: </a> xl = draw->port_xl; yl = draw->port_yl;
- <a name="line485">485: </a> xr = draw->port_xr; yr = draw->port_yr;
- <a name="line486">486: </a> box.x = (int)(xl*win->w); box.y = (int)((1.0-yr)*win->h);
- <a name="line487">487: </a> box.width = (int)((xr-xl)*win->w);box.height = (int)((yr-yl)*win->h);
- <a name="line488">488: </a> XSetClipRectangles(win->disp,win->gc.set,0,0,&box,1,Unsorted);
- <a name="line490">490: </a> <font color="#B22222">/* try to make sure it is actually done before passing info to all */</font>
- <a name="line491">491: </a> XSync(win->disp,False);
- <a name="line492">492: </a> <A href="http://www.mcs.anl.gov/mpi/www/www3/MPI_Bcast.html#MPI_Bcast">MPI_Bcast</A>(&win->drw,1,MPI_UNSIGNED_LONG,0,draw-><A href="../../../../../docs/manualpages/Sys/comm.html#comm">comm</A>);
- <a name="line493">493: </a> <font color="#4169E1">return</font>(0);
- <a name="line494">494: </a>}
- <a name="line496">496: </a><strong><font color="#4169E1">static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawGetSingleton_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A>,<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A>*)</font></strong>;
- <a name="line497">497: </a><strong><font color="#4169E1">static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawRestoreSingleton_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A>,<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A>*)</font></strong>;
- <a name="line501">501: </a><strong><font color="#4169E1"><a name="PetscDrawDestroy_X"></a><A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawDestroy_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw)</font></strong>
- <a name="line502">502: </a>{
- <a name="line503">503: </a> PetscDraw_X *win = (PetscDraw_X*)draw->data;
- <a name="line507">507: </a> XFreeGC(win->disp,win->gc.set);
- <a name="line508">508: </a> XCloseDisplay(win->disp);
- <a name="line509">509: </a> <font color="#4169E1">if</font> (draw->popup) {<A href="../../../../../docs/manualpages/Draw/PetscDrawDestroy.html#PetscDrawDestroy">PetscDrawDestroy</A>(draw->popup);}
- <a name="line510">510: </a> <A href="../../../../../docs/manualpages/Sys/PetscFree.html#PetscFree">PetscFree</A>(win->font);
- <a name="line511">511: </a> <A href="../../../../../docs/manualpages/Sys/PetscFree.html#PetscFree">PetscFree</A>(win);
- <a name="line512">512: </a> <font color="#4169E1">return</font>(0);
- <a name="line513">513: </a>}
- <a name="line515">515: </a>static <font color="#4169E1">struct _PetscDrawOps</font> DvOps = { PetscDrawSetDoubleBuffer_X,
- <a name="line516">516: </a> PetscDrawFlush_X,PetscDrawLine_X,
- <a name="line517">517: </a> 0,
- <a name="line518">518: </a> 0,
- <a name="line519">519: </a> PetscDrawPoint_X,
- <a name="line520">520: </a> 0,
- <a name="line521">521: </a> PetscDrawString_X,
- <a name="line522">522: </a> PetscDrawStringVertical_X,
- <a name="line523">523: </a> PetscDrawStringSetSize_X,
- <a name="line524">524: </a> PetscDrawStringGetSize_X,
- <a name="line525">525: </a> PetscDrawSetViewport_X,
- <a name="line526">526: </a> PetscDrawClear_X,
- <a name="line527">527: </a> PetscDrawSynchronizedFlush_X,
- <a name="line528">528: </a> PetscDrawRectangle_X,
- <a name="line529">529: </a> PetscDrawTriangle_X,
- <a name="line530">530: </a> PetscDrawEllipse_X,
- <a name="line531">531: </a> PetscDrawGetMouseButton_X,
- <a name="line532">532: </a> PetscDrawPause_X,
- <a name="line533">533: </a> PetscDrawSynchronizedClear_X,
- <a name="line534">534: </a> 0,
- <a name="line535">535: </a> 0,
- <a name="line536">536: </a> PetscDrawGetPopup_X,
- <a name="line537">537: </a> PetscDrawSetTitle_X,
- <a name="line538">538: </a> PetscDrawCheckResizedWindow_X,
- <a name="line539">539: </a> PetscDrawResizeWindow_X,
- <a name="line540">540: </a> PetscDrawDestroy_X,
- <a name="line541">541: </a> 0,
- <a name="line542">542: </a> PetscDrawGetSingleton_X,
- <a name="line543">543: </a> PetscDrawRestoreSingleton_X };
- <a name="line546">546: </a><strong><font color="#4169E1">EXTERN <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> XiQuickWindow(PetscDraw_X*,char*,char*,int,int,int,int)</font></strong>;
- <a name="line547">547: </a><strong><font color="#4169E1">EXTERN <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> XiQuickWindowFromWindow(PetscDraw_X*,char*,Window)</font></strong>;
- <a name="line551">551: </a><strong><font color="#4169E1"><a name="PetscDrawGetSingleton_X"></a>static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawGetSingleton_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw,<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> *sdraw)</font></strong>
- <a name="line552">552: </a>{
- <a name="line554">554: </a> PetscDraw_X *Xwin = (PetscDraw_X*)draw->data,*sXwin;
- <a name="line558">558: </a> <A href="../../../../../docs/manualpages/Draw/PetscDrawCreate.html#PetscDrawCreate">PetscDrawCreate</A>(<A href="../../../../../docs/manualpages/Sys/PETSC_COMM_SELF.html#PETSC_COMM_SELF">PETSC_COMM_SELF</A>,draw->display,draw->title,draw->x,draw->y,draw->w,draw->h,sdraw);
- <a name="line559">559: </a> PetscObjectChangeTypeName((<A href="../../../../../docs/manualpages/Sys/PetscObject.html#PetscObject">PetscObject</A>)*sdraw,PETSC_DRAW_X);
- <a name="line560">560: </a> <A href="../../../../../docs/manualpages/Sys/PetscMemcpy.html#PetscMemcpy">PetscMemcpy</A>((*sdraw)->ops,&DvOps,<font color="#4169E1">sizeof</font>(DvOps));
- <a name="line561">561: </a> (*sdraw)->ops->destroy = 0;
- <a name="line563">563: </a> (*sdraw)->pause = draw->pause;
- <a name="line564">564: </a> (*sdraw)->coor_xl = draw->coor_xl;
- <a name="line565">565: </a> (*sdraw)->coor_xr = draw->coor_xr;
- <a name="line566">566: </a> (*sdraw)->coor_yl = draw->coor_yl;
- <a name="line567">567: </a> (*sdraw)->coor_yr = draw->coor_yr;
- <a name="line568">568: </a> (*sdraw)->port_xl = draw->port_xl;
- <a name="line569">569: </a> (*sdraw)->port_xr = draw->port_xr;
- <a name="line570">570: </a> (*sdraw)->port_yl = draw->port_yl;
- <a name="line571">571: </a> (*sdraw)->port_yr = draw->port_yr;
- <a name="line572">572: </a> (*sdraw)->popup = draw->popup;
- <a name="line574">574: </a> <font color="#B22222">/* actually create and open the window */</font>
- <a name="line575">575: </a> <A href="../../../../../docs/manualpages/Sys/PetscNew.html#PetscNew">PetscNew</A>(PetscDraw_X,&sXwin);
- <a name="line576">576: </a> XiQuickWindowFromWindow(sXwin,draw->display,Xwin->win);
- <a name="line578">578: </a> sXwin->x = Xwin->x;
- <a name="line579">579: </a> sXwin->y = Xwin->y;
- <a name="line580">580: </a> sXwin->w = Xwin->w;
- <a name="line581">581: </a> sXwin->h = Xwin->h;
- <a name="line582">582: </a> (*sdraw)->data = (void*)sXwin;
- <a name="line583">583: </a> <font color="#4169E1">return</font>(0);
- <a name="line584">584: </a>}
- <a name="line588">588: </a><strong><font color="#4169E1"><a name="PetscDrawRestoreSingleton_X"></a>static <A href="../../../../../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> PetscDrawRestoreSingleton_X(<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> draw,<A href="../../../../../docs/manualpages/Draw/PetscDraw.html#PetscDraw">PetscDraw</A> *sdraw)</font></strong>
- <a name="line589">589: </a>{
- <a name="line591">591: </a> PetscDraw_X *sXwin = (PetscDraw_X*)(*sdraw)->data;
- <a name="line594">594: </a> XFreeGC(sXwin->disp,sXwin->gc.set);
- <a name="line595">595: </a> XCloseDisplay(sXwin->disp);
- <a name="line596">596: </a> <font color="#4169E1">if</font> ((*sdraw)->popup) {<A href="../../../../../docs/manualpages/Draw/PetscDrawDestroy.html#PetscDrawDestroy">PetscDrawDestroy</A>((*sdraw)->popup);}
- <a name="line597">597: </a> <A href="../../../../../docs/manualpages/Sys/PetscStrfree.html#PetscStrfree">PetscStrfree</A>((*sdraw)->title);
- <a name="line598">598: </a> <A href="../../../../../docs/manualpages/Sys/PetscStrfree.html#PetscStrfree">PetscStrfree</A>((*sdraw)->display);
- <a name="line599">599: </a> <A href="../../../../../docs/manualpages/Sys/PetscFree.html#PetscFree">PetscFree</A>(sXwin->font);
- <a name="line600">600: </a> <A href="../../../../../docs/manualpages/Sys/PetscFree.html#PetscFree">PetscFree</A>(sXwin);
- <a name="line601">601: </a> PetscHeaderDestroy(*sdraw);
- <a name="line602">602: </a> <font color="#4169E1">return</font>(0);
- <a name="line603">603: </a>}
- <a name="line607">607: </a><strong><font color="#4169E1"><a name="PetscDrawXGetDisplaySize_Private"></a><A href="../../../../../docs/manualp