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

dataInitializerWrapper2D.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 
00028 #ifndef DATA_INITIALIZER_WRAPPER_2D_H
00029 #define DATA_INITIALIZER_WRAPPER_2D_H
00030 
00031 #include "core/globalDefs.h"
00032 #include "atomicBlock/dataProcessorWrapper2D.h"
00033 #include "multiBlock/multiDataProcessorWrapper2D.h"
00034 #include "core/dynamics.h"
00035 #include "dataProcessors/dataInitializerFunctional2D.h"
00036 
00037 namespace plb {
00038 
00039 /* *************** PART I ******************************************** */
00040 /* *************** Initialization of the block-lattice: atomic-blocks  */
00041 /* ******************************************************************* */
00042 
00043 template<typename T, template<class U> class Descriptor>
00044 void apply(BlockLattice2D<T,Descriptor>& lattice, Box2D domain, OneCellFunctional2D<T,Descriptor>* f);
00045 
00046 template<typename T, template<class U> class Descriptor>
00047 void applyIndexed(BlockLattice2D<T,Descriptor>& lattice, Box2D domain,
00048                   OneCellIndexedFunctional2D<T,Descriptor>* f);
00049 
00050 template<typename T, template<class U> class Descriptor>
00051 void defineDynamics(BlockLattice2D<T,Descriptor>& lattice, Box2D domain,
00052                     Dynamics<T,Descriptor>* dynamics);
00053 
00054 template<typename T, template<class U> class Descriptor>
00055 void defineDynamics(BlockLattice2D<T,Descriptor>& lattice, Box2D boundingBox,
00056                     DomainFunctional2D* domain, Dynamics<T,Descriptor>* dynamics);
00057 
00058 template<typename T, template<class U> class Descriptor>
00059 void defineDynamics(BlockLattice2D<T,Descriptor>& lattice, plint iX, plint iY,
00060                     Dynamics<T,Descriptor>* dynamics);
00061 
00062 template<typename T, template<class U> class Descriptor>
00063 void defineDynamics(BlockLattice2D<T,Descriptor>& lattice, DotList2D const& dotList,
00064                     Dynamics<T,Descriptor>* dynamics);
00065 
00066 template<typename T, template<typename U> class Descriptor>
00067 void defineDynamics( BlockLattice2D<T,Descriptor>& lattice, ScalarField2D<bool>& boolMask,
00068                      Box2D domain, Dynamics<T,Descriptor>* dynamics, bool whichFlag );
00069 
00070 template<typename T, template<typename U> class Descriptor>
00071 void defineDynamics( BlockLattice2D<T,Descriptor>& lattice, ScalarField2D<bool>& boolMask,
00072                      Dynamics<T,Descriptor>* dynamics, bool whichFlag );
00073 
00074 template<typename T, template<typename U> class Descriptor>
00075 void defineDynamics( BlockLattice2D<T,Descriptor>& lattice, ScalarField2D<int>& intMask,
00076                      Box2D domain, Dynamics<T,Descriptor>* dynamics, int whichFlag );
00077 
00078 template<typename T, template<typename U> class Descriptor>
00079 void defineDynamics( BlockLattice2D<T,Descriptor>& lattice, ScalarField2D<int>& intMask,
00080                      Dynamics<T,Descriptor>* dynamics, int whichFlag );
00081 
00082 template<typename T, template<typename U> class Descriptor>
00083 void recomposeFromFlowVariables ( BlockLattice2D<T,Descriptor>& lattice,
00084                                   ScalarField2D<T>& density, TensorField2D<T,2>& velocity,
00085                                   TensorField2D<T,3>& strainRate, Box2D domain );
00086 
00087 template<typename T, template<typename U> class Descriptor>
00088 void recomposeFromFlowVariables ( BlockLattice2D<T,Descriptor>& lattice,
00089                                   ScalarField2D<T>& density, TensorField2D<T,2>& velocity,
00090                                   TensorField2D<T,3>& strainRate );
00091 
00092 template<typename T, template<class U> class Descriptor>
00093 void setOmega(BlockLattice2D<T,Descriptor>& lattice, Box2D domain, T omega);
00094 
00095 template<typename T, template<class U> class Descriptor>
00096 void setBoundaryVelocity(BlockLattice2D<T,Descriptor>& lattice, Box2D domain, Array<T,2> velocity);
00097 
00098 // This function is implemented in-place, because it cannot be precompiled due to its generic nature.
00099 template<typename T, template<class U> class Descriptor, class VelocityFunction>
00100 void setBoundaryVelocity(BlockLattice2D<T,Descriptor>& lattice, Box2D domain, VelocityFunction f) {
00101     applyIndexed (
00102             lattice, domain,
00103             new SetCustomBoundaryVelocityFunctional2D<T,Descriptor,VelocityFunction> (f) );
00104 }
00105 
00106 template<typename T, template<class U> class Descriptor>
00107 void setBoundaryDensity(BlockLattice2D<T,Descriptor>& lattice, Box2D domain, T rho);
00108 
00109 // This function is implemented in-place, because it cannot be precompiled due to its generic nature.
00110 template<typename T, template<class U> class Descriptor, class DensityFunction>
00111 void setBoundaryDensity(BlockLattice2D<T,Descriptor>& lattice, Box2D domain, DensityFunction f) {
00112     applyIndexed (
00113             lattice, domain,
00114             new SetCustomBoundaryDensityFunctional2D<T,Descriptor,DensityFunction> (f) );
00115 }
00116 
00117 template<typename T, template<class U> class Descriptor>
00118 void setBoundaryTemperature(BlockLattice2D<T,Descriptor>& lattice, Box2D domain, T temperature);
00119 
00120 // This function is implemented in-place, because it cannot be precompiled due to its generic nature.
00121 template<typename T, template<class U> class Descriptor, class TemperatureFunction>
00122 void setBoundaryTemperature(BlockLattice2D<T,Descriptor>& lattice, Box2D domain, TemperatureFunction f) {
00123     applyIndexed (
00124             lattice, domain,
00125             new SetCustomBoundaryTemperatureFunctional2D<T,Descriptor,TemperatureFunction> (f) );
00126 }
00127 
00128 
00129 template<typename T, template<class U> class Descriptor>
00130 void initializeAtEquilibrium(BlockLattice2D<T,Descriptor>& lattice, Box2D domain,
00131                              T density, Array<T,2> velocity, T temperature = (T)1);
00132 
00133 template<typename T, template<class U> class Descriptor>
00134 void initializeAtEquilibrium(BlockLattice2D<T,Descriptor>& lattice,
00135                              Box2D boundingBox, DomainFunctional2D* domain,
00136                              T density, Array<T,2> velocity, T temperature = (T)1);
00137 
00138 // This function is implemented in-place, because it cannot be precompiled due to its generic nature.
00139 template<typename T, template<class U> class Descriptor, class RhoUFunction>
00140 void initializeAtEquilibrium(BlockLattice2D<T,Descriptor>& lattice, Box2D domain, RhoUFunction f) {
00141     applyIndexed (
00142             lattice, domain,
00143             new IniCustomEquilibriumFunctional2D<T,Descriptor,RhoUFunction> (f) );
00144 }
00145 
00146 template<typename T, template<class U> class Descriptor, class RhoVelTempFunction>
00147 void initializeAtThermalEquilibrium(BlockLattice2D<T,Descriptor>& lattice, Box2D domain, RhoVelTempFunction f) {
00148     applyIndexed (
00149             lattice, domain,
00150             new IniCustomThermalEquilibriumFunctional2D<T,Descriptor,RhoVelTempFunction> (f) );
00151 }
00152 
00153 template<typename T, template<class U> class Descriptor, class Function>
00154 void initializeAtEquilibrium(BlockLattice2D<T,Descriptor>& lattice,
00155                              Box2D boundingBox, DomainFunctional2D* domain, Function f);
00156 
00157 template<typename T, template<class U> class Descriptor>
00158 void stripeOffDensityOffset(BlockLattice2D<T,Descriptor>& lattice, Box2D domain, T deltaRho);
00159 
00160 
00161 template<typename T, template<class U> class Descriptor>
00162 void setCompositeDynamics( BlockLattice2D<T,Descriptor>& lattice, Box2D domain,
00163                            CompositeDynamics<T,Descriptor>* compositeDynamics );
00164 
00165 template<typename T, template<class U> class Descriptor>
00166 void setExternalScalar( BlockLattice2D<T,Descriptor>& lattice, Box2D domain,
00167                         int whichScalar, T externalScalar );
00168 
00169 template<typename T, template<class U> class Descriptor>
00170 void setExternalVector( BlockLattice2D<T,Descriptor>& lattice, Box2D domain,
00171                         int vectorStartsAt, Array<T,Descriptor<T>::d> externalVector );
00172 
00173 
00174 /* *************** PART II ******************************************* */
00175 /* *************** Initialization of the block-lattice: multi-block ** */
00176 /* ******************************************************************* */
00177 
00178 template<typename T, template<class U> class Descriptor>
00179 void apply(MultiBlockLattice2D<T,Descriptor>& lattice, Box2D domain, OneCellFunctional2D<T,Descriptor>* f);
00180 
00181 template<typename T, template<class U> class Descriptor>
00182 void applyIndexed(MultiBlockLattice2D<T,Descriptor>& lattice, Box2D domain,
00183                   OneCellIndexedFunctional2D<T,Descriptor>* f);
00184 
00185 template<typename T, template<class U> class Descriptor>
00186 void defineDynamics(MultiBlockLattice2D<T,Descriptor>& lattice, Box2D domain,
00187                     Dynamics<T,Descriptor>* dynamics);
00188 
00189 template<typename T, template<class U> class Descriptor>
00190 void defineDynamics(MultiBlockLattice2D<T,Descriptor>& lattice, Box2D boundingBox,
00191                     DomainFunctional2D* domain, Dynamics<T,Descriptor>* dynamics);
00192 
00193 template<typename T, template<class U> class Descriptor>
00194 void defineDynamics(MultiBlockLattice2D<T,Descriptor>& lattice, plint iX, plint iY,
00195                     Dynamics<T,Descriptor>* dynamics);
00196 
00197 template<typename T, template<class U> class Descriptor>
00198 void defineDynamics(MultiBlockLattice2D<T,Descriptor>& lattice, DotList2D const& dotList,
00199                     Dynamics<T,Descriptor>* dynamics);
00200 
00201 template<typename T, template<typename U> class Descriptor>
00202 void defineDynamics( MultiBlockLattice2D<T,Descriptor>& lattice, MultiScalarField2D<bool>& boolMask,
00203                      Box2D domain, Dynamics<T,Descriptor>* dynamics, bool whichFlag );
00204 
00205 template<typename T, template<typename U> class Descriptor>
00206 void defineDynamics( MultiBlockLattice2D<T,Descriptor>& lattice, MultiScalarField2D<bool>& boolMask,
00207                      Dynamics<T,Descriptor>* dynamics, bool whichFlag );
00208 
00209 template<typename T, template<typename U> class Descriptor>
00210 void defineDynamics( MultiBlockLattice2D<T,Descriptor>& lattice, MultiScalarField2D<int>& intMask,
00211                      Box2D domain, Dynamics<T,Descriptor>* dynamics, int whichFlag );
00212 
00213 template<typename T, template<typename U> class Descriptor>
00214 void defineDynamics( MultiBlockLattice2D<T,Descriptor>& lattice, MultiScalarField2D<int>& intMask,
00215                      Dynamics<T,Descriptor>* dynamics, int whichFlag );
00216 
00217 template<typename T, template<typename U> class Descriptor>
00218 void recomposeFromFlowVariables ( MultiBlockLattice2D<T,Descriptor>& lattice,
00219                                   MultiScalarField2D<T>& density, TensorField2D<T,2>& velocity,
00220                                   MultiTensorField2D<T,3>& strainRate, Box2D domain );
00221 
00222 template<typename T, template<typename U> class Descriptor>
00223 void recomposeFromFlowVariables ( MultiBlockLattice2D<T,Descriptor>& lattice,
00224                                   MultiScalarField2D<T>& density, TensorField2D<T,2>& velocity,
00225                                   MultiTensorField2D<T,3>& strainRate );
00226 
00227 template<typename T, template<class U> class Descriptor>
00228 void setOmega(MultiBlockLattice2D<T,Descriptor>& lattice, Box2D domain, T omega);
00229 
00230 template<typename T, template<class U> class Descriptor>
00231 void setBoundaryVelocity(MultiBlockLattice2D<T,Descriptor>& lattice, Box2D domain, Array<T,2> velocity);
00232 
00233 // This function is implemented in-place, because it cannot be precompiled due to its generic nature.
00234 template<typename T, template<class U> class Descriptor, class VelocityFunction>
00235 void setBoundaryVelocity(MultiBlockLattice2D<T,Descriptor>& lattice, Box2D domain, VelocityFunction f) {
00236     applyIndexed (
00237             lattice, domain,
00238             new SetCustomBoundaryVelocityFunctional2D<T,Descriptor,VelocityFunction> (f) );
00239 }
00240 
00241 template<typename T, template<class U> class Descriptor>
00242 void setBoundaryDensity(MultiBlockLattice2D<T,Descriptor>& lattice, Box2D domain, T rho);
00243 
00244 // This function is implemented in-place, because it cannot be precompiled due to its generic nature.
00245 template<typename T, template<class U> class Descriptor, class DensityFunction>
00246 void setBoundaryDensity(MultiBlockLattice2D<T,Descriptor>& lattice, Box2D domain, DensityFunction f) {
00247     applyIndexed (
00248             lattice, domain,
00249             new SetCustomBoundaryDensityFunctional2D<T,Descriptor,DensityFunction> (f) );
00250 }
00251 
00252 template<typename T, template<class U> class Descriptor>
00253 void setBoundaryTemperature(MultiBlockLattice2D<T,Descriptor>& lattice, Box2D domain, T temperature);
00254 
00255 // This function is implemented in-place, because it cannot be precompiled due to its generic nature.
00256 template<typename T, template<class U> class Descriptor, class TemperatureFunction>
00257 void setBoundaryTemperature(MultiBlockLattice2D<T,Descriptor>& lattice, Box2D domain, TemperatureFunction f) {
00258     applyIndexed (
00259             lattice, domain,
00260             new SetCustomBoundaryTemperatureFunctional2D<T,Descriptor,TemperatureFunction> (f) );
00261 }
00262 
00263 
00264 template<typename T, template<class U> class Descriptor>
00265 void initializeAtEquilibrium(MultiBlockLattice2D<T,Descriptor>& lattice, Box2D domain,
00266                              T density, Array<T,2> velocity, T temperature = (T)1);
00267 
00268 template<typename T, template<class U> class Descriptor>
00269 void initializeAtEquilibrium(MultiBlockLattice2D<T,Descriptor>& lattice,
00270                              Box2D boundingBox, DomainFunctional2D* domain,
00271                              T density, Array<T,2> velocity, T temperature = (T)1);
00272 
00273 // This function is implemented in-place, because it cannot be precompiled due to its generic nature.
00274 template<typename T, template<class U> class Descriptor, class RhoUFunction>
00275 void initializeAtEquilibrium(MultiBlockLattice2D<T,Descriptor>& lattice, Box2D domain, RhoUFunction f) {
00276     applyIndexed (
00277             lattice, domain,
00278             new IniCustomEquilibriumFunctional2D<T,Descriptor,RhoUFunction> (f) );
00279 }
00280 
00281 template<typename T, template<class U> class Descriptor, class RhoVelTempFunction>
00282 void initializeAtThermalEquilibrium(MultiBlockLattice2D<T,Descriptor>& lattice, Box2D domain, RhoVelTempFunction f) {
00283     applyIndexed (
00284             lattice, domain,
00285             new IniCustomThermalEquilibriumFunctional2D<T,Descriptor,RhoVelTempFunction> (f) );
00286 }
00287 
00288 template<typename T, template<class U> class Descriptor, class Function>
00289 void initializeAtEquilibrium(MultiBlockLattice2D<T,Descriptor>& lattice,
00290                              Box2D boundingBox, DomainFunctional2D* domain, Function f);
00291 
00292 template<typename T, template<class U> class Descriptor>
00293 void stripeOffDensityOffset(MultiBlockLattice2D<T,Descriptor>& lattice, Box2D domain, T deltaRho);
00294 
00295 
00296 template<typename T, template<class U> class Descriptor>
00297 void setCompositeDynamics( MultiBlockLattice2D<T,Descriptor>& lattice, Box2D domain,
00298                            CompositeDynamics<T,Descriptor>* compositeDynamics );
00299 
00300 template<typename T, template<class U> class Descriptor>
00301 void setExternalScalar( MultiBlockLattice2D<T,Descriptor>& lattice, Box2D domain,
00302                         int whichScalar, T externalScalar );
00303 
00304 template<typename T, template<class U> class Descriptor>
00305 void setExternalScalar( MultiBlockLattice2D<T,Descriptor>& lattice, Box2D domain,
00306                         int whichScalar, MultiScalarField2D<T> &field );
00307 
00308 template<typename T, template<class U> class Descriptor>
00309 void setExternalVector( MultiBlockLattice2D<T,Descriptor>& lattice, Box2D domain,
00310                         int vectorStartsAt, Array<T,Descriptor<T>::d> externalVector );
00311 
00312 template<typename T, template<class U> class Descriptor, int nDim>
00313 void setExternalVector( MultiBlockLattice2D<T,Descriptor>& lattice, Box2D domain,
00314                         int vectorStartsAt, MultiTensorField2D<T,nDim> &tensor );
00315 
00316 
00317 /* *************** PART III ******************************************* */
00318 /* *************** Initialization of scalar- and tensor-fields: ****** */
00319 /* *************** Atomic-Block  ************************************* */
00320 /* ******************************************************************* */
00321 
00323 template<typename T>
00324 void setToConstant(ScalarField2D<T>& field, Box2D domain, T value);
00325 
00328 template<typename T>
00329 void setToConstant(ScalarField2D<T>& field, ScalarField2D<int>& mask, int flag,
00330                    Box2D domain, T value);
00331 
00333 template<typename T, int nDim>
00334 void setToConstant( TensorField2D<T,nDim>& field, Box2D domain, 
00335                     Array<T,nDim> const& value );
00336 
00339 template<typename T, int nDim>
00340 void setToConstant( TensorField2D<T,nDim>& field, ScalarField2D<int>& mask, int flag,
00341                     Box2D domain, Array<T,nDim> const& value );
00342 
00344 // This function is implemented in-place, because it cannot be precompiled due to its generic nature.
00345 template<typename T, class Function>
00346 void setToFunction(ScalarField2D<T>& field, Box2D domain, Function f) {
00347     applyProcessingFunctional (
00348             new SetToScalarFunctionFunctional2D<T,Function>(f), domain, field );
00349 }
00350 
00352 // This function is implemented in-place, because it cannot be precompiled due to its generic nature.
00353 template<typename T, int nDim, class Function>
00354 void setToFunction(TensorField2D<T,nDim>& field, Box2D domain, Function f) {
00355     applyProcessingFunctional (
00356             new SetToTensorFunctionFunctional2D<T,nDim,Function>(f), domain, field );
00357 }
00358 
00360 template<typename T>
00361 void setToCoordinate(ScalarField2D<T>& field, Box2D domain, plint index);
00362 
00364 template<typename T>
00365 void setToCoordinates(TensorField2D<T,2>& field,  Box2D domain);
00366 
00368 template<typename T, int nDim>
00369 void assignComponent(TensorField2D<T,nDim>& tensorField, int whichComponent,
00370                      ScalarField2D<T>& scalarField, Box2D domain);
00371 
00372 
00373 /* *************** PART IV ******************************************* */
00374 /* *************** Initialization of scalar- and tensor-fields: ****** */
00375 /* *************** Multi-Block *************************************** */
00376 /* ******************************************************************* */
00377 
00379 template<typename T>
00380 void setToConstant(MultiScalarField2D<T>& field, Box2D domain, T value);
00381 
00384 template<typename T>
00385 void setToConstant(MultiScalarField2D<T>& field, MultiScalarField2D<int>& mask, int flag,
00386                    Box2D domain, T value);
00387 
00389 template<typename T, int nDim>
00390 void setToConstant( MultiTensorField2D<T,nDim>& field, Box2D domain, 
00391                     Array<T,nDim> const& value );
00392 
00395 template<typename T, int nDim>
00396 void setToConstant( MultiTensorField2D<T,nDim>& field, MultiScalarField2D<int>& mask, int flag,
00397                     Box2D domain, Array<T,nDim> const& value );
00398 
00400 // This function is implemented in-place, because it cannot be precompiled due to its generic nature.
00401 template<typename T, class Function>
00402 void setToFunction(MultiScalarField2D<T>& field, Box2D domain, Function f) {
00403     applyProcessingFunctional (
00404             new SetToScalarFunctionFunctional2D<T,Function>(f), domain, field );
00405 }
00406 
00408 // This function is implemented in-place, because it cannot be precompiled due to its generic nature.
00409 template<typename T, int nDim, class Function>
00410 void setToFunction(MultiTensorField2D<T,nDim>& field, Box2D domain, Function f) {
00411     applyProcessingFunctional (
00412             new SetToTensorFunctionFunctional2D<T,nDim,Function>(f), domain, field );
00413 }
00414 
00416 template<typename T>
00417 void setToCoordinate(MultiScalarField2D<T>& field, Box2D domain, plint index);
00418 
00420 template<typename T>
00421 void setToCoordinates(MultiTensorField2D<T,2>& field,  Box2D domain);
00422 
00424 template<typename T, int nDim>
00425 void assignComponent(MultiTensorField2D<T,nDim>& tensorField, int whichComponent,
00426                      MultiScalarField2D<T>& scalarField, Box2D domain);
00427 
00428 }  // namespace plb
00429 
00430 #endif  // DATA_INITIALIZER_WRAPPER_2D_H