Hi, thanks for the answers first of all. I have another question though ... :)
Say, i want to print a specific element from a PETSc global vector. Is there a function (PetscSunchFPrintF does not do this i believe) to which i simply pass the file handle, communicator, the vector and the element and it writes the value to the file? thanks mat On Wednesday 13 September 2006 17:13, Berend van Wachem wrote: > Hi Matt, > > > i need to read in an input file. So to open my file i use PETSCFOpen > > which works fine. But then my problems begin ... :) > > > > I guess i need to tell only the first proc in the communicator to fscan. > > But is there a PETSC function that returns me the processor id? > > And when i read the parameters in on the first proc i need to broadcast > > them to the other procs. Does PETSC have anything for this? > > For both issues you can use standard MPI: > > to get the processor ID: > ierr=MPI_Comm_rank(MPI_Comm Communicator,int *rank); > > to broadcast information: > ierr=MPI_Bcast ( void *buffer, int count, MPI_Datatype datatype, int > root, MPI_Comm comm ) > > If possible, I would recommend you to use the PetscViewer interface for > your IO handling; it is very easy. > > Good luck, > > Berend.
