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

serialMultiBlockLattice2D.hh

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 
00028 #ifndef SERIAL_MULTI_BLOCK_LATTICE_2D_HH
00029 #define SERIAL_MULTI_BLOCK_LATTICE_2D_HH
00030 
00031 #include "multiBlock/serialMultiBlockLattice2D.h"
00032 #include "multiBlock/multiBlockManagement2D.h"
00033 #include "atomicBlock/blockLattice2D.h"
00034 
00035 namespace plb {
00036 
00038 
00039 template<typename T, template<typename U> class Descriptor>
00040 SerialCellAccess2D<T,Descriptor>::SerialCellAccess2D()
00041   : locatedBlock(0)
00042 { }
00043 
00044 template<typename T, template<typename U> class Descriptor>
00045 void SerialCellAccess2D<T,Descriptor>::broadCastCell(Cell<T,Descriptor>& cell, plint fromBlock,
00046                                                   MultiBlockManagement2D const& multiBlockManagement) const 
00047 {
00048     // Nothing to do in the serial case
00049 }
00050 
00051 template<typename T, template<typename U> class Descriptor>
00052 Cell<T,Descriptor>& SerialCellAccess2D<T,Descriptor>::getDistributedCell (
00053         plint iX, plint iY,
00054         MultiBlockManagement2D const& multiBlockManagement,
00055         std::map<plint,BlockLattice2D<T,Descriptor>*>& lattices )
00056 {
00057     plint localX, localY;
00058 #ifdef PLB_DEBUG
00059     bool ok =
00060 #endif
00061         multiBlockManagement.findInLocalBulk
00062                   (iX,iY, locatedBlock, localX, localY);
00063     PLB_PRECONDITION( ok );
00064     return lattices[locatedBlock] -> get(localX,localY);
00065 }
00066 
00067 template<typename T, template<typename U> class Descriptor>
00068 Cell<T,Descriptor> const& SerialCellAccess2D<T,Descriptor>::getDistributedCell (
00069         plint iX, plint iY,
00070         MultiBlockManagement2D const& multiBlockManagement,
00071         std::map<plint,BlockLattice2D<T,Descriptor>*> const& lattices ) const
00072 {
00073     plint localX, localY;
00074 #ifdef PLB_DEBUG
00075     bool ok =
00076 #endif
00077         multiBlockManagement.findInLocalBulk
00078             (iX,iY, locatedBlock, localX, localY);
00079     PLB_PRECONDITION( ok );
00080     return lattices.find(locatedBlock)->second -> get(localX,localY);
00081 }
00082 
00083 template<typename T, template<typename U> class Descriptor>
00084 SerialCellAccess2D<T,Descriptor>* SerialCellAccess2D<T,Descriptor>::clone() const {
00085     return new SerialCellAccess2D<T,Descriptor>;
00086 }
00087 
00088 }  // namespace plb
00089 
00090 #endif  // SERIAL_MULTI_BLOCK_LATTICE_2D_HH