diff -r cc1ab864f3d2 src/docs/tex/manual/manual.tex --- a/src/docs/tex/manual/manual.tex Tue Jun 28 07:12:12 2011 -0500 +++ b/src/docs/tex/manual/manual.tex Tue Jun 28 22:29:25 2011 +0100 @@ -89,6 +89,7 @@ \begin{figure*}[hbt] \centerline{\includegraphics{titlepage2}} +\caption{} \end{figure*} @@ -151,6 +152,7 @@ \pagestyle{empty} \begin{figure*}[hbt] \centerline{\includegraphics{endpage}} +\caption{} \end{figure*} \end{document} diff -r cc1ab864f3d2 src/docs/tex/manual/part1.tex --- a/src/docs/tex/manual/part1.tex Tue Jun 28 07:12:12 2011 -0500 +++ b/src/docs/tex/manual/part1.tex Tue Jun 28 22:29:25 2011 +0100 @@ -250,14 +250,14 @@ \trl{MPI_Init()} (or have the other library do it), and then call PetscInitialize(). By default, PetscInitialize() sets the PETSc ``world'' -communicator, given by PETSC_COMM_WORLD, to \trl{MPI_COMM_WORLD}. +communicator, given by PETSC\_COMM\_WORLD, to \trl{MPI_COMM_WORLD}. For those not familar with MPI, a {\em communicator} is a way of indicating a collection of processes that will be involved together in a calculation or communication. Communicators have the variable type \trl{MPI_Comm}. In most cases users can employ the communicator -PETSC_COMM_WORLD to indicate all processes in a given run and -PETSC_COMM_SELF to indicate a single process. +PETSC\_COMM\_WORLD to indicate all processes in a given run and +PETSC\_COMM\_SELF to indicate a single process. MPI provides routines for generating new communicators consisting of subsets of processors, @@ -336,7 +336,7 @@ As shown in Figure~\ref{fig_example1}, the user can input control data at run time using the options database. In this example the command -PetscOptionsGetInt(PETSC_NULL,"-n",\&n,\&flg); checks whether the user has +PetscOptionsGetInt(PETSC\_NULL,"-n",\&n,\&flg); checks whether the user has provided a command line option to set the value of \trl{n}, the problem dimension. If so, the variable \trl{n} is set accordingly; otherwise, \trl{n} remains unchanged. A complete description of the @@ -353,7 +353,7 @@ VecSetSizes(Vec x, int m, int M); \end{tabbing} where \trl{comm} denotes the MPI communicator and \trl{m} is the optional local size -which may be PETSC_DECIDE. The type of storage +which may be PETSC\_DECIDE. The type of storage for the vector may be set with either calls to VecSetType() or VecSetFromOptions(). Additional vectors of the same type can be formed with @@ -363,7 +363,7 @@ The commands \begin{tabbing} VecSet(Vec x,PetscScalar value);\\ - VecSetValues(Vec x,int n,int *indices,PetscScalar *values,INSERT_VALUES); + VecSetValues(Vec x,int n,int *indices,PetscScalar *values,INSERT\_VALUES); \end{tabbing} respectively set all the components of a vector to a particular scalar value and assign a different value to each component. More @@ -402,7 +402,7 @@ matrix entries. See MatType for a list of all matrix types. Values can then be set with the command \begin{tabbing} - MatSetValues(Mat A,int m,int *im,int n,int *in,PetscScalar *values,INSERT_VALUES); + MatSetValues(Mat A,int m,int *im,int n,int *in,PetscScalar *values,INSERT\_VALUES); \end{tabbing} After all elements have been inserted into the matrix, it must be processed with the pair of commands diff -r cc1ab864f3d2 src/docs/tex/manual/part2.tex --- a/src/docs/tex/manual/part2.tex Tue Jun 28 07:12:12 2011 -0500 +++ b/src/docs/tex/manual/part2.tex Tue Jun 28 22:29:25 2011 +0100 @@ -39,7 +39,7 @@ one can use the command \begin{tabbing} - VecCreateSeq(PETSC_COMM_SELF,int m,Vec *x); + VecCreateSeq(PETSC\_COMM\_SELF,int m,Vec *x); \end{tabbing} To create a parallel vector one can either specify the number of components that will be stored on each process or let PETSc decide. @@ -51,7 +51,7 @@ comm, where \trl{m} indicates the number of components to store on the local process, and \trl{M} is the total number of vector components. Either the local or global -dimension, but not both, can be set to PETSC_DECIDE to +dimension, but not both, can be set to PETSC\_DECIDE to \findex{PETSC_DECIDE} indicate that PETSc should determine it. More generally, one can use the routines \begin{tabbing} @@ -83,7 +83,7 @@ code. Assigning a set of components is a two-step process: one first calls \begin{tabbing} - VecSetValues(Vec x,int n,int *indices,PetscScalar *values,INSERT_VALUES); + VecSetValues(Vec x,int n,int *indices,PetscScalar *values,INSERT\_VALUES); \end{tabbing} any number of times on any or all of the processes. The argument \trl{n} gives the number of components being set in this @@ -112,7 +112,7 @@ add values. This process \sindex{vector values, setting} is also done with the command \begin{tabbing} - VecSetValues(Vec x,int n,int *indices, PetscScalar *values,ADD_VALUES); + VecSetValues(Vec x,int n,int *indices, PetscScalar *values,ADD\_VALUES); \end{tabbing} Again one must call the assembly routines VecAssemblyBegin() and VecAssemblyEnd() after all of the values @@ -126,8 +126,8 @@ its value. (In this case the addition and insertion actions could be performed in either order, thus resulting in different values at the particular location. Since -PETSc does not allow the simultaneous use of INSERT_VALUES and -ADD_VALUES this nondeterministic behavior will not occur in PETSc.) +PETSc does not allow the simultaneous use of INSERT\_VALUES and +ADD\_VALUES this nondeterministic behavior will not occur in PETSc.) You can called VecGetValues() to pull local values from a vector (but not off-process values), @@ -140,10 +140,10 @@ VecView(Vec x,PetscViewer v); \end{tabbing} To print the vector to the screen, one can use the viewer -PETSC_VIEWER_STDOUT_WORLD, +PETSC\_VIEWER\_STDOUT\_WORLD, which ensures that parallel vectors are printed correctly to \trl{stdout}. To display the vector in an X-window, one can use the -default X-windows viewer PETSC_VIEWER_DRAW_WORLD, +default X-windows viewer PETSC\_VIEWER\_DRAW\_WORLD, or one can create a viewer with the routine PetscViewerDrawOpenX(). A variety of viewers are discussed further in Section \ref{sec_viewers}. @@ -184,13 +184,13 @@ \sindex{vectors, user-supplied arrays} Such vectors can be created with the routines \begin{tabbing} - VecCreateSeqWithArray(PETSC_COMM_SELF,int n,PetscScalar *array,Vec *V); + VecCreateSeqWithArray(PETSC\_COMM\_SELF,int n,PetscScalar *array,Vec *V); \end{tabbing} and \begin{tabbing} VecCreateMPIWithArray(MPI\_Comm comm,int n,int N,PetscScalar *array,Vec *vv); \end{tabbing} -Note that here one must provide the value \trl{n}, it cannot be PETSC_DECIDE and +Note that here one must provide the value \trl{n}, it cannot be PETSC\_DECIDE and the user is responsible for providing enough space in the array; {\em n*sizeof(PetscScalar)}. @@ -235,7 +235,7 @@ basic vector operations to support within the PETSc vector library. These operations were selected because they often arise in application codes. The NormType argument to VecNorm() is one of -NORM_1, NORM_2, or NORM_INFINITY. +NORM\_1, NORM\_2, or NORM\_INFINITY. \sindex{2-norm} \sindex{1-norm} \sindex{infinity norm} The 1-norm is $ \sum_i |x_{i}|$, the 2-norm is $( \sum_{i} x_{i}^{2})^{1/2} $ and the @@ -288,20 +288,20 @@ \begin{tabbing} VecDot(Vec x,Vec y,PetscScalar *dot);\\ VecMDot(Vec x,PetscInt nv, Vec y[],PetscScalar *dot);\\ - VecNorm(Vec x,NormType NORM_2,PetscReal *norm2);\\ - VecNorm(Vec x,NormType NORM_1,PetscReal *norm1); + VecNorm(Vec x,NormType NORM\_2,PetscReal *norm2);\\ + VecNorm(Vec x,NormType NORM\_1,PetscReal *norm1); \end{tabbing} This code works fine, the problem is that it performs three separate parallel communication operations. Instead one can write \begin{tabbing} VecDotBegin(Vec x,Vec y,PetscScalar *dot);\\ VecMDotBegin(Vec x, PetscInt nv,Vec y[],PetscScalar *dot);\\ - VecNormBegin(Vec x,NormType NORM_2,PetscReal *norm2);\\ - VecNormBegin(Vec x,NormType NORM_1,PetscReal *norm1);\\ + VecNormBegin(Vec x,NormType NORM\_2,PetscReal *norm2);\\ + VecNormBegin(Vec x,NormType NORM\_1,PetscReal *norm1);\\ VecDotEnd(Vec x,Vec y,PetscScalar *dot);\\ VecMDotEnd(Vec x, PetscInt nv,Vec y[],PetscScalar *dot);\\ - VecNormEnd(Vec x,NormType NORM_2,PetscReal *norm2);\\ - VecNormEnd(Vec x,NormType NORM_1,PetscReal *norm1); + VecNormEnd(Vec x,NormType NORM\_2,PetscReal *norm2);\\ + VecNormEnd(Vec x,NormType NORM\_1,PetscReal *norm1); \end{tabbing} With this code, the communication is delayed until the first call to @@ -373,11 +373,11 @@ The user can create the PETSc-AO mappings in a number of ways. For example, if using two processes, one could call \begin{tabbing} - AOCreateBasic(PETSC_COMM_WORLD,2,\{0,3\},\{3,4\},\&ao); + AOCreateBasic(PETSC\_COMM\_WORLD,2,\{0,3\},\{3,4\},\&ao); \end{tabbing} on the first process and \begin{tabbing} - AOCreateBasic(PETSC_COMM_WORLD,3,\{1,2,4\},\{2,1,0\},\&ao); + AOCreateBasic(PETSC\_COMM\_WORLD,3,\{1,2,4\},\{2,1,0\},\&ao); \end{tabbing} on the other process. @@ -481,7 +481,7 @@ potentially \trl{nout} is smaller than \trl{nin}. One must pass in an array long enough to hold all the indices. One can call ISGlobalToLocalMappingApply() with \trl{idxout} equal to -PETSC_NULL to determine the required length (returned in +PETSC\_NULL to determine the required length (returned in \trl{nout}) and then allocate the required space and call ISGlobalToLocalMappingApply() a second time to set the values. @@ -495,7 +495,7 @@ \sindex{vectors, setting values with local numbering} and then call \begin{tabbing} - VecSetValuesLocal(Vec x,int n,const int indices[],const PetscScalar values[],INSERT_VALUES); + VecSetValuesLocal(Vec x,int n,const int indices[],const PetscScalar values[],INSERT\_VALUES); \end{tabbing} Now the \trl{indices} use the local numbering, rather than the global, meaning the entries lie in $[0,n)$ where $n$ is the local size of the vector. @@ -552,7 +552,7 @@ denote the process partition in each direction; \trl{m*n} must equal the number of processes in the MPI communicator, \trl{comm}. Instead of specifying the process layout, one may use -PETSC_DECIDE for \trl{m} and \trl{n} +PETSC\_DECIDE for \trl{m} and \trl{n} so that PETSc will determine the partition using MPI. The type of periodicity of the array is specified by \trl{wrap}, which can be \trl{DA_NONPERIODIC} \findex{DA_NONPERIODIC} (no periodicity), @@ -563,7 +563,7 @@ and \trl{s} is the stencil width (i.e., the width of the ghost point region). The optional arrays \trl{lx} and \trl{ly} may contain the number of nodes along the x and y axis for each cell, i.e. the dimension of \trl{lx} is -\trl{m} and the dimension of \trl{ly} is \trl{n}; or PETSC_NULL +\trl{m} and the dimension of \trl{ly} is \trl{n}; or PETSC\_NULL may be passed in. Two types of distributed array communication data structures @@ -652,7 +652,7 @@ generated by DMCreateGlobalVector() and DMCreateLocalVector() (or be duplicates of such a vector obtained via VecDuplicate()). -The InsertMode can be either ADD_VALUES or INSERT_VALUES. +The InsertMode can be either ADD\_VALUES or INSERT\_VALUES. One can scatter the local patches into the distributed vector with the command @@ -766,7 +766,7 @@ The output argument \trl{n} contains the number of local nodes, including ghost nodes, while \trl{idx} contains a list of length \trl{n} containing the global indices that correspond to the local nodes. Either -parameter may be omitted by passing PETSC_NULL. Note that the Fortran +parameter may be omitted by passing PETSC\_NULL. Note that the Fortran interface differs slightly; see Section~\ref{sec_fortranarrays} for details. \item or to set up the vectors and matrices so that their entries may be @@ -901,8 +901,8 @@ to another, one uses the following set of commands: \begin{tabbing} VecScatterCreate(Vec x,IS ix,Vec y,IS iy,VecScatter *ctx);\\ - VecScatterBegin(VecScatter ctx,Vec x,Vec y,INSERT_VALUES,SCATTER_FORWARD);\\ - VecScatterEnd(VecScatter ctx,Vec x,Vec y,INSERT_VALUES,SCATTER_FORWARD);\\ + VecScatterBegin(VecScatter ctx,Vec x,Vec y,INSERT\_VALUES,SCATTER\_FORWARD);\\ + VecScatterEnd(VecScatter ctx,Vec x,Vec y,INSERT\_VALUES,SCATTER\_FORWARD);\\ VecScatterDestroy(VecScatter *ctx); \end{tabbing} Here \trl{ix} denotes the index set of the first vector, while \trl{ @@ -911,11 +911,11 @@ number of entries in the index set of the first vector, \trl{ix}, equal the number in the destination index set, \trl{iy}, and that the vectors be long enough to contain all the indices referred to in the -index sets. The argument INSERT_VALUES specifies that the +index sets. The argument INSERT\_VALUES specifies that the vector elements will be inserted into the specified locations of the destination vector, overwriting any existing values. To add the components, rather than insert them, the user should select the option -ADD_VALUES instead of INSERT_VALUES. +ADD\_VALUES instead of INSERT\_VALUES. To perform a conventional gather operation, the user simply makes the destination index set, @@ -930,21 +930,21 @@ from sequential vectors to a parallel vector, each process has its own sequential vector that makes contributions to the parallel vector. -{\em Caution}: When INSERT_VALUES is used, if two different +{\em Caution}: When INSERT\_VALUES is used, if two different processes contribute different values to the same component in a parallel vector, either value may end up being inserted. When -ADD_VALUES is used, the correct sum is added to the correct +ADD\_VALUES is used, the correct sum is added to the correct location. In some cases one may wish to ``undo'' a scatter, that is perform the scatter backwards switching the roles of the sender and receiver. This is done by using \begin{tabbing} - VecScatterBegin(VecScatter ctx,Vec y,Vec x,INSERT_VALUES,SCATTER_REVERSE);\\ - VecScatterEnd(VecScatter ctx,Vec y,Vec x,INSERT_VALUES,SCATTER_REVERSE); + VecScatterBegin(VecScatter ctx,Vec y,Vec x,INSERT\_VALUES,SCATTER\_REVERSE);\\ + VecScatterEnd(VecScatter ctx,Vec y,Vec x,INSERT\_VALUES,SCATTER\_REVERSE); \end{tabbing} Note that the roles of the first -two arguments to these routines must be swapped whenever the SCATTER_REVERSE +two arguments to these routines must be swapped whenever the SCATTER\_REVERSE option is used. Once a VecScatter object has been created it may be used with any vectors @@ -978,12 +978,12 @@ PetscScalar *values;\\ int \trl{idx_from[] = {100,200}, idx_to[] = {0,1};}\\ - VecCreateSeq(PETSC_COMM_SELF,2,\&x);\\ - ISCreateGeneral(PETSC_COMM_SELF,2,idx\_from,PETSC\_COPY\_VALUES,\&from);\\ - ISCreateGeneral(PETSC_COMM_SELF,2,idx\_to,PETSC\_COPY\_VALUES,\&to);\\ + VecCreateSeq(PETSC\_COMM\_SELF,2,\&x);\\ + ISCreateGeneral(PETSC\_COMM\_SELF,2,idx\_from,PETSC\_COPY\_VALUES,\&from);\\ + ISCreateGeneral(PETSC\_COMM\_SELF,2,idx\_to,PETSC\_COPY\_VALUES,\&to);\\ VecScatterCreate(p,from,x,to,\&scatter);\\ - VecScatterBegin(scatter,p,x,INSERT_VALUES,SCATTER_FORWARD);\\ - VecScatterEnd(scatter,p,x,INSERT_VALUES,SCATTER_FORWARD);\\ + VecScatterBegin(scatter,p,x,INSERT\_VALUES,SCATTER\_FORWARD);\\ + VecScatterEnd(scatter,p,x,INSERT\_VALUES,SCATTER\_FORWARD);\\ VecGetArray(x,\&values);\\ ISDestroy(\&from);\\ ISDestroy(\&to); \\ @@ -1011,15 +1011,15 @@ \begin{tabbing} Function: (Input Vec globalin, Output Vec globalout)\\ \\ - VecScatterBegin(\=VecScatter scatter,Vec globalin,Vec localin,InsertMode INSERT_VALUES,\\ - \> ScatterMode SCATTER_FORWARD);\\ - VecScatterEnd(VecScatter scatter,Vec globalin,Vec localin,InsertMode INSERT_VALUES,\\ - \> ScatterMode SCATTER_FORWARD);\\ + VecScatterBegin(\=VecScatter scatter,Vec globalin,Vec localin,InsertMode INSERT\_VALUES,\\ + \> ScatterMode SCATTER\_FORWARD);\\ + VecScatterEnd(VecScatter scatter,Vec globalin,Vec localin,InsertMode INSERT\_VALUES,\\ + \> ScatterMode SCATTER\_FORWARD);\\ \trl{/*} For example, do local calculations from localin to localout \trl{*/} \\ - VecScatterBegin(VecScatter scatter,Vec localout,Vec globalout,InsertMode ADD_VALUES,\\ - \> ScatterMode SCATTER_REVERSE);\\ - VecScatterEnd(VecScatter scatter,Vec localout,Vec globalout,InsertMode ADD_VALUES,\\ - \> ScatterMode SCATTER_REVERSE); + VecScatterBegin(VecScatter scatter,Vec localout,Vec globalout,InsertMode ADD\_VALUES,\\ + \> ScatterMode SCATTER\_REVERSE);\\ + VecScatterEnd(VecScatter scatter,Vec localout,Vec globalout,InsertMode ADD\_VALUES,\\ + \> ScatterMode SCATTER\_REVERSE); \end{tabbing} % ------------------------------------------------------------------------------- @@ -1046,7 +1046,7 @@ \end{tabbing} Here \trl{n} is the number of local vector entries, \trl{N} is the number of \sindex{vectors, with ghost values} -global entries (or PETSC_NULL) and \trl{nghost} is the number of +global entries (or PETSC\_NULL) and \trl{nghost} is the number of ghost entries. The array \trl{ghosts} is of size \trl{nghost} and contains the global vector location for each local ghost location. Using VecDuplicate() or VecDuplicateVecs() on a ghosted vector will generate additional ghosted vectors. @@ -1067,10 +1067,10 @@ A common usage of a ghosted vector is given by \begin{tabbing} - VecGhostUpdateBegin\=(Vec globalin,InsertMode INSERT_VALUES,\\ - \> ScatterMode SCATTER_FORWARD);\\ - VecGhostUpdateEnd(Vec globalin,InsertMode INSERT_VALUES,\\ - \> ScatterMode SCATTER_FORWARD);\\ + VecGhostUpdateBegin\=(Vec globalin,InsertMode INSERT\_VALUES,\\ + \> ScatterMode SCATTER\_FORWARD);\\ + VecGhostUpdateEnd(Vec globalin,InsertMode INSERT\_VALUES,\\ + \> ScatterMode SCATTER\_FORWARD);\\ VecGhostGetLocalForm(Vec globalin,Vec *localin);\\ VecGhostGetLocalForm(Vec globalout,Vec *localout);\\ \trl{/*}\\ @@ -1078,10 +1078,10 @@ \trl{*/}\\ VecGhostRestoreLocalForm(Vec globalin,Vec *localin);\\ VecGhostRestoreLocalForm(Vec globalout,Vec *localout);\\ - VecGhostUpdateBegin(Vec globalout,InsertMode ADD_VALUES,\\ - \> ScatterMode SCATTER_REVERSE);\\ - VecGhostUpdateEnd(Vec globalout,InsertMode ADD_VALUES,\\ - \> ScatterMode SCATTER_REVERSE); + VecGhostUpdateBegin(Vec globalout,InsertMode ADD\_VALUES,\\ + \> ScatterMode SCATTER\_REVERSE);\\ + VecGhostUpdateEnd(Vec globalout,InsertMode ADD\_VALUES,\\ + \> ScatterMode SCATTER\_REVERSE); \end{tabbing} The routines VecGhostUpdateBegin() and VecGhostUpdateEnd() are equivalent to the routines VecScatterBegin() and VecScatterEnd() @@ -1090,9 +1090,9 @@ have to allocate the local work vector, since the ghosted vector already has allocated slots to contain the ghost values. -The input arguments INSERT_VALUES and SCATTER_FORWARD +The input arguments INSERT\_VALUES and SCATTER\_FORWARD cause the ghost values to be correctly updated from the appropriate -process. The arguments ADD_VALUES and SCATTER_REVERSE +process. The arguments ADD\_VALUES and SCATTER\_REVERSE update the ``local'' portions of the vector from all the other processes' ghost values. This would be appropriate, for example, when performing a finite element assembly of a load vector. @@ -1147,12 +1147,12 @@ To insert or add entries to a matrix, one can call a variant of MatSetValues(), either \begin{tabbing} MatSetValues(\=Mat A,int m,const int idxm[],int n,const int idxn[],const PetscScalar values[],\\ - \>INSERT_VALUES); + \>INSERT\_VALUES); \end{tabbing} or \begin{tabbing} MatSetValues(\=Mat A,int m,const int idxm[],int n,const int idxn[],const PetscScalar values[],\\ - \>ADD_VALUES); + \>ADD\_VALUES); \end{tabbing} This routine inserts or adds a logically dense subblock of dimension \trl{m*n} into the @@ -1166,7 +1166,7 @@ \trl{idxm[i]} and column \trl{idxn[j]} is located in \trl{values[i*n+j]}. To allow the insertion of values in column major order, one can call the command \begin{tabbing} - MatSetOption(Mat A,MAT\_COLUMN\_ORIENTED,PETSC_TRUE); + MatSetOption(Mat A,MAT\_COLUMN\_ORIENTED,PETSC\_TRUE); \end{tabbing} {\bf Warning}: Several of the sparse implementations do {\em not} currently support the column-oriented option. @@ -1193,8 +1193,8 @@ \end{tabbing} By placing other code between these two calls, the user can perform computations while messages are in transit. -Calls to MatSetValues() with the INSERT_VALUES and -ADD_VALUES options {\em cannot} be mixed without intervening calls to +Calls to MatSetValues() with the INSERT\_VALUES and +ADD\_VALUES options {\em cannot} be mixed without intervening calls to the assembly routines. For such intermediate assembly calls the second routine argument typically should be \trl{MAT_FLUSH_ASSEMBLY}, \findex{MAT_FLUSH_ASSEMBLY} which omits some of the work of the full @@ -1226,7 +1226,7 @@ nonzero pattern (such as within a nonlinear or time-dependent problem), the option \begin{tabbing} - MatSetOption(Mat A,MAT\_NO\_NEW\_NONZERO\_LOCATIONS,PETSC_TRUE); + MatSetOption(Mat A,MAT\_NO\_NEW\_NONZERO\_LOCATIONS,PETSC\_TRUE); \end{tabbing} should be specified after the first matrix has been fully assembled. This option ensures that certain data structures and communication @@ -1264,11 +1264,11 @@ with \trl{m} rows and \trl{n} columns, one uses the command \begin{tabbing} - MatCreateSeqAIJ(PETSC_COMM_SELF,int m,int n,int nz,int *nnz,Mat *A); + MatCreateSeqAIJ(PETSC\_COMM\_SELF,int m,int n,int nz,int *nnz,Mat *A); \end{tabbing} where \trl{nz} or \trl{nnz} can be used to preallocate matrix memory, as discussed below. The user can set \trl{nz=0} and \trl{ -nnz=}PETSC_NULL for PETSc to control all matrix memory allocation. +nnz=}PETSC\_NULL for PETSc to control all matrix memory allocation. The sequential and parallel AIJ matrix storage formats by default employ {\em i-nodes} (identical nodes) when possible. We search for @@ -1395,13 +1395,13 @@ all the matrix columns are local and \trl{n} is the number of columns corresponding to local part of a parallel vector. Either the local or -global parameters can be replaced with PETSC_DECIDE, so that +global parameters can be replaced with PETSC\_DECIDE, so that PETSc will determine \findex{PETSC_DECIDE} them. The matrix is stored with a fixed number of rows on each process, given by \trl{m}, or determined by PETSc if \trl{m} is -PETSC_DECIDE. - -If PETSC_DECIDE is not used for the arguments +PETSC\_DECIDE. + +If PETSC\_DECIDE is not used for the arguments \trl{m} and \trl{n}, then the user must ensure that they are chosen to be compatible with the vectors. To do this, one first considers the matrix-vector product $y = A x$. The \trl{m} that is used in the matrix creation routine MatCreateMPIAIJ() @@ -1409,8 +1409,8 @@ Likewise, the \trl{n} used must match that used as the local size in VecCreateMPI() for \trl{x}. -The user must set \trl{d_nz=0}, \trl{o_nz=0}, \trl{d_nnz=}PETSC_NULL, and -\trl{o_nnz=}PETSC_NULL for PETSc to control dynamic allocation of matrix +The user must set \trl{d_nz=0}, \trl{o_nz=0}, \trl{d_nnz=}PETSC\_NULL, and +\trl{o_nnz=}PETSC\_NULL for PETSc to control dynamic allocation of matrix memory space. Analogous to \trl{nz} and \trl{nnz} for the routine MatCreateSeqAIJ(), these arguments optionally specify nonzero information for the diagonal (\trl{d_nz} and \trl{d_nnz}) and @@ -1541,12 +1541,12 @@ \trl{A} of dimensions \trl{m} by \trl{n}, the user should call \begin{tabbing} - MatCreateSeqDense(PETSC_COMM_SELF,int m,int n,PetscScalar *data,Mat *A); + MatCreateSeqDense(PETSC\_COMM\_SELF,int m,int n,PetscScalar *data,Mat *A); \end{tabbing} The variable \trl{data} enables the user to optionally provide the location of the data for matrix storage (intended for Fortran users who wish to allocate their own storage space). Most users should merely -set \trl{data} to PETSC_NULL for PETSc to control matrix memory allocation. +set \trl{data} to PETSC\_NULL for PETSc to control matrix memory allocation. To create a parallel, dense matrix, \trl{A}, the user should call \begin{tabbing} MatCreateMPIDense(MPI\_Comm comm,int m,int n,int M,int N,PetscScalar *data,Mat *A) @@ -1554,11 +1554,11 @@ The arguments \trl{m}, \trl{n}, \trl{M}, and \trl{N}, indicate the number of local rows and columns and the number of global rows and columns, respectively. Either the local or -global parameters can be replaced with PETSC_DECIDE, so that +global parameters can be replaced with PETSC\_DECIDE, so that PETSc will determine them. The matrix is stored with a fixed number of rows on each process, given by \trl{m}, or determined by PETSc if \trl{m} is -PETSC_DECIDE. +PETSC\_DECIDE. PETSc does not provide parallel dense direct solvers. Our focus is on sparse iterative solvers. @@ -1581,7 +1581,7 @@ VecCreateMPI(MPI\_Comm comm,m,M,\&y); \end{tabbing} By default, if the user lets PETSc decide the number of components to -be stored locally (by passing in PETSC_DECIDE as the second +be stored locally (by passing in PETSC\_DECIDE as the second argument to VecCreateMPI() or using VecCreate()), vectors and matrices of the same dimension are automatically compatible for parallel matrix-vector operations. @@ -1605,13 +1605,13 @@ One can print a matrix (sequential or parallel) to the screen with the command \begin{tabbing} - MatView(Mat mat,PETSC_VIEWER_STDOUT_WORLD); + MatView(Mat mat,PETSC\_VIEWER\_STDOUT\_WORLD); \end{tabbing} Other viewers can be used as well. For instance, one can draw the nonzero stucture of the matrix into the default X-window with the command \begin{tabbing} - MatView(Mat mat,PETSC_VIEWER_DRAW_WORLD); + MatView(Mat mat,PETSC\_VIEWER\_DRAW\_WORLD); \end{tabbing} Also one can use \begin{tabbing} @@ -1647,7 +1647,7 @@ \label{fig_matrixops} \end{table} The NormType argument to MatNorm() is one of -NORM_1, NORM_INFINITY, and NORM_FROBENIUS. +NORM\_1, NORM\_INFINITY, and NORM\_FROBENIUS. \sindex{1-norm} \sindex{infinity norm} \sindex {Frobenius norm} \section{Matrix-Free Matrices} \sindex{matrix-free methods} @@ -1734,7 +1734,7 @@ To prevent the allocation of additional memory and simply discard those new entries, one can use the option \begin{tabbing} - MatSetOption(Mat A,MAT\_NO\_NEW\_NONZERO\_LOCATIONS,PETSC_TRUE); + MatSetOption(Mat A,MAT\_NO\_NEW\_NONZERO\_LOCATIONS,PETSC\_TRUE); \end{tabbing} Once the matrix has been assembled, one can factor it numerically without repeating the ordering or the symbolic factorization. @@ -1766,7 +1766,7 @@ MatZeroRowsIS(Mat A,IS rows,PetscScalar diag\_value,Vec x,Vec b); \end{tabbing} For sparse matrices this removes the data structures for certain rows -of the matrix. If the pointer \trl{diag_value} is PETSC_NULL, it +of the matrix. If the pointer \trl{diag_value} is PETSC\_NULL, it even removes the diagonal entry. If the pointer is not null, it uses that given value at the pointer location in the diagonal entry of the eliminated rows. @@ -1777,7 +1777,7 @@ can call MatZeroRows() in the first iteration. Then, before generating the matrix in the second iteration the user should call \begin{tabbing} - MatSetOption(Mat A,MAT\_NO\_NEW\_NONZERO\_LOCATIONS,PETSC_TRUE); + MatSetOption(Mat A,MAT\_NO\_NEW\_NONZERO\_LOCATIONS,PETSC\_TRUE); \end{tabbing} From that point, no new values will be inserted into those (boundary) rows of @@ -1804,8 +1804,8 @@ while \trl{cols} and \trl{vals} returns the column indices (with indices starting at zero) and values in the row. If only the column indices are needed (and not the corresponding matrix elements), one -can use PETSC_NULL for the \trl{vals} argument. Similarly, -one can use PETSC_NULL for the \trl{cols} argument. +can use PETSC\_NULL for the \trl{vals} argument. Similarly, +one can use PETSC\_NULL for the \trl{cols} argument. The user can only examine the values extracted with MatGetRow(); the values {\em cannot} be altered. To change the matrix entries, one must use MatSetValues(). @@ -1900,7 +1900,7 @@ renumber all the nodes and migrate the grid information to the correct process. The command \begin{tabbing} - AOCreateBasicIS(isg,PETSC_NULL,\&ao); + AOCreateBasicIS(isg,PETSC\_NULL,\&ao); \end{tabbing} generates, see Section \ref{sec_ao}, an AO object that can be used in conjunction with the \trl{is} and \trl{gis} to move the relevant grid information to the correct process @@ -2268,7 +2268,7 @@ KSPSetTolerances(KSP ksp,double rtol,double atol,double dtol,int maxits); \end{tabbing} The user can retain the default value of any of these parameters by -specifying PETSC_DEFAULT as the +specifying PETSC\_DEFAULT as the corresponding tolerance; the defaults are \trl{rtol}=$10^{-5}$, \trl{atol}=$10^{-50}$, \trl{dtol}=$10^{5}$, and \trl{maxits}=$10^5$. @@ -2382,7 +2382,7 @@ routines for eigenvalue approximation via the Arnoldi or Lanczos iteration. First, before the linear solve one must call \begin{tabbing} - KSPSetComputeEigenvalues(KSP ksp,PETSC_TRUE); + KSPSetComputeEigenvalues(KSP ksp,PETSC\_TRUE); \end{tabbing} Then after the KSP solve one calls \begin{tabbing} @@ -2427,7 +2427,7 @@ \end{tabbing} where the solution is returned in \trl{v}. The user can optionally provide a vector in \trl{w} as the location to store the vector; however, if -\trl{w} is PETSC_NULL, space allocated by PETSc in the KSP context is +\trl{w} is PETSC\_NULL, space allocated by PETSc in the KSP context is used. One should not destroy this vector. For certain KSP methods, (e.g., GMRES), the construction of the solution is expensive, while for many others it requires not even a vector copy. @@ -3555,7 +3555,7 @@ \end{tabbing} The argument \trl{ctx} is an optional user-defined context, which can store any private, application-specific data required by the -function evaluation routine; PETSC_NULL should be used if such information +function evaluation routine; PETSC\_NULL should be used if such information is not needed. In C and C++, a user-defined context is merely a structure in which various objects can be stashed; in Fortran a user context can be an integer array that contains both parameters and @@ -4349,10 +4349,10 @@ The functions \trl{frhs} and \trl{flhs} are used to form the matrices \trl{A} and \trl{B} at each timestep if the matrices are time dependent. If the matrices do not depend on time, the user should -pass in PETSC_NULL. The variable \trl{ctx} allows +pass in PETSC\_NULL. The variable \trl{ctx} allows users to pass in an application context that is passed to the \trl{frhs()} or \trl{flhs()} function whenever they are called, as the final argument. The user must provide the matrices -\trl{A}. If \trl{B} is an identity matrix, the user should pass in PETSC_NULL. +\trl{A}. If \trl{B} is an identity matrix, the user should pass in PETSC\_NULL. If the right-hand side is provided only as a linear function, the user must construct a MATSHELL matrix. Note that this is the same interface as that for SNESSetJacobian(). @@ -4699,7 +4699,7 @@ For many nonlinear problems it is too difficult to compute the Jacobian analytically, thus if \trl{jacobian} or \trl{localjacobian} is not -provided, (indicated by passing in a PETSC_NULL) the DMMG will compute the +provided, (indicated by passing in a PETSC\_NULL) the DMMG will compute the sparse Jacobian reasonably efficiently automatically using finite differencing. See the next chapter on computing the Jacobian via automatic differentiation. The option \trl{-dmmg_jacobian_mf_fd} @@ -4736,7 +4736,7 @@ Next one uses the call \begin{tabbing} DMMGSetSNESLocal(DMMG *dmmg,\\ - PetscErrorCode (*localfunction)(DMDALocalInfo *info,void *x,void *f,void* appctx),PETSC_NULL,\\ + PetscErrorCode (*localfunction)(DMDALocalInfo *info,void *x,void *f,void* appctx),PETSC\_NULL,\\ ad\_localfunction,ad\_mf\_localfunction); \end{tabbing} where the names of the last two functions are obtained @@ -4803,13 +4803,13 @@ \trl{PETSC_VIEWER_STDOUT_WORLD}, \trl{PETSC_VIEWER_STDOUT_SELF}, or \trl{PETSC_VIEWER_STDOUT_(MPI_Comm)}). Before calling the viewer set the output type with, for example, \begin{tabbing} - PetscViewerSetFormat(PETSC_VIEWER_STDOUT_WORLD,PETSC\_VIEWER\_ASCII\_MATLAB);\\ - VecView(A,PETSC_VIEWER_STDOUT_WORLD); + PetscViewerSetFormat(PETSC\_VIEWER\_STDOUT\_WORLD,PETSC\_VIEWER\_ASCII\_MATLAB);\\ + VecView(A,PETSC\_VIEWER\_STDOUT\_WORLD); \end{tabbing} or \begin{tabbing} - PetscViewerPushFormat(PETSC_VIEWER_STDOUT_WORLD,PETSC\_VIEWER\_ASCII\_MATLAB);\\ - MatView(B,PETSC_VIEWER_STDOUT_WORLD); + PetscViewerPushFormat(PETSC\_VIEWER\_STDOUT\_WORLD,PETSC\_VIEWER\_ASCII\_MATLAB);\\ + MatView(B,PETSC\_VIEWER\_STDOUT\_WORLD); \end{tabbing} The name of each PETSc variable printed for MATLAB may be set with \begin{tabbing}\sindex{PetscObjectSetName()} @@ -4823,7 +4823,7 @@ \begin{tabbing} PetscViewerSocketOpen(MPI\_Comm,char *machine,int port,PetscViewer *v); \end{tabbing} -(port is usally set to \trl{PETSC_DEFAULT}, use PETSC_NULL for the machine if the +(port is usally set to \trl{PETSC_DEFAULT}, use PETSC\_NULL for the machine if the MATLAB interactive session is running on the same machine as the PETSc program) and then sends matrices or vectors via \begin{tabbing} @@ -4832,7 +4832,7 @@ \end{tabbing} One can also send arrays or integer arrays via PetscIntView(), PetscRealView() and PetscScalarView(). One may start the MATLAB program manually or use the PETSc command -PetscStartMATLAB\trl{(MPI_Comm,char *machine,char *script,FILE **fp)}; where machine and script may be PETSC_NULL. +PetscStartMATLAB\trl{(MPI_Comm,char *machine,char *script,FILE **fp)}; where machine and script may be PETSC\_NULL. To receive the objects in MATLAB you must first make sure that \trl{${PETSC_DIR}/bin/matlab} is in your MATLAB path. Use \trl{p = sopen;} (or \trl{p = sopen(portnum)} if you provided a port number in @@ -4847,7 +4847,7 @@ \begin{tabbing} PetscMatlabEngineCreate(MPI\_Comm comm,char *machine,PetscMatlabEngine *e); \end{tabbing} -where \trl{machine} is the name of the machine hosting MATLAB (PETSC_NULL may be used for localhost). +where \trl{machine} is the name of the machine hosting MATLAB (PETSC\_NULL may be used for localhost). One can send objects to MATLAB via \begin{tabbing} PetscMatlabEnginePut(PetscMatlabEngine e,PetscObject obj); @@ -5104,7 +5104,7 @@ \findex{PETSC_NULL_INTEGER} passing \findex{PETSC_NULL_SCALAR} 0 from \findex{PETSC_NULL_DOUBLE} Fortran \findex{PETSC_NULL_CHARACTER} will crash the code. Note -that the C convention of passing PETSC_NULL (or 0) {\em cannot} +that the C convention of passing PETSC\_NULL (or 0) {\em cannot} be used. For example, when no options prefix is desired in the routine PetscOptionsGetInt(), one must use the following command in Fortran: @@ -5113,7 +5113,7 @@ \end{tabbing} This Fortran requirement is inconsistent with C, where the -user can employ PETSC_NULL for all null arguments. +user can employ PETSC\_NULL for all null arguments. \subsection{Duplicating Multiple Vectors} \label{sec_fortvecd} @@ -6287,7 +6287,7 @@ was not found. The optional argument \trl{pre} indicates that the true name of the option is the given name (with the dash ``-'' removed) prepended by the prefix \trl{pre}. -Usually \trl{pre} should be set to PETSC_NULL (or \trl{PETSC_NULL_CHARACTER} +Usually \trl{pre} should be set to PETSC\_NULL (or \trl{PETSC_NULL_CHARACTER} for Fortran); its purpose is to allow someone to rename all the options in a package without knowing the names of the individual options. For example, when using block @@ -6322,12 +6322,12 @@ \item Passing in a zero for the viewer causes the object to be printed to the screen; this is most useful when viewing an object in a debugger. -\item PETSC_VIEWER_STDOUT_SELF and - PETSC_VIEWER_STDOUT_WORLD +\item PETSC\_VIEWER\_STDOUT\_SELF and + PETSC\_VIEWER\_STDOUT\_WORLD cause the object to be printed to the screen. -\item PETSC_VIEWER_DRAW_SELF - PETSC_VIEWER_DRAW_WORLD causes the +\item PETSC\_VIEWER\_DRAW\_SELF + PETSC\_VIEWER\_DRAW\_WORLD causes the object to be drawn in a default X window. \item Passing in a viewer obtained by PetscViewerDrawOpen() causes the object to be displayed graphically. @@ -6335,9 +6335,9 @@ the viewer object with the command PetscViewerASCIIOpen\trl{(MPI_Comm comm, char* file, PetscViewer *viewer)}. This object is - analogous to PETSC_VIEWER_STDOUT_SELF (for a communicator of + analogous to PETSC\_VIEWER\_STDOUT\_SELF (for a communicator of \trl{MPI_COMM_SELF}) and - PETSC_VIEWER_STDOUT_WORLD (for a parallel communicator). + PETSC\_VIEWER\_STDOUT\_WORLD (for a parallel communicator). \item To save an object to a file in binary format, the user creates the viewer object with the command PetscViewerBinaryOpen\trl{(MPI_Comm} comm,char* file,PetscViewerBinaryType type, @@ -6520,7 +6520,7 @@ programmer as well. When an error is first detected, one should set it by calling \begin{tabbing} - SETERRQ(MPI_Comm comm,PetscErrorCode flag,,char *message); + SETERRQ(MPI\_Comm comm,PetscErrorCode flag,,char *message); \end{tabbing} The user should check the return codes for all PETSc routines (and possibly user-defined routines as well) with @@ -6751,8 +6751,8 @@ object. If one obtains the \trl{draw} object in this manner, one does not call the PetscDrawOpenX() command discussed below. -Predefined viewers, PETSC_VIEWER_DRAW_WORLD -and PETSC_VIEWER_DRAW_SELF, may be used at any time. Their initial +Predefined viewers, PETSC\_VIEWER\_DRAW\_WORLD +and PETSC\_VIEWER\_DRAW\_SELF, may be used at any time. Their initial use will cause the appropriate window to be created. \medskip