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

multiGridManagement3D.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_MANAGEMENT_3D_H
00033 #define MULTI_GRID_MANAGEMENT_3D_H
00034 
00035 #include "core/globalDefs.h"
00036 #include "core/geometry3D.h"
00037 #include "multiGrid/multiScale.h"
00038 
00039 namespace plb {
00040 
00041 class MultiGridManagement3D {
00042 public:
00043     MultiGridManagement3D(plint coarseNx, plint coarseNy, plint coarseNz, plint numLevels, plint referenceLevel=0);
00044     MultiGridManagement3D(Box3D coarseBoundingBox, plint numLevels, plint referenceLevel=0);
00045     
00046     MultiGridManagement3D(MultiGridManagement3D const& rhs, Box3D coarsestDomain);
00047     MultiGridManagement3D(MultiGridManagement3D const& rhs);
00048     ~MultiGridManagement3D();
00049     
00050     void swap(MultiGridManagement3D& rhs);
00051     
00053     std::vector<Box3D> const& getBulks(plint iLevel) const;
00054     std::vector<std::vector<Box3D> > const& getBulks() const;
00055     
00057     std::vector<Box3D> const& getUniqueBulks(plint iLevel) const;
00058     std::vector<std::vector<Box3D> > const& getUniqueBulks() const;
00059      
00061     Box3D getBoundingBox(plint level) const;
00062     
00064     void refine(plint level, Box3D domain);
00066     void coarsen(plint level, Box3D domain);
00067     
00069     std::vector<std::vector<plint> > const& getMpiProcesses() const;
00070 
00071     std::vector<std::vector<Box3D> > const& getCoarseInterface() const;
00072     std::vector<std::vector<Box3D> > const& getFineInterface() const;
00073     
00074     void trimDomain (plint whichLevel, Box3D& domain, bool* touches) const;
00075 
00076     plint getNumLevels() const;
00077     plint getReferenceLevel() const;
00078     
00080     void parallelizeX(std::vector<plint> const& finePositions);
00082     void parallelizeY(std::vector<plint> const& finePositions);
00084     void parallelizeZ(std::vector<plint> const& finePositions);
00085     
00087     void parallelize(std::vector<Box3D> parallelRegions, std::vector<plint> const& regionIDs);
00088 
00089     friend MultiGridManagement3D extractManagement(MultiGridManagement3D management, Box3D coarsestDomain, bool crop);
00090     
00091 private:
00092     void initialize(Box3D const& level0_box);
00093     void parallelizeLevel(plint whichLevel, std::vector<Box3D> const& parallelRegions, 
00094                           std::vector<plint> const& regionIDs);
00095 
00096 private:
00097     plint                                referenceLevel;
00098     std::vector<Box3D>                   boundingBoxes;
00100     std::vector<std::vector<plint> >     mpiProcess;
00102 
00103     std::vector<std::vector<Box3D> >     coarseGridInterfaces;
00105 
00106     std::vector<std::vector<Box3D> >     fineGridInterfaces;
00107 
00109     std::vector<std::vector<Box3D> >     bulks;
00110     
00112     std::vector<std::vector<Box3D> >     uniqueBulks;
00113     
00114     MultiScaleManager *scaleManager; 
00115     
00116 };
00117 
00118 MultiGridManagement3D extractManagement(MultiGridManagement3D management, Box3D coarsestDomain, bool crop=true);
00119 
00120 
00121 } // namespace plb
00122 
00123 #endif  // MULTI_GRID_MANAGEMENT_3D_H
00124