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

Jed Brown jed at 59A2.org
Thu Apr 22 12:35:47 CDT 2010


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()");

Jed


More information about the petsc-users mailing list