Allow passing in non-petsc communiators to PetscShmCommGet
Design thoughts:
- I always want to stash the shared memory communicators on petsc inner comms, so that when petsc is finalized, they will be destroyed.
- Only on rare cases (the input comm in
PetscShmCommGet()is neither a petsc inner comm, nor an outer comm with a linked inner comm), I need to dup the communicator. So I use a fixed-size static array to store these dupped communicators. NotePETSC_COMM_WORLDhas an inner comm, so callingPetscShmCommGet()onPETSC_COMM_WORLDwon't generate new comm.
Edited by Junchao Zhang