diff --git a/Dockerfile b/Dockerfile index 738a8b5..5d9c48f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,9 @@ -FROM ubuntu:latest +FROM alpine:3.19.0 -WORKDIR /usr/src/app +WORKDIR /app -RUN apt-get update; \ - apt-get install -y --no-install-recommends make g++ libgtest-dev cmake; \ - rm -rf /var/lib/apt/lists/* +RUN apk update && \ + apk add --no-cache build-base cmake gtest-dev COPY . . diff --git a/src/rainflow.cpp b/src/rainflow.cpp index 1682322..09e5618 100644 --- a/src/rainflow.cpp +++ b/src/rainflow.cpp @@ -111,25 +111,16 @@ RainFlow::Counts RainFlow::count_cycles(const RainFlow::Series& series, double b nmax = n; auto range = n * binSize; - if (counts.find(range) == counts.end()) { - counts[range] = cycle.count; - } else { - counts[range] += cycle.count; - } + counts[range] += cycle.count; } for (auto n = 1; n < nmax; ++n) { auto range = n * binSize; - if (counts.find(range) == counts.end()) - counts[range] = 0.0; + counts.emplace(range, 0.0); } } else { for (auto cycle: extract_cycles(series)) { - if (counts.find(cycle.range) == counts.end()) { - counts[cycle.range] = cycle.count; - } else { - counts[cycle.range] += cycle.count; - } + counts[cycle.range] += cycle.count; } }