petsc-3.7.1 2016-05-15
Report Typos and Errors

# MatAssemblyEnd

Completes assembling the matrix. This routine should be called after MatAssemblyBegin().

### Synopsis

    #include "petscmat.h"
    PetscErrorCode MatAssemblyEnd(Mat mat,MatAssemblyType type)

Collective on Mat Many br

### Input Parameters

| mat | - the matrix Many br
| type | - type of assembly, either MAT_FLUSH_ASSEMBLY or MAT_FINAL_ASSEMBLY Many br

### Options Database Keys

| -mat_view ::ascii_info | - Prints info on matrix at conclusion of MatEndAssembly() Many br
| -mat_view ::ascii_info_detail | - Prints more detailed info Many br
| -mat_view | - Prints matrix in ASCII format Many br
| -mat_view ::ascii_matlab | - Prints matrix in Matlab format Many br
| -mat_view draw | - PetscDraws nonzero structure of matrix, using MatView() and PetscDrawOpenX(). Many br
| -display <name> | - Sets display name (default is host) Many br
| -draw_pause <sec> | - Sets number of seconds to pause after display Many br
| -mat_view socket | - Sends matrix to socket, can be accessed from Matlab (See Users-Manual: Chapter 11 Using MATLAB with PETSc ) Many br
| -viewer_socket_machine <machine> | - Machine to use for socket Many br
| -viewer_socket_port <port> | - Port number to use for socket Many br
| -mat_view binary:filename[:append] | - Save matrix to file in binary format Many br

### Notes

MatSetValues() generally caches the values. The matrix is ready to Many bruse only after MatAssemblyBegin() and MatAssemblyEnd() have been called. Many brUse MAT_FLUSH_ASSEMBLY when switching between ADD_VALUES and INSERT_VALUES Many brin MatSetValues(); use MAT_FINAL_ASSEMBLY for the final assembly before Many brusing the matrix. Many br

Space for preallocated nonzeros that is not filled by a call to MatSetValues() or a related routine are compressed Many brout by assembly. If you intend to use that extra space on a subsequent assembly, be sure to insert explicit zeros Many brbefore MAT_FINAL_ASSEMBLY so the space is not compressed out. Many br

Many br

### See Also

MatAssemblyBegin(), MatSetValues(), PetscDrawOpenX(), PetscDrawCreate(), MatView(), MatAssembled(), PetscViewerSocketOpen()

Level:beginner
Location:src/mat/interface/matrix.c
Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages

### Examples

src/mat/examples/tutorials/ex2.c.html
src/mat/examples/tutorials/ex5.c.html
src/mat/examples/tutorials/ex8.c.html
src/mat/examples/tutorials/ex12.c.html
src/mat/examples/tutorials/ex15.c.html
src/mat/examples/tutorials/ex16.c.html
src/mat/examples/tutorials/ex17.c.html
src/ksp/pc/examples/tutorials/ex1.c.html
src/ksp/pc/examples/tutorials/ex2.c.html
src/ksp/ksp/examples/tutorials/ex1.c.html
src/ksp/ksp/examples/tutorials/ex2.c.html