[petsc-users] numerical quadrature

Matthew Knepley knepley at gmail.com
Wed Feb 4 22:02:56 CST 2015


On Wed, Feb 4, 2015 at 10:00 PM, Gideon Simpson <gideon.simpson at gmail.com>
wrote:

> Suppose I have a function f at sample points x, with x and f both stored
> as Vec distributed structures.  What I would like to do is compute an
> estimate of the anti derivative of f,
>
> \int_a^x f(s)ds
>
> for a<= x <=b.
>
> One way I can see how to compute this efficiently is to do the numerical
> quadrature on each node, and then use standard MPI to send the successive
> cumulative quantity from processor 0 to 1 to 2, and so on.  I am wondering
> if there is a “PETSc” way to do this kind of calculation, as opposed to
> relying on MPI code.
>

I would use MPI, but I would use

  http://www.mpich.org/static/docs/v3.1/www3/MPI_Scan.html

which will give you all the partial sums at once.

   Matt


> -gideon
>
>


-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150204/e2b77d4e/attachment.html>


More information about the petsc-users mailing list