Re: [deal.II] How to manually create sparsity pattern for PETSc sparsity matrix in parallel

2019-04-04 Thread Pai Liu
Hi Wolfgang, Thank you so much for your kind help. I tried the dynamic sparsity pattern, and with the sparsity_pattern.add_entries() and sparse_matrix.set() function, I sucesefully insert values in the sparse matrix. -- The deal.II project is located at http://www.dealii.org/ For mailing list

Re: [deal.II] How to manually create sparsity pattern for PETSc sparsity matrix in parallel

2019-04-04 Thread Pai Liu
Hi Juan Carlos Araújo Cabarcas, Thank you for your code, and it is really an excellent way. I also tried to use the dynamic sparsity pattern in dealii, and use the add_entries() function to indicate the nonzeros' locations, then I successfully insert the values in the sparse matrix as you did in

Re: [deal.II] How to manually create sparsity pattern for PETSc sparsity matrix in parallel

2019-04-03 Thread Wolfgang Bangerth
In addition to the excellent idea by Juan Carlos: > When I initialize the PETSc sparsity matrix, I don't know where the nonzeros > are. > Then I loop over the locally owned cells on each processor, and guadually > know > for each row of the matrix the locations and values of the nonzeros. Do

Re: [deal.II] How to manually create sparsity pattern for PETSc sparsity matrix in parallel

2019-04-03 Thread Juan Carlos Araujo Cabarcas
Hey Pai Liu, At some point in my research I had to do something similar to what you want to do. In the application of the so-called Dirichlet-to-Neumann maps for Helmholtz problems, one has to assemble a dense block corresponding to the boundary degrees of freedom, so I had to include extra ent

Re: [deal.II] How to manually create sparsity pattern for PETSc sparsity matrix in parallel

2019-04-02 Thread Pai Liu
Hi Wolfgang, > I would start by asking where the nonzero entries are going to lie. What > kind of operator do you plan on implementing for which you don't know > where the nonzeros are? > I want to multiply this matrix with a PETSc vector (which is also stored in parallel). When I initializ

Re: [deal.II] How to manually create sparsity pattern for PETSc sparsity matrix in parallel

2019-04-02 Thread Wolfgang Bangerth
On 4/2/19 9:28 AM, Pai Liu wrote: > > I need to manually create a PETSc sparsity matrix (not the system > matrix) in parallel computing for other purposes. I would start by asking where the nonzero entries are going to lie. What kind of operator do you plan on implementing for which you don't k

[deal.II] How to manually create sparsity pattern for PETSc sparsity matrix in parallel

2019-04-02 Thread Pai Liu
Hi all, I need to manually create a PETSc sparsity matrix (not the system matrix) in parallel computing for other purposes. I only know the number of nonzero values per row before I initialize the sparsity matrix. Thus I use the following codes to initialize the PETSc sparsity matrix and add en