petsc-3.15.0 2021-04-05
Report Typos and Errors

Vectors: Examples

PETSc vectors (Vec objects) are used to store the field variables in PDE-based (or other) simulations.

ex1.c: Basic vector routines
ex2.c: Builds a parallel vector with 1 component on the first processor, 2 on the second, etc
ex3.c: Parallel vector layout
ex5.c: Tests binary I/O of vectors and illustrates the use of user-defined event logging
ex6.c: Writes an array to a file, then reads an array from a file, then forms a vector
ex7.c: Demonstrates calling a Fortran computational routine from C
ex8.c: Demonstrates using a local ordering to set values into a parallel vector
ex9.c: Demonstrates use of VecCreateGhost()
ex10.c: Tests I/O of vectors for different data formats (binary,HDF5) and illustrates the use of user-defined event logging\n\n
ex11.c: Demonstrates VecStrideNorm()
ex12.c: Demonstrates VecStrideScatter() and VecStrideGather()
ex15.c: Tests Mathematica I/O of vectors and illustrates the use of user-defined event logging
ex16.c: Demonstrates VecStrideScatter() and VecStrideGather() with subvectors that are also strided
ex18.c: Computes the integral of 2*x/(1+x^2) from x=0
ex19.c: Parallel HDF5 Vec Viewing
ex42.c: Reads a PETSc vector from a socket connection, then sends it back within a loop
ex42a.c: Sends a PETSc vector to a socket connection, receives it back, within a loop
ex44.c: Test VecConcatenate both in serial and parallel
performance.c: Time vector operations on GPU\n