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

multiGridLattice2D.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 
00025 /* Main author: Daniel Lagrava
00026  **/
00027 
00028 #ifndef MULTI_GRID_LATTICE_2D_H
00029 #define MULTI_GRID_LATTICE_2D_H
00030 
00031 #include "multiGrid/multiGrid2D.h"
00032 #include "core/globalDefs.h"
00033 #include "core/geometry2D.h"
00034 #include "core/array.h"
00035 #include "multiBlock/multiBlock2D.h"
00036 #include "multiBlock/multiBlockManagement2D.h"
00037 #include "multiBlock/blockCommunicator2D.h"
00038 #include "multiBlock/combinedStatistics.h"
00039 #include "core/block2D.h"
00040 #include "core/blockStatistics.h"
00041 
00042 #include "multiGrid/multiGridParameterManager.h"
00043 #include "multiGrid/coarseGridProcessors2D.h"
00044 #include "multiGrid/fineGridProcessors2D.h"
00045 #include "multiGrid/gridRefinement.h"
00046 #include "multiGrid/gridRefinementDynamics.h"
00047 #include "multiGrid/multiGridGenerator2D.h"
00048 
00049 #include <memory>
00050 
00051 namespace plb {
00052 
00054 template <typename T, template <typename U> class Descriptor>
00055 class MultiGridLattice2D : public BlockLatticeBase2D< T,Descriptor >, public MultiGrid2D {
00056 
00057   public:
00058     MultiGridLattice2D(MultiGridManagement2D management,
00059                        std::vector<BlockCommunicator2D* > communicators_,
00060                        std::vector<CombinedStatistics*> combinedStatistics_, 
00061                        Dynamics<T,Descriptor>* backgroundDynamics, plint behaviorLevel,
00062                        FineGridInterfaceInstantiator<T,Descriptor> *fineGridInstantiator_,
00063                        CoarseGridInterfaceInstantiator<T,Descriptor> *coarseGridInstantiator_
00064                         );
00065 
00066     MultiGridLattice2D( MultiGridManagement2D management,
00067                        Dynamics<T,Descriptor>* backgroundDynamics, plint behaviorLevel,
00068                        FineGridInterfaceInstantiator<T,Descriptor> *fineGridInstantiator_,
00069                        CoarseGridInterfaceInstantiator<T,Descriptor> *coarseGridInstantiator_ 
00070                         );
00071 
00073     MultiGridLattice2D(MultiGridLattice2D<T,Descriptor> const& rhs);
00075     MultiGridLattice2D(MultiGridLattice2D<T,Descriptor> const& rhs, Box2D subDomain, bool crop=true);
00076     
00077     MultiGridLattice2D(MultiGrid2D const& rhs);
00078     MultiGridLattice2D(MultiGrid2D const& rhs, Box2D subDomain, bool crop=true);
00079     
00080     MultiGridLattice2D<T,Descriptor>& operator=(MultiGridLattice2D<T,Descriptor> const& rhs);
00081     ~MultiGridLattice2D();
00082     
00084     void initialize();
00085     
00087     std::auto_ptr<MultiBlockLattice2D<T,Descriptor> > convertToLevel(plint level) const;
00088     
00089     /* *** MultiGrid2D methods *** */
00090     int getBlockId () const;
00091     
00093     MultiBlockLattice2D<T,Descriptor>& getComponent(plint iBlock);
00094     const MultiBlockLattice2D<T,Descriptor>& getComponent(plint iBlock) const;
00095     
00096     /* **** BlockLatticeBase2D methods **** */
00097     
00098     virtual Cell<T,Descriptor>& get(plint iX, plint iY);
00099     virtual Cell<T,Descriptor> const& get(plint iX, plint iY) const;
00100     virtual void specifyStatisticsStatus (Box2D domain, bool status);
00101     virtual void collide(Box2D domain);
00102     virtual void collide();
00103     virtual void stream(Box2D domain);
00104     virtual void stream();              
00105     virtual void collideAndStream(Box2D domain);
00106     virtual void collideAndStream();    
00107     virtual void incrementTime();
00108     TimeCounter& getTimeCounter();
00109     TimeCounter const& getTimeCounter() const;
00110   private:
00111     void createInterfaces();
00112     void iterateMultiGrid(plint level);
00113     void eliminateStatisticsInOverlap();
00114   private:
00115     std::vector<MultiBlockLattice2D<T,Descriptor>*> lattices;
00116     // the objects to create the interfaces
00117     FineGridInterfaceInstantiator<T,Descriptor> *fineGridInstantiator;
00118     CoarseGridInterfaceInstantiator<T,Descriptor> *coarseGridInstantiator;
00119 };
00120 
00121 template<typename T, template<typename U> class Descriptor>
00122 double getStoredAverageDensity(MultiGridLattice2D<T,Descriptor> const& multiGrid);
00123 
00124 template<typename T, template<typename U> class Descriptor>
00125 double getStoredAverageEnergy(MultiGridLattice2D<T,Descriptor> const& multiGrid);
00126 
00127 template<typename T, template<typename U> class Descriptor>
00128 double getStoredMaxVelocity(MultiGridLattice2D<T,Descriptor> const& multiGrid);
00129 
00130 }// namespace plb
00131 
00132 #endif