24#ifndef SUPER_LATTICE_TIME_AVERAGED_F2_D_HH
25#define SUPER_LATTICE_TIME_AVERAGED_F2_D_HH
36 :
SuperF2D<T,T>(sFunctor.getSuperStructure(),sFunctor.getTargetDim()*2), _ensembles(0), _sFunctor(sFunctor),
37 _sData(_sFunctor.getSuperStructure().getCuboidGeometry(),
38 _sFunctor.getSuperStructure().getLoadBalancer(),
39 _sFunctor.getSuperStructure().getOverlap(),
40 _sFunctor.getTargetDim()),
41 _sDataP2(_sFunctor.getSuperStructure().getCuboidGeometry(),
42 _sFunctor.getSuperStructure().getLoadBalancer(),
43 _sFunctor.getSuperStructure().getOverlap(),
44 _sFunctor.getTargetDim())
51 T iCloc = _sData.getLoadBalancer().loc(input[0]);
52 for (
int iDim = 0; iDim < _sData.getDataSize(); iDim++) {
53 output[iDim] = _sData.getBlock(iCloc).get(input+1,iDim) / _ensembles;
55 for (
int iDim = _sData.getDataSize(); iDim < _sData.getDataSize()*2; iDim++)
56 if (_sDataP2.getBlock(iCloc).get(input+1,(
int) iDim-_sDataP2.getDataSize())/_ensembles - _sData.getBlock(iCloc).get(input+1,(
int) iDim-_sDataP2.getDataSize())*_sData.getBlock(iCloc).get(input+1,(
int) iDim-_sDataP2.getDataSize())/_ensembles/_ensembles<0) {
60 output[iDim] =
util::sqrt(_sDataP2.getBlock(iCloc).get(input+1,(
int) iDim-_sDataP2.getDataSize())/_ensembles - _sData.getBlock(iCloc).get(input+1,(
int) iDim-_sDataP2.getDataSize())*_sData.getBlock(iCloc).get(input+1,(
int) iDim-_sDataP2.getDataSize())/_ensembles/_ensembles);
73 for (
int iCloc=0; iCloc < _sData.getLoadBalancer().size(); ++iCloc) {
74 i[0] = _sData.getLoadBalancer().glob(iCloc);
75 _sData.getBlock(iCloc).forSpatialLocations([&](
auto iX,
auto iY) {
78 std::vector<BaseType<T>> tmp(_sFunctor.getTargetDim(), 0);
79 _sFunctor(tmp.data(), i);
80 for (
int iDim=0; iDim<_sFunctor.getTargetDim(); iDim++) {
81 _sData.getBlock(iCloc).get({iX, iY}, iDim) += (
BaseType<T>)(tmp[iDim]) ;
96 :
SuperF2D<T,T>(sFunctorM.getSuperStructure(),sFunctorM.getTargetDim()*sFunctorN.getTargetDim()), _ensembles(0), _sFunctorM(sFunctorM), _sFunctorN(sFunctorN), _sDataM(_sFunctorM.getSuperStructure().getCuboidGeometry(),_sFunctorM.getSuperStructure().getLoadBalancer(),_sFunctorM.getSuperStructure().getOverlap(),_sFunctorM.getTargetDim()),_sDataN(_sFunctorN.getSuperStructure().getCuboidGeometry(),_sFunctorN.getSuperStructure().getLoadBalancer(),_sFunctorN.getSuperStructure().getOverlap(),_sFunctorN.getTargetDim()),_sDataMN(_sFunctorM.getSuperStructure().getCuboidGeometry(),_sFunctorM.getSuperStructure().getLoadBalancer(),_sFunctorM.getSuperStructure().getOverlap(),_sFunctorM.getTargetDim()*_sFunctorN.getTargetDim())
109 for (
int iCloc=0; iCloc < _sDataMN.getLoadBalancer().size(); ++iCloc) {
110 i[0] = _sDataMN.getLoadBalancer().glob(iCloc);
111 for (iX=0; iX < _sDataMN.getBlock(iCloc).getNx(); iX++) {
112 for (iY=0; iY < _sDataMN.getBlock(iCloc).getNy(); iY++) {
120 for (
int iDimM=0; iDimM<_sFunctorM.getTargetDim(); iDimM++) {
121 for (
int iDimN=0; iDimN<_sFunctorN.getTargetDim(); iDimN++) {
126 for (
int iDim=0; iDim<_sFunctorN.getTargetDim(); iDim++) {
127 _sDataN.getBlock(iCloc).get({iX, iY}, iDim) += (
BaseType<T>)(tmpN[iDim]) ;
129 for (
int iDim=0; iDim<_sFunctorM.getTargetDim(); iDim++) {
130 _sDataM.getBlock(iCloc).get({iX, iY}, iDim) += (
BaseType<T>)(tmpM[iDim]) ;
142 T iCloc = _sDataMN.getLoadBalancer().loc(input[0]);
143 for (
int iDimM=0; iDimM<_sFunctorM.getTargetDim(); iDimM++) {
144 for (
int iDimN=0; iDimN<_sFunctorN.getTargetDim(); iDimN++) {
145 output[iDim] = _sDataMN.getBlock(iCloc).get(input+1,iDim)-_sDataM.getBlock(iCloc).get(input+1,iDimM) *_sDataN.getBlock(iCloc).get(input+1,iDimN)/_ensembles/_ensembles;
155 :
SuperF2D<T,T>(sFunctorM.getSuperStructure(),sFunctorM.getTargetDim()), _sFunctorM(sFunctorM), _sFunctorN(sFunctorN), _sGeometry(sGeometry),_material(material)
157 this->
getName() =
"SuperLatticeTimeAveraged2DL2Norm";
167 T tmpM[_sFunctorM.getTargetDim()];
168 T tmpN[_sFunctorN.getTargetDim()];
169 for (
int iC = 0; iC < _sFunctorM.getSuperStructure().getLoadBalancer().size(); ++iC) {
170 Cuboid2D<T>& cuboid = geometry.
get(_sFunctorM.getSuperStructure().getLoadBalancer().glob(iC));
172 const int nX = cuboid.
getNx();
173 const int nY = cuboid.
getNy();
175 inputTmp[0] = _sFunctorM.getSuperStructure().getLoadBalancer().glob(iC);
177 for (inputTmp[1] = 0; inputTmp[1] < nX; ++inputTmp[1]) {
178 for (inputTmp[2] = 0; inputTmp[2] < nY; ++inputTmp[2]) {
179 _sFunctorM(tmpM, inputTmp);
180 _sFunctorN(tmpN, inputTmp);
181 for (
int iDim = 0; iDim < _sFunctorM.getTargetDim()/2; ++iDim) {
182 output[0] += (tmpM[iDim]-tmpN[iDim])*(tmpM[iDim]-tmpN[iDim]);
189#ifdef PARALLEL_MODE_MPI
193 Cuboid2D<T>& cuboid = geometry.
get(_sFunctorM.getSuperStructure().getLoadBalancer().glob(0));
A regular single 2D cuboid is the basic component of a 2D cuboid structure which defines the grid.
T getDeltaR() const
Read access to the distance of cuboid nodes.
int getNx() const
Read access to cuboid width.
int getNy() const
Read access to cuboid height.
A cuboid structure represents the grid of a considered domain.
Cuboid2D< T > & get(int i)
Read and write access to the cuboids.
std::string & getName()
read and write access to name
represents all functors that operate on a SuperStructure<T,2> in general
Representation of a statistic for a parallel 2D geometry.
bool operator()(T output[], const int input[])
SuperLatticeTimeAveraged2DL2Norm(SuperF2D< T, T > &sFunctorM, SuperF2D< T, T > &sFunctorN, SuperGeometry< T, 2 > &sGeometry, int material)
bool operator()(T output[], const int input[])
SuperLatticeTimeAveragedCrossCorrelationF2D(SuperF2D< T, T > &sFunctorM, SuperF2D< T, T > &sFunctorN)
SuperLatticeTimeAveragedF2D(SuperF2D< T, T > &sFunctor)
bool operator()(T output[], const int input[])
int getBlockFSize() const
void reduceAndBcast(T &reductVal, MPI_Op op, int root=0, MPI_Comm comm=MPI_COMM_WORLD)
Reduction operation, followed by a broadcast.
cpu::simd::Pack< T > sqrt(cpu::simd::Pack< T > value)
Top level namespace for all of OpenLB.
typename util::BaseTypeHelper< T >::type BaseType