00001
00002
00008 #if !defined(__elc_LagrangianComm_h__)
00009 #define __elc_LagrangianComm_h__
00010
00011
00012 #if defined(DEBUG_elc) && !defined(DEBUG_LagrangianComm)
00013 #define DEBUG_LagrangianComm
00014 #endif
00015
00016 #ifdef DEBUG_LagrangianComm
00017 #ifndef DEBUG_ELComm
00018 #define DEBUG_ELComm
00019 #endif
00020 #endif
00021
00022 #include "ELComm.h"
00023
00024 #if defined(ELC_USE_CPP_INTERFACE) && !defined(PT2PT_BBOX_USE_CPP_INTERFACE)
00025 #define PT2PT_BBOX_USE_CPP_INTERFACE
00026 #endif
00027 #include "../concurrent/pt2pt_bbox.h"
00028
00029 #include "../ads/iterator/TrivialOutputIterator.h"
00030
00031 BEGIN_NAMESPACE_ELC
00032
00033
00035
00041 template<int N, typename T>
00042 class LagrangianComm :
00043 public ELComm<N,T> {
00044
00045
00046
00047
00048 private:
00049
00050 typedef ELComm<N,T> Base;
00051
00052
00053
00054
00055
00056 protected:
00057
00059 typedef typename Base::Point Point;
00061 typedef typename Base::BBox BBox;
00063 typedef typename Base::MpiRequest MpiRequest;
00065 typedef typename Base::MpiStatus MpiStatus;
00066
00067
00068
00069
00070
00071 public:
00072
00074 typedef typename Base::Number Number;
00075
00076
00077
00078
00079
00080 private:
00081
00083 using Base::_comm;
00085 using Base::_mpiNumber;
00087 using Base::_vertexIdentifierStyle;
00088
00090 using Base::TagIdentifiers;
00092 using Base::TagPositions;
00094 using Base::TagVelocities;
00096 using Base::TagFaceData;
00098 using Base::TagPressures;
00099
00100
00101
00102
00103
00104 private:
00105
00106 #ifdef ELC_USE_CPP_INTERFACE
00107
00108 MPI::Intracomm _lagrangianCommunicator;
00109 #else
00110
00111 MPI_Comm _lagrangianCommunicator;
00112 #endif
00113
00115 int _eulerianRoot;
00116
00118 std::vector<int> _eulerianProcessors;
00119
00120
00121 concurrent::PtToPt2Grp1Dom<N, T, ads::FixedArray<3,int>, int>
00122 _pointToPoint;
00123
00124 std::vector<MpiRequest> _identifierRequests;
00125 std::vector<MpiRequest> _positionRequests;
00126 std::vector<MpiRequest> _velocityRequests;
00127 std::vector<MpiRequest> _connectivityRequests;
00128
00129 int _numNodes;
00130 int _numFaces;
00131
00133 std::vector<ads::Array<1,Number> > _pressures;
00134 ads::Array<1,Number,false> _compositePressures;
00135
00136 std::vector<MpiRequest> _pressureRequests;
00137
00138 int _numPoints;
00139
00140
00141
00142
00143
00144 private:
00145
00146
00147 LagrangianComm();
00148
00149
00150 LagrangianComm(const LagrangianComm&);
00151
00152
00153 LagrangianComm&
00154 operator=(const LagrangianComm&);
00155
00156 public:
00157
00158
00160
00161
00162 #ifdef ELC_USE_CPP_INTERFACE
00163
00164
00173 LagrangianComm(const MPI::Comm& comm, const MPI::Intracomm& lagrangian,
00174 const int eulerianSize, const int eulerianRoot,
00175 VertexIdentifierStyle vertexIdentifierStyle) :
00176 Base(comm, vertexIdentifierStyle),
00177 _lagrangianCommunicator(lagrangian.Dup()),
00178 _eulerianRoot(eulerianRoot),
00179 _pointToPoint(comm, lagrangian, eulerianSize, eulerianRoot)
00180 {}
00181 #else
00182
00183
00192 LagrangianComm(const MPI_Comm comm, const MPI_Comm lagrangian,
00193 const int eulerianSize, const int eulerianRoot,
00194 VertexIdentifierStyle vertexIdentifierStyle) :
00195 Base(comm, vertexIdentifierStyle),
00196 _lagrangianCommunicator(),
00197 _eulerianRoot(eulerianRoot),
00198 _pointToPoint(comm, lagrangian, eulerianSize, eulerianRoot) {
00199 MPI_Comm_dup(lagrangian, &_lagrangianCommunicator);
00200 }
00201 #endif
00202
00204 virtual
00205 ~LagrangianComm()
00206 {
00207 #ifdef ELC_USE_CPP_INTERFACE
00208 _lagrangianCommunicator.Free();
00209 #else
00210 MPI_Comm_free(&_lagrangianCommunicator);
00211 #endif
00212 }
00213
00214
00215
00217
00218
00219
00220
00221
00222
00224
00238 void
00239 sendMesh(const int numNodes, const void* identifiers,
00240 const void* positions, const void* velocities,
00241 const int numFaces, const void* connectivities);
00242
00244 void
00245 waitForMesh();
00246
00248 void
00249 receivePressure(const int numPoints, void* pressures);
00250
00252 void
00253 waitForPressure();
00254
00255
00256 };
00257
00258
00259 END_NAMESPACE_ELC
00260
00261 #define __elc_LagrangianComm_ipp__
00262 #include "LagrangianComm.ipp"
00263 #undef __elc_LagrangianComm_ipp__
00264
00265 #endif