From: Derek Gaston <friedmud@gm...>  20090121 21:26:09

In working on this... it turns out that you don't have to do the allgather(). Petsc has a distributed index list... which is what the scatters work on. So each processor only adds it's indices to be copied. So far VecScatter is working well for just one variable... now to see how it goes for 2. Derek On Wed, Jan 21, 2009 at 2:12 PM, Derek Gaston <friedmud@...> wrote: > So, I have one big coupled implicit system.... and then a smaller implicit > system for each variable in the coupled system. I need to copy the entries > from the RHS vector for the big system that correspond to one variable into > the RHS vector for the small system... > > Looking around it appears as though Petsc's VecScatter is exactly what I > want.... it takes a list of indices to copy from and to... the problem I'm > having is with the indices. > > Obviously the dof_indices (of each system) are both what I want to copy > from and too.... but they are only defined in the context of one element... > I really need to have the global list of all of the dof_indices for a > variable. > > I could use the System::local_dof_indices() function I added... which > returns the set of all the local dofs... and then copy it out to a > std::vector and use parallel::allgather() to get the global list of dofs. > > The problem I'm having with all of this is ordering. When i get the > std::set of local dofs... they are going to be sorted. My question is: is > it true that (for instance) the smallest dof_index for a variable in one > system will correspond to the smallest dof index for that same variable in > another system? > > Say for instance you have variables u and v.... you create one implicit > system (named "Ben") with _both_ variables in it and 2 more implicit systems > ("John" and "Roy").... where you just add one variable (either u or v) to > each system. > > Will the smallest dof_index for u in "Ben" always correspond to the > smallest dof_index for u in "John"? More generally, will the ordering of > dofs correspond between the two systems? > > Finally: am I going about this all wrong? Is there a better (easier) way? > > Thanks, > Derek > 