On Tue, Apr 6, 2021 at 7:44 PM Abhyankar, Shrirang G < shrirang.abhyan...@pnnl.gov> wrote:
> Hong, > > It was just to keep things simple. We can have an API (and a run-time > option) for setting the max. number of components instead of a configure > option. I can work on making this change. > I would advocate just carrying the size of those arrays in the struct. That way it can be completely flexible, and you can just check at runtime if there is a chance of out of bounds indexing. Thanks, Matt > > > Thanks, > > Shri > > *From: *petsc-dev <petsc-dev-boun...@mcs.anl.gov> on behalf of PETSc > Development <petsc-dev@mcs.anl.gov> > *Reply-To: *"Zhang, Hong" <hzh...@mcs.anl.gov> > *Date: *Tuesday, April 6, 2021 at 4:46 PM > *To: *Matthew Knepley <knep...@gmail.com>, PETSc Development < > petsc-dev@mcs.anl.gov> > *Cc: *"Abhyankar, Shrirang G" <shrirang.abhyan...@pnnl.gov> > *Subject: *Re: [petsc-dev] DMNetwork static sizing > > > > Shri, > > You designed this approach. Is it intended or out of implementation > convenience at the time? > > Hong > ------------------------------ > > *From:* petsc-dev <petsc-dev-boun...@mcs.anl.gov> on behalf of Matthew > Knepley <knep...@gmail.com> > *Sent:* Monday, April 5, 2021 5:47 AM > *To:* PETSc <petsc-dev@mcs.anl.gov> > *Subject:* [petsc-dev] DMNetwork static sizing > > > > Dowe really need a configure time constant for > > > > struct _p_DMNetworkComponentHeader { > PetscInt index; /* index for user input global edge and vertex */ > PetscInt subnetid; /* Id for subnetwork */ > PetscInt ndata; /* number of components */ > PetscInt size[PETSC_DMNETWORK_MAXIMUM_COMPONENTS_PER_POINT]; > PetscInt key[PETSC_DMNETWORK_MAXIMUM_COMPONENTS_PER_POINT]; > PetscInt offset[PETSC_DMNETWORK_MAXIMUM_COMPONENTS_PER_POINT]; > PetscInt nvar[PETSC_DMNETWORK_MAXIMUM_COMPONENTS_PER_POINT]; /* Number > of variables */ > PetscInt offsetvarrel[PETSC_DMNETWORK_MAXIMUM_COMPONENTS_PER_POINT]; /* > offset from the first variable of the network point */ > } PETSC_ATTRIBUTEALIGNED(PetscMax(sizeof(double),sizeof(PetscScalar))); > > > > Can't we just allocate this struct when needed and carry the size along? > > > > This design seem to go against the rest of what we do in PETSc? > > > > Thanks, > > > > Matt > > > > -- > > 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/ > <https://gcc02.safelinks.protection.outlook.com/?url=http:%2F%2Fwww.cse.buffalo.edu%2F~knepley%2F&data=04%7C01%7Cshrirang.abhyankar%40pnnl.gov%7C939ff6f678d44ac6f15408d8f9457203%7Cd6faa5f90ae240338c0130048a38deeb%7C0%7C0%7C637533423968218909%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=poe0pJ2JhmdHmV5%2BzkkNNzENa4tAV0rqfU%2BHXtvF1nQ%3D&reserved=0> > -- 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.cse.buffalo.edu/~knepley/>