Skip to content
Snippets Groups Projects
Commit 866a86ce authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

clang-format

parent 1023a3f7
No related branches found
No related tags found
1 merge request!1028simplify slicing procedures
Pipeline #74957 passed
......@@ -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;
}
......
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment