1095059a4SDave May #ifndef __DATA_EXCHANGER_H__ 2095059a4SDave May #define __DATA_EXCHANGER_H__ 3095059a4SDave May 4095059a4SDave May #include <petscvec.h> 5095059a4SDave May #include <petscmat.h> 6095059a4SDave May 7095059a4SDave May typedef enum { DEOBJECT_INITIALIZED=0, DEOBJECT_FINALIZED, DEOBJECT_STATE_UNKNOWN } DEObjectState; 8095059a4SDave May 9095059a4SDave May typedef struct _p_DataEx* DataEx; 10095059a4SDave May struct _p_DataEx { 11095059a4SDave May PetscInt instance; 12095059a4SDave May MPI_Comm comm; 13095059a4SDave May PetscMPIInt rank; 14095059a4SDave May PetscMPIInt n_neighbour_procs; 15095059a4SDave May PetscMPIInt *neighbour_procs; /* [n_neighbour_procs] */ 16095059a4SDave May PetscInt *messages_to_be_sent; /* [n_neighbour_procs] */ 17095059a4SDave May PetscInt *message_offsets; /* [n_neighbour_procs] */ 18095059a4SDave May PetscInt *messages_to_be_recvieved; /* [n_neighbour_procs] */ 19095059a4SDave May size_t unit_message_size; 20095059a4SDave May void *send_message; 21095059a4SDave May PetscInt send_message_length; 22095059a4SDave May void *recv_message; 23095059a4SDave May PetscInt recv_message_length; 24*e4fbd051SBarry Smith PetscMPIInt *send_tags, *recv_tags; 25095059a4SDave May PetscInt total_pack_cnt; 26095059a4SDave May PetscInt *pack_cnt; /* [n_neighbour_procs] */ 27095059a4SDave May DEObjectState topology_status; 28095059a4SDave May DEObjectState message_lengths_status; 29095059a4SDave May DEObjectState packer_status; 30095059a4SDave May DEObjectState communication_status; 31095059a4SDave May MPI_Status *_stats; 32095059a4SDave May MPI_Request *_requests; 33095059a4SDave May }; 34095059a4SDave May 35095059a4SDave May 36095059a4SDave May /* OBJECT_STATUS */ 37d2ebda5dSSatish Balay /* #define OBJECT_INITIALIZED 0 */ 38d2ebda5dSSatish Balay /* #define OBJECT_FINALIZED 1 */ 39d2ebda5dSSatish Balay /* #define OBJECT_STATE_UNKNOWN 2 */ 40095059a4SDave May 41095059a4SDave May extern const char *status_names[]; 42095059a4SDave May 43*e4fbd051SBarry Smith PetscErrorCode DataExCreate(MPI_Comm,const PetscInt, DataEx *); 44*e4fbd051SBarry Smith PetscErrorCode DataExView(DataEx); 45*e4fbd051SBarry Smith PetscErrorCode DataExDestroy(DataEx); 46*e4fbd051SBarry Smith PetscErrorCode DataExTopologyInitialize(DataEx); 47*e4fbd051SBarry Smith PetscErrorCode DataExTopologyAddNeighbour(DataEx,const PetscMPIInt); 48*e4fbd051SBarry Smith PetscErrorCode DataExTopologyFinalize(DataEx); 49*e4fbd051SBarry Smith PetscErrorCode DataExInitializeSendCount(DataEx); 50*e4fbd051SBarry Smith PetscErrorCode DataExAddToSendCount(DataEx,const PetscMPIInt,const PetscInt); 51*e4fbd051SBarry Smith PetscErrorCode DataExFinalizeSendCount(DataEx); 52*e4fbd051SBarry Smith PetscErrorCode DataExPackInitialize(DataEx,size_t); 53*e4fbd051SBarry Smith PetscErrorCode DataExPackData(DataEx,PetscMPIInt,PetscInt,void*); 54*e4fbd051SBarry Smith PetscErrorCode DataExPackFinalize(DataEx); 55*e4fbd051SBarry Smith PetscErrorCode DataExBegin(DataEx); 56*e4fbd051SBarry Smith PetscErrorCode DataExEnd(DataEx); 57*e4fbd051SBarry Smith PetscErrorCode DataExGetSendData(DataEx,PetscInt*,void**); 58*e4fbd051SBarry Smith PetscErrorCode DataExGetRecvData(DataEx,PetscInt*,void**); 59*e4fbd051SBarry Smith PetscErrorCode DataExTopologyGetNeighbours(DataEx,PetscMPIInt*,PetscMPIInt *[]); 60095059a4SDave May 61095059a4SDave May 62095059a4SDave May #endif 63095059a4SDave May 64