[petsc-users] Newbie Question - Really slow - PetscMemCpy

Barry Smith bsmith at mcs.anl.gov
Thu Apr 22 12:58:32 CDT 2010


On Apr 22, 2010, at 12:35 PM, Jed Brown wrote:

> On Thu, 22 Apr 2010 12:27:58 -0500, Barry Smith <bsmith at mcs.anl.gov>  
> wrote:
>>    Do you mean if (!mat->ops->setoption) SETERRQ..... ?
>
> I think that is too strong because it will break everyone's existing
> matrix type (including MatShell) that didn't bother to implement
> MatSetOption.  The primary implementations explicitly ignore certain
> options and generate an error for unknown options.  I think this is  
> the
> right behavior *if* the implementation chooses to define a
> MatSetOption_XXX, but I think that ignoring options is the correct
> behavior if they do not implement this function (for example, most
> options don't even apply to MatShell, I definitely don't want users to
> have to query whether an option is supported before setting it).
>
> What I had in mind was just
>
>  if (!((PetscObject)mat)->type_name)  
> SETERRQ(PETSC_ERR_ARG_TYPENOTSET,"Cannot set options until type and  
> size have been set, see MatSetType() and MatSetSizes()");
>

    Ok, I guess this is probably ok.

    Barry

> Jed



More information about the petsc-users mailing list