[petsc-users] non-contiguous parallel block of the coefficient matrix and AO functions

Barry Smith bsmith at mcs.anl.gov
Mon Oct 4 16:57:16 CDT 2010


  PETSc matrix and vector indexing is ALWAYS in the PETSc numbering. You can also make it in the PETSc local numbering with Vec/MatSetLocalToGlobalNumbering() but you can NEVER make it in some other "global numbering".

  The idea behind using AO is to "renumber" your mesh nodes (or something) to the PETSc numbering so you can then use the usual Vec/MatSetValues(). So you renumber anything that you would use to index into PETSc Vecs and Mats into the PETSc numbering.

    Barry


On Oct 4, 2010, at 4:52 PM, M. Scot Breitenfeld wrote:

> I'm a little unclear how to use the AO functions if the global nodal numbering results in a non-contiguous parallel block of the coefficient matrix.
> 
> For example, if I have 1D (1 dof per node) problem (2 processors), for this case node number = row position in vector:
> 
> 0    3   4   7       2   5   6   1 (Apps)
> o    o   o   o  ||  o   o   o  o
> 0    1    2   3      4   5   6  7 (Petsc)
> 
> First I call,
> 
> CALL AOCreateBasic(PETSC_COMM_WORLD,  n, mappings, PETSC_NULL_INTEGER, ao, ierr)
> 
> where
> 
> n = 4, mappings=P0:{0,3,4,7}, P1:{2,5,6,1}
> Petsc will be continuous P0:{0,1,2,3}, P1:{4,5,6,7} so I used NULL.
> 
> CALL AOApplicationToPetsc(ao,n,mappings, ierr)
> 
> Now if I want to add a value at the global 7th row (Application row) on processor 0, do I use the Application's numbering 7, or petsc numbering 3.
> 
> If it's the global Application id:
> CALL VecSetValues(b, 1, 7 , value, ADD_VALUES, ierr)
> Does Petsc know if I specify row 7 to put it in row 3 of petsc numbering?
> 
> Or is the numbering always Petsc's numbering?
> 
> If I then solve the solution
> CALL KSPSolve(ksp,b,b,ierr)
> 
> and I want to get the values back
> 
> CALL VecGetValues(b,1,row, value, ierr)
> 
> is 'row' the Application row (7) or Petsc row (3)
> 
> Thanks,
> Scot
> 
> 
> 
> 
> 
> 
> 
> 



More information about the petsc-users mailing list