From 866a86ce4c831b268fa2bc5f296f60ae6f8e5413 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Thu, 8 Sep 2022 13:21:22 +0200 Subject: [PATCH] clang-format --- Resample/Processed/ParticleSpans.cpp | 14 ++++++-------- Sample/Multilayer/MultiLayer.cpp | 16 ++++++++-------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/Resample/Processed/ParticleSpans.cpp b/Resample/Processed/ParticleSpans.cpp index 6f0b49d9490..7bb9fa9a741 100644 --- a/Resample/Processed/ParticleSpans.cpp +++ b/Resample/Processed/ParticleSpans.cpp @@ -22,9 +22,9 @@ #include "Sample/Particle/IParticle.h" #include <algorithm> #include <cstddef> +#include <iostream> // debug #include <stdexcept> #include <utility> -#include <iostream> // debug namespace { @@ -46,7 +46,7 @@ size_t iLayerTop(double top, const std::vector<double>& ZBottoms) for (size_t i = 0; i < ZBottoms.size(); ++i) if (ZBottoms.at(i) < top) return i; - return ZBottoms.size()-1; + return ZBottoms.size() - 1; // old implementation: // auto index_above = std::lower_bound(ZBottoms.rbegin(), ZBottoms.rend(), top); // return static_cast<size_t>(ZBottoms.rend() - index_above); @@ -57,8 +57,8 @@ size_t iLayerBottom(double bottom, const std::vector<double>& ZBottoms) if (bottom < ZBottoms.back()) return ZBottoms.size(); for (size_t i = 0; i < ZBottoms.size(); ++i) - if (ZBottoms.at(ZBottoms.size()-1-i) > bottom) - return ZBottoms.size()-i; + if (ZBottoms.at(ZBottoms.size() - 1 - i) > bottom) + return ZBottoms.size() - i; return 0; // old implementation // auto index_below = std::upper_bound(ZBottoms.rbegin(), ZBottoms.rend(), bottom); @@ -100,12 +100,10 @@ std::vector<ZLimits> Compute::particleSpans(const MultiLayer& sample) for (size_t ii = top_index; ii < bottoindex + 1; ++ii) { double layer_ref = ii ? sample.zTop(ii) : sample.zBottom(ii); double upper = ii ? std::min(top, layer_ref) : top; - double lower = (ii == N - 1) ? bottom - : std::max(bottom, ZBottoms[ii]); + double lower = (ii == N - 1) ? bottom : std::max(bottom, ZBottoms[ii]); ZLimits bounded_limits(lower - layer_ref, upper - layer_ref); if (result[ii].isFinite()) - result[ii] = ZLimits::enclosingInterval(result[ii], - bounded_limits); + result[ii] = ZLimits::enclosingInterval(result[ii], bounded_limits); else result[ii] = bounded_limits; } diff --git a/Sample/Multilayer/MultiLayer.cpp b/Sample/Multilayer/MultiLayer.cpp index 27d2a11ae9d..b9526573947 100644 --- a/Sample/Multilayer/MultiLayer.cpp +++ b/Sample/Multilayer/MultiLayer.cpp @@ -146,14 +146,14 @@ void MultiLayer::addInterface(LayerInterface* child) double MultiLayer::zTop(size_t i) const { ASSERT(m_validated); - ASSERT(i>=1 && i<numberOfLayers()); - return ZInterfaces.at(i-1); + ASSERT(i >= 1 && i < numberOfLayers()); + return ZInterfaces.at(i - 1); } double MultiLayer::zBottom(size_t i) const { ASSERT(m_validated); - ASSERT(i<numberOfLayers()-1); + ASSERT(i < numberOfLayers() - 1); return ZInterfaces.at(i); } @@ -183,12 +183,12 @@ std::string MultiLayer::validate() const //! Precompute interface coordinates size_t N = numberOfLayers(); - if (N>=1) - ZInterfaces.resize(N-1); - if (N>=2) { + if (N >= 1) + ZInterfaces.resize(N - 1); + if (N >= 2) { ZInterfaces[0] = 0; - for (size_t i=1; i<N-1; ++i) - ZInterfaces.at(i) = ZInterfaces.at(i-1) - m_layers.at(i)->thickness(); + for (size_t i = 1; i < N - 1; ++i) + ZInterfaces.at(i) = ZInterfaces.at(i - 1) - m_layers.at(i)->thickness(); } m_validated = true; -- GitLab