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