[petsc-dev] why does DMSetFromOptions() not follow the paradigm of all other XXXSetFromOptions()?
Barry Smith
bsmith at mcs.anl.gov
Wed Nov 9 16:06:24 CST 2011
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.
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?
More information about the petsc-dev
mailing list