$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 00028 #ifndef NTENSOR_ANALYSIS_FUNCTIONAL_2D_HH 00029 #define NTENSOR_ANALYSIS_FUNCTIONAL_2D_HH 00030 00031 #include "dataProcessors/ntensorAnalysisFunctional2D.h" 00032 #include "core/blockStatistics.h" 00033 #include "core/plbDebug.h" 00034 #include "core/util.h" 00035 #include "latticeBoltzmann/momentTemplates.h" 00036 #include "latticeBoltzmann/geometricOperationTemplates.h" 00037 #include "finiteDifference/fdStencils1D.h" 00038 #include "atomicBlock/atomicBlock2D.h" 00039 #include "atomicBlock/blockLattice2D.h" 00040 #include "atomicBlock/dataField2D.h" 00041 #include <cmath> 00042 #include <limits> 00043 00044 namespace plb { 00045 00046 template<typename T1, typename T2> 00047 void CopyConvertNTensorFunctional2D<T1,T2>::process ( 00048 Box2D domain, NTensorField2D<T1>& field1, 00049 NTensorField2D<T2>& field2 ) 00050 { 00051 00052 PLB_PRECONDITION( field1.getNdim() == field2.getNdim()); 00053 plint ndim = field1.getNdim(); 00054 Dot2D offset = computeRelativeDisplacement(field1, field2); 00055 00056 // Improve computational speed if the field is scalar-valued. 00057 if (ndim==1) { 00058 for (plint iX=domain.x0; iX<=domain.x1; ++iX) { 00059 for (plint iY=domain.y0; iY<=domain.y1; ++iY) { 00060 for (int iDim=0; iDim<ndim; ++iDim) { 00061 *field2.get(iX+offset.x,iY+offset.y) = 00062 (T2) *field1.get(iX,iY); 00063 } 00064 } 00065 } 00066 } 00067 // Generic implementation for any number of dimensions. 00068 else { 00069 for (plint iX=domain.x0; iX<=domain.x1; ++iX) { 00070 for (plint iY=domain.y0; iY<=domain.y1; ++iY) { 00071 for (int iDim=0; iDim<ndim; ++iDim) { 00072 field2.get(iX+offset.x,iY+offset.y)[iDim] = 00073 (T2) field1.get(iX,iY)[iDim]; 00074 } 00075 } 00076 } 00077 } 00078 } 00079 00080 template<typename T1, typename T2> 00081 CopyConvertNTensorFunctional2D<T1,T2>* CopyConvertNTensorFunctional2D<T1,T2>::clone() const 00082 { 00083 return new CopyConvertNTensorFunctional2D<T1,T2>(*this); 00084 } 00085 00086 template<typename T1, typename T2> 00087 void CopyConvertNTensorFunctional2D<T1,T2>::getTypeOfModification(std::vector<modif::ModifT>& modified) const { 00088 modified[0] = modif::nothing; 00089 modified[1] = modif::staticVariables; 00090 } 00091 00092 template<typename T1, typename T2> 00093 BlockDomain::DomainT CopyConvertNTensorFunctional2D<T1,T2>::appliesTo() const { 00094 return BlockDomain::bulkAndEnvelope; 00095 } 00096 00097 } // namespace plb 00098 00099 #endif // NTENSOR_ANALYSIS_FUNCTIONAL_2D_HH 00100
1.6.3
1.6.3