$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 MULTI_GRID_3D_H 00029 #define MULTI_GRID_3D_H 00030 00031 #include "core/globalDefs.h" 00032 #include "core/geometry3D.h" 00033 #include "core/array.h" 00034 #include "multiBlock/multiBlock3D.h" 00035 #include "multiBlock/multiBlockManagement3D.h" 00036 #include "multiBlock/blockCommunicator3D.h" 00037 #include "multiBlock/combinedStatistics.h" 00038 #include "core/block3D.h" 00039 #include "core/blockStatistics.h" 00040 #include "multiGrid/multiScale.h" 00041 #include "multiGrid/multiGridManagement3D.h" 00042 00043 00044 namespace plb { 00045 00046 class MultiGrid3D; 00047 00049 class MultiGridPeriodicitySwitch3D { 00050 public: 00051 MultiGridPeriodicitySwitch3D(MultiGrid3D *block_); 00052 MultiGridPeriodicitySwitch3D(MultiGridPeriodicitySwitch3D const& rhs); 00053 MultiGridPeriodicitySwitch3D& operator=(MultiGridPeriodicitySwitch3D const& rhs); 00054 00055 void swap(MultiGridPeriodicitySwitch3D& rhs); 00056 00057 void toggle(int direction, bool periodicity); 00058 void toggleAll(bool periodicity); 00059 00060 Array<bool,3> const& getPeriodicityArray() const; 00061 00062 private: 00063 MultiGrid3D* block; 00064 Array<bool,3> periodicityArray; 00065 00066 }; 00067 00069 00073 class MultiGridStatSubscriber3D { 00074 public: 00075 MultiGridStatSubscriber3D(MultiGrid3D* multiGrid_); 00076 MultiGridStatSubscriber3D(MultiGridStatSubscriber3D const& rhs); 00077 00078 void swap(MultiGridStatSubscriber3D& rhs); 00079 MultiGridStatSubscriber3D& operator=(MultiGridStatSubscriber3D const& rhs); 00080 00082 plint subscribeAverage(plint dimDx, plint dimDt); 00084 plint subscribeSum(plint dimDx, plint dimDt); 00086 plint subscribeMax(plint dimDx, plint dimDt); 00088 plint subscribeIntSum(plint dimDx, plint dimDt); 00090 void initialize(); 00091 00093 std::vector<int> const& getDimensionsX() const; 00094 std::vector<int> const& getDimensionsT() const; 00095 00096 private: 00097 MultiGrid3D* multiGrid; 00098 std::vector<int> dimensionsX; 00099 std::vector<int> dimensionsT; 00100 }; 00101 00102 00104 class MultiGrid3D : public Block3D 00105 { 00106 public: 00107 MultiGrid3D( MultiGridManagement3D management, 00108 plint behaviorLevel_); 00109 // Copy constructor 00110 MultiGrid3D(const MultiGrid3D& rhs); 00111 MultiGrid3D(MultiGrid3D const& rhs, Box3D subDomain, bool crop); 00112 virtual ~MultiGrid3D(); 00113 00114 void swap(MultiGrid3D& rhs); 00115 00117 virtual MultiBlock3D const& getComponent(plint level) const = 0; 00118 virtual MultiBlock3D& getComponent(plint level) = 0; 00119 00120 MultiGridManagement3D const& getMultiGridManagement() const; 00121 MultiGridManagement3D& getMultiGridManagement(); 00122 00124 plint getNx() const; 00125 plint getNy() const; 00126 plint getNz() const; 00127 00129 virtual Box3D getBoundingBox() const; 00130 00132 plint getReferenceLevel() const; 00133 plint getNumLevels() const; 00134 plint getBehaviorLevel() const; 00135 void setBehaviorLevel(plint behaviorLevel_); 00136 00138 void initialize(); 00139 00141 void executeInternalProcessors(); 00142 void executeInternalProcessors(plint level); 00143 00145 void subscribeProcessor(plint level); 00146 00148 BlockStatistics& getInternalStatistics(); 00149 BlockStatistics const& getInternalStatistics() const; 00150 00152 void reduceStatistics(); 00153 void evaluateStatistics(); 00154 void toggleInternalStatistics(bool statisticsOn_); 00155 bool isInternalStatisticsOn() const; 00156 00158 MultiGridPeriodicitySwitch3D const& periodicity() const; 00160 MultiGridPeriodicitySwitch3D& periodicity(); 00161 void signalPeriodicity(); 00162 00164 MultiGridStatSubscriber3D& internalStatSubscription(); 00165 00167 MultiScaleManager const& getScaleManager() const; 00168 00169 virtual DataSerializer* getBlockSerializer ( 00170 Box3D const& domain, IndexOrdering::OrderingT ordering ) const; 00171 virtual DataUnSerializer* getBlockUnSerializer ( 00172 Box3D const& domain, IndexOrdering::OrderingT ordering ); 00173 00174 virtual int getBlockId () const =0; 00175 00176 private: 00177 // reference level management 00178 MultiGridManagement3D management; 00179 00180 plint behaviorLevel; 00181 MultiGridPeriodicitySwitch3D periodicitySwitch; 00182 00183 plint maxProcessorLevel; 00184 bool statisticsOn; 00185 00186 MultiGridStatSubscriber3D statsSubscriber; 00187 BlockStatistics internalStatistics; 00188 00189 // Used to easen the scale conversion in this class 00190 MultiScaleManager *scaleManager; 00191 }; 00192 00193 // checkpointing for the multiGrid 00194 void saveBinaryGrid(MultiGrid3D const& block, std::string fName, bool enforceUint=false); 00195 void loadBinaryGrid(MultiGrid3D& block, std::string fName, bool enforceUint=false); 00196 00197 00198 00199 } // namespace plb 00200 00201 #endif // MULTI_GRID_3D_H
1.6.3
1.6.3