Actual source code: aoimpl.h

  1: /* $Id: aoimpl.h,v 1.25 2001/08/07 21:31:33 bsmith Exp $ */
  2: /* 
  3:    This private file should not be included in users' code.
  4: */

  6: #ifndef __AOIMPL 

 9:  #include petscao.h

 11: /*
 12:     Defines the abstract AO operations
 13: */
 14: struct _AOOps {
 15:       /* Generic Operations */
 16:   int (*view)(AO, PetscViewer),
 17:       (*destroy)(AO),
 18:       /* AO-Specific Operations */
 19:       (*petsctoapplication)(AO, int, int *),
 20:       (*applicationtopetsc)(AO, int, int *),
 21:       (*petsctoapplicationpermuteint)(AO, int, int *),
 22:       (*applicationtopetscpermuteint)(AO, int, int *),
 23:       (*petsctoapplicationpermutereal)(AO, int, double *),
 24:       (*applicationtopetscpermutereal)(AO, int, double *);
 25: };

 27: struct _p_AO {
 28:   PETSCHEADER(struct _AOOps)
 29:   void          *data;                   /* implementation-specific data */
 30:   int           N,n;                    /* global, local vector size */
 31: };

 33: /*
 34:     Defines the abstract AOData operations
 35: */
 36: struct _AODataOps {
 37:   int (*segmentadd)(AOData,char *,char *,int,int,int*,void*,PetscDataType);
 38:   int (*segmentget)(AOData,char *,char*,int,int*,void**);
 39:   int (*segmentrestore)(AOData,char *,char *,int,int*,void**);
 40:   int (*segmentgetlocal)(AOData,char *,char*,int,int*,void**);
 41:   int (*segmentrestorelocal)(AOData,char *,char *,int,int*,void**);
 42:   int (*segmentgetreduced)(AOData,char *,char*,int,int*,IS *);
 43:   int (*segmentgetextrema)(AOData,char *,char*,void *,void *);
 44:   int (*keyremap)(AOData,char *,AO);
 45:   int (*keygetadjacency)(AOData,char *,Mat*);
 46:   int (*keygetactive)(AOData,char*,char*,int,int*,int,IS*);
 47:   int (*keygetactivelocal)(AOData,char*,char*,int,int*,int,IS*);
 48:   int (*segmentpartition)(AOData,char*,char*);
 49:   int (*keyremove)(AOData,char*);
 50:   int (*segmentremove)(AOData,char*,char*);
 51:   int (*destroy)(AOData);
 52:   int (*view)(AOData,PetscViewer);
 53: };

 55: /*
 56:       A AODate object consists of 

 58:            - key1 
 59:                * name      = name of first key
 60:                * N         = number of key entries
 61:                * nlocal    = number of local key entries
 62:                * nsegments = number of segments in first key  
 63:                * ltog      = local to global mapping 
 64:                - segment1 
 65:                   * name      = name of first segment in first key
 66:                   * bs        = blocksize of first segment in first key
 67:                   * datatype  = datatype of first segment in first key

 69:                - segment2

 71:                   ....

 73:             - key2

 75:                 ....
 76: */
 77: typedef struct __AODataSegment AODataSegment;
 78: struct __AODataSegment {
 79:   void              *data;                   /* implementation-specific data */
 80:   char              *name;
 81:   int               bs;                      /* block size of basic chunk */
 82:   PetscDataType     datatype;                /* type of data item, int, double etc */
 83:   AODataSegment     *next;
 84: };

 86: typedef struct __AODataKey AODataKey;
 87: struct __AODataKey {
 88:   void                   *data;                   /* implementation-specific data */
 89:   char                   *name;
 90:   int                    N;                       /* number of key entries */
 91:   int                    nsegments;               /* number of segments in key */
 92:   AODataSegment          *segments;
 93:   ISLocalToGlobalMapping ltog;

 95:   /* should the following be so public? */

 97:   int                    nlocal;                  /* number of key entries owned locally */
 98:   int                    *rowners;                /* ownership range of each processor */
 99:   int                    rstart,rend;             /* first and 1 + last owned locally */
100:   AODataKey              *next;
101: };

103: typedef struct __AODataAlias AODataAlias;         /* allows a field or key to have several names */
104: struct __AODataAlias {
105:   char        *alias;
106:   char        *name;
107:   AODataAlias *next;
108: };

110: struct _p_AOData {
111:   PETSCHEADER(struct _AODataOps)
112:   int               nkeys;                   /* current number of keys */
113:   AODataKey         *keys;
114:   void              *data;
115:   int               datacomplete;            /* indicates all AOData object is fully set */
116:   AODataAlias       *aliases;
117: };

119: EXTERN int AODataKeyFind_Private(AOData,char *,PetscTruth *,AODataKey **);
120: EXTERN int AODataSegmentFind_Private(AOData,char *,char *,PetscTruth *,AODataKey **,AODataSegment **);


123:  #include petscbt.h

125: struct _p_AOData2dGrid {
126:    int       cell_n, vertex_n, edge_n;
127:    int       cell_max, vertex_max, edge_max;
128:    int       *cell_vertex,*cell_edge,*cell_cell;
129:    PetscReal *vertex;
130:    PetscReal xmin,xmax,ymin,ymax;
131:    int       *edge_vertex,*edge_cell;
132:    PetscBT   vertex_boundary;
133: };


136: #endif