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

multiGridGenerator2D.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 
00032 #ifndef MULTI_GRID_GENERATOR_2D_H
00033 #define MULTI_GRID_GENERATOR_2D_H
00034 
00035 #include "multiBlock/multiBlockLattice2D.h"
00036 #include "multiBlock/multiDataField2D.h"
00037 
00038 #include "multiGrid/multiGridManagement2D.h"
00039 #include "multiGrid/multiGridLattice2D.h"
00040 
00041 namespace plb {
00042 
00043 template<typename T, template<typename U> class Descriptor>
00044 class MultiGridLattice2D;
00045     
00047 template<typename T, template<typename U> class Descriptor>
00048 std::vector<MultiBlockLattice2D<T,Descriptor>*> generateLattices(
00049                 MultiGridManagement2D management,
00050                 std::vector<Dynamics<T,Descriptor>*> backgroundDynamics,
00051                 std::vector<BlockCommunicator2D*> communicators,
00052                 std::vector<CombinedStatistics*> combinedStatistics,
00053                 plint envelopeWidth
00054                 );
00055 
00056 template<typename T, template<typename U> class Descriptor>
00057 std::vector<MultiBlockLattice2D<T,Descriptor>*> generateLattices(
00058                 MultiGridManagement2D management,
00059                 std::vector<Dynamics<T,Descriptor>*> backgroundDynamics,
00060                 plint envelopeWidth );
00061 
00062 
00063 template<typename T, template<typename U> class Descriptor>
00064 void createInterfaces(std::vector<MultiBlockLattice2D<T,Descriptor>*>& multiBlocks,
00065                       MultiGridManagement2D management, bool cubic=false);
00066 
00068 template<typename T, template<typename U> class Descriptor>
00069 void createCoarseGridInterface (
00070         plint coarseLevel, Box2D coarseGridInterface, std::vector<MultiBlockLattice2D<T,Descriptor>*>& multiBlocks,
00071         plint orientation );
00072 
00074 template<typename T, template<typename U> class Descriptor>
00075 void createFineGridInterface (
00076         plint coarseLevel, Box2D fineGridInterface, std::vector<MultiBlockLattice2D<T,Descriptor>*>& multiBlocks,
00077         plint orientation );
00078 
00079 
00082 template<typename T>
00083 std::vector<MultiScalarField2D<T>*> generateScalarFields(
00084                         MultiGridManagement2D const& management,
00085                         std::vector<BlockCommunicator2D*> communicators,
00086                         std::vector<CombinedStatistics*> combinedStatistics );
00087 
00090 template<typename T, int nDim>
00091 std::vector<MultiTensorField2D<T,nDim> *> generateTensorFields (
00092         MultiGridManagement2D const& management,
00093         std::vector<BlockCommunicator2D*> communicators,
00094         std::vector<CombinedStatistics*> combinedStatistics );
00095 
00096         
00097         
00099 template<typename T, template<typename U> class Descriptor>
00100 class FineGridInterfaceInstantiator {
00101     public:
00102         virtual FineGridInterfaceInstantiator* clone()=0;
00103         
00104         virtual void instantiateDataProcessors(Box2D whereToInstanciate,
00105                                                MultiBlockLattice2D<T,Descriptor>& coarseLattice,
00106                                                MultiBlockLattice2D<T,Descriptor>& fineLattice,
00107                                                plint direction, plint orientation
00108                                                ) =0;
00109                                                
00110         virtual plint getEnvelopeWidth() =0;
00111 };
00112         
00114 template<typename T, template<typename U> class Descriptor>
00115 class CoarseGridInterfaceInstantiator {
00116     public:
00117         virtual CoarseGridInterfaceInstantiator* clone()=0;
00118         
00119         virtual void instantiateDataProcessors(Box2D whereToInstanciate,
00120                                                MultiBlockLattice2D<T,Descriptor>& coarseLattice,
00121                                                MultiBlockLattice2D<T,Descriptor>& fineLattice,
00122                                                plint direction, plint orientation
00123                                                ) =0;
00124 };
00125 
00126 
00128 template<typename T, template<typename U> class Descriptor>
00129 class LinearInterpolationFineGridInterfaceInstantiator 
00130         : public FineGridInterfaceInstantiator<T,Descriptor> {
00131     public:
00132         virtual LinearInterpolationFineGridInterfaceInstantiator* clone(){
00133             return new LinearInterpolationFineGridInterfaceInstantiator<T,Descriptor>(*this);
00134         }
00135         
00136         virtual void instantiateDataProcessors(Box2D whereToInstanciate,
00137                                                MultiBlockLattice2D<T,Descriptor>& coarseLattice,
00138                                                MultiBlockLattice2D<T,Descriptor>& fineLattice,
00139                                                plint direction, plint orientation
00140                                                );
00141                                                
00142         virtual plint getEnvelopeWidth(){return 1;}
00143 };
00144 
00145 
00147 template<typename T, template<typename U> class Descriptor>
00148 class CubicInterpolationFineGridInterfaceInstantiator 
00149         : public FineGridInterfaceInstantiator<T,Descriptor> {
00150     public:
00151         virtual CubicInterpolationFineGridInterfaceInstantiator* clone(){
00152             return new CubicInterpolationFineGridInterfaceInstantiator<T,Descriptor>(*this);
00153         }
00154         
00155         virtual void instantiateDataProcessors(Box2D whereToInstanciate,
00156                                                MultiBlockLattice2D<T,Descriptor>& coarseLattice,
00157                                                MultiBlockLattice2D<T,Descriptor>& fineLattice,
00158                                                plint direction, plint orientation
00159                                                );
00160                                                
00161         virtual plint getEnvelopeWidth(){return 2;}
00162 };
00163 
00164 
00166 template<typename T, template<typename U> class Descriptor>
00167 class FilteredCoarseGridInterfaceInstantiator
00168         : public CoarseGridInterfaceInstantiator<T,Descriptor>
00169 {
00170     public:
00171         virtual FilteredCoarseGridInterfaceInstantiator* clone(){
00172             return new FilteredCoarseGridInterfaceInstantiator<T,Descriptor>(*this);
00173         }
00174         
00175         virtual void instantiateDataProcessors(Box2D whereToInstanciate,
00176                                                MultiBlockLattice2D<T,Descriptor>& coarseLattice,
00177                                                MultiBlockLattice2D<T,Descriptor>& fineLattice,
00178                                                plint direction, plint orientation
00179                                                );
00180 };
00181 
00183 template<typename T, template<typename U> class Descriptor>
00184 class UnfilteredCoarseGridInterfaceInstantiator
00185         : public CoarseGridInterfaceInstantiator<T,Descriptor>
00186 {
00187     public:
00188         virtual UnfilteredCoarseGridInterfaceInstantiator* clone(){
00189             return new UnfilteredCoarseGridInterfaceInstantiator<T,Descriptor>(*this);
00190         }
00191         
00192         virtual void instantiateDataProcessors(Box2D whereToInstanciate,
00193                                                MultiBlockLattice2D<T,Descriptor>& coarseLattice,
00194                                                MultiBlockLattice2D<T,Descriptor>& fineLattice,
00195                                                plint direction, plint orientation
00196                                                );
00197 };
00198 
00199 
00201 template<typename T, template<typename U> class Descriptor>
00202 class MultiGridGenerator2D {
00203     public:
00204         static std::auto_ptr< MultiGridLattice2D<T,Descriptor> > createRefinedLatticeCubicInterpolationNoFiltering(
00205                         MultiGridManagement2D management,
00206                         Dynamics<T,Descriptor>* backgroundDynamics, plint behaviorLevel );
00207                         
00208         static std::auto_ptr< MultiGridLattice2D<T,Descriptor> > createRefinedLatticeLinearInterpolationNoFiltering(
00209                         MultiGridManagement2D management,
00210                         Dynamics<T,Descriptor>* backgroundDynamics, plint behaviorLevel );
00211                         
00212         static std::auto_ptr< MultiGridLattice2D<T,Descriptor> > createRefinedLatticeCubicInterpolationFiltering(
00213                         MultiGridManagement2D management,
00214                         Dynamics<T,Descriptor>* backgroundDynamics, plint behaviorLevel );
00215                         
00216         static std::auto_ptr< MultiGridLattice2D<T,Descriptor> > createRefinedLatticeLinearInterpolationFiltering(
00217                         MultiGridManagement2D management,
00218                         Dynamics<T,Descriptor>* backgroundDynamics, plint behaviorLevel);
00219         
00220     private:
00221         MultiGridGenerator2D();
00222 };
00223 
00224 
00225 } // namespace plb
00226 
00227 #endif  // MULTI_GRID_GENERATOR_2D_H
00228