$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 #ifndef NEXT_NEIGHBORS_3D_HH 00026 #define NEXT_NEIGHBORS_3D_HH 00027 00028 #include "offLattice/nextNeighbors3D.h" 00029 #include "latticeBoltzmann/geometricOperationTemplates.h" 00030 #include "latticeBoltzmann/externalFieldAccess.h" 00031 #include <cmath> 00032 00033 namespace plb { 00034 00035 template <typename T> 00036 const int NextNeighbor<T>::c[numNeighbors][3] = 00037 { { 0, 0, 1}, { 0, 0,-1}, 00038 { 0, 1, 0}, { 0, 1, 1}, { 0, 1,-1}, 00039 { 0,-1, 0}, { 0,-1, 1}, { 0,-1,-1}, 00040 00041 { 1, 0, 0}, { 1, 0, 1}, { 1, 0,-1}, 00042 { 1, 1, 0}, { 1, 1, 1}, { 1, 1,-1}, 00043 { 1,-1, 0}, { 1,-1, 1}, { 1,-1,-1}, 00044 00045 {-1, 0, 0}, {-1, 0, 1}, {-1, 0,-1}, 00046 {-1, 1, 0}, {-1, 1, 1}, {-1, 1,-1}, 00047 {-1,-1, 0}, {-1,-1, 1}, {-1,-1,-1} 00048 }; 00049 00050 template <typename T> 00051 const T NextNeighbor<T>::d1 = (T)1.; 00052 template <typename T> 00053 const T NextNeighbor<T>::d2 = sqrt((T)2); 00054 template <typename T> 00055 const T NextNeighbor<T>::d3 = sqrt((T)3); 00056 00057 template <typename T> 00058 const T NextNeighbor<T>::d[numNeighbors] = 00059 { d1, d1, d1, d2, d2, d1, d2, d2, 00060 d1, d2, d2, d2, d3, d3, d2, d3, d3, 00061 d1, d2, d2, d2, d3, d3, d2, d3, d3 }; 00062 00063 template <typename T> 00064 const T NextNeighbor<T>::id1 = (T)1; 00065 template <typename T> 00066 const T NextNeighbor<T>::id2 = (T)1/sqrt((T)2); 00067 template <typename T> 00068 const T NextNeighbor<T>::id3 = (T)1/sqrt((T)3); 00069 00070 template <typename T> 00071 const T NextNeighbor<T>::invD[numNeighbors] = 00072 { id1, id1, id1, id2, id2, id1, id2, id2, 00073 id1, id2, id2, id2, id3, id3, id2, id3, id3, 00074 id1, id2, id2, id2, id3, id3, id2, id3, id3 }; 00075 00076 template<typename T, template<typename U> class Descriptor> 00077 NextNeighborPop<T,Descriptor>::NextNeighborPop() 00078 { 00079 typedef Descriptor<T> D; 00080 for (plint iNeighbor=0; iNeighbor<NextNeighbor<T>::numNeighbors; ++iNeighbor) { 00081 int const* c = NextNeighbor<T>::c[iNeighbor]; 00082 ids[iNeighbor] = -1; 00083 for (plint iPop=0; iPop<D::q; ++iPop) { 00084 if (D::c[iPop][0]==c[0] && D::c[iPop][1]==c[1] && D::c[iPop][2]==c[2]) { 00085 ids[iNeighbor] = iPop; 00086 break; 00087 } 00088 } 00089 } 00090 } 00091 00092 } // namespace plb 00093 00094 #endif // NEXT_NEIGHBORS_3D_HH
1.6.3
1.6.3