Actual source code: aoimpl.h
1: /*
2: This private file should not be included in users' code.
3: */
5: #ifndef __AOIMPL
8: #include petscao.h
10: /*
11: Defines the abstract AO operations
12: */
13: struct _AOOps {
14: /* Generic Operations */
15: PetscErrorCode (*view)(AO, PetscViewer);
16: PetscErrorCode (*destroy)(AO);
17: /* AO-Specific Operations */
18: PetscErrorCode (*petsctoapplication)(AO, PetscInt, PetscInt[]);
19: PetscErrorCode (*applicationtopetsc)(AO, PetscInt, PetscInt[]);
20: PetscErrorCode (*petsctoapplicationpermuteint)(AO, PetscInt, PetscInt[]);
21: PetscErrorCode (*applicationtopetscpermuteint)(AO, PetscInt, PetscInt[]);
22: PetscErrorCode (*petsctoapplicationpermutereal)(AO, PetscInt, PetscReal[]);
23: PetscErrorCode (*applicationtopetscpermutereal)(AO, PetscInt, PetscReal[]);
24: };
26: struct _p_AO {
27: PETSCHEADER(struct _AOOps);
28: void *data; /* implementation-specific data */
29: PetscInt N,n; /* global, local vector size */
30: };
32: /*
33: Defines the abstract AOData operations
34: */
35: struct _AODataOps {
36: PetscErrorCode (*segmentadd)(AOData,const char[],const char[],PetscInt,PetscInt,PetscInt*,void*,PetscDataType);
37: PetscErrorCode (*segmentget)(AOData,const char[],const char[],PetscInt,PetscInt*,void**);
38: PetscErrorCode (*segmentrestore)(AOData,const char[],const char[],PetscInt,PetscInt*,void**);
39: PetscErrorCode (*segmentgetlocal)(AOData,const char[],const char[],PetscInt,PetscInt*,void**);
40: PetscErrorCode (*segmentrestorelocal)(AOData,const char[],const char[],PetscInt,PetscInt*,void**);
41: PetscErrorCode (*segmentgetreduced)(AOData,const char[],const char[],PetscInt,PetscInt*,IS *);
42: PetscErrorCode (*segmentgetextrema)(AOData,const char[],const char[],void *,void *);
43: PetscErrorCode (*keyremap)(AOData,const char[],AO);
44: PetscErrorCode (*keygetadjacency)(AOData,const char[],Mat*);
45: PetscErrorCode (*keygetactive)(AOData,const char[],const char[],PetscInt,PetscInt*,PetscInt,IS*);
46: PetscErrorCode (*keygetactivelocal)(AOData,const char[],const char[],PetscInt,PetscInt*,PetscInt,IS*);
47: PetscErrorCode (*segmentpartition)(AOData,const char[],const char[]);
48: PetscErrorCode (*keyremove)(AOData,const char[]);
49: PetscErrorCode (*segmentremove)(AOData,const char[],const char[]);
50: PetscErrorCode (*destroy)(AOData);
51: PetscErrorCode (*view)(AOData,PetscViewer);
52: };
54: /*
55: A AODate object consists of
57: - key1
58: * name = name of first key
59: * N = number of key entries
60: * nlocal = number of local key entries
61: * nsegments = number of segments in first key
62: * ltog = local to global mapping
63: - segment1
64: * name = name of first segment in first key
65: * bs = blocksize of first segment in first key
66: * datatype = datatype of first segment in first key
68: - segment2
70: ....
72: - key2
74: ....
75: */
76: typedef struct __AODataSegment AODataSegment;
77: struct __AODataSegment {
78: void *data; /* implementation-specific data */
79: char *name;
80: PetscInt bs; /* block size of basic chunk */
81: PetscDataType datatype; /* type of data item, PetscInt, double etc */
82: AODataSegment *next;
83: };
85: typedef struct __AODataKey AODataKey;
86: struct __AODataKey {
87: void *data; /* implementation-specific data */
88: char *name;
89: PetscInt N; /* number of key entries */
90: PetscInt nsegments; /* number of segments in key */
91: AODataSegment *segments;
92: ISLocalToGlobalMapping ltog;
94: /* should the following be so public? */
96: PetscInt nlocal; /* number of key entries owned locally */
97: PetscInt *rowners; /* ownership range of each processor */
98: PetscInt rstart,rend; /* first and 1 + last owned locally */
99: AODataKey *next;
100: };
102: typedef struct __AODataAlias AODataAlias; /* allows a field or key to have several names */
103: struct __AODataAlias {
104: char *alias;
105: char *name;
106: AODataAlias *next;
107: };
109: struct _p_AOData {
110: PETSCHEADER(struct _AODataOps);
111: PetscInt nkeys; /* current number of keys */
112: AODataKey *keys;
113: void *data;
114: PetscInt datacomplete; /* indicates all AOData object is fully set */
115: AODataAlias *aliases;
116: };
118: EXTERN PetscErrorCode AODataKeyFind_Private(AOData,const char[],PetscTruth *,AODataKey **);
119: EXTERN PetscErrorCode AODataSegmentFind_Private(AOData,const char[],const char[],PetscTruth *,AODataKey **,AODataSegment **);
122: #include petscbt.h
124: struct _n_AOData2dGrid {
125: PetscInt cell_n, vertex_n, edge_n;
126: PetscInt cell_max, vertex_max, edge_max;
127: PetscInt *cell_vertex,*cell_edge,*cell_cell;
128: PetscReal *vertex;
129: PetscReal xmin,xmax,ymin,ymax;
130: PetscInt *edge_vertex,*edge_cell;
131: PetscBT vertex_boundary;
132: };
137: #endif