<div dir="ltr"><div class="gmail_default" style="font-size:small">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 <strong style="color:rgb(0,0,0)"><font color="#4169E1">DMCreateMatrix_Composite_AIJ </font></strong>seems to be:</div><div class="gmail_default" style="font-size:small"><span style="color:rgb(0,0,0)"><br></span></div><div class="gmail_default" style="font-size:small"><span style="color:rgb(0,0,0)">(*com->FormCoupleLocations)(dm,NULL,dnz,onz,__rstart,__nrows,__start,__end);</span><br></div><div class="gmail_default" style="font-size:small"><span style="color:rgb(0,0,0)"><br></span></div><div class="gmail_default" style="font-size:small"><span style="color:rgb(0,0,0)">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?</span></div><div class="gmail_default" style="font-size:small"><span style="color:rgb(0,0,0)"><br></span></div><div class="gmail_default" style="font-size:small"><span style="color:rgb(0,0,0)">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.</span></div></div>