Dear Mike, Thanks for the reply.
I know that MatSetValuesStencil() is not ready for a Jacobian of DMComposite object, so I am using MatSetValues() to do it row by row. What I am working now is to get the global indices idxm[] and idxn[] for each processor, so I need some information transferred between processors. I think the following iterations would give me the necessary information for global row indices idxm[] if (rank > 0){ PetscInt receivedNumber[rank]; for (i=0;i<rank;i++){//recieve from rank i } } if (rank < size-1){ PetscInt sentNumber[size-rank-1]; for (i=rank+1;i<size;i++){//send to rank i } } For the column indices idxn[], it is the next step. Thanks very much for your kind reply again! Rebecca Quoting Mike McCourt <mccomic at mcs.anl.gov>: > Sorry, MatSetValuesStencil() only "knows" about DA's, not more > general DMs. In the arguments to MatSetValuesStencil() there is no way > to indicate anything except the location in a single regular grid. We > all need to think about what makes sense for an interface for > composite grids. > > I think we're working on this now. But it's not ready yet. > > -Mike > > ----- Original Message ----- > From: "(Rebecca) Xuefei YUAN" <xy2102 at columbia.edu> > To: "PETSc users list" <petsc-users at mcs.anl.gov> > Sent: Friday, March 19, 2010 3:24:10 PM GMT -06:00 US/Canada Central > Subject: [petsc-users] Assemble a Jacobian for a DMComposite object. > > Dear all, > > I am working on assembling a Jacobian for a DMComposite object. > > In FormJacobian(), I am not sure how to use MatSetValuesStencil() in > this case, so I use MatSetValues() to assemble this Jacobian row by row. > > MatSetValues(Mat mat,PetscInt m,const PetscInt idxm[],PetscInt n,const > PetscInt idxn[],const PetscScalar v[],InsertMode addv) > > To specify the row and columns' global indices idxm[] and idxn[], I > need processor (rank=i) to receive (info.xm*info.ym) from each > processor (rank<i), totally n(=rank) ints, and send its > info.xm*info.ym to each processor (rank<i), totally m (=size-rank-1). > > Is there an existing call for that? > > Thanks a lot! > > Rebecca > > > > > -- > (Rebecca) Xuefei YUAN > Department of Applied Physics and Applied Mathematics > Columbia University > Tel:917-399-8032 > www.columbia.edu/~xy2102 > > > -- (Rebecca) Xuefei YUAN Department of Applied Physics and Applied Mathematics Columbia University Tel:917-399-8032 www.columbia.edu/~xy2102