File: PetscVFPrintf.html

package info (click to toggle)
petsc 3.2.dfsg-6
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 124,660 kB
  • sloc: ansic: 342,250; cpp: 62,975; python: 32,761; fortran: 17,337; makefile: 15,867; xml: 621; objc: 594; sh: 492; java: 381; f90: 347; csh: 245
file content (73 lines) | stat: -rw-r--r-- 2,596 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML3.2 EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="DOCTEXT">
<TITLE>PetscVFPrintf</TITLE>
</HEAD>
<BODY BGCOLOR="FFFFFF">
<A NAME="PetscVFPrintf"><H1>PetscVFPrintf</H1></A>
All PETSc standard out and error messages are sent through this function; so, in theory, this can can be replaced with something that does not simply write to a file.  
<H3><FONT COLOR="#CC3333">Synopsis</FONT></H3>
<PRE>
PetscErrorCode  PetscVFPrintfDefault(FILE *fd,const char *format,va_list Argp)
</PRE>
To use, write your own function for example,
.<A HREF="../Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> mypetscvfprintf(FILE *fd,const char format[],va_list Argp)
</pre>
.{ $  <A HREF="../Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> ierr;
</pre>
<pre>
</pre>
<pre>
 <A HREF="../Sys/PetscFunctionBegin.html#PetscFunctionBegin">PetscFunctionBegin</A>;
</pre>
<pre>
  if (fd != stdout &amp;&amp; fd != stderr) {  handle regular files 
</pre>
<pre>
     ierr = PetscVFPrintfDefault(fd,format,Argp); CHKERR(ierr);
</pre>
<pre>
 } else {
</pre>
<pre>
    char   buff[BIG];
</pre>
<pre>
    size_t length;
</pre>
<pre>
    ierr = <A HREF="../Sys/PetscVSNPrintf.html#PetscVSNPrintf">PetscVSNPrintf</A>(buff,BIG,format,&amp;length,Argp);<A HREF="../Sys/CHKERRQ.html#CHKERRQ">CHKERRQ</A>(ierr);
</pre>
<pre>
    now send buff to whatever stream or whatever you want 
</pre>
<pre>
}
</pre>
<pre>
<A HREF="../Sys/PetscFunctionReturn.html#PetscFunctionReturn">PetscFunctionReturn</A>(0);
</pre>
.} then before the call to <A HREF="../Sys/PetscInitialize.html#PetscInitialize">PetscInitialize</A>() do the assignment
</pre>
<pre>
   <A HREF="../Sys/PetscVFPrintf.html#PetscVFPrintf">PetscVFPrintf</A> = mypetscvfprintf;
</pre>
<P>
Notes: For error messages this may be called by any process, for regular standard out it is
called only by process 0 of a given communicator
<P>
No error handling because may be called by error handler
<P>

<P>
<H3><FONT COLOR="#CC3333">See Also</FONT></H3>
 <A HREF="../Sys/PetscVSNPrintf.html#PetscVSNPrintf">PetscVSNPrintf</A>(), <A HREF="../Sys/PetscErrorPrintf.html#PetscErrorPrintf">PetscErrorPrintf</A>()
<BR>
<P>
<P><B><P><B><FONT COLOR="#CC3333">Level:</FONT></B>developer
<BR><FONT COLOR="#CC3333">Location:</FONT></B><A HREF="../../../src/sys/fileio/mprint.c.html#PetscVFPrintf">src/sys/fileio/mprint.c</A>
<BR><A HREF="./index.html">Index of all Sys routines</A>
<BR><A HREF="../../index.html">Table of Contents for all manual pages</A>
<BR><A HREF="../singleindex.html">Index of all manual pages</A>
</BODY></HTML>