Thanks Barry, that looks like exactly what I need. I'm looking at pack.c and packm.c and I want to check my understanding of what my coupling function should do. The relevant line in *DMCreateMatrix_Composite_AIJ *seems to be:
(*com->FormCoupleLocations)(dm,NULL,dnz,onz,__rstart,__nrows,__start,__end); and I infer that dnz and onz are the number of nonzero elements in the diagonal and off-diagonal submatrices, for each row of the DMComposite matrix. I suppose I can just set each of these in a for loop, but can I use the arguments to FormCoupleLocations as the range for the loop? Which ones - __rstart to __rstart+__nrows? How can I determine the number of rows on each processor from within the function that I pass? From the preallocation macros it looks like __start to __end describe the range of the columns of the diagonal submatrix - is that right? It looks like the ranges will be specific to each processor. Do I just set the values in dnz and onz, or do I need to reduce them? Thanks for all the help! Maybe if I get things working I can carve out the core of the code to make an example program for DMRedundant/Composite.
