$treeview $search $mathjax
|
Palabos
Version 1.1
$projectbrief
|
$projectbrief
|
$searchbox |
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 DEFAULT_MULTI_GRID_POLICY_2D_H 00029 #define DEFAULT_MULTI_GRID_POLICY_2D_H 00030 00031 #include "multiBlock/defaultMultiBlockPolicy2D.h" 00032 #include "multiGrid/multiGrid2D.h" 00033 #include "multiGrid/multiGridManagement2D.h" 00034 00035 #include <cmath> 00036 00037 namespace plb { 00038 00039 class DefaultMultiGridPolicy2D { 00040 public: 00042 template <typename T> 00043 std::vector< BlockCommunicator2D* > getBlockCommunicator(plint levels){ 00044 PLB_ASSERT(levels>0); 00045 std::vector< BlockCommunicator2D* > res; 00046 for (int i = 0; i < levels; ++i){ 00047 res.push_back(defaultMultiBlockPolicy2D().getBlockCommunicator()); 00048 } 00049 return res; 00050 } 00051 00053 MultiGridManagement2D getMultiGridManagement(plint nx, plint ny, plint numLevels, plint referenceLevel) { 00054 return MultiGridManagement2D(nx, ny, numLevels, referenceLevel ); 00055 } 00056 00058 std::vector<CombinedStatistics*> getCombinedStatistics(plint levels) { 00059 PLB_ASSERT(levels>0); 00060 std::vector<CombinedStatistics*> stats(levels); 00061 for (int i = 0; i < levels; ++i){ 00062 // it will be defaultMultiBlockPolicy2D who will give us serial or parallel 00063 stats[i] = defaultMultiBlockPolicy2D().getCombinedStatistics(); 00064 } 00065 return stats; 00066 } 00067 00068 00069 friend DefaultMultiGridPolicy2D& defaultMultiGridPolicy2D(); 00070 00071 private: 00072 00073 DefaultMultiGridPolicy2D() 00074 :numProcesses(global::mpi().getSize()), 00075 gridSpacing(100) 00076 {} 00077 00078 private: 00079 int numProcesses; 00080 plint gridSpacing; 00081 00082 }; 00083 00084 inline DefaultMultiGridPolicy2D& defaultMultiGridPolicy2D(){ 00085 static DefaultMultiGridPolicy2D singleton; 00086 return singleton; 00087 } 00088 00089 00090 } // namespace plb 00091 00092 #endif // DEFAULT_MULTI_GRID_POLICY_2D_H 00093
1.6.3
1.6.3