[petsc-dev] dm/interface directory files should NOT have DMPlex code in them. Shudder!
Matthew Knepley
knepley at gmail.com
Sun Mar 11 18:49:11 CDT 2018
On Mon, Mar 12, 2018 at 8:33 AM, Smith, Barry F. <bsmith at mcs.anl.gov> wrote:
> Please implement things properly with subclasses (subtypes) and get this
> crap out of the public interface files
>
See below.
Matt
> dm/interfaces should be able to be compiled and linked even if dm/impls
> stuff did not exist. This mixing of particular subclass implementations and
> public interface functions is disgusting. Ideally we'd have nightly tests
> that flags this broken stuff.
>
>
>
> Barry
>
> #include <petscdmplex.h>
>
> {
> PetscBool isplex;
>
> ierr = PetscObjectTypeCompare((PetscObject) cdm, DMPLEX,
> &isplex);CHKERRQ(ierr);
> if (isplex) {
> ierr = DMPlexGetHeightStratum(cdm, 0, &cStart, &cEnd);CHKERRQ(ierr);
> } else SETERRQ(PetscObjectComm((PetscObject) cdm),
> PETSC_ERR_ARG_WRONG, "Coordinate localization requires a DMPLEX coordinate
> DM");
>
> PetscBool isplex;
>
> ierr = PetscObjectTypeCompare((PetscObject) cdm, DMPLEX,
> &isplex);CHKERRQ(ierr);
> if (isplex) {
> ierr = DMPlexGetDepthStratum(cdm, 0, &vStart, &vEnd);CHKERRQ(ierr);
> ierr = DMPlexGetMaxProjectionHeight(cdm,&maxHeight);CHKERRQ(ierr);
> ierr = DMGetWorkArray(dm,2*(maxHeight + 1),MPIU_INT,&pStart);CHKERRQ(
> ierr);
> pEnd = &pStart[maxHeight + 1];
> newStart = vStart;
> newEnd = vEnd;
> for (h = 0; h <= maxHeight; h++) {
> ierr = DMPlexGetHeightStratum(cdm, h, &pStart[h],
> &pEnd[h]);CHKERRQ(ierr);
> newStart = PetscMin(newStart,pStart[h]);
> newEnd = PetscMax(newEnd,pEnd[h]);
>
>
>
> > On Mar 11, 2018, at 4:21 PM, Matthew Knepley <knepley at gmail.com> wrote:
> >
> > This stuff is in DM because two concepts need to be promoted to DM. They
> are
> > already both in DA and Plex:
> >
> > 1) GlobalToNatural, which is in dmi.c
> >
> > 2) Coordinates, in particular periodic coordinates, which is in dm.c
> >
> > Removing these means adding 1 or 2 functions to dmimpl
> >
> > Matt
> >
> >
> > On Mon, Mar 12, 2018 at 3:06 AM, Smith, Barry F. <bsmith at mcs.anl.gov>
> wrote:
> >
> >
> >
> >
> > --
> > 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
> >
> > https://www.cse.buffalo.edu/~knepley/
>
>
--
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
https://www.cse.buffalo.edu/~knepley/ <http://www.caam.rice.edu/~mk51/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20180312/4b246020/attachment.html>
More information about the petsc-dev
mailing list