Saras
Finite   Difference   Solver   for   Fluid   Dynamics   Simulations
mpidata.h
Go to the documentation of this file.
1/********************************************************************************************************************************************
2 * Saras
3 *
4 * Copyright (C) 2019, Mahendra K. Verma
5 *
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the copyright holder nor the
16 * names of its contributors may be used to endorse or promote products
17 * derived from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 *
30 ********************************************************************************************************************************************
31 */
43#ifndef MPIDATA_H
44#define MPIDATA_H
45
46#include <blitz/array.h>
47#include <mpi.h>
48
49#include "parallel.h"
50
51class mpidata {
52 private:
54 MPI_Datatype sendSubarrayX0;
56 MPI_Datatype sendSubarrayX1;
58 MPI_Datatype sendSubarrayY0;
60 MPI_Datatype sendSubarrayY1;
61
63 MPI_Datatype recvSubarrayX0;
65 MPI_Datatype recvSubarrayX1;
67 MPI_Datatype recvSubarrayY0;
69 MPI_Datatype recvSubarrayY1;
70
72 MPI_Datatype sendSubarrayX0Y0;
74 MPI_Datatype sendSubarrayX0Y1;
76 MPI_Datatype sendSubarrayX1Y0;
78 MPI_Datatype sendSubarrayX1Y1;
79
81 MPI_Datatype recvSubarrayX0Y0;
83 MPI_Datatype recvSubarrayX0Y1;
85 MPI_Datatype recvSubarrayX1Y0;
87 MPI_Datatype recvSubarrayX1Y1;
88
90 blitz::Array<MPI_Request, 1> recvRequest;
91
93 blitz::Array<MPI_Status, 1> recvStatus;
94
96 blitz::Array<real, 3> dataField;
97
98 public:
101
102 mpidata(blitz::Array<real, 3> inputArray, const parallel &parallelData);
103
104 void createSubarrays(const blitz::TinyVector<int, 3> globSize,
105 const blitz::TinyVector<int, 3> coreSize,
106 const blitz::TinyVector<int, 3> padWidth,
107 const bool xStag, const bool yStag);
108
109 void syncData();
110};
111
125#endif
Class to store MPI derived datatypes for individual arrays.
Definition: mpidata.h:51
const parallel & rankData
A const reference to the global variables stored in the parallel class to access rank data.
Definition: mpidata.h:100
void createSubarrays(const blitz::TinyVector< int, 3 > globSize, const blitz::TinyVector< int, 3 > coreSize, const blitz::TinyVector< int, 3 > padWidth, const bool xStag, const bool yStag)
Function to create the subarray MPI_Datatypes.
Definition: mpidata.cc:82
void syncData()
Function to send data across all sub-domain faces.
Definition: mpidata.cc:278
mpidata(blitz::Array< real, 3 > inputArray, const parallel &parallelData)
Constructor of the mpidata class.
Definition: mpidata.cc:57
Class for all the global variables and functions related to parallelization.
Definition: parallel.h:51
Class declaration of parallel.