From 16e2825c69d4dea4bca1e311c2bfbe8d6a8a254f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Peters?= <soe.peters@tu-braunschweig.de> Date: Thu, 31 Aug 2023 15:19:04 +0000 Subject: [PATCH] Renamed Coefficients --- .clang-format | 4 +- .../CompressibleOffsetMomentsInterpolator.cpp | 8 +-- .../GPU/GridScaling/scaleCF_compressible.cu | 6 +- .../GPU/GridScaling/scaleFC_compressible.cu | 6 +- .../LBM/GPUHelperFunctions/ScalingUtilities.h | 2 +- .../InterpolationCoefficients.h} | 56 +++++++++---------- src/lbm/refinement/InterpolationCF.h | 4 +- src/lbm/refinement/InterpolationFC.h | 4 +- 8 files changed, 44 insertions(+), 46 deletions(-) rename src/lbm/{refinement/Coefficients.h => interpolation/InterpolationCoefficients.h} (97%) diff --git a/.clang-format b/.clang-format index 600543875..1067e3c24 100644 --- a/.clang-format +++ b/.clang-format @@ -30,7 +30,7 @@ BraceWrapping: AfterControlStatement: Never AfterEnum: false AfterFunction: true - AfterNamespace: false + AfterNamespace: true AfterObjCDeclaration: false AfterStruct: true AfterUnion: true @@ -42,7 +42,7 @@ BraceWrapping: SplitEmptyRecord: true SplitEmptyNamespace: true BreakBeforeBinaryOperators: None -BreakBeforeBraces: Linux +BreakBeforeBraces: Custom BreakBeforeInheritanceComma: false BreakInheritanceList: BeforeColon BreakBeforeTernaryOperators: true diff --git a/src/cpu/VirtualFluidsCore/LBM/Interpolation/CompressibleOffsetMomentsInterpolator.cpp b/src/cpu/VirtualFluidsCore/LBM/Interpolation/CompressibleOffsetMomentsInterpolator.cpp index e7d891df0..b4b5ed1fd 100644 --- a/src/cpu/VirtualFluidsCore/LBM/Interpolation/CompressibleOffsetMomentsInterpolator.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/Interpolation/CompressibleOffsetMomentsInterpolator.cpp @@ -6,10 +6,10 @@ #include <lbm/refinement/InterpolationCF.h> #include <lbm/refinement/InterpolationFC.h> -#include <lbm/refinement/Coefficients.h> +#include <lbm/interpolation/InterpolationCoefficients.h> -void calculateCoefficients(vf::lbm::Coefficients& coefficients, const D3Q27ICell& icell, real omega, real xoff, real yoff, real zoff) +void calculateCoefficients(vf::lbm::InterpolationCoefficients& coefficients, const D3Q27ICell& icell, real omega, real xoff, real yoff, real zoff) { vf::lbm::MomentsOnSourceNodeSet momentsSet; @@ -43,7 +43,7 @@ void CompressibleOffsetMomentsInterpolator::setOmegas(real omegaC, real omegaF) void CompressibleOffsetMomentsInterpolator::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF, real xoff, real yoff, real zoff) { - vf::lbm::Coefficients coefficients; + vf::lbm::InterpolationCoefficients coefficients; calculateCoefficients(coefficients, icellC, omegaC, xoff, yoff, zoff); vf::lbm::interpolateCF(icellF.BSW, omegaF, vf::basics::constant::c1o2, coefficients, -0.25, -0.25, -0.25); @@ -58,7 +58,7 @@ void CompressibleOffsetMomentsInterpolator::interpolateCoarseToFine(D3Q27ICell& void CompressibleOffsetMomentsInterpolator::interpolateFineToCoarse(D3Q27ICell& icellF, real* icellC, real xoff, real yoff, real zoff) { - vf::lbm::Coefficients coefficients; + vf::lbm::InterpolationCoefficients coefficients; calculateCoefficients(coefficients, icellF, omegaF, xoff, yoff, zoff); vf::lbm::interpolateFC(icellC, vf::basics::constant::c2o1, omegaC, coefficients); diff --git a/src/gpu/VirtualFluids_GPU/GPU/GridScaling/scaleCF_compressible.cu b/src/gpu/VirtualFluids_GPU/GPU/GridScaling/scaleCF_compressible.cu index 528bbfc7a..4df1d28b1 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/GridScaling/scaleCF_compressible.cu +++ b/src/gpu/VirtualFluids_GPU/GPU/GridScaling/scaleCF_compressible.cu @@ -37,12 +37,12 @@ #include "LBM/GPUHelperFunctions/ScalingUtilities.h" #include <lbm/refinement/InterpolationCF.h> -#include <lbm/refinement/Coefficients.h> +#include <lbm/interpolation/InterpolationCoefficients.h> template <bool hasTurbulentViscosity> __device__ void interpolate( - vf::lbm::Coefficients& coefficients, + vf::lbm::InterpolationCoefficients& coefficients, const unsigned int nodeIndex, real* distributionsFine, unsigned int* neighborXfine, @@ -509,7 +509,7 @@ template<bool hasTurbulentViscosity> __global__ void scaleCF_compressible( // - ################################################################### // 2.calculate coefficients - vf::lbm::Coefficients coefficients; + vf::lbm::InterpolationCoefficients coefficients; momentsSet.calculateCoefficients(coefficients, neighborCoarseToFine.x[nodeIndex], neighborCoarseToFine.y[nodeIndex], neighborCoarseToFine.z[nodeIndex]); // 3. interpolate coarse to fine diff --git a/src/gpu/VirtualFluids_GPU/GPU/GridScaling/scaleFC_compressible.cu b/src/gpu/VirtualFluids_GPU/GPU/GridScaling/scaleFC_compressible.cu index 3276db059..bad30b311 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/GridScaling/scaleFC_compressible.cu +++ b/src/gpu/VirtualFluids_GPU/GPU/GridScaling/scaleFC_compressible.cu @@ -37,11 +37,11 @@ #include <lbm/KernelParameter.h> #include <lbm/refinement/InterpolationFC.h> -#include <lbm/refinement/Coefficients.h> +#include <lbm/interpolation/InterpolationCoefficients.h> template <bool hasTurbulentViscosity> __device__ void interpolate( - vf::lbm::Coefficients& coefficients, + vf::lbm::InterpolationCoefficients& coefficients, const unsigned int nodeIndex, real* distributionsCoarse, unsigned int* neighborXcoarse, @@ -106,7 +106,7 @@ template<bool hasTurbulentViscosity> __global__ void scaleFC_compressible( momentsSet, nodeIndex, distributionsFine, neighborXfine, neighborYfine, neighborZfine, indicesFineMMM, turbulentViscosityFine, numberOfLBnodesFine, omegaFine, true); // 2.calculate coefficients - vf::lbm::Coefficients coefficients; + vf::lbm::InterpolationCoefficients coefficients; momentsSet.calculateCoefficients(coefficients, neighborFineToCoarse.x[nodeIndex], neighborFineToCoarse.y[nodeIndex], neighborFineToCoarse.z[nodeIndex]); // 3. interpolate fine to coarse diff --git a/src/gpu/VirtualFluids_GPU/LBM/GPUHelperFunctions/ScalingUtilities.h b/src/gpu/VirtualFluids_GPU/LBM/GPUHelperFunctions/ScalingUtilities.h index 606f6b38b..c825ae108 100644 --- a/src/gpu/VirtualFluids_GPU/LBM/GPUHelperFunctions/ScalingUtilities.h +++ b/src/gpu/VirtualFluids_GPU/LBM/GPUHelperFunctions/ScalingUtilities.h @@ -41,7 +41,7 @@ #include <lbm/KernelParameter.h> #include <basics/DataTypes.h> -#include <lbm/refinement/Coefficients.h> +#include <lbm/interpolation/InterpolationCoefficients.h> using namespace vf::basics::constant; using namespace vf::lbm::dir; diff --git a/src/lbm/refinement/Coefficients.h b/src/lbm/interpolation/InterpolationCoefficients.h similarity index 97% rename from src/lbm/refinement/Coefficients.h rename to src/lbm/interpolation/InterpolationCoefficients.h index 78790f758..acc1127b7 100644 --- a/src/lbm/refinement/Coefficients.h +++ b/src/lbm/interpolation/InterpolationCoefficients.h @@ -1,28 +1,28 @@ //======================================================================================= -// ____ ____ __ ______ __________ __ __ __ __ -// \ \ | | | | | _ \ |___ ___| | | | | / \ | | -// \ \ | | | | | |_) | | | | | | | / \ | | -// \ \ | | | | | _ / | | | | | | / /\ \ | | -// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ -// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| -// \ \ | | ________________________________________________________________ -// \ \ | | | ______________________________________________________________| -// \ \| | | | __ __ __ __ ______ _______ -// \ | | |_____ | | | | | | | | | _ \ / _____) -// \ | | _____| | | | | | | | | | | \ \ \_______ +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ // \ | | | | |_____ | \_/ | | | | |_/ / _____ | -// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ // -// This file is part of VirtualFluids. VirtualFluids is free software: you can +// This file is part of VirtualFluids. VirtualFluids is free software: you can // redistribute it and/or modify it under the terms of the GNU General Public -// License as published by the Free Software Foundation, either version 3 of +// License as published by the Free Software Foundation, either version 3 of // the License, or (at your option) any later version. -// -// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License // for more details. -// +// // You should have received a copy of the GNU General Public License along // with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. // @@ -37,14 +37,13 @@ #define __device__ #endif +#include <basics/constants/NumericConstants.h> #include "lbm/constants/D3Q27.h" -#include <basics/constants/NumericConstants.h> #include "lbm/KernelParameter.h" #include "lbm/MacroscopicQuantities.h" - using namespace vf::basics::constant; using namespace vf::lbm::dir; @@ -52,15 +51,14 @@ namespace vf::lbm { // The Coefficients struct needs be created like this: -// Coefficients coeffs; // MomentsOnSourceNodeSet momentsSet; // momentsSet.calculatePPP(f, omega); // ... and so on -// Coefficients coeffs; +// InterpolationCoefficients coeffs; // momentsSet.calculateCoefficients(coeffs); // Coefficients of the interpolation polynomial -struct Coefficients +struct InterpolationCoefficients { real a000, a100, a010, a001, a200, a020, a002, a110, a101, a011; real b000, b100, b010, b001, b200, b020, b002, b110, b101, b011; @@ -70,9 +68,8 @@ struct Coefficients real LaplaceRho; }; - // Private struct - is only used within the MomentsOnSourceNodeSet -struct MomentsOnSourceNode +struct MomentsOnSourceNode { real drho; real velocityX; @@ -84,7 +81,7 @@ struct MomentsOnSourceNode real kxxMyyFromfcNEQ; real kxxMzzFromfcNEQ; - __host__ __device__ void calculate(const real* const f, const real omega) + __host__ __device__ void calculate(const real *const f, const real omega) { // const real f_000 = f[dir::DIR_000]; const real fP00 = f[dir::DIR_P00]; @@ -199,7 +196,8 @@ public: momentsMMM.calculate(f, omega); } - __host__ __device__ void calculateCoefficients(Coefficients &coefficients, real xoff, real yoff, real zoff) const + __host__ __device__ void calculateCoefficients(InterpolationCoefficients &coefficients, real xoff, real yoff, + real zoff) const { real& a000 = coefficients.a000; real& b000 = coefficients.b000; @@ -431,6 +429,6 @@ public: }; -} +} // namespace vf::lbm #endif diff --git a/src/lbm/refinement/InterpolationCF.h b/src/lbm/refinement/InterpolationCF.h index 82b8df256..bf59a5d41 100644 --- a/src/lbm/refinement/InterpolationCF.h +++ b/src/lbm/refinement/InterpolationCF.h @@ -44,7 +44,7 @@ #include "lbm/KernelParameter.h" #include "lbm/Chimera.h" -#include "lbm/refinement/Coefficients.h" +#include "lbm/interpolation/InterpolationCoefficients.h" using namespace vf::basics::constant; using namespace vf::lbm::dir; @@ -52,7 +52,7 @@ using namespace vf::lbm::dir; namespace vf::lbm { -inline __host__ __device__ void interpolateCF(real* const f, const real& omegaF, const real& epsnew, const Coefficients &coefficients, const real& x, const real& y, const real& z) +inline __host__ __device__ void interpolateCF(real* const f, const real& omegaF, const real& epsnew, const InterpolationCoefficients &coefficients, const real& x, const real& y, const real& z) { const real useNEQ = c1o1; diff --git a/src/lbm/refinement/InterpolationFC.h b/src/lbm/refinement/InterpolationFC.h index f3e638447..e88c96bac 100644 --- a/src/lbm/refinement/InterpolationFC.h +++ b/src/lbm/refinement/InterpolationFC.h @@ -43,7 +43,7 @@ #include "lbm/KernelParameter.h" #include "lbm/Chimera.h" -#include "lbm/refinement/Coefficients.h" +#include "lbm/interpolation/InterpolationCoefficients.h" using namespace vf::basics::constant; using namespace vf::lbm::dir; @@ -51,7 +51,7 @@ using namespace vf::lbm::dir; namespace vf::lbm { -inline __host__ __device__ void interpolateFC(real* const f, const real epsnew, const real omegaC, const Coefficients& coefficients) +inline __host__ __device__ void interpolateFC(real* const f, const real epsnew, const real omegaC, const InterpolationCoefficients& coefficients) { const real kxyAverage = c0o1; -- GitLab