Do we then remove the current functionality? Which is a little weird as 
currently partly supporting one matrix format and only one of the set values 
calls 

   Barry


Begin forwarded message:

> From: Jed Brown <[email protected]>
> Subject: Re: [petsc-dev] MatSetValues with v=0
> Date: April 16, 2014 at 8:44:02 AM CDT
> To: Eric Chamberland <[email protected]>, Barry Smith 
> <[email protected]>, Patrick Lacasse <[email protected]>
> Cc: For users of the development version of PETSc <[email protected]>
> 
> Eric Chamberland <[email protected]> writes:
>> I was writing (new) code which do the firsts MatSetValues after the 
>> MatXAIJSetPreallocation.  We have to do this because the "real" 
>> non-zeros will be added later by a mix of ADD_VALUES and 
>> INSERT_VALUES... which would prevent us to "lock" the matrix 
>> (MatSetOption(aMatricePETSc, MAT_NEW_NONZERO_LOCATION_ERR, PETSC_TRUE) 
>> because this option must be passed after the first MatAssemblyEnd()... 
>> but all the non-zeros are "triggered" only after this "mixed" assembly...
>> 
>> In other words, we have to do a "fake" assembly with all "0" to cover 
>> all non-zeros that will be in fact added later... So we have to create 
>> many "fake" elementary matrices to pass for assembly... that is why 
>> Patrick was asking if the feature was supported... It would save us from 
>> creating the fake matrices...  Or maybe there is a better solution?...
> 
> Just create one large-enough buffer containing all zeros.  For example,
> 
>  PetscScalar *values;
>  PetscCalloc1(1000,&values);
> 
>  for (...) {
>    MatSetValues(...,values,INSERT_VALUES);
>  }
>  PetscFree(values);
> 
> Is this okay?

Reply via email to