distribution/minimum.h
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /// @file | ||
| 2 | /// @brief The pointwise minimum of size-frequency distributions. | ||
| 3 | #pragma once | ||
| 4 | |||
| 5 | #include "terraingen/distribution/size_frequency.h" | ||
| 6 | |||
| 7 | #include <memory> | ||
| 8 | #include <vector> | ||
| 9 | |||
| 10 | namespace terraingen { | ||
| 11 | |||
| 12 | /// The pointwise minimum of distributions of one kind, such as the DSNE crater density: the | ||
| 13 | /// lesser of the production surface and the equilibrium density at every diameter. | ||
| 14 | /// | ||
| 15 | /// The valid range is the intersection of the inputs' valid ranges, even for inputs that allow | ||
| 16 | /// extrapolation, which `SummedSfd` and `SplicedSfd` treat as valid everywhere. | ||
| 17 | class MinimumSfd final : public SizeFrequencyDistribution { | ||
| 18 | public: | ||
| 19 | /// The minimum of `distributions`, all of one kind. | ||
| 20 | /// @throws std::invalid_argument if `distributions` is empty, holds a null pointer, mixes | ||
| 21 | /// kinds, or the valid ranges do not overlap. | ||
| 22 | explicit MinimumSfd( | ||
| 23 | std::vector<std::shared_ptr<const SizeFrequencyDistribution>> distributions); | ||
| 24 | |||
| 25 | /// The distributions whose minimum this is. | ||
| 26 | 2 | const std::vector<std::shared_ptr<const SizeFrequencyDistribution>>& Distributions() const { | |
| 27 | 2 | return distributions_; | |
| 28 | } | ||
| 29 | |||
| 30 | protected: | ||
| 31 | double CumulativeAt(double diameter) const override; | ||
| 32 | double IncrementalAt(double diameter) const override; | ||
| 33 | |||
| 34 | private: | ||
| 35 | const SizeFrequencyDistribution& LowestAt(double diameter) const; | ||
| 36 | |||
| 37 | std::vector<std::shared_ptr<const SizeFrequencyDistribution>> distributions_; | ||
| 38 | }; | ||
| 39 | |||
| 40 | } // namespace terraingen | ||
| 41 |