[petsc-dev] Petsc functions must ALWAYS return error codes

Mark F. Adams mark.adams at columbia.edu
Sun Mar 25 10:53:54 CDT 2012


Barry,

The iterators are a problem.  THe code now looks like:

for(pos=PetscCDGetHeadPos(agg_llists,kk) ; 
     pos ; 
     pos=PetscCDGetNextPos(agg_llists,kk,pos)){
   ....
} 

I could use:

ierr = PetscCDGetHeadPos(agg_llists,kk, &pos);
while( pos ){

   ...

  ierr = PetscCDGetNextPos(agg_llists, kk, &pos );
} 

Is this what you would like or do you have another API suggestion?

Mark

On Mar 24, 2012, at 11:21 PM, Barry Smith wrote:

> 
> There are a bunch of these functions that don't return error codes and need to be fixed.
> 
>   Barry
> 
> PetscInt LLNGetID( const PetscCDIntNd *a_this );
> PetscErrorCode PetscCDAppendID( PetscCoarsenData *ail, PetscInt a_idx, PetscInt a_gid );
> PetscErrorCode PetscCDAppendRemove( PetscCoarsenData *ail, PetscInt a_destidx, PetscInt a_srcidx );
> PetscErrorCode PetscCDAppendNode( PetscCoarsenData *ail, PetscInt a_idx,  PetscCDIntNd *a_n );
> PetscErrorCode PetscCDRemoveNextNode( PetscCoarsenData *ail, PetscInt a_idx, PetscCDIntNd *a_last );
> PetscErrorCode PetscCDRemoveAllAt( PetscCoarsenData *ail, PetscInt a_idx );
> PetscInt PetscCDSizeAt( const PetscCoarsenData *ail, PetscInt a_idx );
> PetscErrorCode PetscCDSetChuckSize( PetscCoarsenData *ail, PetscInt a_sz );
> PetscErrorCode PetscCDPrint( const PetscCoarsenData *ail, MPI_Comm comm  );
> PetscErrorCode PetscCDGetMIS( PetscCoarsenData *ail, IS * );
> PetscErrorCode PetscCDGetMat( const PetscCoarsenData *ail, Mat * );
> PetscErrorCode PetscCDSetMat( PetscCoarsenData *ail, Mat );
> typedef PetscCDIntNd* PetscCDPos;
> const PetscCDPos PetscCDGetHeadPos( const PetscCoarsenData *ail, PetscInt idx );
> const PetscCDPos PetscCDGetNextPos( const PetscCoarsenData *ail, PetscInt idx, PetscCDPos cpos);
> 
> 
> 
> 




More information about the petsc-dev mailing list