#include "MPICommunicator.h"
#include "ThirdPartyHeadersBegin.h"
#include <sstream>
#include "ThirdPartyHeadersEnd.h"
#include "basicTypes.h"
#include "MinMax.h"
#include "mpiDatatype.h"
namespace tecplot { namespace teciompi { namespace { void throwMPIError(char const* method, char const* mpiRoutine, int errorCode) { std::ostringstream ___2432; ___2432 << "Error in " << method << ": " << mpiRoutine << " returned error code " << errorCode; throw(MPIError(___2432.str())); } } MPICommunicator::MPICommunicator(MPI_Comm communicator) : m_communicator(communicator) {} template<typename T> void tecplot::teciompi::MPICommunicator::sendScalar(T ___4298, int dest, int tag) { int ___3358 = MPI_Send(&___4298, 1, mpiDatatype<T>(), dest, tag, m_communicator); if (___3358 != MPI_SUCCESS) throwMPIError("MPICommunicator::sendScalar", "MPI_Send", ___3358); } template<> void tecplot::teciompi::MPICommunicator::sendScalar<___2479>(___2479 ___4298, int dest, int tag) { int ___3358 = MPI_Send(&___4298, 2, MPI_DOUBLE, dest, tag, m_communicator); if (___3358 != MPI_SUCCESS) throwMPIError("MPICommunicator::sendScalar", "MPI_Send", ___3358); } template<typename T> void tecplot::teciompi::MPICommunicator::receiveScalar(T& ___4298, int ___3656, int tag) { int ___3358 = MPI_Recv(&___4298, 1, mpiDatatype<T>(), ___3656, tag, m_communicator, MPI_STATUS_IGNORE); if (___3358 != MPI_SUCCESS) throwMPIError("MPICommunicator::receiveScalar", "MPI_Recv", ___3358); } template<> void tecplot::teciompi::MPICommunicator::receiveScalar<___2479>(___2479& ___4298, int ___3656, int tag) { int ___3358 = MPI_Recv(&___4298, 2, MPI_DOUBLE, ___3656, tag, m_communicator, MPI_STATUS_IGNORE); if (___3358 != MPI_SUCCESS) throwMPIError("MPICommunicator::receiveScalar", "MPI_Recv", ___3358); } template<typename T> void tecplot::teciompi::MPICommunicator::sendVector(SimpleVector<T> const& vec, int dest, int sizeTag, int vecTag) { REQUIRE(vec.size() > 0); REQUIRE(sizeTag != vecTag); int ___3358 = MPI_Send(const_cast<int*>(&vec.size()), 1, MPI_INT, dest, sizeTag, m_communicator); if (___3358 == MPI_SUCCESS) ___3358 = MPI_Send(const_cast<T*>(vec.begin()), vec.size(), mpiDatatype<T>(), dest, vecTag, m_communicator); if (___3358 != MPI_SUCCESS) throwMPIError("MPICommunicator::sendVector", "MPI_Send", ___3358); } template<> void tecplot::teciompi::MPICommunicator::sendVector<___2479>(SimpleVector<___2479> const& vec, int dest, int sizeTag, int vecTag) { REQUIRE(vec.size() > 0); REQUIRE(sizeTag != vecTag); int ___3358 = MPI_Send(const_cast<int*>(&vec.size()), 1, MPI_INT, dest, sizeTag, m_communicator); if (___3358 == MPI_SUCCESS) ___3358 = MPI_Send(const_cast<___2479*>(vec.begin()), 2 * vec.size(), MPI_DOUBLE, dest, vecTag, m_communicator); if (___3358 != MPI_SUCCESS) throwMPIError("MPICommunicator::sendVector", "MPI_Send", ___3358); } template<typename T> void tecplot::teciompi::MPICommunicator::receiveVector(SimpleVector<T>& vec, int ___3656, int sizeTag, int vecTag) { REQUIRE(vec.size() == 0); REQUIRE(sizeTag != vecTag); int size; int ___3358 = MPI_Recv(&size, 1, MPI_INT, ___3656, sizeTag, m_communicator, MPI_STATUS_IGNORE); if (___3358 == MPI_SUCCESS) { vec.allocate(size); ___3358 = MPI_Recv(vec.begin(), size, mpiDatatype<T>(), ___3656, vecTag, m_communicator, MPI_STATUS_IGNORE); } if (___3358 != MPI_SUCCESS) throwMPIError("MPICommunicator::receiveVector", "MPI_Recv", ___3358); } template<> void tecplot::teciompi::MPICommunicator::receiveVector<___2479>(SimpleVector<___2479>& vec, int ___3656, int sizeTag, int vecTag) { REQUIRE(vec.size() == 0); REQUIRE(sizeTag != vecTag); int size; int ___3358 = MPI_Recv(&size, 1, MPI_INT, ___3656, sizeTag, m_communicator, MPI_STATUS_IGNORE); if (___3358 == MPI_SUCCESS) { vec.allocate(size); ___3358 = MPI_Recv(vec.begin(), 2 * size, MPI_DOUBLE, ___3656, vecTag, m_communicator, MPI_STATUS_IGNORE); } if (___3358 != MPI_SUCCESS) throwMPIError("MPICommunicator::receiveVector", "MPI_Recv", ___3358); }
 #define INSTANTIATE_FOR_TYPE(T) \
 template void MPICommunicator::sendScalar<T>(T ___4298, int dest, int tag); \
 template void MPICommunicator::receiveScalar<T>(T& ___4298, int ___3656, int tag); \
 template void MPICommunicator::sendVector<T>(SimpleVector<T> const& vec, int dest, int sizeTag, int vecTag); \
 template void MPICommunicator::receiveVector<T>(SimpleVector<T>& vec, int ___3656, int sizeTag, int vecTag);
INSTANTIATE_FOR_TYPE(char) INSTANTIATE_FOR_TYPE(uint8_t) INSTANTIATE_FOR_TYPE(uint16_t) INSTANTIATE_FOR_TYPE(int32_t) INSTANTIATE_FOR_TYPE(uint32_t) INSTANTIATE_FOR_TYPE(int64_t) INSTANTIATE_FOR_TYPE(uint64_t) INSTANTIATE_FOR_TYPE(float) INSTANTIATE_FOR_TYPE(double)
 #undef INSTANTIATE_FOR_TYPE
}}
