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

offLatticeBoundaryCondition3D.hh

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 #ifndef OFF_LATTICE_BOUNDARY_CONDITION_3D_HH
00026 #define OFF_LATTICE_BOUNDARY_CONDITION_3D_HH
00027 
00028 #include "core/globalDefs.h"
00029 #include "offLattice/offLatticeBoundaryCondition3D.h"
00030 #include "offLattice/triangularSurfaceMesh.h"
00031 #include "offLattice/offLatticeBoundaryProfiles3D.h"
00032 #include "triangleToDef.h"
00033 
00034 namespace plb {
00035 
00036 
00037 /* ********** OffLatticeBoundaryCondition3D ********************************** */
00038 
00039 template< typename T,
00040           template<typename U> class Descriptor,
00041           class BoundaryType >
00042 OffLatticeBoundaryCondition3D<T,Descriptor,BoundaryType>::
00043     OffLatticeBoundaryCondition3D (
00044         OffLatticeModel3D<T,BoundaryType>* offLatticeModel_,
00045         VoxelizedDomain3D<T>& voxelizedDomain_,
00046         MultiBlockLattice3D<T,Descriptor>& lattice_ )
00047     : voxelizedDomain(voxelizedDomain_),
00048       lattice(lattice_),
00049       boundaryShapeArg(lattice_),
00050       offLatticeModel(offLatticeModel_),
00051       offLatticePattern(lattice)
00052 {
00053     std::vector<MultiBlock3D*> offLatticeIniArg;
00054     // First argument for compute-off-lattice-pattern.
00055     offLatticeIniArg.push_back(&offLatticePattern);
00056     // Remaining arguments for inner-flow-shape.
00057     offLatticeIniArg.push_back(&voxelizedDomain.getVoxelMatrix());
00058     offLatticeIniArg.push_back(&voxelizedDomain.getTriangleHash());
00059     offLatticeIniArg.push_back(&boundaryShapeArg);
00060     applyProcessingFunctional (
00061             new OffLatticePatternFunctional3D<T,BoundaryType> (
00062                 offLatticeModel->clone() ),
00063             offLatticePattern.getBoundingBox(), offLatticeIniArg );
00064 }
00065 
00066 template< typename T,
00067           template<typename U> class Descriptor,
00068           class BoundaryType >
00069 OffLatticeBoundaryCondition3D<T,Descriptor,BoundaryType>::
00070     OffLatticeBoundaryCondition3D (
00071         OffLatticeModel3D<T,BoundaryType>* offLatticeModel_,
00072         VoxelizedDomain3D<T>& voxelizedDomain_,
00073         MultiBlockLattice3D<T,Descriptor>& lattice_,
00074         MultiParticleField3D<DenseParticleField3D<T,Descriptor> >& particleField_ )
00075     : offLatticeModel(offLatticeModel_),
00076       voxelizedDomain(voxelizedDomain_),
00077       lattice(lattice_),
00078       boundaryShapeArg(particleField_),
00079       offLatticePattern(lattice)
00080 {
00081     std::vector<MultiBlock3D*> offLatticeIniArg;
00082     // First argument for compute-off-lattice-pattern.
00083     offLatticeIniArg.push_back(&offLatticePattern);
00084     // Remaining arguments for inner-flow-shape.
00085     offLatticeIniArg.push_back(&voxelizedDomain.getVoxelMatrix());
00086     offLatticeIniArg.push_back(&voxelizedDomain.getTriangleHash());
00087     offLatticeIniArg.push_back(&boundaryShapeArg);
00088     applyProcessingFunctional (
00089             new OffLatticePatternFunctional3D<T,BoundaryType> (
00090                 offLatticeModel->clone() ),
00091             offLatticePattern.getBoundingBox(), offLatticeIniArg );
00092 }
00093 
00094 template< typename T,
00095           template<typename U> class Descriptor,
00096           class BoundaryType >
00097 OffLatticeBoundaryCondition3D<T,Descriptor,BoundaryType>::OffLatticeBoundaryCondition3D (
00098         OffLatticeBoundaryCondition3D<T,Descriptor,BoundaryType> const& rhs )
00099     : offLatticeModel(rhs.offLatticeModel.clone()),
00100       voxelizedDomain(rhs.voxelizedDomain),
00101       lattice(rhs.lattice),
00102       boundaryShapeArg(rhs.boundaryShapeArg),
00103       offLatticePattern(rhs.offLatticePattern)
00104 { }
00105 
00106 
00107 template< typename T,
00108           template<typename U> class Descriptor,
00109           class BoundaryType >
00110 OffLatticeBoundaryCondition3D<T,Descriptor,BoundaryType>::~OffLatticeBoundaryCondition3D()
00111 {
00112     delete offLatticeModel;
00113 }
00114 
00115 template< typename T,
00116           template<typename U> class Descriptor,
00117           class BoundaryType >
00118 void OffLatticeBoundaryCondition3D<T,Descriptor,BoundaryType>::insert()
00119 {
00120     std::vector<MultiBlock3D*> offLatticeArg;
00121     // First three arguments for Guo algorithm.
00122     offLatticeArg.push_back(&lattice);
00123     offLatticeArg.push_back(&offLatticePattern);
00124     // Remaining arguments for inner-flow-shape.
00125     offLatticeArg.push_back(&voxelizedDomain.getVoxelMatrix());
00126     offLatticeArg.push_back(&voxelizedDomain.getTriangleHash());
00127     offLatticeArg.push_back(&boundaryShapeArg);
00128     plint processorLevel = 1;
00129     plint numShapeArgs = 3;
00130     plint numCompletionArgs = 0;
00131     integrateProcessingFunctional (
00132             new OffLatticeCompletionFunctional3D<T,Descriptor,BoundaryType> (
00133                 offLatticeModel->clone(), numShapeArgs, numCompletionArgs ),
00134             boundaryShapeArg.getBoundingBox(), offLatticeArg, processorLevel );
00135 }
00136     
00137 template< typename T,
00138           template<typename U> class Descriptor,
00139           class BoundaryType >
00140 void OffLatticeBoundaryCondition3D<T,Descriptor,BoundaryType>::insert (
00141         std::vector<MultiBlock3D*> const& completionArg )
00142 {
00143     std::vector<MultiBlock3D*> offLatticeArg;
00144     // First three arguments for Guo algorithm.
00145     offLatticeArg.push_back(&lattice);
00146     offLatticeArg.push_back(&offLatticePattern);
00147     // Next arguments for inner-flow-shape.
00148     offLatticeArg.push_back(&voxelizedDomain.getVoxelMatrix());
00149     offLatticeArg.push_back(&voxelizedDomain.getTriangleHash());
00150     offLatticeArg.push_back(&boundaryShapeArg);
00151     // Remaining are optional arguments for completion algorithm.
00152     plint numCompletionArgs = (plint)completionArg.size();
00153     for (plint i=0; i<numCompletionArgs; ++i) {
00154         offLatticeArg.push_back(completionArg[i]);
00155     }
00156     plint processorLevel = 1;
00157     plint numShapeArgs = 3;
00158     integrateProcessingFunctional (
00159             new OffLatticeCompletionFunctional3D<T,Descriptor,BoundaryType> (
00160                 offLatticeModel->clone(), numShapeArgs, numCompletionArgs ),
00161             boundaryShapeArg.getBoundingBox(), offLatticeArg, processorLevel );
00162 }
00163     
00164 template< typename T,
00165           template<typename U> class Descriptor,
00166           class BoundaryType >
00167 void OffLatticeBoundaryCondition3D<T,Descriptor,BoundaryType>::apply()
00168 {
00169     std::vector<MultiBlock3D*> offLatticeArg;
00170     // First three arguments for Guo algorithm.
00171     offLatticeArg.push_back(&lattice);
00172     offLatticeArg.push_back(&offLatticePattern);
00173     // Remaining arguments for inner-flow-shape.
00174     offLatticeArg.push_back(&voxelizedDomain.getVoxelMatrix());
00175     offLatticeArg.push_back(&voxelizedDomain.getTriangleHash());
00176     offLatticeArg.push_back(&boundaryShapeArg);
00177     plint numShapeArgs = 3;
00178     plint numCompletionArgs = 0;
00179     applyProcessingFunctional (
00180             new OffLatticeCompletionFunctional3D<T,Descriptor,BoundaryType> (
00181                 offLatticeModel->clone(), numShapeArgs, numCompletionArgs ),
00182             boundaryShapeArg.getBoundingBox(), offLatticeArg );
00183 }
00184 
00185 template< typename T,
00186           template<typename U> class Descriptor,
00187           class BoundaryType >
00188 void OffLatticeBoundaryCondition3D<T,Descriptor,BoundaryType>::apply (
00189         std::vector<MultiBlock3D*> const& completionArg )
00190 {
00191     std::vector<MultiBlock3D*> offLatticeArg;
00192     // First three arguments for Guo algorithm.
00193     offLatticeArg.push_back(&lattice);
00194     offLatticeArg.push_back(&offLatticePattern);
00195     // Next arguments for inner-flow-shape.
00196     offLatticeArg.push_back(&voxelizedDomain.getVoxelMatrix());
00197     offLatticeArg.push_back(&voxelizedDomain.getTriangleHash());
00198     offLatticeArg.push_back(&boundaryShapeArg);
00199     // Remaining are optional arguments for completion algorithm.
00200     plint numCompletionArgs = (plint)completionArg.size();
00201     for (plint i=0; i<numCompletionArgs; ++i) {
00202         offLatticeArg.push_back(completionArg[i]);
00203     }
00204     plint numShapeArgs = 3;
00205     applyProcessingFunctional (
00206             new OffLatticeCompletionFunctional3D<T,Descriptor,BoundaryType> (
00207                 offLatticeModel->clone(), numShapeArgs, numCompletionArgs ),
00208             boundaryShapeArg.getBoundingBox(), offLatticeArg );
00209 }
00210 
00211 template< typename T,
00212           template<typename U> class Descriptor,
00213           class BoundaryType >
00214 Array<T,3> OffLatticeBoundaryCondition3D<T,Descriptor,BoundaryType>::getForceOnObject()
00215 {
00216     std::vector<MultiBlock3D*> arg;
00217     arg.push_back(&offLatticePattern);
00218     GetForceOnObjectFunctional3D<T,BoundaryType> functional(offLatticeModel->clone());
00219     applyProcessingFunctional (
00220             functional, boundaryShapeArg.getBoundingBox(), arg );
00221     return functional.getForce();
00222 }
00223 
00224     
00225 template< typename T,
00226           template<typename U> class Descriptor,
00227           class BoundaryType >
00228 std::auto_ptr<MultiTensorField3D<T,3> >
00229     OffLatticeBoundaryCondition3D<T,Descriptor,BoundaryType>::computeVelocity(Box3D domain)
00230 {
00231     std::auto_ptr<MultiTensorField3D<T,3> > velocity(plb::computeVelocity(lattice,domain));
00232     int flowType = voxelizedDomain.getFlowType();
00233     int solidFlag = voxelFlag::invert(flowType);
00234     int solidBorderFlag = voxelFlag::borderFlag(solidFlag);
00235     setToConstant<T,3>(*velocity, voxelizedDomain.getVoxelMatrix(), solidFlag,
00236                        domain, Array<T,3>(T(),T(),T()));
00237     setToConstant<T,3>(*velocity, voxelizedDomain.getVoxelMatrix(), solidBorderFlag,
00238                        domain, Array<T,3>(T(),T(),T()));
00239     return velocity;
00240 }
00241 
00242 template< typename T,
00243           template<typename U> class Descriptor,
00244           class BoundaryType >
00245 std::auto_ptr<MultiTensorField3D<T,3> >
00246     OffLatticeBoundaryCondition3D<T,Descriptor,BoundaryType>::computeVelocity()
00247 {
00248     return computeVelocity(lattice.getBoundingBox());
00249 }
00250 
00251     
00252 template< typename T,
00253           template<typename U> class Descriptor,
00254           class BoundaryType >
00255 std::auto_ptr<MultiTensorField3D<T,3> >
00256     OffLatticeBoundaryCondition3D<T,Descriptor,BoundaryType>::computeVorticity(Box3D domain)
00257 {
00258     std::auto_ptr<MultiTensorField3D<T,3> > vorticity (
00259             plb::computeBulkVorticity(*plb::computeVelocity(lattice,domain), domain) );
00260     int flowType = voxelizedDomain.getFlowType();
00261     int solidFlag = voxelFlag::invert(flowType);
00262     int solidBorderFlag = voxelFlag::borderFlag(solidFlag);
00263     setToConstant<T,3>(*vorticity, voxelizedDomain.getVoxelMatrix(), solidFlag,
00264                        domain, Array<T,3>(T(),T(),T()));
00265     setToConstant<T,3>(*vorticity, voxelizedDomain.getVoxelMatrix(), solidBorderFlag,
00266                        domain, Array<T,3>(T(),T(),T()));
00267     return vorticity;
00268 }
00269 
00270 template< typename T,
00271           template<typename U> class Descriptor,
00272           class BoundaryType >
00273 std::auto_ptr<MultiTensorField3D<T,3> >
00274     OffLatticeBoundaryCondition3D<T,Descriptor,BoundaryType>::computeVorticity()
00275 {
00276     return computeVorticity(lattice.getBoundingBox());
00277 }
00278     
00279 template< typename T,
00280           template<typename U> class Descriptor,
00281           class BoundaryType >
00282 std::auto_ptr<MultiScalarField3D<T> >
00283     OffLatticeBoundaryCondition3D<T,Descriptor,BoundaryType>::computeVelocityNorm(Box3D domain)
00284 {
00285     std::auto_ptr<MultiScalarField3D<T> > velocityNorm(plb::computeVelocityNorm(lattice,domain));
00286     int flowType = voxelizedDomain.getFlowType();
00287     int solidFlag = voxelFlag::invert(flowType);
00288     int solidBorderFlag = voxelFlag::borderFlag(solidFlag);
00289     setToConstant(*velocityNorm, voxelizedDomain.getVoxelMatrix(),
00290                   solidFlag, domain, (T)0);
00291     setToConstant(*velocityNorm, voxelizedDomain.getVoxelMatrix(),
00292                   solidBorderFlag, domain, (T)0);
00293     return velocityNorm;
00294 }
00295     
00296 template< typename T,
00297           template<typename U> class Descriptor,
00298           class BoundaryType >
00299 std::auto_ptr<MultiScalarField3D<T> >
00300     OffLatticeBoundaryCondition3D<T,Descriptor,BoundaryType>::computeVelocityNorm()
00301 {
00302     return computeVelocityNorm(lattice.getBoundingBox());
00303 }
00304     
00305 template< typename T,
00306           template<typename U> class Descriptor,
00307           class BoundaryType >
00308 std::auto_ptr<MultiScalarField3D<T> >
00309     OffLatticeBoundaryCondition3D<T,Descriptor,BoundaryType>::computeVelocityComponent (
00310             Box3D domain, plint iComp )
00311 {
00312     std::auto_ptr<MultiScalarField3D<T> > velocityComponent (
00313             plb::computeVelocityComponent(lattice,domain, iComp));
00314     int flowType = voxelizedDomain.getFlowType();
00315     int solidFlag = voxelFlag::invert(flowType);
00316     int solidBorderFlag = voxelFlag::borderFlag(solidFlag);
00317     setToConstant(*velocityComponent, voxelizedDomain.getVoxelMatrix(),
00318                   solidFlag, domain, (T)0);
00319     setToConstant(*velocityComponent, voxelizedDomain.getVoxelMatrix(),
00320                   solidBorderFlag, domain, (T)0);
00321     return velocityComponent;
00322 }
00323     
00324 template< typename T,
00325           template<typename U> class Descriptor,
00326           class BoundaryType >
00327 std::auto_ptr<MultiScalarField3D<T> >
00328     OffLatticeBoundaryCondition3D<T,Descriptor,BoundaryType>::computeVelocityComponent(plint iComp)
00329 {
00330     return computeVelocityComponent(lattice.getBoundingBox(), iComp);
00331 }
00332     
00333 template< typename T,
00334           template<typename U> class Descriptor,
00335           class BoundaryType >
00336 std::auto_ptr<MultiScalarField3D<T> >
00337     OffLatticeBoundaryCondition3D<T,Descriptor,BoundaryType>::computePressure(Box3D domain)
00338 {
00339     std::auto_ptr<MultiScalarField3D<T> > pressure(plb::computeDensity(lattice,domain));
00340     T averageDensity = computeAverageDensity(domain);
00341     subtractInPlace(*pressure, averageDensity, domain);
00342     multiplyInPlace(*pressure, Descriptor<T>::cs2, domain);
00343     int flowType = voxelizedDomain.getFlowType();
00344     int solidFlag = voxelFlag::invert(flowType);
00345     int solidBorderFlag = voxelFlag::borderFlag(solidFlag);
00346     setToConstant(*pressure, voxelizedDomain.getVoxelMatrix(),
00347                   solidFlag, domain, (T)0);
00348     setToConstant(*pressure, voxelizedDomain.getVoxelMatrix(),
00349                   solidBorderFlag, domain, (T)0);
00350     return pressure;
00351 }
00352     
00353 template< typename T,
00354           template<typename U> class Descriptor,
00355           class BoundaryType >
00356 std::auto_ptr<MultiScalarField3D<T> >
00357     OffLatticeBoundaryCondition3D<T,Descriptor,BoundaryType>::computePressure()
00358 {
00359     return computePressure(lattice.getBoundingBox());
00360 }
00361 
00362 template< typename T,
00363           template<typename U> class Descriptor,
00364           class BoundaryType >
00365 std::auto_ptr<MultiScalarField3D<T> >
00366     OffLatticeBoundaryCondition3D<T,Descriptor,BoundaryType>::computeDensity(Box3D domain, T solidDensity)
00367 {
00368     std::auto_ptr<MultiScalarField3D<T> > density(plb::computeDensity(lattice,domain));
00369     int flowType = voxelizedDomain.getFlowType();
00370     int solidFlag = voxelFlag::invert(flowType);
00371     int solidBorderFlag = voxelFlag::borderFlag(solidFlag);
00372     setToConstant(*density, voxelizedDomain.getVoxelMatrix(),
00373                   solidFlag, domain, solidDensity);
00374     setToConstant(*density, voxelizedDomain.getVoxelMatrix(),
00375                   solidBorderFlag, domain, solidDensity);
00376     return density;
00377 }
00378     
00379 template< typename T,
00380           template<typename U> class Descriptor,
00381           class BoundaryType >
00382 std::auto_ptr<MultiScalarField3D<T> >
00383     OffLatticeBoundaryCondition3D<T,Descriptor,BoundaryType>::computeDensity(T solidDensity)
00384 {
00385     return computeDensity(lattice.getBoundingBox(), solidDensity);
00386 }
00387 
00388     
00389 template< typename T,
00390           template<typename U> class Descriptor,
00391           class BoundaryType >
00392 std::auto_ptr<MultiScalarField3D<T> >
00393     OffLatticeBoundaryCondition3D<T,Descriptor,BoundaryType>::computeStrainRateNorm(Box3D domain)
00394 {
00395     std::auto_ptr<MultiScalarField3D<T> >
00396          strainRateNorm(computeSymmetricTensorNorm(*plb::computeStrainRateFromStress(lattice,domain)));
00397     int flowType = voxelizedDomain.getFlowType();
00398     int solidFlag = voxelFlag::invert(flowType);
00399     int solidBorderFlag = voxelFlag::borderFlag(solidFlag);
00400     setToConstant(*strainRateNorm, voxelizedDomain.getVoxelMatrix(),
00401                   solidFlag, domain, (T)0);
00402     setToConstant(*strainRateNorm, voxelizedDomain.getVoxelMatrix(),
00403                   solidBorderFlag, domain, (T)0);
00404     return strainRateNorm;
00405 }
00406     
00407 template< typename T,
00408           template<typename U> class Descriptor,
00409           class BoundaryType >
00410 std::auto_ptr<MultiScalarField3D<T> >
00411     OffLatticeBoundaryCondition3D<T,Descriptor,BoundaryType>::computeStrainRateNorm()
00412 {
00413     return computeStrainRateNorm(lattice.getBoundingBox());
00414 }
00415 
00416 
00417 template< typename T,
00418           template<typename U> class Descriptor,
00419           class BoundaryType >
00420 T OffLatticeBoundaryCondition3D<T,Descriptor,BoundaryType>::computeAverageVelocityComponent(Box3D domain, plint iComponent)
00421 {
00422     std::auto_ptr<MultiScalarField3D<T> > density (
00423             plb::computeVelocityComponent(lattice,domain, iComponent) );
00424     MultiScalarField3D<int> flagMatrix((MultiBlock3D&)voxelizedDomain.getVoxelMatrix());
00425     int flowType = voxelizedDomain.getFlowType();
00426     int fluidBorderFlag = voxelFlag::borderFlag(flowType);
00427     setToConstant(flagMatrix, voxelizedDomain.getVoxelMatrix(),
00428                   flowType, domain, 1);
00429     setToConstant(flagMatrix, voxelizedDomain.getVoxelMatrix(),
00430                   fluidBorderFlag, domain, 1);
00431     return computeAverage(*density, flagMatrix, 1, domain);
00432 }
00433 
00434 template< typename T,
00435           template<typename U> class Descriptor,
00436           class BoundaryType >
00437 T OffLatticeBoundaryCondition3D<T,Descriptor,BoundaryType>::computeAverageDensity()
00438 {
00439     return computeAverageDensity(voxelizedDomain.getVoxelMatrix().getBoundingBox());
00440 }
00441 
00442 template< typename T,
00443           template<typename U> class Descriptor,
00444           class BoundaryType >
00445 T OffLatticeBoundaryCondition3D<T,Descriptor,BoundaryType>::computeAverageDensity(Box3D domain)
00446 {
00447     std::auto_ptr<MultiScalarField3D<T> > density (
00448             plb::computeDensity(lattice,domain) );
00449     std::auto_ptr<MultiScalarField3D<T> > density2 (
00450             plb::computeDensity(lattice,domain) );
00451     MultiScalarField3D<int> flagMatrix((MultiBlock3D&)voxelizedDomain.getVoxelMatrix());
00452     int flowType = voxelizedDomain.getFlowType();
00453     int fluidBorderFlag = voxelFlag::borderFlag(flowType);
00454     setToConstant(flagMatrix, voxelizedDomain.getVoxelMatrix(),
00455                   flowType, domain, 1);
00456     setToConstant(flagMatrix, voxelizedDomain.getVoxelMatrix(),
00457                   fluidBorderFlag, domain, 1);
00458     return computeAverage(*density, flagMatrix, 1, domain);
00459 }
00460     
00461 template< typename T,
00462           template<typename U> class Descriptor,
00463           class BoundaryType >
00464 T OffLatticeBoundaryCondition3D<T,Descriptor,BoundaryType>::computeAverageEnergy()
00465 {
00466     return computeAverageEnergy(voxelizedDomain.getVoxelMatrix().getBoundingBox());
00467 }
00468 
00469 template< typename T,
00470           template<typename U> class Descriptor,
00471           class BoundaryType >
00472 T OffLatticeBoundaryCondition3D<T,Descriptor,BoundaryType>::computeAverageEnergy(Box3D domain)
00473 {
00474     std::auto_ptr<MultiScalarField3D<T> > energy (
00475             plb::computeKineticEnergy(lattice,domain) );
00476     MultiScalarField3D<int> flagMatrix((MultiBlock3D&)voxelizedDomain.getVoxelMatrix());
00477     int flowType = voxelizedDomain.getFlowType();
00478     int fluidBorderFlag = voxelFlag::borderFlag(flowType);
00479     setToConstant(flagMatrix, voxelizedDomain.getVoxelMatrix(),
00480                   flowType, domain, 1);
00481     setToConstant(flagMatrix, voxelizedDomain.getVoxelMatrix(),
00482                   fluidBorderFlag, domain, 1);
00483     return computeAverage(*energy, flagMatrix, 1, domain);
00484 }
00485     
00486 template< typename T,
00487           template<typename U> class Descriptor,
00488           class BoundaryType >
00489 T OffLatticeBoundaryCondition3D<T,Descriptor,BoundaryType>::computeRMSvorticity()
00490 {
00491     return computeRMSvorticity(voxelizedDomain.getVoxelMatrix().getBoundingBox());
00492 }
00493 
00494 template< typename T,
00495           template<typename U> class Descriptor,
00496           class BoundaryType >
00497 T OffLatticeBoundaryCondition3D<T,Descriptor,BoundaryType>::computeRMSvorticity(Box3D domain)
00498 {
00499     std::auto_ptr<MultiScalarField3D<T> > vorticityNormSqr (
00500             plb::computeNormSqr(*plb::computeBulkVorticity(*plb::computeVelocity(lattice,domain)) ) );
00501     MultiScalarField3D<int> flagMatrix((MultiBlock3D&)voxelizedDomain.getVoxelMatrix());
00502     int flowType = voxelizedDomain.getFlowType();
00503     int fluidBorderFlag = voxelFlag::borderFlag(flowType);
00504     setToConstant(flagMatrix, voxelizedDomain.getVoxelMatrix(),
00505                   flowType, domain, 1);
00506     setToConstant(flagMatrix, voxelizedDomain.getVoxelMatrix(),
00507                   fluidBorderFlag, domain, 1);
00508     return sqrt(computeAverage(*vorticityNormSqr, flagMatrix, 1, domain));
00509 }
00510     
00511 }  // namespace plb
00512 
00513 #endif  // OFF_LATTICE_BOUNDARY_CONDITION_3D_HH