$treeview $search $mathjax
Palabos  Version 1.1
$projectbrief
$projectbrief
$searchbox

offEquilibriumAdvectionDiffusionTemplates.h

Go to the documentation of this file.
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: Orestis Malaspinas
00026  */
00027 
00040 #ifndef ADVECTION_DIFFUSION_OFF_EQUILIBRIUM_TEMPLATES_H
00041 #define ADVECTION_DIFFUSION_OFF_EQUILIBRIUM_TEMPLATES_H
00042 
00043 #include "core/globalDefs.h"
00044 #include "core/cell.h"
00045 #include "core/util.h"
00046 
00047 namespace plb {
00048 
00049 template<typename T, class Descriptor> struct offEquilibriumAdvectionDiffusionTemplatesImpl;
00050 
00052 template<typename T, template<typename U> class Descriptor>
00053 struct offEquilibriumAdvectionDiffusionTemplates {
00054 
00056 
00064 static T fromJtoFneq(plint iPop, Array<T,Descriptor<T>::d> const& jNeq) {
00065     return offEquilibriumAdvectionDiffusionTemplatesImpl<T,typename Descriptor<T>::BaseDescriptor>
00066         ::fromJtoFneq(iPop, jNeq);
00067 }
00068 
00069 };  // struct offEquilibriumAdvectionDiffusionTemplates
00070 
00071 template<typename T, class Descriptor>
00072 struct offEquilibriumAdvectionDiffusionTemplatesImpl {
00073 
00074 static T fromJtoFneq (
00075     plint iPop, Array<T,Descriptor::d> const& jNeq )
00076 {
00077     T fNeq = (T)Descriptor::c[iPop][0]*jNeq[0];
00078     for (plint iD=1; iD<Descriptor::d; ++iD) 
00079     {
00080         fNeq += (T)Descriptor::c[iPop][iD]*jNeq[iD];
00081     }
00082     fNeq *= Descriptor::t[iPop] * Descriptor::invCs2;
00083             
00084     return fNeq;
00085 }
00086 
00087 };  // struct offEquilibriumAdvectionDiffusionTemplates
00088 
00089 }  // namespace plb
00090 
00091 #endif