MAT[SEQ/MPI]AIJXXXX 

     PetscObjectBaseTypeCompare() strips off the XXXX and compares

     PetscObjectTypeCompare() compares the entire string

     As discussed with Richard recently for likely a similar need we also need 
a 

     PetscObjectRootTypeCompare() that strips out the Seq/MPI for the 
comparison, see MatRegisterRootname()

     If you want a check for either SeqAIJ or MPIAIJ you can use 
PetscObjectBaseTypeCompareAny() with MATSeqAIJ and MatMPIAIJ

     

> On Jun 16, 2022, at 4:26 PM, Mark Adams <[email protected]> wrote:
> 
> I have a test failing: ksp_ksp_tutorials-ex7_gamg_cuda_nsize-2 
> (https://gitlab.com/petsc/petsc/-/jobs/2601658676 
> <https://gitlab.com/petsc/petsc/-/jobs/2601658676>)
> 
> I have this code that I want to be true here (2 processors):
> 
>  PetscCall(PetscObjectTypeCompare((PetscObject)Gmat, MATMPIAIJ, &isMPI));
> 
> But it is returning false.  Should I have a CompareAny here or something else?
> 
> ksp_ksp_tutorials-ex7_gamg_cuda_nsize-1 does seem to work and passes this 
> test:
> 
>       
> PetscCall(PetscObjectBaseTypeCompare((PetscObject)cMat,MATSEQAIJ,&isAIJ));
>       PetscCheck(isAIJ,PETSC_COMM_SELF,PETSC_ERR_USER,"Require AIJ matrix.");
> 
> Seems inconsistent.
> 
> Thanks
> Mark 

Reply via email to