Re: [petsc-dev] How to enforce private data/methods in PETSc?

2018-08-11 Thread Matthew Knepley
On Sat, Aug 11, 2018 at 12:02 AM Junchao Zhang wrote: > See this example, after multiple casts, the code directly accesses > VecScatter_MPI_General's members, with an assumption that from->n is the > total number of receive processors. When I separate intranode / internode > communications, I

Re: [petsc-dev] How to enforce private data/methods in PETSc?

2018-08-11 Thread Jed Brown
Matthew Knepley writes: > On Sat, Aug 11, 2018 at 12:02 AM Junchao Zhang wrote: > >> See this example, after multiple casts, the code directly accesses >> VecScatter_MPI_General's members, with an assumption that from->n is the >> total number of receive processors. When I separate intranode /

Re: [petsc-dev] How to enforce private data/methods in PETSc?

2018-08-11 Thread Jeff Hammond
On Sat, Aug 11, 2018 at 6:58 AM Jed Brown wrote: > Matthew Knepley writes: > > > On Sat, Aug 11, 2018 at 12:02 AM Junchao Zhang > wrote: > > > >> See this example, after multiple casts, the code directly accesses > >> VecScatter_MPI_General's members, with an assumption that from->n is the >

Re: [petsc-dev] How to enforce private data/methods in PETSc?

2018-08-11 Thread Jed Brown
Jeff Hammond writes: > https://stackoverflow.com/questions/27778908/define-private-to-public-in-c/27779038#27779038 Of course, but my point stands: data hiding is only as strong as the mores and norms of clients. Even if the private header is unavailable to the client, offsets can be reversed