Re: [petsc-users] MatPrealloctor

2022-07-29 Thread Randall Mackie
Barry, So adding the call to MatSetBlockSize to the preallocator does fix the error, but that is not necessary if I simply replace the call to MatPreallocaterPreallocate with a call to MatMPIAIJSetPreallocation. And it’s confusing to me especially in light of this exchange a couple months ago

Re: [petsc-users] MatPrealloctor

2022-07-29 Thread Barry Smith
Because you create the DMDA with a dof of 3, this triggers any matrices it creates and the localtoglobalmapping object it creates to have a block size of three. The error you are seeing is that a localtoglobal with a block size of 3 cannot be attached to a matrix with a block size of 1. T

Re: [petsc-users] MatPrealloctor

2022-07-29 Thread Randall Mackie
Why do I have to set the block size to 3? I’m not trying to create a block matrix. In fact just a couple months ago I was told I don’t have block matrices and I had to remove calls to set the block size: https://lists.mcs.anl.gov/mailman/htdig/petsc-users/2022-May/046094.html This works fine w

Re: [petsc-users] MatPrealloctor

2022-07-29 Thread Barry Smith
I'm hoping that it is as simple as that you did not set the block size of your newly created matrix to 3? > On Jul 29, 2022, at 4:04 PM, Randall Mackie wrote: > > Hi Barry, > > It seems like this should be trivial to get working but so far I’ve been > unsuccessful. > Most likely I’m doin

Re: [petsc-users] MatPrealloctor

2022-07-29 Thread Randall Mackie
Hi Barry,It seems like this should be trivial to get working but so far I’ve been unsuccessful.Most likely I’m doing something wrong but I have no idea what that is.I’ve attached a little test program that fails with the errors:[0]PETSC ERROR: - Error Message ---

Re: [petsc-users] MatPrealloctor

2022-07-28 Thread Barry Smith
I am not sure what you are asking exactly but I think so, so long have you have called MatSetLocalToGlobalMapping() and the "stencil" idea makes sense for your discretization. Barry > On Jul 28, 2022, at 5:41 PM, Randall Mackie wrote: > > Dear PETSc users: > > Can one use a MatPreall

[petsc-users] MatPrealloctor

2022-07-28 Thread Randall Mackie
Dear PETSc users: Can one use a MatPreallocator and then call MatPreAlloctorPreallocate if using MatStencil routines (which seem to call MatSetValuesLocal). Thanks, Randy