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

parallelBlockCommunicator3D.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_3D_H
00030 #define PARALLEL_BLOCK_COMMUNICATOR_3D_H
00031 
00032 #include "core/globalDefs.h"
00033 #include "multiBlock/blockCommunicator3D.h"
00034 #include "multiBlock/multiBlockManagement3D.h"
00035 #include "multiBlock/multiBlock3D.h"
00036 #include "parallelism/sendRecvPool.h"
00037 #include "parallelism/communicationPackage3D.h"
00038 #include <vector>
00039 
00040 namespace plb {
00041 
00042 #ifdef PLB_MPI_PARALLEL
00043 
00044 struct CommunicationStructure3D
00045 {
00046     CommunicationStructure3D (
00047             std::vector<Overlap3D> const& overlaps,
00048             MultiBlockManagement3D const& originManagement,
00049             MultiBlockManagement3D const& destinationManagement,
00050             plint sizeOfCell );
00051     CommunicationPackage3D sendPackage;
00052     CommunicationPackage3D recvPackage;
00053     CommunicationPackage3D sendRecvPackage;
00054     SendPoolCommunicator sendComm;
00055     RecvPoolCommunicator recvComm;
00056 };
00057 
00058 
00059 class ParallelBlockCommunicator3D : public BlockCommunicator3D {
00060 public:
00061     ParallelBlockCommunicator3D();
00062     ~ParallelBlockCommunicator3D();
00063     ParallelBlockCommunicator3D(ParallelBlockCommunicator3D const& rhs);
00064     ParallelBlockCommunicator3D& operator= (
00065             ParallelBlockCommunicator3D const& rhs );
00066     void swap(ParallelBlockCommunicator3D& rhs);
00067     virtual ParallelBlockCommunicator3D* clone() const;
00068     virtual void duplicateOverlaps(MultiBlock3D& multiBlock, modif::ModifT whichData) const;
00069     virtual void communicate( std::vector<Overlap3D> const& overlaps,
00070                               MultiBlock3D const& originMultiBlock,
00071                               MultiBlock3D& destinationMultiBlock,
00072                               modif::ModifT whichData ) const;
00073     virtual void signalPeriodicity() const;
00074 private:
00075     void communicate( CommunicationStructure3D& communication,
00076                       MultiBlock3D const& originMultiBlock,
00077                       MultiBlock3D& destinationMultiBlock, modif::ModifT whichData ) const;
00078     void subscribeOverlap (
00079         Overlap3D const& overlap, MultiBlockManagement3D const& multiBlockManagement,
00080         SendRecvPool& sendPool, SendRecvPool& recvPool, plint sizeOfCell ) const;
00081 private:
00082     mutable bool overlapsModified;
00083     mutable CommunicationStructure3D* communication;
00084 };
00085 
00086 #endif  // PLB_MPI_PARALLEL
00087 
00088 }  // namespace plb
00089 
00090 #endif  // PARALLEL_BLOCK_COMMUNICATOR_3D_H