Actual source code: data_ex.h

      1: #pragma once

      3: #include <petscvec.h>
      4: #include <petscmat.h>

      6: typedef enum {
      7:   DEOBJECT_INITIALIZED = 0,
      8:   DEOBJECT_FINALIZED,
      9:   DEOBJECT_STATE_UNKNOWN
     10: } DMSwarmDEObjectState;

     12: typedef struct _p_DMSwarmDataEx *DMSwarmDataEx;
     13: struct _p_DMSwarmDataEx {
     14:   PetscInt             instance;
     15:   MPI_Comm             comm;
     16:   PetscMPIInt          rank;
     17:   PetscMPIInt          n_neighbour_procs;
     18:   PetscMPIInt         *neighbour_procs;          /* [n_neighbour_procs] */
     19:   PetscInt            *messages_to_be_sent;      /* [n_neighbour_procs] */
     20:   PetscInt            *message_offsets;          /* [n_neighbour_procs] */
     21:   PetscInt            *messages_to_be_recvieved; /* [n_neighbour_procs] */
     22:   size_t               unit_message_size;
     23:   void                *send_message;
     24:   PetscInt             send_message_length;
     25:   void                *recv_message;
     26:   PetscInt             recv_message_length;
     27:   PetscMPIInt         *send_tags, *recv_tags;
     28:   PetscInt             total_pack_cnt;
     29:   PetscInt            *pack_cnt; /* [n_neighbour_procs] */
     30:   DMSwarmDEObjectState topology_status;
     31:   DMSwarmDEObjectState message_lengths_status;
     32:   DMSwarmDEObjectState packer_status;
     33:   DMSwarmDEObjectState communication_status;
     34:   MPI_Status          *_stats;
     35:   MPI_Request         *_requests;
     36: };

     38: /* OBJECT_STATUS */
     39: /* #define OBJECT_INITIALIZED    0 */
     40: /* #define OBJECT_FINALIZED      1 */
     41: /* #define OBJECT_STATE_UNKNOWN  2 */

     43: extern const char *status_names[];

     45: PETSC_INTERN PetscErrorCode DMSwarmDataExCreate(MPI_Comm, const PetscInt, DMSwarmDataEx *);
     46: PETSC_INTERN PetscErrorCode DMSwarmDataExView(DMSwarmDataEx);
     47: PETSC_INTERN PetscErrorCode DMSwarmDataExDestroy(DMSwarmDataEx);
     48: PETSC_INTERN PetscErrorCode DMSwarmDataExTopologyInitialize(DMSwarmDataEx);
     49: PETSC_INTERN PetscErrorCode DMSwarmDataExTopologyAddNeighbour(DMSwarmDataEx, const PetscMPIInt);
     50: PETSC_INTERN PetscErrorCode DMSwarmDataExTopologyFinalize(DMSwarmDataEx);
     51: PETSC_INTERN PetscErrorCode DMSwarmDataExInitializeSendCount(DMSwarmDataEx);
     52: PETSC_INTERN PetscErrorCode DMSwarmDataExAddToSendCount(DMSwarmDataEx, const PetscMPIInt, const PetscInt);
     53: PETSC_INTERN PetscErrorCode DMSwarmDataExFinalizeSendCount(DMSwarmDataEx);
     54: PETSC_INTERN PetscErrorCode DMSwarmDataExPackInitialize(DMSwarmDataEx, size_t);
     55: PETSC_INTERN PetscErrorCode DMSwarmDataExPackData(DMSwarmDataEx, PetscMPIInt, PetscInt, void *);
     56: PETSC_INTERN PetscErrorCode DMSwarmDataExPackFinalize(DMSwarmDataEx);
     57: PETSC_INTERN PetscErrorCode DMSwarmDataExBegin(DMSwarmDataEx);
     58: PETSC_INTERN PetscErrorCode DMSwarmDataExEnd(DMSwarmDataEx);
     59: PETSC_INTERN PetscErrorCode DMSwarmDataExGetSendData(DMSwarmDataEx, PetscInt *, void **);
     60: PETSC_INTERN PetscErrorCode DMSwarmDataExGetRecvData(DMSwarmDataEx, PetscInt *, void **);
     61: PETSC_INTERN PetscErrorCode DMSwarmDataExTopologyGetNeighbours(DMSwarmDataEx, PetscMPIInt *, PetscMPIInt *[]);