SWMMVis  6.0.0-alpha.4
Qt6/C++ GIS-based graphical user interface for the SWMMVis engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
heatproperties.h
Go to the documentation of this file.
1
10#pragma once
11#include <QCoreApplication>
12#include <QString>
13#include <array>
14#include <cmath>
15#include <limits>
16
17namespace OpenSWMMVis
18{
19// Attribute ordinals follow SWMM_HeatAttr. Shared by the table, import mapping
20// and raster assignment so units and the refuse-not-clamp ranges agree.
22 const char *key;
23 const char *label;
24 double minimum;
25 double maximum;
26};
31inline const std::array<HeatProperty, 16> &heatProperties()
32{
33 static const std::array<HeatProperty, 16> fields = {
34 {{"albedo", "Water albedo", 0, 1},
35 {"shade", "Shade factor", 0, 1},
36 {"sky_view", "Sky view", 0, 1},
37 {"emiss_water", "Water emissivity", 0, 1},
38 {"emiss_landcover", "Land-cover emissivity", 0, 1},
39 {"landcover_temperature", "Land-cover temperature (°C)",
40 -std::numeric_limits<double>::max(), std::numeric_limits<double>::max()},
41 {"thermal_diffusivity", "Bed thermal diffusivity (m²/s)",
42 std::numeric_limits<double>::denorm_min(), std::numeric_limits<double>::max()},
43 {"solute_diffusivity", "Bed solute diffusivity (m²/s)", 0,
44 std::numeric_limits<double>::max()},
45 {"bed_thickness", "Bed thickness (m)", std::numeric_limits<double>::denorm_min(),
46 std::numeric_limits<double>::max()},
47 {"ground_depth", "Deep-ground depth (m)", std::numeric_limits<double>::denorm_min(),
48 std::numeric_limits<double>::max()},
49 {"ground_temperature", "Ground temperature (°C)", -std::numeric_limits<double>::max(),
50 std::numeric_limits<double>::max()},
51 {"hyporheic_velocity", "Hyporheic velocity (m/s)", 0, std::numeric_limits<double>::max()},
52 {"sediment_density", "Sediment density (kg/m³)", std::numeric_limits<double>::denorm_min(),
53 std::numeric_limits<double>::max()},
54 {"sediment_specific_heat", "Sediment specific heat (J/kg/K)",
55 std::numeric_limits<double>::denorm_min(), std::numeric_limits<double>::max()},
56 {"mesh_porosity", "Mesh-bed porosity (0–1)", 0, 1},
57 {"ground_source", "Ground heat source mode (0 prescribed, 1 mesh contacts)", 0, 1}}};
58 return fields;
59}
65inline QString heatPropertyLabel(int attr)
66{
67 return QCoreApplication::translate("HeatCfg", heatProperties().at(attr).label);
68}
74inline int heatPropertyIndex(const QString &key)
75{
76 for (int i = 0; i < int(heatProperties().size()); ++i)
77 if (key == QStringLiteral("heat.") + QLatin1String(heatProperties()[i].key))
78 return i;
79 return -1;
80}
87inline bool heatPropertyValueValid(int attr, double value)
88{
89 return attr >= 0 && attr < int(heatProperties().size()) && std::isfinite(value) &&
90 value >= heatProperties()[attr].minimum && value <= heatProperties()[attr].maximum &&
91 (attr != 15 || (value == 0.0 || value == 1.0));
92}
93}
size_t i
Definition contourjob.cpp:30
QMap< int, QVector< OpenSWMM::Render::AttributeField > > fields
Local keys, grouped by category.
Definition extensionattributes.cpp:35
const char * label
Human label for the filter entry.
Definition gdaldrivers.cpp:28
Definition heatassignment.h:15
bool heatPropertyValueValid(int attr, double value)
Apply shared refuse-instead-of-clamp validation for thermal overrides.
Definition heatproperties.h:87
QString heatPropertyLabel(int attr)
Translate a thermal property's shared field caption.
Definition heatproperties.h:65
int heatPropertyIndex(const QString &key)
Resolve an exact attribute-column key to a thermal ordinal.
Definition heatproperties.h:74
const std::array< HeatProperty, 16 > & heatProperties()
Access the shared sixteen thermal override definitions in SWMM_HeatAttr ordinal order.
Definition heatproperties.h:31
int at
Definition constraintaudit.cpp:156
double value
Definition rasterfluxintegration.cpp:27
Definition heatproperties.h:21
const char * key
Definition heatproperties.h:22
double maximum
Definition heatproperties.h:25
double minimum
Definition heatproperties.h:24
const char * label
Definition heatproperties.h:23