$treeview $search $mathjax
Palabos  Version 1.1
$projectbrief
$projectbrief
$searchbox

parallelBlockCommunicator2D.h

Go to the documentation of this file.
00001 /* This file is part of the Palabos library.
00002  *
00003  * Copyright (C) 2011 FlowKit Sarl
00004  * Avenue de Chailly 23
00005  * 1012 Lausanne, Switzerland
00006  * E-mail contact: contact@flowkit.com
00007  *
00008  * The most recent release of Palabos can be downloaded at 
00009  * <http://www.palabos.org/>
00010  *
00011  * The library Palabos is free software: you can redistribute it and/or
00012  * modify it under the terms of the GNU Affero General Public License as
00013  * published by the Free Software Foundation, either version 3 of the
00014  * License, or (at your option) any later version.
00015  *
00016  * The library is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU Affero General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU Affero General Public License
00022  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00023 */
00024 
00029 #ifndef PARALLEL_BLOCK_COMMUNICATOR_2D_H
00030 #define PARALLEL_BLOCK_COMMUNICATOR_2D_H
00031 
00032 #include "core/globalDefs.h"
00033 #include "multiBlock/blockCommunicator2D.h"
00034 #include "multiBlock/multiBlockManagement2D.h"
00035 #include "multiBlock/multiBlock2D.h"
00036 #include "parallelism/sendRecvPool.h"
00037 #include "parallelism/communicationPackage2D.h"
00038 #include <vector>
00039 
00040 namespace plb {
00041 
00042 #ifdef PLB_MPI_PARALLEL
00043 
00044 struct CommunicationStructure2D
00045 {
00046     CommunicationStructure2D (
00047             std::vector<Overlap2D> const& overlaps,
00048             MultiBlockManagement2D const& originManagement,
00049             MultiBlockManagement2D const& destinationManagement,
00050             plint sizeOfCell );
00051     CommunicationPackage2D sendPackage;
00052     CommunicationPackage2D recvPackage;
00053     CommunicationPackage2D sendRecvPackage;
00054     SendPoolCommunicator sendComm;
00055     RecvPoolCommunicator recvComm;
00056 };
00057 
00058 
00059 class ParallelBlockCommunicator2D : public BlockCommunicator2D {
00060 public:
00061     ParallelBlockCommunicator2D();
00062     ~ParallelBlockCommunicator2D();
00063     ParallelBlockCommunicator2D(ParallelBlockCommunicator2D const& rhs);
00064     ParallelBlockCommunicator2D& operator= (
00065             ParallelBlockCommunicator2D const& rhs );
00066     void swap(ParallelBlockCommunicator2D& rhs);
00067     virtual ParallelBlockCommunicator2D* clone() const;
00068     virtual void duplicateOverlaps(MultiBlock2D& multiBlock, modif::ModifT whichData) const;
00069     virtual void communicate( std::vector<Overlap2D> const& overlaps,
00070                               MultiBlock2D const& originMultiBlock,
00071                               MultiBlock2D& destinationMultiBlock,
00072                               modif::ModifT whichData ) const;
00073     virtual void signalPeriodicity() const;
00074 private:
00075     void communicate( CommunicationStructure2D& communication,
00076                       MultiBlock2D const& originMultiBlock,
00077                       MultiBlock2D& destinationMultiBlock, modif::ModifT whichData ) const;
00078     void subscribeOverlap (
00079         Overlap2D const& overlap, MultiBlockManagement2D const& multiBlockManagement,
00080         SendRecvPool& sendPool, SendRecvPool& recvPool, plint sizeOfCell ) const;
00081 private:
00082     mutable bool overlapsModified;
00083     mutable CommunicationStructure2D* communication;
00084 };
00085 
00086 #endif  // PLB_MPI_PARALLEL
00087 
00088 }  // namespace plb
00089 
00090 #endif  // PARALLEL_BLOCK_COMMUNICATOR_2D_H