./
Coverage:
low: ≥ 0%
medium: ≥ 75.0%
high: ≥ 90.0%
Lines:
480 / 501
95.8%
Branches:
5 / 7
71.4%
Functions:
30 / 32
93.8%

include/terraingen/layers/dunes_fields.h
Line Branch Exec Source
1 // SPDX-License-Identifier: BSD-3-Clause
2
3 /// @file
4 /// @brief The field lists of dunes, their ripples and grainflows, and the names of dune shapes.
5 #pragma once
6
7 #include "terraingen/layers/dunes.h"
8 #include "terraingen/layers/layer_fields.h"
9 #include "terraingen/util/option_fields.h"
10
11 #include <array>
12
13 namespace terraingen {
14
15 template <> struct EnumNames<DuneShape> {
16 static constexpr std::array<EnumEntry<DuneShape>, 5> kValues{{
17 {"barchan", DuneShape::Barchan,
18 "Isolated crescents with a slip face and horns downwind; domes below min_width_m."},
19 {"dome", DuneShape::Dome, "Isolated rounded heaps without a slip face."},
20 {"transverse", DuneShape::Transverse,
21 "Continuous crests across the wind, each with a slip face."},
22 {"barchanoid", DuneShape::Barchanoid,
23 "Transverse crests bent into linked crescents, as where sand supply rises."},
24 {"linear", DuneShape::Linear,
25 "Symmetric crests along the wind, as under two winds on scarce sand."},
26 }};
27 };
28
29 95 template <typename IO> void Fields(IO& io, DuneRipples& ripples) {
30 95 io("wavelength_m", ripples.wavelength,
31 95 "Crest-to-crest spacing of the ripples on flat sand, in meters.", "m", Above(0.0));
32 93 io("height_m", ripples.height, "Trough-to-crest height of the ripples on flat sand, in meters.",
33 93 "m", AtLeast(0.0));
34 93 io("lee_fraction", ripples.leeFraction,
35 "Share of a ripple wavelength the lee face takes: 0.5 is symmetric, lower values give a "
36 "steeper lee face.",
37 93 "", Inside(0.0, 1.0));
38 92 io("sinuosity", ripples.sinuosity,
39 92 "How far a ripple crest wanders along its length, in wavelengths.", "", AtLeast(0.0));
40 92 io("slope_coupling", ripples.slopeCoupling,
41 "How strongly the dune's slope turns and tightens the ripples: they shorten on steep lee "
42 "faces and turn on the flanks; 0 keeps them straight across the wind.",
43 92 "", AtLeast(0.0));
44 92 io("interdune_cover", ripples.interduneCover,
45 92 "Share of the ripple height kept on the ground between dunes.", "", UnitInterval());
46 91 io("defect_density", ripples.defectDensity,
47 "Forked crests (Y-junctions): pairs of crest ends per meter of crest, as measured on dune "
48 "fields (Ewing et al. 2010); 0 for none. Mars large ripples: 0.099.",
49 91 "1/m", AtLeast(0.0));
50 90 io("flank_straightening", ripples.flankStraightening,
51 "How far crests straighten off the stoss: 1 keeps the sinuosity on flat sand and stoss "
52 "slopes and takes it away on flanks and lee slopes, as Martian large ripples do.",
53 90 "", UnitInterval());
54 178 FadePixelFields(
55 89 io, ripples.fade,
56 "How ripples too fine for the sample spacing fade out, by samples per wavelength.");
57 89 }
58
59 58 template <typename IO> void Fields(IO& io, DuneGrainflows& flows) {
60 58 io("cover", flows.cover, "Chance that each lattice cell of the slip faces holds a grainflow.",
61 58 "", UnitInterval());
62 56 io("min_scarp_width_m", flows.minScarpWidth, "Narrowest scarp, in meters.", "m", Above(0.0));
63 55 io("max_scarp_width_m", flows.maxScarpWidth, "Widest scarp, in meters.", "m", Above(0.0));
64 55 io("min_scarp_length_m", flows.minScarpLength, "Shortest scarp downslope, in meters.", "m",
65 55 Above(0.0));
66 55 io("max_scarp_length_m", flows.maxScarpLength, "Longest scarp downslope, in meters.", "m",
67 55 Above(0.0));
68 55 io("min_lobe_width_m", flows.minLobeWidth, "Narrowest lobe, in meters.", "m", Above(0.0));
69 55 io("max_lobe_width_m", flows.maxLobeWidth, "Widest lobe, in meters.", "m", Above(0.0));
70 55 io("min_lobe_length_m", flows.minLobeLength, "Shortest lobe downslope, in meters.", "m",
71 55 Above(0.0));
72 55 io("max_lobe_length_m", flows.maxLobeLength, "Longest lobe downslope, in meters.", "m",
73 55 Above(0.0));
74 55 io("thickness_m", flows.thickness, "Depth of a scarp and height of a lobe, in meters.", "m",
75 55 AtLeast(0.0));
76 108 FadePixelFields(
77 54 io, flows.fade,
78 "How grainflows too narrow for the sample spacing fade out, by samples across a lobe.");
79 54 }
80
81 /// The fields of every dune's shape and the wind that shapes it.
82 189 template <typename IO> void DuneProfileFields(IO& io, DuneOptions& dunes) {
83 189 io("shape", dunes.shape, "The kind of dune.");
84
5/5
void terraingen::DuneProfileFields<terraingen::RangeChecker>(terraingen::RangeChecker&, terraingen::DuneOptions&):
✓ Branch 2 taken 92 times.
void terraingen::DuneProfileFields<terraingen::config::(anonymous namespace)::SchemaWriter>(terraingen::config::(anonymous namespace)::SchemaWriter&, terraingen::DuneOptions&):
✓ Branch 2 taken 13 times.
void terraingen::DuneProfileFields<terraingen::config::Reader>(terraingen::config::Reader&, terraingen::DuneOptions&):
✓ Branch 2 taken 26 times.
void terraingen::DuneProfileFields<terraingen::config::Writer>(terraingen::config::Writer&, terraingen::DuneOptions&):
✓ Branch 2 taken 54 times.
void terraingen::DuneProfileFields<terraingen::python::OptionsBinder<terraingen::DuneOptions> >(terraingen::python::OptionsBinder<terraingen::DuneOptions>&, terraingen::DuneOptions&):
✓ Branch 2 taken 3 times.
188 io("wind_azimuth_deg", dunes.windAzimuthDegrees, WindAzimuthHelp("wind", "slip faces face it"),
85 "deg");
86 188 io("azimuth_spread_deg", dunes.azimuthSpreadDegrees,
87 "Largest difference of each barchan or dome's wind from the azimuth, in degrees.", "deg",
88 188 AtLeast(0.0));
89 188 io("slip_face_angle_deg", dunes.slipFaceAngleDegrees,
90 "Slope of the lee slip faces, in degrees: the sand's angle of repose.", "deg",
91 188 Inside(0.0, 90.0));
92 185 io("stoss_slope_deg", dunes.stossSlopeDegrees,
93 "Mean slope of the windward faces, in degrees; below the slip face angle.", "deg",
94 185 Inside(0.0, 90.0));
95 185 io("stoss_exponent", dunes.stossExponent,
96 "Exponent alpha of the cos^alpha windward profile of dunes; higher is blunter.", "",
97 185 Above(0.0));
98 185 io("dome_exponent", dunes.domeExponent, "Exponent alpha of the cos^alpha profile of domes.", "",
99 185 Above(0.0));
100 185 }
101
102 /// The fields of isolated barchans and domes, one per lattice cell at most.
103 185 template <typename IO> void DuneLatticeFields(IO& io, DuneOptions& dunes) {
104 185 io("lattice_spacing_m", dunes.latticeSpacing,
105 "Barchans and domes: side of the lattice cells, each holding at most one dune, in meters.",
106 185 "m", Above(0.0));
107 184 io("density", dunes.density, "Barchans and domes: chance a cell holds a dune.", "",
108 184 UnitInterval());
109 183 io("width_m", dunes.width, "Barchans and domes: mean width, horn to horn, in meters.", "m",
110 183 Above(0.0));
111 182 io("width_spread", dunes.widthSpread,
112 "Barchans and domes: each width varies from (1 - spread) to (1 + spread) times the mean.",
113 182 "", FromBelow(0.0, 1.0));
114 181 io("min_width_m", dunes.minWidth,
115 "Barchans: width in meters below which a dune is a dome without a slip face, blending "
116 "into barchans up to 1.5 times it.",
117 181 "m", AtLeast(0.0));
118 181 io("height_ratio", dunes.heightRatio, "Barchans and domes: height over width.", "", Above(0.0));
119 181 io("horn_length", dunes.hornLength,
120 "Barchans: how far the horns reach downwind of the crest, in dune heights.", "",
121 181 AtLeast(0.0));
122 181 io("dome_length", dunes.domeLength, "Domes: length along the wind over width.", "", Above(0.0));
123 181 }
124
125 /// The fields of fields of transverse, barchanoid and linear crests.
126 181 template <typename IO> void DuneCrestFields(IO& io, DuneOptions& dunes) {
127 181 io("wavelength_m", dunes.wavelength,
128 "Transverse, barchanoid and linear dunes: crest-to-crest spacing, in meters.", "m",
129 181 Above(0.0));
130 181 io("height_m", dunes.height,
131 181 "Transverse, barchanoid and linear dunes: crest height, in meters.", "m", AtLeast(0.0));
132 181 io("sinuosity", dunes.sinuosity,
133 "Transverse, barchanoid and linear dunes: how far a crest wanders along its length, in "
134 "wavelengths.",
135 181 "", AtLeast(0.0));
136 180 io("defects", dunes.defects,
137 "Transverse, barchanoid and linear dunes: share of the height that varies along crests, "
138 "lowering and ending some.",
139 180 "", UnitInterval());
140 179 io("defect_density", dunes.defectDensity,
141 "Transverse, barchanoid and linear dunes: pairs of crest ends per meter of crest, so crests "
142 "break into segments about 1 / defect_density long; 0 for none. Olympia Undae: 0.0027 "
143 "(Ewing et al. 2010).",
144 179 "1/m", AtLeast(0.0));
145 178 io("flank_slope_deg", dunes.flankSlopeDegrees,
146 178 "Linear dunes: mean slope of both flanks, in degrees.", "deg", Inside(0.0, 90.0));
147 178 }
148
149 189 template <typename IO> void Fields(IO& io, DuneOptions& dunes) {
150 189 DuneProfileFields(io, dunes);
151 185 DuneLatticeFields(io, dunes);
152 181 DuneCrestFields(io, dunes);
153
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
178 io("seed", dunes.seed,
154 "Seed of the dunes and ripples; changing it gives a different layout of the same "
155 "statistics.");
156 178 AnchorFields(io, dunes.anchor,
157 "the dunes are laid out in; they are true to scale near it and absent on the far "
158 "hemisphere");
159 354 FadePixelFields(
160 177 io, dunes.fade,
161 "How dunes too fine for the sample spacing fade out, by samples across their width or "
162 "wavelength.");
163 177 io("ripples", dunes.ripples, "Ripples superposed on the dunes; unset for none.");
164 171 io("grainflows", dunes.grainflows,
165 "Grainflows on the slip faces: scarps below the brink and lobes below them; unset for "
166 "none.");
167 167 SourceResolvesField(io, dunes.sourceResolvesPixels, "dunes, their ripples and grainflows",
168 "width or crest wavelength, ripple wavelength and narrowest lobe");
169 165 }
170
171 } // namespace terraingen
172