Date: 2015-10-02T22:29:38+00:00

Actual source code: characteristicimpl.h
petsc-3.6.2 2015-10-02
Report Typos and Errors

      2: #ifndef __CHARACTERISTICIMPL_H

      5: #include <petsccharacteristic.h>
      6: #include <petsc/private/petscimpl.h>

      8: /* Logging support */
      9: PETSC_EXTERN PetscClassId CHARACTERISTIC_CLASSID;
     10: PETSC_EXTERN PetscBool        CharacteristicRegisterAllCalled;
     11: PETSC_EXTERN PetscErrorCode   CharacteristicRegisterAll(void);
     12: PETSC_EXTERN PetscLogEvent CHARACTERISTIC_SetUp, CHARACTERISTIC_Solve, CHARACTERISTIC_QueueSetup, CHARACTERISTIC_DAUpdate;
     13: PETSC_EXTERN PetscLogEvent CHARACTERISTIC_HalfTimeLocal, CHARACTERISTIC_HalfTimeRemote, CHARACTERISTIC_HalfTimeExchange;
     14: PETSC_EXTERN PetscLogEvent CHARACTERISTIC_FullTimeLocal, CHARACTERISTIC_FullTimeRemote, CHARACTERISTIC_FullTimeExchange;

     16: #define MAX_COMPONENTS 10

     18: typedef struct _p_Item {
     19:   int           proc; /* Relative processor from which data is required (mapped to absolute by neighbors) */
     20:   int           i, j; /* The vertex for which we need field values */
     21:   PassiveScalar x, y; /* Coordinates of a point on the characteristic */
     22:   PassiveScalar u, v; /* Velocity of a point on the characteristic */
     23:   PassiveScalar field[MAX_COMPONENTS]; /* Field being advected */
     24: } CharacteristicPointDA2D;

     26: typedef CharacteristicPointDA2D *Queue;

     28: struct _CharacteristicOps {
     29:   PetscErrorCode (*view)(Characteristic, PetscViewer);
     30:   PetscErrorCode (*destroy)(Characteristic);
     31:   PetscErrorCode (*setup)(Characteristic);
     32: };

     34: struct _p_Characteristic {
     35:   PETSCHEADER(struct _CharacteristicOps);
     36:   PetscInt     setupcalled;
     37:   PetscBool    structured;      /* Flag for mesh type */
     38:   PetscInt     numIds;          /* Number of integers necessary to identify a mesh element */
     39:   /* Velocity interpolation structures */
     40:   DM           velocityDA;      /* DM for the velocity field */
     41:   Vec          velocity;        /* Velocity field at t_n */
     42:   Vec          velocityOld;     /* Velocity field at t_n-1 */
     43:   PetscInt     numVelocityComp; /* Number of velocity components (should be the mesh dimension) */
     44:   PetscInt    *velocityComp;    /* Components of the velocity in the DM */
     45:   PetscErrorCode (*velocityInterp)(Vec, PetscReal [], PetscInt, PetscInt [], PetscScalar [], void *);
     46:   PetscErrorCode (*velocityInterpLocal)(void *, PetscReal [], PetscInt, PetscInt [], PetscScalar [], void *);
     47:   void        *velocityCtx;     /* User context for velocity inteprolation */
     48:   /* Field interpolation structures */
     49:   DM           fieldDA;         /* DM for the field field */
     50:   Vec          field;           /* Field field at t_n */
     51:   Vec          fieldOld;        /* Field field at t_n-1 */
     52:   PetscInt     numFieldComp;    /* Number of field components (should be the mesh dimension) */
     53:   PetscInt    *fieldComp;       /* Components of the field in the DM */
     54:   PetscErrorCode (*fieldInterp)(Vec, PetscReal [], PetscInt, PetscInt [], PetscScalar [], void *);
     55:   PetscErrorCode (*fieldInterpLocal)(void *, PetscReal [], PetscInt, PetscInt [], PetscScalar [], void *);
     56:   void        *fieldCtx;        /* User context for field inteprolation */
     57:   /* Communication structures*/
     58:   MPI_Datatype itemType;        /* Type corresponding to the item struct */
     59:   Queue        queue;
     60:   PetscInt     queueSize;
     61:   PetscInt     queueMax;
     62:   Queue        queueLocal;      /* Queue of Items to receive from other processes */
     63:   PetscInt     queueLocalSize;
     64:   PetscInt     queueLocalMax;
     65:   Queue        queueRemote;     /* Queue of Items to send to other processes */
     66:   PetscInt     queueRemoteSize;
     67:   PetscInt     queueRemoteMax;
     68:   PetscInt     numNeighbors;    /* Number of neighboring processes */
     69:   PetscMPIInt *neighbors;       /* Ranks of neighbors */
     70:   PetscInt    *needCount;       /* Number of Items requested from other processes */
     71:   PetscInt    *localOffsets;    /* Offset into queue for each process (Prefix sums of need_count) */
     72:   PetscInt    *fillCount;       /* Number of Items requested by other processes */
     73:   PetscInt    *remoteOffsets;   /* Offset into remote queue for each process (Prefix sums of fill_count) */
     74:   MPI_Request *request;         /* Requests for sizes/velocities/fields from other processes */
     75:   MPI_Status  *status;          /* Status structues for the persistent requests */
     76:   void        *data;            /* Holder for implementation class */
     77: };

     79: PETSC_EXTERN PetscErrorCode CharacteristicSetNeighbors(Characteristic, PetscInt, PetscMPIInt []);
     80: PETSC_EXTERN PetscErrorCode CharacteristicAddPoint(Characteristic, CharacteristicPointDA2D *);
     81: PETSC_EXTERN PetscErrorCode CharacteristicSendCoordinatesBegin(Characteristic);
     82: PETSC_EXTERN PetscErrorCode CharacteristicSendCoordinatesEnd(Characteristic);
     83: PETSC_EXTERN PetscErrorCode CharacteristicGetValuesBegin(Characteristic);
     84: PETSC_EXTERN PetscErrorCode CharacteristicGetValuesEnd(Characteristic);

     86: #endif /*__CHARACTERISTICIMPL_H*/