diff --git a/.clang-format b/.clang-format index 60054387527c3cfa59e2dcfa13ebb2ae9a0b184a..1067e3c24a255eab69b5149f5d40d4b9ce3a596b 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 e7d891df037a05fed023fff3aaaa0db19f0cfa43..b4b5ed1fd7d984362732c39e13c04fe450b0e662 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 528bbfc7a9584b2c5dedb17098324cbeab9ee1f6..4df1d28b148fa00f5efb81a5683d1df33b71b73d 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 3276db0595329b4c948779d0b27857170d125f78..bad30b31130347dd2543714318effb61dbd21972 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 606f6b38b4f50ebc621cce23f05c2d54091934f9..c825ae108dac5aed46b6741606026b0ba9e52a08 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 78790f758f597a49caaad5e719641cf3df08afca..acc1127b7d9c78e74d76ef9187442efdb47dfa40 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 82b8df256ce8ebecdc37e202e0dbe763331a1a65..bf59a5d41208997220551e65c8e24feaf49ad38e 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 f3e6384476033880c40b4b6f4c73890ba1e33ae7..e88c96bac6d7509e139f1e4eb1c4c4eb6017febd 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;