./
Coverage:
low: ≥ 0%
medium: ≥ 75.0%
high: ≥ 90.0%
Lines:
2 / 2
100.0%
Branches:
1 / 2
50.0%
Functions:
-
-%

include/terraingen/distribution/minimum.h
Line Branch Exec Source
1 // SPDX-License-Identifier: BSD-3-Clause
2
3 /// @file
4 /// @brief The pointwise minimum of size-frequency distributions.
5 #pragma once
6
7 #include "terraingen/distribution/size_frequency.h"
8
9 #include <memory>
10 #include <utility>
11 #include <vector>
12
13 namespace terraingen {
14
15 /// The pointwise minimum of distributions of one kind, such as the DSNE crater density: the
16 /// lesser of the production surface and the equilibrium density at every diameter.
17 ///
18 /// The valid range is the intersection of the inputs' valid ranges, even for inputs that allow
19 /// extrapolation, which `SummedSfd` and `SplicedSfd` treat as valid everywhere.
20
1/2
✓ Branch 11 taken 1 time.
✗ Branch 12 not taken.
436 class MinimumSfd final : public SizeFrequencyDistribution {
21 public:
22 /// The minimum of `distributions`, all of one kind.
23 /// @throws std::invalid_argument if `distributions` is empty, holds a null pointer, mixes
24 /// kinds, or the valid ranges do not overlap.
25 explicit MinimumSfd(
26 std::vector<std::shared_ptr<const SizeFrequencyDistribution>> distributions);
27
28 /// The distributions whose minimum this is.
29 const std::vector<std::shared_ptr<const SizeFrequencyDistribution>>& Distributions() const {
30 1 return m_distributions;
31 }
32
33 protected:
34 double CumulativeAt(double diameter) const override;
35 double IncrementalAt(double diameter) const override;
36
37 private:
38 /// The minimum of `distributions`, already checked to share `kind`.
39 MinimumSfd(SfdKind kind,
40 std::vector<std::shared_ptr<const SizeFrequencyDistribution>>&& distributions);
41
42 /// The input with the lowest N(>=D) at `diameter` meters, the first on ties, and that N.
43 std::pair<const SizeFrequencyDistribution*, double> LowestAt(double diameter) const;
44
45 std::vector<std::shared_ptr<const SizeFrequencyDistribution>> m_distributions;
46 };
47
48 } // namespace terraingen
49