If I get a matrix from a DM, I usually do something like PetscOptionsGetString(NULL,"-q1_mat_type",mtype,sizeof(mtype),NULL); DMGetMatrix(dm,mtype,&Jp);
so that the type can be changed on the command line (I frequently switch between preconditioners that can use BAIJ and those that cannot). But, MatSetFromOptions never gets called. If I add MatSetOptionsPrefix(Jp,"q1_"); MatSetFromOptions(Jp); after the above, then preallocation will be blown if I change anything on the command line. This includes setting block size for AIJ formats (I think BAIJ should implement MatSetBlockSize and just confirm that it matches, but that's a separate issue) so MatSetValuesBlocked cannot even assemble the correct matrix. To rectify this, I think that DMGetMatrix either must have enough information to call MatSetFromOptions (like the prefix) or preallocation should be separated from setting the sizes (so the user can get the matrix, call MatSetFromOptions, and then ask the DM to preallocate). In the former case, we have functionality that is essentially inaccessible from code (PetscOptionsSetValue is a workaround). The latter significantly complicates matters. Note that since the user may get multiple matrices from a DM, to be used for different purposes, it's not okay to use the DM's prefix as the Mat's prefix. Any preferences here? I'm happy with any solution in which the user doesn't have to do an inordinate amount of work to make the following work. -q1_mat_type baij -q1_mat_type aij -mat_no_inode -q1_mat_type crl Jed -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 260 bytes Desc: OpenPGP digital signature URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20090722/785e6308/attachment.pgp>