PETSc C macro within struct -


in petsc, number of common-use structures such vec, mat, is, etc. defined similarly, in 4 snippets below. questions:

  • when , how petscheader expanded? writing foreign interface language, , wondering whether have wrap macro in function or whatnot
  • what's scope of hdr , ops ?

thanks in advance


petscvec.h

typedef struct _p_vec* vec; 

vecimpl.h

struct _p_vec {   petscheader(struct _vecops);   petsclayout            map;   void                   *data;     /* implementation-specific data */   ... 

petscimpl.h

#define petscheader(objectops) \   _p_petscobject hdr;          \   objectops      *ops 

vecimpl.h

typedef struct _vecops *vecops; struct _vecops {   petscerrorcode (*duplicate)(vec,vec*);         /* single vector */   petscerrorcode (*duplicatevecs)(vec,petscint,vec**);     /* array of vectors */     ... 


Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -