Re: [petsc-users] Union of sequential vecs

2022-12-09 Thread Matthew Knepley
On Fri, Dec 9, 2022 at 6:50 PM Karthikeyan Chockalingam - STFC UKRI via petsc-users wrote: > Thank you Mark and Barry. > > > > @Mark Adams I follow you for the most part. Shouldn’t R > be an MPI Vector? > > > > Here it goes: > > > > Q[Vec[i]] for all "i" in my local (sequential) "Vec". > >

Re: [petsc-users] Union of sequential vecs

2022-12-09 Thread Mark Adams
On Fri, Dec 9, 2022 at 6:50 PM Karthikeyan Chockalingam - STFC UKRI < karthikeyan.chockalin...@stfc.ac.uk> wrote: > Thank you Mark and Barry. > > > > @Mark Adams I follow you for the most part. Shouldn’t R > be an MPI Vector? > yes, "R, with local size n" implies an MPI vector. > > > Here it

Re: [petsc-users] Union of sequential vecs

2022-12-09 Thread Karthikeyan Chockalingam - STFC UKRI via petsc-users
Thank you Mark and Barry. @Mark Adams I follow you for the most part. Shouldn’t R be an MPI Vector? Here it goes: Q[Vec[i]] for all "i" in my local (sequential) "Vec". Compute number of local nonzeros in Q, call it n. //Create a MPI Vector R, with local size n

Re: [petsc-users] Union of sequential vecs

2022-12-09 Thread Blaise Bourdin
Hi, If you use an IS to store your ints, you can also do ISAllGather followed by ISSortRemoveDups Blaise On Dec 9, 2022, at 4:14 PM, Barry Smith wrote:   Ok, so you want the unique list of integers sorted from all the seq vectors on ever MPI rank?

Re: [petsc-users] Union of sequential vecs

2022-12-09 Thread Barry Smith
Ok, so you want the unique list of integers sorted from all the seq vectors on ever MPI rank? VecScatterCreateToAll() to get all values on all ranks (make the sequential vectors MPI vectors instead). create an integer array long enough to hold all of them Use VecGetArray() and a

Re: [petsc-users] Union of sequential vecs

2022-12-09 Thread Mark Adams
If your space is pretty compact, eg, (0,12), you could create an MPI vector Q of size 13, say, and each processor can add 1.0 to Q[Vec[i]], for all "i" in my local "Vec". Then each processor can count the number of local nonzeros in Q, call it n, create a new vector, R, with local size n, then set

Re: [petsc-users] Union of sequential vecs

2022-12-09 Thread Karthikeyan Chockalingam - STFC UKRI via petsc-users
That is where I am stuck, I don’t know who to combine them to get Vec = {2,5,7,8,10,11,12}. I just want them in an MPI vector. I finally plan to call VecScatterCreateToAll so that all processor gets a copy. Thank you. Kind regards, Karthik. From: Barry Smith Date: Friday, 9 December 2022 at

Re: [petsc-users] Union of sequential vecs

2022-12-09 Thread Barry Smith
How are you combining them to get Vec = {2,5,7,8,10,11,12}? Do you want the values to remain on the same MPI rank as before, just in an MPI vector? > On Dec 9, 2022, at 2:28 PM, Karthikeyan Chockalingam - STFC UKRI via > petsc-users wrote: > > Hi, > > I want to take the union of a

[petsc-users] Union of sequential vecs

2022-12-09 Thread Karthikeyan Chockalingam - STFC UKRI via petsc-users
Hi, I want to take the union of a set of sequential vectors, each living in a different processor. Say, Vec_Seq1 = {2,5,7} Vec_Seq2 = {5,8,10,11} Vec_Seq3 = {5,2,12}. Finally, get the union of all them Vec = {2,5,7,8,10,11,12}. I initially wanted to create a parallel vector and insert the

Re: [petsc-users] Modifying Entries Tied to Specific Points in Finite Element Stiffness Matrix using DMPlex

2022-12-09 Thread Matthew Knepley
On Fri, Dec 9, 2022 at 10:51 AM Hongrui Yu wrote: > Thank you for your reply! Unfortunately yes.. I’ll need to modify > stiffness between nodes on the boundary so most of them are going to be in > completely general location. > Hmm, there is usually a better way to do this. This is a mesh and

Re: [petsc-users] Modifying Entries Tied to Specific Points in Finite Element Stiffness Matrix using DMPlex

2022-12-09 Thread Hongrui Yu
Thank you for your reply! Unfortunately yes.. I’ll need to modify stiffness between nodes on the boundary so most of them are going to be in completely general location. I can create an IS after distribution using DMPlexCreatePointNumbering() but they are Global numbering. Is there a way to

Re: [petsc-users] Modifying Entries Tied to Specific Points in Finite Element Stiffness Matrix using DMPlex

2022-12-09 Thread Matthew Knepley
On Thu, Dec 8, 2022 at 6:06 PM Hongrui Yu wrote: > Hello! I’m trying to adapt a serial Finite Element code using PETSc. In > this code it reads in special stiffness terms between the boundary DoFs > from an input file, and add them to corresponding locations in the global > Jacobian matrix. >