$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 00029 #ifndef LATTICE_TEMPLATES_3D_H 00030 #define LATTICE_TEMPLATES_3D_H 00031 00032 #include "core/globalDefs.h" 00033 #include "latticeBoltzmann/nearestNeighborLattices3D.h" 00034 00035 namespace plb { 00036 00037 template<typename T> 00038 struct latticeTemplates<T, descriptors::D3Q19Descriptor> { 00039 00040 static void swapAndStreamCell ( 00041 Cell<T,descriptors::D3Q19Descriptor> ***grid, 00042 plint iX, plint iY, plint iZ, plint nX, plint nY, plint nZ, plint iPop, T& fTmp ) 00043 { 00044 fTmp = grid[iX][iY][iZ][iPop]; 00045 grid[iX][iY][iZ][iPop] = grid[iX][iY][iZ][iPop+9]; 00046 grid[iX][iY][iZ][iPop+9] = grid[nX][nY][nZ][iPop]; 00047 grid[nX][nY][nZ][iPop] = fTmp; 00048 } 00049 00050 static void swapAndStream3D(Cell<T,descriptors::D3Q19Descriptor> ***grid, 00051 plint iX, plint iY, plint iZ) 00052 { 00053 T fTmp; 00054 swapAndStreamCell(grid, iX, iY, iZ, iX-1, iY, iZ, 1, fTmp); 00055 swapAndStreamCell(grid, iX, iY, iZ, iX, iY-1, iZ, 2, fTmp); 00056 swapAndStreamCell(grid, iX, iY, iZ, iX, iY , iZ-1, 3, fTmp); 00057 swapAndStreamCell(grid, iX, iY, iZ, iX-1, iY-1, iZ, 4, fTmp); 00058 swapAndStreamCell(grid, iX, iY, iZ, iX-1, iY+1, iZ, 5, fTmp); 00059 swapAndStreamCell(grid, iX, iY, iZ, iX-1, iY , iZ-1, 6, fTmp); 00060 swapAndStreamCell(grid, iX, iY, iZ, iX-1, iY , iZ+1, 7, fTmp); 00061 swapAndStreamCell(grid, iX, iY, iZ, iX , iY-1, iZ-1, 8, fTmp); 00062 swapAndStreamCell(grid, iX, iY, iZ, iX , iY-1, iZ+1, 9, fTmp); 00063 } 00064 00065 }; 00066 00067 template<typename T> 00068 struct latticeTemplates<T, descriptors::ForcedD3Q19Descriptor> { 00069 00070 static void swapAndStreamCell ( 00071 Cell<T,descriptors::ForcedD3Q19Descriptor> ***grid, 00072 plint iX, plint iY, plint iZ, plint nX, plint nY, plint nZ, plint iPop, T& fTmp ) 00073 { 00074 fTmp = grid[iX][iY][iZ][iPop]; 00075 grid[iX][iY][iZ][iPop] = grid[iX][iY][iZ][iPop+9]; 00076 grid[iX][iY][iZ][iPop+9] = grid[nX][nY][nZ][iPop]; 00077 grid[nX][nY][nZ][iPop] = fTmp; 00078 } 00079 00080 static void swapAndStream3D(Cell<T,descriptors::ForcedD3Q19Descriptor> ***grid, 00081 plint iX, plint iY, plint iZ) 00082 { 00083 T fTmp; 00084 swapAndStreamCell(grid, iX, iY, iZ, iX-1, iY, iZ, 1, fTmp); 00085 swapAndStreamCell(grid, iX, iY, iZ, iX, iY-1, iZ, 2, fTmp); 00086 swapAndStreamCell(grid, iX, iY, iZ, iX, iY , iZ-1, 3, fTmp); 00087 swapAndStreamCell(grid, iX, iY, iZ, iX-1, iY-1, iZ, 4, fTmp); 00088 swapAndStreamCell(grid, iX, iY, iZ, iX-1, iY+1, iZ, 5, fTmp); 00089 swapAndStreamCell(grid, iX, iY, iZ, iX-1, iY , iZ-1, 6, fTmp); 00090 swapAndStreamCell(grid, iX, iY, iZ, iX-1, iY , iZ+1, 7, fTmp); 00091 swapAndStreamCell(grid, iX, iY, iZ, iX , iY-1, iZ-1, 8, fTmp); 00092 swapAndStreamCell(grid, iX, iY, iZ, iX , iY-1, iZ+1, 9, fTmp); 00093 } 00094 00095 }; 00096 00097 template<typename T> 00098 struct latticeTemplates<T, descriptors::D3Q15Descriptor> { 00099 00100 static void swapAndStreamCell ( 00101 Cell<T,descriptors::D3Q15Descriptor> ***grid, 00102 plint iX, plint iY, plint iZ, plint nX, plint nY, plint nZ, plint iPop, T& fTmp ) 00103 { 00104 fTmp = grid[iX][iY][iZ][iPop]; 00105 grid[iX][iY][iZ][iPop] = grid[iX][iY][iZ][iPop+7]; 00106 grid[iX][iY][iZ][iPop+7] = grid[nX][nY][nZ][iPop]; 00107 grid[nX][nY][nZ][iPop] = fTmp; 00108 } 00109 00110 static void swapAndStream3D(Cell<T,descriptors::D3Q15Descriptor> ***grid, 00111 plint iX, plint iY, plint iZ) 00112 { 00113 T fTmp; 00114 swapAndStreamCell(grid, iX, iY, iZ, iX-1, iY, iZ, 1, fTmp); 00115 swapAndStreamCell(grid, iX, iY, iZ, iX, iY-1, iZ, 2, fTmp); 00116 swapAndStreamCell(grid, iX, iY, iZ, iX, iY , iZ-1, 3, fTmp); 00117 00118 swapAndStreamCell(grid, iX, iY, iZ, iX-1, iY-1, iZ-1, 4, fTmp); 00119 swapAndStreamCell(grid, iX, iY, iZ, iX-1, iY-1, iZ+1, 5, fTmp); 00120 swapAndStreamCell(grid, iX, iY, iZ, iX-1, iY+1, iZ-1, 6, fTmp); 00121 swapAndStreamCell(grid, iX, iY, iZ, iX-1, iY+1, iZ+1, 7, fTmp); 00122 } 00123 00124 }; 00125 00126 template<typename T> 00127 struct latticeTemplates<T, descriptors::ForcedD3Q15Descriptor> { 00128 00129 static void swapAndStreamCell ( 00130 Cell<T,descriptors::D3Q15Descriptor> ***grid, 00131 plint iX, plint iY, plint iZ, plint nX, plint nY, plint nZ, plint iPop, T& fTmp ) 00132 { 00133 fTmp = grid[iX][iY][iZ][iPop]; 00134 grid[iX][iY][iZ][iPop] = grid[iX][iY][iZ][iPop+7]; 00135 grid[iX][iY][iZ][iPop+7] = grid[nX][nY][nZ][iPop]; 00136 grid[nX][nY][nZ][iPop] = fTmp; 00137 } 00138 00139 static void swapAndStream3D(Cell<T,descriptors::D3Q15Descriptor> ***grid, 00140 plint iX, plint iY, plint iZ) 00141 { 00142 T fTmp; 00143 swapAndStreamCell(grid, iX, iY, iZ, iX-1, iY, iZ, 1, fTmp); 00144 swapAndStreamCell(grid, iX, iY, iZ, iX, iY-1, iZ, 2, fTmp); 00145 swapAndStreamCell(grid, iX, iY, iZ, iX, iY , iZ-1, 3, fTmp); 00146 00147 swapAndStreamCell(grid, iX, iY, iZ, iX-1, iY-1, iZ-1, 4, fTmp); 00148 swapAndStreamCell(grid, iX, iY, iZ, iX-1, iY-1, iZ+1, 5, fTmp); 00149 swapAndStreamCell(grid, iX, iY, iZ, iX-1, iY+1, iZ-1, 6, fTmp); 00150 swapAndStreamCell(grid, iX, iY, iZ, iX-1, iY+1, iZ+1, 7, fTmp); 00151 } 00152 00153 }; 00154 00155 } // namespace plb 00156 00157 #endif
1.6.3
1.6.3