Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project!

## Re: [Libmesh-users] Reciprocal of ghosted NumericVector

 Re: [Libmesh-users] Reciprocal of ghosted NumericVector From: Vetter Roman - 2012-01-26 19:46:17 ```Ah, I see. Thank you all for the fast replies. I went with PETSc's VecReciprocal(). Roman ```

 [Libmesh-users] Reciprocal of ghosted NumericVector From: Vetter Roman - 2012-01-26 19:06:19 ```Hi folks how would I compute the element-wise reciprocal of a ghosted NumericVector in parallel? While I can just iterate through all entries i and do v.set(i, 1/v(i)) in serial mode, the solution in parallel with ghosts is not at all obvious to me. In case you're wondering: I can't fill v with the desired reciprocal values in the first place, because the entries to be inverted are sums of element contributions. Cheers, Roman ```
 Re: [Libmesh-users] Reciprocal of ghosted NumericVector From: Roy Stogner - 2012-01-26 19:12:44 ```On Thu, 26 Jan 2012, Vetter Roman wrote: > how would I compute the element-wise reciprocal of a ghosted > NumericVector in parallel? While I can just iterate through all > entries i and do v.set(i, 1/v(i)) in serial mode, the solution in > parallel with ghosts is not at all obvious to me. If you don't mind a little inter-node chatter, I'd just loop over local DoFs, and then sync up the ghost DoFs. --- Roy ```
 Re: [Libmesh-users] Reciprocal of ghosted NumericVector From: Jed Brown - 2012-01-26 19:12:45 ```On Thu, Jan 26, 2012 at 13:06, Vetter Roman wrote: > how would I compute the element-wise reciprocal of a ghosted NumericVector > in parallel? While I can just iterate through all entries i and do v.set(i, > 1/v(i)) in serial mode, the solution in parallel with ghosts is not at all > obvious to me. > > In case you're wondering: I can't fill v with the desired reciprocal > values in the first place, because the entries to be inverted are sums of > element contributions. > PETSc's VecReciprocal() does this, but it is not wrapped by Libmesh. ```
 Re: [Libmesh-users] Reciprocal of ghosted NumericVector From: Vetter Roman - 2012-01-26 19:46:17 ```Ah, I see. Thank you all for the fast replies. I went with PETSc's VecReciprocal(). Roman ```
 Re: [Libmesh-users] Reciprocal of ghosted NumericVector From: Vijay S. Mahadevan - 2012-01-26 19:16:47 ```If you are only using PETSc, the efficient way to do this is to get the raw petsc vector via the wrapper (wrappervec.vec()) and then use that with VecReciprocal function. If you are using Trilinos, I believe there is also a reciprocal function that takes an EPetraVector to do the same. If need be, it might be worthwhile to add a pure virtual method on NumericVector so that the overridden class can call its corresponding specialized routines. On Fri, Jan 27, 2012 at 12:36 AM, Vetter Roman wrote: > Hi folks > > how would I compute the element-wise reciprocal of a ghosted NumericVector in parallel? While I can just iterate through all entries i and do v.set(i, 1/v(i)) in serial mode, the solution in parallel with ghosts is not at all obvious to me. > > In case you're wondering: I can't fill v with the desired reciprocal values in the first place, because the entries to be inverted are sums of element contributions. > > Cheers, > > Roman > > ------------------------------------------------------------------------------ > Keep Your Developer Skills Current with LearnDevNow! > The most comprehensive online learning library for Microsoft developers > is just \$99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > Metro Style Apps, more. Free future releases when you subscribe now! > http://p.sf.net/sfu/learndevnow-d2d > _______________________________________________ > Libmesh-users mailing list > Libmesh-users@... > https://lists.sourceforge.net/lists/listinfo/libmesh-users ```