$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 00028 #ifndef CO_PROCESSOR_3D_H 00029 #define CO_PROCESSOR_3D_H 00030 00031 #include "core/globalDefs.h" 00032 #include "core/geometry3D.h" 00033 #include "atomicBlock/blockLattice3D.h" 00034 #include <map> 00035 00036 namespace plb { 00037 00040 00057 template<typename T> 00058 class CoProcessor3D { 00059 public: 00060 virtual ~CoProcessor3D() { } 00061 00063 00076 virtual int addDomain(plint nx, plint ny, plint nz, T omega, int& domainHandle) =0; 00077 00079 00092 virtual int send(int domainHandle, Box3D const& subDomain, std::vector<char> const& data) =0; 00093 00095 00102 virtual int receive(int domainHandle, Box3D const& subDomain, std::vector<char>& data) const =0; 00103 00104 00106 00114 virtual int collideAndStream(int domainHandle) =0; 00115 }; 00116 00121 template<typename T> 00122 class D3Q19ExampleCoProcessor3D : public CoProcessor3D<T> 00123 { 00124 public: 00125 virtual int addDomain(plint nx, plint ny, plint nz, T omega, int& domainHandle); 00126 virtual int send(int domainHandle, Box3D const& subDomain, std::vector<char> const& data); 00127 virtual int receive(int domainHandle, Box3D const& subDomain, std::vector<char>& data) const; 00128 virtual int collideAndStream(int domainHandle); 00129 private: 00130 std::map<int, BlockLattice3D<T,descriptors::D3Q19Descriptor> > domains; 00131 }; 00132 00133 00134 template<typename T> 00135 class D3Q19CudaCoProcessor3D : public CoProcessor3D<T> 00136 { 00137 public: 00138 D3Q19CudaCoProcessor3D(); 00139 ~D3Q19CudaCoProcessor3D(); 00141 virtual int addDomain(plint nx, plint ny, plint nz, T omega, int& domainHandle); 00142 // virtual int addDomain(Box3D const& domain, T omega); 00144 virtual int send(int domainHandle, Box3D const& subDomain, std::vector<char> const& data); 00146 virtual int receive(int domainHandle, Box3D const& subDomain, std::vector<char>& data) const; 00148 virtual int collideAndStream(int domainHandle); 00149 private: 00150 /* 00151 PyObject *createCUDASimulation(void); 00152 void prepareSimulationToRun(void); 00153 00154 PyObject *geometryClass; 00155 PyObject *simulationClass; 00156 PyObject *simulation; 00157 PyObject *pyCUDA; 00158 PyObject *copyFunctionDtoH; 00159 PyObject *copyFunctionHtoD; 00160 PyObject *buffer; 00161 float *data; 00162 int nx; 00163 int ny; 00164 int nz; 00165 int basis; 00166 int size; 00167 int floatSize; 00168 int strideXSailfish; 00169 int strideYSailfish; 00170 int strideZSailfish; 00171 int strideYPalabos; 00172 int strideZPalabos; 00173 */ 00174 }; 00175 00176 namespace global { 00177 00178 template<typename T> 00179 inline CoProcessor3D<T>& defaultCoProcessor3D() { 00181 // D3Q19ExampleCoProcessor3D singleton by a 00182 // D3Q19CudaCoProcessor3D singleton to get your code running. 00183 static D3Q19CudaCoProcessor3D<T> singleton; 00184 return singleton; 00185 }; 00186 00187 } 00188 00189 } // namespace plb 00190 00191 #endif // CO_PROCESSOR_3D_H 00192
1.6.3
1.6.3