Escript  Revision_4320
Coupler.h
Go to the documentation of this file.
1 
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2013 by University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Open Software License version 3.0
9 * http://www.opensource.org/licenses/osl-3.0.php
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development since 2012 by School of Earth Sciences
13 *
14 *****************************************************************************/
15 
16 
17 /************************************************************************************/
18 
19 /* Paso: coupler */
20 
21 /************************************************************************************/
22 
23 /* Author: Lutz Gross, l.gross@uq.edu.au */
24 
25 /************************************************************************************/
26 
27 #ifndef INC_PASO_COUPLER
28 #define INC_PASO_COUPLER
29 
30 #include "SharedComponents.h"
31 /************************************************************************************/
32 
33 typedef struct Paso_Connector {
34 
39 
41 typedef struct Paso_Coupler {
42 
44 
46 
48  double *data; /* unmanaged pointer to data to be sent */
49  double *send_buffer;
50  double *recv_buffer;
51  #ifdef ESYS_MPI
53  MPI_Status* mpi_stati;
54  #else
55  void* mpi_requests;
56  void* mpi_stati;
57  #endif
58 
61 
62 } Paso_Coupler;
63 
64 
65 
68 
71 
74 
77 
80 
81 
84 
87 
89 void Paso_Coupler_startCollect(Paso_Coupler* self,const double* in);
90 
93 
96 
97 #define Paso_Coupler_borrowLocalData(_in_) (_in_)->data
98 #define Paso_Coupler_borrowRemoteData(_in_) (_in_)->recv_buffer
99 #define Paso_Coupler_getNumSharedComponents(_in_) ((_in_)->connector->send->numSharedComponents)
100 #define Paso_Coupler_getNumOverlapComponents(_in_) ((_in_)->connector->recv->numSharedComponents)
101 #define Paso_Coupler_getNumSharedValues(_in_) ( Paso_Coupler_getNumSharedComponents(_in_) * (_in_)->block_size )
102 #define Paso_Coupler_getNumOverlapValues(_in_) ( Paso_Coupler_getNumOverlapComponents(_in_) * (_in_)->block_size )
103 #define Paso_Coupler_getLocalLength(_in_) ( (_in_)->connector->send->local_length )
104 
106 void Paso_Coupler_copyAll(const Paso_Coupler* src, Paso_Coupler* target);
107 
108 
110 void Paso_Coupler_fillOverlap(const dim_t n, double* x, Paso_Coupler *coupler);
111 
113 void Paso_Coupler_max(const dim_t n, double* x, Paso_Coupler *coupler);
114 
115 #endif
116