On 9/15/06, <b class="gmail_sendername">Matt Funk</b> <<a href="mailto:mafunk@nmsu.edu">mafunk@nmsu.edu</a>> wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br><br>thanks for the answers first of all. I have another question though ... :)<br><br>Say, i want to print a specific element from a PETSc global vector. Is there a<br>function (PetscSunchFPrintF does not do this i believe) to which i simply
<br>pass the file handle, communicator, the vector and the element and it writes<br>the value to the file?</blockquote><div><br>
No, this function does not currently exist. Are these elements local? If not, it<br>
would entail communication. If so, you could use VecGetArray() and then just<br>
index in. Is that sufficient?<br>
<br>
thanks,<br>
<br>
Matt<br>
</div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">thanks<br>mat<br><br>On Wednesday 13 September 2006 17:13, Berend van Wachem wrote:
<br>> Hi Matt,<br>><br>> > i need to read in an input file. So to open my file i use PETSCFOpen<br>> > which works fine. But then my problems begin ... :)<br>> ><br>> > I guess i need to tell only the first proc in the communicator to fscan.
<br>> > But is there a PETSC function that returns me the processor id?<br>> > And when i read the parameters in on the first proc i need to broadcast<br>> > them to the other procs. Does PETSC have anything for this?
<br>><br>> For both issues you can use standard MPI:<br>><br>> to get the processor ID:<br>> ierr=MPI_Comm_rank(MPI_Comm Communicator,int *rank);<br>><br>> to broadcast information:<br>> ierr=MPI_Bcast ( void *buffer, int count, MPI_Datatype datatype, int
<br>> root, MPI_Comm comm )<br>><br>> If possible, I would recommend you to use the PetscViewer interface for<br>> your IO handling; it is very easy.<br>><br>> Good luck,<br>><br>> Berend.<br><br>
</blockquote></div><br><br clear="all"><br>-- <br>"Failure has a thousand explanations. Success doesn't need one" -- Sir Alec Guiness