./
Coverage:
low: ≥ 0%
medium: ≥ 75.0%
high: ≥ 90.0%
Lines:
1 / 1
100.0%
Branches:
6 / 16
37.5%
Functions:
-
-%

include/terraingen/distribution/golombek_rapp.h
Line Branch Exec Source
1 // SPDX-License-Identifier: BSD-3-Clause
2
3 /// @file
4 /// @brief Boulder sizes after Golombek and Rapp (1997), from the fraction of ground boulders cover.
5 #pragma once
6
7 #include "terraingen/distribution/size_frequency.h"
8
9 namespace terraingen {
10
11 /// Boulder densities whose cumulative fractional area is F(D) = k exp(-q D), with q = `qa` +
12 /// `qb` / k per meter and k the fraction of ground the boulders cover (`coverage`); N(>=D) =
13 /// (4 k q / pi) E2(q D) / D per m^2.
14
6/16
✗ Branch 0 not taken.
✗ Branch 0 not taken.
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 1 taken 6 times.
✓ Branch 1 taken 1 time.
✓ Branch 2 taken 1 time.
✗ Branch 2 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 3 taken 2 times.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 5 taken 2 times.
91553 class GolombekRappSfd final : public SizeFrequencyDistribution {
15 public:
16 /// The distribution for coverage k.
17 /// @param coverage k, the fractional area covered by boulders, in (0, 1).
18 /// @param qa The constant part of q, per meter; finite and not negative.
19 /// @param qb The part of q that scales with 1 / k, per meter; finite and not negative.
20 /// @throws std::invalid_argument for a parameter outside its range, a zero q or a bad range.
21 explicit GolombekRappSfd(double coverage, double qa = 1.79, double qb = 0.152,
22 DiameterRange range = {});
23
24 /// F(D) = k exp(-q D), the fractional area covered by boulders at least `diameter` meters
25 /// across.
26 double FractionalArea(double diameter) const;
27
28 protected:
29 double CumulativeAt(double diameter) const override;
30 double IncrementalAt(double diameter) const override;
31
32 private:
33 double m_coverage;
34 double m_q;
35 };
36
37 /// The Golombek-Rapp density -dN/dD per m^2 per meter of diameter at `diameter` meters, for
38 /// coverage k and q = qa + qb / k per meter.
39 double GolombekRappIncremental(double diameter, double coverage, double q);
40
41 } // namespace terraingen
42