[petsc-dev] Two question about DM API
Lisandro Dalcin
dalcinl at gmail.com
Thu Jul 4 09:32:39 CDT 2019
Dear Barry,
1) Do we still need this? It is totally untested, from the docs it seems it
may be redundant
$ git grep DMCreateAggregates
include/petscdm.h:PETSC_EXTERN PetscErrorCode
DMCreateAggregates(DM,DM,Mat*);
src/dm/impls/da/dacreate.c:extern PetscErrorCode
DMCreateAggregates_DA(DM,DM,Mat*);
src/dm/impls/da/dacreate.c: da->ops->getaggregates =
DMCreateAggregates_DA;
src/dm/impls/da/dainterp.c:PetscErrorCode DMCreateAggregates_DA(DM dac,DM
daf,Mat *rest)
src/dm/interface/dm.c: DMCreateAggregates - Gets the aggregates that map
between
src/dm/interface/dm.c:PetscErrorCode DMCreateAggregates(DM dmc, DM dmf,
Mat *rest)
2) Why don't we implement DMHasCreateInjection_Default() this way?
static PetscErrorCode DMHasCreateInjection_Default(DM dm, PetscBool *flg)
{
PetscFunctionBegin;
PetscValidHeaderSpecific(dm,DM_CLASSID,1);
PetscValidPointer(flg,2);
*flg = dm->ops->getinjection ? PETSC_TRUE : PETSC_FALSE;
PetscFunctionReturn(0);
}
This way we can keep the one in DMDA, perhaps the one in SNESVI, and remove
all the other type specific implementations.
Or maybe even better, we should get rid of DMHasCreateInjection_Default(),
and do things this simple and obvious way:
PetscErrorCode DMHasCreateInjection(DM dm,PetscBool *flg)
{
PetscErrorCode ierr;
PetscFunctionBegin;
if (dm->ops->hascreateinjection) {
ierr = (*dm->ops->hascreateinjection)(dm,flg);CHKERRQ(ierr);
} else {
*flg = dm->ops->getinjection ? PETSC_TRUE : PETSC_FALSE;
}
PetscFunctionReturn(0);
}
and of course rename m->ops->getinjection to dm->ops->createinjection,
because the inconsistency offends my little mind.
Am I missing something about this one?
--
Lisandro Dalcin
============
Research Scientist
Extreme Computing Research Center (ECRC)
King Abdullah University of Science and Technology (KAUST)
http://ecrc.kaust.edu.sa/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20190704/4bdc0b9b/attachment.html>
More information about the petsc-dev
mailing list