> On Oct 16, 2019, at 2:50 AM, Pierre Jolivet via petsc-dev 
> <petsc-dev@mcs.anl.gov> wrote:
> 
> Hello,
> I’m trying to understand what is the rationale for naming a function 
> ISBlockGetIndices and another ISLocalToGlobalMappingGetBlockIndices (BlockGet 
> vs. GetBlock).

   ISBlockGetIndices returns the indices for each block; it is method that only 
applies too the  ISBlock subclass. Given its purpose its name is perfect.

   ISLocalToGlobalMapping is a class that has direct support for a block size 
(unlike IS which has no concept of a block size, it is an abstraction of any 
collection of integers).

   ISLocalToGlobalMappingGetBlockIndices is then a method on 
ISLocalToGlobalMapping that gives you the block indices (one index per block). 
Given its purpose its name is also perfect; the method is getblockindices()   
Note there is also ISLocalToGlobalMappingGetIndices(). 

  Though IS and ISLocalToGlobalMapping both begin with IS they are really not 
closely related.

   

> Also, it looks to me like the implementation of ISBlockGetIndices is somehow 
> less versatile than ISLocalToGlobalMappingGetBlockIndices.
> Indeed, I may call ISLocalToGlobalMappingGetBlockIndices with an underlying 
> non-block IS, while I can’t for ISBlockGetIndices, so a check must be 
> performed by the user, e.g., 
> https://www.mcs.anl.gov/petsc/petsc-current/src/vec/is/is/examples/tutorials/ex3.c.html#line58
>  or this (IMHO) ugly code duplication 
> https://www.mcs.anl.gov/petsc/petsc-dev/src/vec/is/utils/isltog.c.html#line322.
> 
> Thoughts and/or comments? Would it make sense to add an 
> ISGetBlockIndices/ISRestoreBlockIndices or would that be too confusing for 
> the user?

   For non ISBlock subclass of IS I don't know what ISGetBlockIndices is 
suppose to even mean. 

> 
> Thanks,
> Pierre

Reply via email to