Actual source code: characteristicimpl.h
2: #ifndef __CHARACTERISTICIMPL_H
5: #include <petsccharacteristic.h>
7: /* Logging support */
13: #define MAX_COMPONENTS 10
15: typedef struct _p_Item {
16: int proc; /* Relative processor from which data is required (mapped to absolute by neighbors) */
17: int i, j; /* The vertex for which we need field values */
18: PassiveScalar x, y; /* Coordinates of a point on the characteristic */
19: PassiveScalar u, v; /* Velocity of a point on the characteristic */
20: PassiveScalar field[MAX_COMPONENTS]; /* Field being advected */
21: } CharacteristicPointDA2D;
23: typedef CharacteristicPointDA2D *Queue;
25: struct _CharacteristicOps {
26: PetscErrorCode (*view)(Characteristic, PetscViewer);
27: PetscErrorCode (*destroy)(Characteristic);
28: PetscErrorCode (*setup)(Characteristic);
29: };
31: struct _p_Characteristic {
32: PETSCHEADER(struct _CharacteristicOps);
33: PetscInt setupcalled;
34: PetscBool structured; /* Flag for mesh type */
35: PetscInt numIds; /* Number of integers necessary to identify a mesh element */
36: /* Velocity interpolation structures */
37: DM velocityDA; /* DM for the velocity field */
38: Vec velocity; /* Velocity field at t_n */
39: Vec velocityOld; /* Velocity field at t_n-1 */
40: PetscInt numVelocityComp; /* Number of velocity components (should be the mesh dimension) */
41: PetscInt *velocityComp; /* Components of the velocity in the DM */
42: PetscErrorCode (*velocityInterp)(Vec, PetscReal [], PetscInt, PetscInt [], PetscScalar [], void *);
43: PetscErrorCode (*velocityInterpLocal)(void *, PetscReal [], PetscInt, PetscInt [], PetscScalar [], void *);
44: void *velocityCtx; /* User context for velocity inteprolation */
45: /* Field interpolation structures */
46: DM fieldDA; /* DM for the field field */
47: Vec field; /* Field field at t_n */
48: Vec fieldOld; /* Field field at t_n-1 */
49: PetscInt numFieldComp; /* Number of field components (should be the mesh dimension) */
50: PetscInt *fieldComp; /* Components of the field in the DM */
51: PetscErrorCode (*fieldInterp)(Vec, PetscReal [], PetscInt, PetscInt [], PetscScalar [], void *);
52: PetscErrorCode (*fieldInterpLocal)(void *, PetscReal [], PetscInt, PetscInt [], PetscScalar [], void *);
53: void *fieldCtx; /* User context for field inteprolation */
54: /* Communication structures*/
55: MPI_Datatype itemType; /* Type corresponding to the item struct */
56: Queue queue;
57: PetscInt queueSize;
58: PetscInt queueMax;
59: Queue queueLocal; /* Queue of Items to receive from other processes */
60: PetscInt queueLocalSize;
61: PetscInt queueLocalMax;
62: Queue queueRemote; /* Queue of Items to send to other processes */
63: PetscInt queueRemoteSize;
64: PetscInt queueRemoteMax;
65: PetscInt numNeighbors; /* Number of neighboring processes */
66: PetscMPIInt *neighbors; /* Ranks of neighbors */
67: PetscInt *needCount; /* Number of Items requested from other processes */
68: PetscInt *localOffsets; /* Offset into queue for each process (Prefix sums of need_count) */
69: PetscInt *fillCount; /* Number of Items requested by other processes */
70: PetscInt *remoteOffsets; /* Offset into remote queue for each process (Prefix sums of fill_count) */
71: MPI_Request *request; /* Requests for sizes/velocities/fields from other processes */
72: MPI_Status *status; /* Status structues for the persistent requests */
73: void *data; /* Holder for implementation class */
74: };
86: #endif /*__CHARACTERISTICIMPL_H*/