[petsc-dev] Preprocessor hell: #define VecType

2012-09-28 Thread Barry Smith
I don't like having two typedefs I tried typedef const char* VecType; PETSC_EXTERN PetscErrorCode VecSetType(Vec, const VecType); PETSC_EXTERN PetscErrorCode VecGetType(Vec, VecType *); then everything compiled fine except I need to change in a bunch of places ierr = PetscStrallocpy(ctype

[petsc-dev] Fwd: PRACE Summer School 2013

2012-09-28 Thread Jed Brown
k at vsb.cz) and Ondrej Jakl > > (ondrej.jakl at vsb.cz) > > > > > > This message was sent using IMP, the Internet Messaging Program. > > > > -- next part -- An HTML attachment was scrubbed... URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20120928/a136cbdf/attachment.html>

[petsc-dev] Preprocessor hell: #define VecType

2012-09-28 Thread Jed Brown
. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20120928/4f332c78/attachment.html>

[petsc-dev] Preprocessor hell: #define VecType

2012-09-28 Thread Karl Rupp
Hi, > The problem is we/people may want to "build" XXXType values on the fly > with string operations like strcpy, strcat etc. You cannot do that into a > const char*, thus we/people would have to declare the place they build things > as char* instead of XXXType and that is "unnatural". K

[petsc-dev] Preprocessor hell: #define VecType

2012-09-28 Thread Matthew Knepley
ldn't have expected a general PETSc-type to be defined via a > preprocessor define), it is indeed inconsistent. > > Best regards, > Karli > > -- 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 -- next part -- An HTML attachment was scrubbed... URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20120928/372c7769/attachment.html>

[petsc-dev] Preprocessor hell: #define VecType

2012-09-28 Thread Barry Smith
On Sep 28, 2012, at 3:01 PM, Matthew Knepley wrote: > On Fri, Sep 28, 2012 at 3:17 PM, Karl Rupp wrote: > Hi, > > > > The reason we use a #define instead of typedef is because of > (...) > > > We really want to be able to const the beast in many places and I couldn't > get it to work

[petsc-dev] Preprocessor hell: #define VecType

2012-09-28 Thread Matthew Knepley
be any error in compiling > > > > template > > > > if VecType were a typedef. > > > > Chetan > > > > > >> having checked the following, > >> #define VecType PetscVecType > >> typedef char* PetscVecType; > >> may already improve the situation substantially. Removing any > >> preprocessor activity on the string/type 'VecType' would be the cleaner > >> approach, though... > >> > >> Best regards, > >> Karli > > > -- next part -- An HTML attachment was scrubbed... URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20120928/c1632e96/attachment.html>

[petsc-dev] Preprocessor hell: #define VecType

2012-09-28 Thread Karl Rupp
Hi, > The reason we use a #define instead of typedef is because of > (...) > > We really want to be able to const the beast in many places and I couldn't > get it to work with typedefs in a way natural for users. If you can come up > with a clean natural way to handle the const we can sw

[petsc-dev] Preprocessor hell: #define VecType

2012-09-28 Thread Barry Smith
Karl, 1) The reason we use a #define instead of typedef is because of ch-uni/include -I/usr/X11R6/include -I/opt/local/include -I/Users/barrysmith/Src/petsc-dev/include/mpiuni-o CMakeFiles/petsc.dir/src/vec/vec/impls/nest/vecnest.c.o -c /Users/barrysmith/Src/petsc-dev/src/vec

[petsc-dev] Preprocessor hell: #define VecType

2012-09-28 Thread Matthew Knepley
ted conversion of strings, just add > 'const' in front of 'VecType'. > -- 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 -- next part -- An HTML attachment was scrubbed... URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20120928/caccc179/attachment.html>

[petsc-dev] Preprocessor hell: #define VecType

2012-09-28 Thread Karl Rupp
Hi, > You are missing the fact that all PetscObjects have an implementation > type and it is a string, and there is > one of these #defines for every class. Ok, thanks for shedding light on that. > However, I would support namespacing all these Types since they are not > in heavy use, e.g. Petsc

[petsc-dev] Preprocessor hell: #define VecType

2012-09-28 Thread Karl Rupp
Hi guys, a long time ago, I stumbled upon one thing that caused a lot of headaches when interfacing my code with PETSc. Stripping away all the details, my solver interface looked about like this: template VecType solve(MatrixType const & A, VecType const & b); Everything went well if PETSc wa

[petsc-dev] Preprocessor hell: #define VecType

2012-09-28 Thread Chetan Jhurani
> -Original Message- > From: petsc-dev-bounces at mcs.anl.gov [mailto:petsc-dev-bounces at > mcs.anl.gov] On Behalf Of Karl Rupp > Sent: Friday, September 28, 2012 9:59 AM > To: For users of the development version of PETSc > Subject: Re: [petsc-dev] Preprocessor hell: #define VecType > >