[petsc-dev] why does DMSetFromOptions() not follow the paradigm of all other XXXSetFromOptions()?
Matthew Knepley
knepley at gmail.com
Wed Nov 9 16:15:32 CST 2011
On Wed, Nov 9, 2011 at 10:06 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
>
> PetscErrorCode DMSetFromOptions(DM dm)
> {
> PetscBool flg1 = PETSC_FALSE,flg;
> PetscErrorCode ierr;
> char mtype[256] = MATAIJ;
>
> PetscFunctionBegin;
> if (dm->ops->setfromoptions) {
> ierr = (*dm->ops->setfromoptions)(dm);CHKERRQ(ierr);
> }
> ierr = PetscObjectOptionsBegin((PetscObject)dm);CHKERRQ(ierr);
> ierr = PetscOptionsBool("-dm_view", "Information on DM", "DMView",
> flg1, &flg1, PETSC_NULL);CHKERRQ(ierr);
> ierr = PetscOptionsBool("-dm_preallocate_only","only preallocate
> matrix, but do not set column
> indices","DMSetMatrixPreallocateOnly",dm->prealloc_only,&dm->prealloc_only,PETSC_NULL);CHKERRQ(ierr);
> ierr = PetscOptionsList("-dm_mat_type","Matrix
> type","MatSetType",MatList,mtype,mtype,sizeof mtype,&flg);CHKERRQ(ierr);
> if (flg) {
> ierr = PetscFree(dm->mattype);CHKERRQ(ierr);
> ierr = PetscStrallocpy(mtype,&dm->mattype);CHKERRQ(ierr);
> }
> ierr = PetscOptionsEnd();CHKERRQ(ierr);
> if (flg1) {
> ierr = DMView(dm, PETSC_VIEWER_STDOUT_WORLD);CHKERRQ(ierr);
> }
> PetscFunctionReturn(0);
> }
>
>
> While all others are
>
> ierr = PetscObjectOptionsBegin((PetscObject)object);CHKERRQ(ierr);
> common options
> call options specific to object function
> OptionsEnd()
>
> is there a reason for this paradigm shift? If not I will fix it to be like
> all the others.
>
I have no problem with the change.
Matt
> Barry
>
> Note: there is no possibility of setting the type here but that is ok,
> that doesn't mean the process has to be turned on its head does it?
>
>
--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20111109/64ed197c/attachment.html>
More information about the petsc-dev
mailing list