Maybe I'm not understanding you -- matCopy does not have your sub-communicator so how would it create a Mat with it ...
You probably want to use MatGetSubmatrix. This is general, but the output will have the same communicator, but the idle processors will be empty, if that is what you specify. Now you just need to replace the communicator with your sub communicator. Not sure how to do this but now you have your data in the right place at least. Oh, there is a method to create a Mat with a sub communicator with non-empty rows. Now you use this and use the communicator in the new matrix as your sub-communicator. https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatMPIAdjCreateNonemptySubcommMat.html On Mon, Jan 27, 2020 at 11:59 AM David Knezevic <[email protected]> wrote: > I have a case where I'd like to copy a Mat defined on COMM_WORLD to a new > Mat defined on some sub-communicator. Does MatCopy support this, or would I > have to write a custom copy operation? > > I see here > <https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatConvert.html#MatConvert> > that MatConvert requires identical communicators, but I don't see any > mention of this for MatCopy, so I wanted to check. > > Thanks, > David >
