OpenSWMM Engine  6.0.0-alpha.3
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.3)
Loading...
Searching...
No Matches
XSectBatch.hpp
Go to the documentation of this file.
1
33
34#ifndef OPENSWMM_XSECT_BATCH_HPP
35#define OPENSWMM_XSECT_BATCH_HPP
36
37#ifndef OPENSWMM_RESTRICT
38# if defined(_MSC_VER)
39# define OPENSWMM_RESTRICT __restrict
40# else
41# define OPENSWMM_RESTRICT __restrict__
42# endif
43#endif
44
45#include <vector>
46#include <cstddef>
47#include <cstdint>
48#include <cmath>
49
50namespace openswmm {
51
52// Forward declaration
53struct SimulationContext;
54
55// ============================================================================
56// Cross-section shape codes (matches legacy enums.h XsectType)
57// ============================================================================
58
87
88// ============================================================================
89// Cross-section parameter struct (mirrors legacy TXsect)
90// ============================================================================
91
93 int type = 0;
94 int culvert_code = 0;
95 int transect = -1;
96
97 double y_full = 0.0;
98 double w_max = 0.0;
99 double yw_max = 0.0;
100 double a_full = 0.0;
101 double r_full = 0.0;
102 double s_full = 0.0;
103 double s_max = 0.0;
104
105 double y_bot = 0.0;
106 double a_bot = 0.0;
107 double s_bot = 0.0;
108 double r_bot = 0.0;
109
110 // Tabulated geometry for IRREGULAR / CUSTOM / STREET_XSECT shapes, whose
111 // A/R/W vs depth come from a per-link transect table rather than a shared
112 // static table. These point into ctx.transect_tables (stable for the run)
113 // and stay null for every self-contained shape. Without them the
114 // context-free per-element accessors return 0 for irregular sections (so
115 // e.g. init-time getDepthFromFlow could not compute normal depth/storage).
116 const double* area_tbl = nullptr;
117 const double* hrad_tbl = nullptr;
118 const double* width_tbl = nullptr;
120};
121
122// ============================================================================
123// Per-element functions (xsect:: namespace)
124// ============================================================================
125
126namespace xsect {
127
128double getAofY(const XSectParams& xs, double y);
129double getRofY(const XSectParams& xs, double y);
130double getWofY(const XSectParams& xs, double y);
131double getYofA(const XSectParams& xs, double a);
132double getSofA(const XSectParams& xs, double a);
133double getRofA(const XSectParams& xs, double a);
134double getdSdA(const XSectParams& xs, double a);
135double getAofS(const XSectParams& xs, double s_factor);
136double getAmax(const XSectParams& xs);
137double getYcrit(const XSectParams& xs, double q);
138bool isOpen(int type);
139int setParams(XSectParams& xs, int type, const double p[], double ucf);
140
141// Lookup table helpers (exposed for batch kernels and testing)
142double lookup(double x, const double* table, int n_items);
143double invLookup(double y, const double* table, int n_items);
144int locate(double y, const double* table, int n);
145double getYcircular(double alpha);
146double getScircular(double alpha);
147
148} // namespace xsect
149
150// ============================================================================
151// Shape group — contiguous SoA for all links sharing one shape type
152// ============================================================================
153
166 int count = 0;
167
168 // Mapping back to global link arrays
169 std::vector<int> link_idx;
170
171 // Geometry parameters (contiguous, aligned for SIMD)
172 std::vector<double> y_full;
173 std::vector<double> a_full;
174 std::vector<double> r_full;
175 std::vector<double> s_full;
176 std::vector<double> w_max;
177
178 // Pre-computed reciprocal of y_full (avoids per-element division in kernels)
179 std::vector<double> inv_y_full;
180
181 // Multi-purpose parameters (meaning depends on shape)
182 std::vector<double> y_bot;
183 std::vector<double> a_bot;
184 std::vector<double> s_bot;
185 std::vector<double> r_bot;
186
187 // Per-link transect table pointers (IRREGULAR shapes only)
188 // Each pointer → a normalized table of N_TRANSECT_TBL entries.
189 std::vector<const double*> area_tables;
190 std::vector<const double*> hrad_tables;
191 std::vector<const double*> width_tables;
193
194 // Pre-allocated working buffers (avoids per-call allocation in hot loop)
195 mutable std::vector<double> buf_d;
196 mutable std::vector<double> buf_r;
197 mutable std::vector<double> buf_r2;
198
200 void resize(int n);
201};
202
203// ============================================================================
204// XSectGroups — the shape-grouped index over all links
205// ============================================================================
206
220public:
230 void build(const SimulationContext& ctx);
231
242
251 void build(const XSectParams* params, int n_links);
252
253 // ========================================================================
254 // Batch compute — results scattered to global link arrays
255 // ========================================================================
256
264 void computeAreas(const double* depths, double* areas, int n_links) const;
265
273 void computeHydRad(const double* depths, double* hydrad, int n_links) const;
274
282 void computeWidths(const double* depths, double* widths, int n_links) const;
283
292 void computeAreaAndHydRad(const double* depths, double* areas,
293 double* hydrad, int n_links) const;
294
301 const double* d1, const double* d2, const double* dm,
302 double* a1, double* a2, double* am,
303 double* hrad1, double* hrad_mid, int n_links) const;
304
309 const double* d1, const double* d2, const double* dm,
310 double* w1, double* w2, double* wm, int n_links) const;
311
328 const double* d1, const double* d2, const double* dm,
329 double* a1, double* a2, double* am,
330 double* hrad1, double* hrad_mid, int n_links,
331 int tid, int nthreads) const;
332
334 const double* d1, const double* d2, const double* dm,
335 double* w1, double* w2, double* wm, int n_links,
336 int tid, int nthreads) const;
337
364 void setBypassMask(const std::uint8_t* bypassed_by_link) const;
365
373 void computeSectionFactors(const double* areas, double* sfact, int n_links) const;
374
382 void computeDepthsFromArea(const double* areas, double* depths, int n_links) const;
383
384 // ========================================================================
385 // Accessors
386 // ========================================================================
387
389 int numGroups() const { return static_cast<int>(groups_.size()); }
390
392 const ShapeGroup& group(int i) const { return groups_[i]; }
393
395 const ShapeGroup* findGroup(XSectShape shape) const;
396
397private:
398 std::vector<ShapeGroup> groups_;
399
400 // Per-iteration bypass-mask state (see setBypassMask). packed_groups_[gi]
401 // is a packed view of groups_[gi] holding only the active links; it reuses
402 // the ShapeGroup layout so the gather/kernel/scatter path runs unchanged.
403 // packed_count_[gi]: kMaskFullGroup → no link in the group is bypassed
404 // (use the original group directly, no packing was done); 0..count →
405 // number of active links in the packed view. All mutable because the
406 // mask is per-Picard-iteration scratch while the compute API is const.
407 static constexpr int kMaskFullGroup = -1;
408 mutable std::vector<ShapeGroup> packed_groups_;
409 mutable std::vector<int> packed_count_;
410 mutable bool mask_active_ = false;
411
413 const ShapeGroup* maskedGroup(std::size_t gi) const {
414 const ShapeGroup* gp = &groups_[gi];
415 if (mask_active_) {
416 const int na = packed_count_[gi];
417 if (na == 0) return nullptr;
418 if (na != kMaskFullGroup) gp = &packed_groups_[gi];
419 }
420 return gp;
421 }
422};
423
424// ============================================================================
425// Shape-specific batch kernels (called by XSectGroups, also usable directly)
426// ============================================================================
427
428namespace xsect_batch {
429
437void area_circular(
438 const double* OPENSWMM_RESTRICT depth,
439 const double* OPENSWMM_RESTRICT y_full,
440 const double* OPENSWMM_RESTRICT a_full,
441 double* OPENSWMM_RESTRICT area,
442 int count
443);
444
446void area_rect(
447 const double* OPENSWMM_RESTRICT depth,
448 const double* OPENSWMM_RESTRICT w_max,
449 double* OPENSWMM_RESTRICT area,
450 int count
451);
452
455 const double* OPENSWMM_RESTRICT depth,
456 const double* OPENSWMM_RESTRICT y_bot,
457 const double* OPENSWMM_RESTRICT s_bot,
458 double* OPENSWMM_RESTRICT area,
459 int count
460);
461
463void area_triangular(
464 const double* OPENSWMM_RESTRICT depth,
465 const double* OPENSWMM_RESTRICT s_bot,
466 double* OPENSWMM_RESTRICT area,
467 int count
468);
469
471void area_parabolic(
472 const double* OPENSWMM_RESTRICT depth,
473 const double* OPENSWMM_RESTRICT r_bot,
474 double* OPENSWMM_RESTRICT area,
475 int count
476);
477
479void area_powerfunc(
480 const double* OPENSWMM_RESTRICT depth,
481 const double* OPENSWMM_RESTRICT s_bot,
482 const double* OPENSWMM_RESTRICT r_bot,
483 double* OPENSWMM_RESTRICT area,
484 int count
485);
486
488void area_tabulated(
489 const double* OPENSWMM_RESTRICT depth,
490 const double* OPENSWMM_RESTRICT y_full,
491 const double* OPENSWMM_RESTRICT a_full,
492 const double* table,
493 int table_size,
494 double* OPENSWMM_RESTRICT area,
495 int count
496);
497
500 const double* OPENSWMM_RESTRICT depth,
501 const double* OPENSWMM_RESTRICT y_full,
502 const double* OPENSWMM_RESTRICT a_full,
503 const double* table,
504 int table_size,
505 double* OPENSWMM_RESTRICT area,
506 int count
507);
508
509// --- Hydraulic radius batch kernels ---
510
511void hydrad_circular(
512 const double* OPENSWMM_RESTRICT depth,
513 const double* OPENSWMM_RESTRICT y_full,
514 const double* OPENSWMM_RESTRICT r_full,
515 double* OPENSWMM_RESTRICT hydrad,
516 int count
517);
518
521 const double* OPENSWMM_RESTRICT depth,
522 const double* OPENSWMM_RESTRICT y_full,
523 const double* OPENSWMM_RESTRICT a_full,
524 const double* OPENSWMM_RESTRICT r_full,
525 double* OPENSWMM_RESTRICT area,
526 double* OPENSWMM_RESTRICT hydrad,
527 int count
528);
529
531 const double* OPENSWMM_RESTRICT depth,
532 const double* OPENSWMM_RESTRICT y_bot,
533 const double* OPENSWMM_RESTRICT s_bot,
534 const double* OPENSWMM_RESTRICT r_bot,
535 double* OPENSWMM_RESTRICT hydrad,
536 int count
537);
538
540 const double* OPENSWMM_RESTRICT depth,
541 const double* OPENSWMM_RESTRICT s_bot,
542 const double* OPENSWMM_RESTRICT r_bot,
543 double* OPENSWMM_RESTRICT hydrad,
544 int count
545);
546
547void hydrad_rect(
548 const double* OPENSWMM_RESTRICT depth,
549 const double* OPENSWMM_RESTRICT w_max,
550 double* OPENSWMM_RESTRICT hydrad,
551 int count
552);
553
555 const double* OPENSWMM_RESTRICT depth,
556 const double* OPENSWMM_RESTRICT y_full,
557 const double* OPENSWMM_RESTRICT r_full,
558 const double* table,
559 int table_size,
560 double* OPENSWMM_RESTRICT hydrad,
561 int count
562);
563
564// --- Top width batch kernels ---
565
566void width_circular(
567 const double* OPENSWMM_RESTRICT depth,
568 const double* OPENSWMM_RESTRICT y_full,
569 const double* OPENSWMM_RESTRICT w_max,
570 double* OPENSWMM_RESTRICT width,
571 int count
572);
573
575 const double* OPENSWMM_RESTRICT depth,
576 const double* OPENSWMM_RESTRICT y_bot,
577 const double* OPENSWMM_RESTRICT s_bot,
578 double* OPENSWMM_RESTRICT width,
579 int count
580);
581
583 const double* OPENSWMM_RESTRICT depth,
584 const double* OPENSWMM_RESTRICT s_bot,
585 double* OPENSWMM_RESTRICT width,
586 int count
587);
588
589void width_rect(
590 const double* OPENSWMM_RESTRICT w_max,
591 double* OPENSWMM_RESTRICT width,
592 int count
593);
594
595void width_tabulated(
596 const double* OPENSWMM_RESTRICT depth,
597 const double* OPENSWMM_RESTRICT y_full,
598 const double* OPENSWMM_RESTRICT w_max,
599 const double* table,
600 int table_size,
601 double* OPENSWMM_RESTRICT width,
602 int count
603);
604
605} // namespace xsect_batch
606
607} // namespace openswmm
608
609#endif // OPENSWMM_XSECT_BATCH_HPP
#define OPENSWMM_RESTRICT
Definition XSectBatch.hpp:41
Shape-grouped cross-section manager for batch computation.
Definition XSectBatch.hpp:219
void computeAreas(const double *depths, double *areas, int n_links) const
Compute area for every link, reading depth from depths[link].
Definition XSectBatch.cpp:1005
void computeWidths(const double *depths, double *widths, int n_links) const
Compute top width for every link.
Definition XSectBatch.cpp:1057
void setBypassMask(const std::uint8_t *bypassed_by_link) const
Restrict the triple kernels to non-bypassed links for the current Picard iteration.
Definition XSectBatch.cpp:1148
void computeAreaHydRadTripleTeam(const double *d1, const double *d2, const double *dm, double *a1, double *a2, double *am, double *hrad1, double *hrad_mid, int n_links, int tid, int nthreads) const
Team-callable triple kernels: thread tid of nthreads processes only its static slice of every shape g...
Definition XSectBatch.cpp:1092
void computeAreaAndHydRad(const double *depths, double *areas, double *hydrad, int n_links) const
Fused area + hydraulic radius computation (single gather/scatter).
Definition XSectBatch.cpp:1035
void build(const SimulationContext &ctx)
Build shape groups from SimulationContext link data.
void computeAreaHydRadTriple(const double *d1, const double *d2, const double *dm, double *a1, double *a2, double *am, double *hrad1, double *hrad_mid, int n_links) const
Fused triple: d1→(a1,hrad1), d2→a2, dm→(am,hrad_mid) in one pass over shape groups....
Definition XSectBatch.cpp:1132
void computeWidthsTriple(const double *d1, const double *d2, const double *dm, double *w1, double *w2, double *wm, int n_links) const
Fused triple: d1→w1, d2→w2, dm→wm in one pass over shape groups.
Definition XSectBatch.cpp:1247
const ShapeGroup & group(int i) const
Access a specific shape group.
Definition XSectBatch.hpp:392
void computeWidthsTripleTeam(const double *d1, const double *d2, const double *dm, double *w1, double *w2, double *wm, int n_links, int tid, int nthreads) const
Definition XSectBatch.cpp:1217
void computeDepthsFromArea(const double *areas, double *depths, int n_links) const
Compute depth from area for every link (inverse).
Definition XSectBatch.cpp:1271
void computeHydRad(const double *depths, double *hydrad, int n_links) const
Compute hydraulic radius for every link.
Definition XSectBatch.cpp:1020
void computeSectionFactors(const double *areas, double *sfact, int n_links) const
Compute section factor for every link (from area, not depth).
Definition XSectBatch.cpp:1259
void attachTransectTables(const SimulationContext &ctx)
Attach transect tables to the IRREGULAR shape group.
Definition XSectBatch.cpp:135
int numGroups() const
Number of non-empty shape groups.
Definition XSectBatch.hpp:389
const ShapeGroup * findGroup(XSectShape shape) const
Find the group for a given shape (returns nullptr if no links have that shape).
Definition XSectBatch.cpp:173
Definition UnitConversion.cpp:15
Definition XSectBatch.cpp:184
void area_trapezoidal(const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT y_bot, const double *OPENSWMM_RESTRICT s_bot, double *OPENSWMM_RESTRICT area, int count)
Batch area for TRAPEZOIDAL: area = (y_bot + s_bot * depth) * depth.
Definition XSectBatch.cpp:222
void width_rect(const double *OPENSWMM_RESTRICT w_max, double *OPENSWMM_RESTRICT width, int count)
Definition XSectBatch.cpp:622
void hydrad_triangular(const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT s_bot, const double *OPENSWMM_RESTRICT r_bot, double *OPENSWMM_RESTRICT hydrad, int count)
Definition XSectBatch.cpp:469
void hydrad_trapezoidal(const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT y_bot, const double *OPENSWMM_RESTRICT s_bot, const double *OPENSWMM_RESTRICT r_bot, double *OPENSWMM_RESTRICT hydrad, int count)
Definition XSectBatch.cpp:450
void width_triangular(const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT s_bot, double *OPENSWMM_RESTRICT width, int count)
Definition XSectBatch.cpp:609
void hydrad_rect(const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT w_max, double *OPENSWMM_RESTRICT hydrad, int count)
Definition XSectBatch.cpp:483
void width_tabulated(const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT nrm, const double *OPENSWMM_RESTRICT w_max, const double *table, int table_size, double *OPENSWMM_RESTRICT width, int count)
Definition XSectBatch.cpp:632
void hydrad_circular(const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT nrm, const double *OPENSWMM_RESTRICT r_full, double *OPENSWMM_RESTRICT hydrad, int count)
Definition XSectBatch.cpp:332
void area_inv_tabulated(const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT nrm, const double *OPENSWMM_RESTRICT a_full, const double *table, int table_size, double *OPENSWMM_RESTRICT area, int count)
Batch area for shapes using invLookup (gothic, catenary, semielliptical, semicircular).
Definition XSectBatch.cpp:295
void area_powerfunc(const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT s_bot, const double *OPENSWMM_RESTRICT r_bot, double *OPENSWMM_RESTRICT area, int count)
Batch area for POWERFUNC: area = r_bot * depth^(s_bot+1).
Definition XSectBatch.cpp:266
void area_circular(const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT nrm, const double *OPENSWMM_RESTRICT a_full, double *OPENSWMM_RESTRICT area, int count)
Batch area for CIRCULAR/FORCE_MAIN — lookup table interpolation.
Definition XSectBatch.cpp:195
void area_rect(const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT w_max, double *OPENSWMM_RESTRICT area, int count)
Batch area for RECT_CLOSED / RECT_OPEN: area = depth * w_max.
Definition XSectBatch.cpp:212
void hydrad_tabulated(const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT nrm, const double *OPENSWMM_RESTRICT r_full, const double *table, int table_size, double *OPENSWMM_RESTRICT hydrad, int count)
Definition XSectBatch.cpp:560
void width_trapezoidal(const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT y_bot, const double *OPENSWMM_RESTRICT s_bot, double *OPENSWMM_RESTRICT width, int count)
Definition XSectBatch.cpp:595
void area_tabulated(const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT nrm, const double *OPENSWMM_RESTRICT a_full, const double *table, int table_size, double *OPENSWMM_RESTRICT area, int count)
Batch area for any tabulated shape (egg, horseshoe, arch, ellipse, etc.).
Definition XSectBatch.cpp:279
void width_circular(const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT nrm, const double *OPENSWMM_RESTRICT w_max, double *OPENSWMM_RESTRICT width, int count)
Definition XSectBatch.cpp:579
void area_hydrad_circular(const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT nrm, const double *OPENSWMM_RESTRICT a_full, const double *OPENSWMM_RESTRICT r_full, double *OPENSWMM_RESTRICT area, double *OPENSWMM_RESTRICT hydrad, int count)
Fused area + hydraulic radius for CIRCULAR/FORCE_MAIN (shared table index).
Definition XSectBatch.cpp:353
void area_triangular(const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT s_bot, double *OPENSWMM_RESTRICT area, int count)
Batch area for TRIANGULAR: area = s_bot * depth^2.
Definition XSectBatch.cpp:237
void area_parabolic(const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT r_bot, double *OPENSWMM_RESTRICT area, int count)
Batch area for PARABOLIC: area = (4/3) * r_bot * depth^(3/2).
Definition XSectBatch.cpp:251
Definition XSectBatch.hpp:126
double getAmax(const XSectParams &xs)
Definition XSection.cpp:1125
double getdSdA(const XSectParams &xs, double a)
Definition XSection.cpp:1035
double lookup(double x, const double *table, int n_items)
Definition XSection.cpp:154
double invLookup(double y, const double *table, int n_items)
Definition XSection.cpp:178
double getYofA(const XSectParams &xs, double a)
Definition XSection.cpp:913
double getScircular(double alpha)
Definition XSection.cpp:257
double getWofY(const XSectParams &xs, double y)
Definition XSection.cpp:809
double getSofA(const XSectParams &xs, double a)
Definition XSection.cpp:965
double getRofY(const XSectParams &xs, double y)
Definition XSection.cpp:866
double getYcrit(const XSectParams &xs, double q)
Definition XSection.cpp:1135
int locate(double y, const double *table, int n)
Definition XSection.cpp:140
double getAofY(const XSectParams &xs, double y)
Definition XSection.cpp:752
double getAofS(const XSectParams &xs, double s_factor)
Definition XSection.cpp:1068
bool isOpen(int type)
Definition XSection.cpp:1228
int setParams(XSectParams &xs, int type, const double p[], double ucf)
Definition XSection.cpp:1253
double getRofA(const XSectParams &xs, double a)
Definition XSection.cpp:1002
double getYcircular(double alpha)
Definition XSection.cpp:245
Definition NodeCoupling.cpp:15
XSectShape
Definition XSectBatch.hpp:59
@ POWERFUNC
Definition XSectBatch.hpp:68
@ MOD_BASKET
Definition XSectBatch.hpp:71
@ DUMMY
Definition XSectBatch.hpp:60
@ TRIANGULAR
Definition LinkData.hpp:60
@ RECT_CLOSED
Definition LinkData.hpp:57
@ ARCH
Arch pipe.
Definition LinkData.hpp:75
@ FORCE_MAIN
Circular force main (Hazen-Williams or D-W)
Definition LinkData.hpp:78
@ RECT_OPEN
Definition LinkData.hpp:58
@ BASKETHANDLE
Definition LinkData.hpp:69
@ STREET_XSECT
Street cross-section.
Definition LinkData.hpp:79
@ SEMICIRCULAR
Definition LinkData.hpp:70
@ IRREGULAR
User-supplied shape curve.
Definition LinkData.hpp:76
@ HORIZ_ELLIPSE
Horizontal elliptical pipe.
Definition LinkData.hpp:73
@ VERT_ELLIPSE
Vertical elliptical pipe.
Definition LinkData.hpp:74
@ CUSTOM
Shape from CURVE_SHAPE table.
Definition LinkData.hpp:77
@ RECT_ROUND
Rectangular-round bottom.
Definition LinkData.hpp:72
@ EGGSHAPED
Definition LinkData.hpp:64
@ SEMIELLIPTICAL
Definition LinkData.hpp:68
@ CATENARY
Definition LinkData.hpp:67
@ CIRCULAR
Definition LinkData.hpp:55
@ TRAPEZOIDAL
Definition LinkData.hpp:59
@ HORSESHOE
Definition LinkData.hpp:65
@ DUMMY
Dummy (no geometry)
Definition LinkData.hpp:80
@ PARABOLIC
Definition LinkData.hpp:61
@ RECT_TRIANG
Rectangular-triangular bottom.
Definition LinkData.hpp:71
@ FILLED_CIRCULAR
Definition LinkData.hpp:56
@ GOTHIC
Definition LinkData.hpp:66
double * y
Definition odesolve.c:28
SoA parameter block for all links of one cross-section shape.
Definition XSectBatch.hpp:164
std::vector< double > r_full
Hyd. radius at full (ft)
Definition XSectBatch.hpp:174
std::vector< const double * > hrad_tables
Per-link hyd-rad table.
Definition XSectBatch.hpp:190
std::vector< double > w_max
Max width (ft)
Definition XSectBatch.hpp:176
std::vector< double > buf_r
Scatter buffer for results.
Definition XSectBatch.hpp:196
std::vector< double > buf_r2
Second scatter buffer (for fused ops)
Definition XSectBatch.hpp:197
std::vector< double > inv_y_full
1.0 / y_full (or 0 if y_full==0)
Definition XSectBatch.hpp:179
XSectShape shape
Definition XSectBatch.hpp:165
int transect_tbl_size
Table size (same for all)
Definition XSectBatch.hpp:192
std::vector< double > r_bot
Definition XSectBatch.hpp:185
std::vector< double > s_bot
Definition XSectBatch.hpp:184
std::vector< double > y_bot
Definition XSectBatch.hpp:182
void resize(int n)
Resize all arrays to n elements.
Definition XSectBatch.cpp:58
std::vector< const double * > area_tables
Per-link area table.
Definition XSectBatch.hpp:189
std::vector< const double * > width_tables
Per-link width table.
Definition XSectBatch.hpp:191
std::vector< int > link_idx
link_idx[i] = index in SimulationContext
Definition XSectBatch.hpp:169
std::vector< double > buf_d
Gather buffer for depths.
Definition XSectBatch.hpp:195
int count
Definition XSectBatch.hpp:166
std::vector< double > a_bot
Definition XSectBatch.hpp:183
std::vector< double > a_full
Full area (ft2)
Definition XSectBatch.hpp:173
std::vector< double > s_full
Section factor at full.
Definition XSectBatch.hpp:175
std::vector< double > y_full
Full depth (ft)
Definition XSectBatch.hpp:172
Central, reentrant simulation context.
Definition SimulationContext.hpp:292
Definition XSectBatch.hpp:92
double s_full
Section factor when full (ft^4/3)
Definition XSectBatch.hpp:102
double s_bot
Slope of bottom section / exponent.
Definition XSectBatch.hpp:107
int culvert_code
Definition XSectBatch.hpp:94
const double * hrad_tbl
Normalized hyd-radius vs y/y_full.
Definition XSectBatch.hpp:117
int transect
Definition XSectBatch.hpp:95
int transect_tbl_size
Entry count of the tables above.
Definition XSectBatch.hpp:119
const double * width_tbl
Normalized width vs y/y_full.
Definition XSectBatch.hpp:118
double a_full
Area when full (ft2)
Definition XSectBatch.hpp:100
double r_bot
Radius of bottom section / coefficient.
Definition XSectBatch.hpp:108
double s_max
Section factor at max flow (ft^4/3)
Definition XSectBatch.hpp:103
int type
Definition XSectBatch.hpp:93
double a_bot
Area of bottom section.
Definition XSectBatch.hpp:106
double w_max
Width at widest point (ft)
Definition XSectBatch.hpp:98
double yw_max
Depth at widest point (ft)
Definition XSectBatch.hpp:99
double y_bot
Depth of bottom section / fill depth.
Definition XSectBatch.hpp:105
double y_full
Full depth (ft)
Definition XSectBatch.hpp:97
double r_full
Hydraulic radius when full (ft)
Definition XSectBatch.hpp:101
const double * area_tbl
Normalized area vs y/y_full.
Definition XSectBatch.hpp:116