OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
XSectBatch.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2//
3// Copyright 2026 Caleb Buahin
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing, software
12// distributed under the License is distributed on an "AS IS" BASIS,
13// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14// See the License for the specific language governing permissions and
15// limitations under the License.
16
49
50#ifndef OPENSWMM_XSECT_BATCH_HPP
51#define OPENSWMM_XSECT_BATCH_HPP
52
53#ifndef OPENSWMM_RESTRICT
54# if defined(_MSC_VER)
55# define OPENSWMM_RESTRICT __restrict
56# else
57# define OPENSWMM_RESTRICT __restrict__
58# endif
59#endif
60
61#include <vector>
62#include <cstddef>
63#include <cstdint>
64#include <cmath>
65
66#include "XSectLookup.hpp"
67
68namespace openswmm {
69
70// Forward declaration
71struct SimulationContext;
72
73// ============================================================================
74// Cross-section shape codes (matches legacy enums.h XsectType)
75// ============================================================================
76
105
106// ============================================================================
107// Cross-section parameter struct (mirrors legacy TXsect)
108// ============================================================================
109
111 int type = 0;
113 int transect = -1;
114
115 double y_full = 0.0;
116 double w_max = 0.0;
117 double yw_max = 0.0;
118 double a_full = 0.0;
119 double r_full = 0.0;
120 double s_full = 0.0;
121 double s_max = 0.0;
122
123 double y_bot = 0.0;
124 double a_bot = 0.0;
125 double s_bot = 0.0;
126 double r_bot = 0.0;
127
128 // Tabulated geometry for IRREGULAR / CUSTOM / STREET_XSECT shapes, whose
129 // A/R/W vs depth come from a per-link transect table rather than a shared
130 // static table. These point into ctx.transect_tables (stable for the run)
131 // and stay null for every self-contained shape. Without them the
132 // context-free per-element accessors return 0 for irregular sections (so
133 // e.g. init-time getDepthFromFlow could not compute normal depth/storage).
134 const double* area_tbl = nullptr;
135 const double* hrad_tbl = nullptr;
136 const double* width_tbl = nullptr;
138
142 const xsect::LocateLut* area_lut = nullptr;
143};
144
145// ============================================================================
146// Per-element functions (xsect:: namespace)
147// ============================================================================
148
149namespace xsect {
150
151double getAofY(const XSectParams& xs, double y);
152double getRofY(const XSectParams& xs, double y);
153double getWofY(const XSectParams& xs, double y);
154double getYofA(const XSectParams& xs, double a);
155double getSofA(const XSectParams& xs, double a);
156double getRofA(const XSectParams& xs, double a);
157double getdSdA(const XSectParams& xs, double a);
158double getAofS(const XSectParams& xs, double s_factor);
159double getAmax(const XSectParams& xs);
160double getYcrit(const XSectParams& xs, double q);
161bool isOpen(int type);
162int setParams(XSectParams& xs, int type, const double p[], double ucf);
163
164// Lookup table helpers (exposed for batch kernels and testing)
165double lookup(double x, const double* table, int n_items);
166double invLookup(double y, const double* table, int n_items,
167 const LocateLut* lut = nullptr);
168int locate(double y, const double* table, int n);
169double getYcircular(double alpha);
170double getScircular(double alpha);
171
172} // namespace xsect
173
174// ============================================================================
175// Shape group — contiguous SoA for all links sharing one shape type
176// ============================================================================
177
190 int count = 0;
191
192 // Mapping back to global link arrays
193 std::vector<int> link_idx;
194
195 // Geometry parameters (contiguous, aligned for SIMD)
196 std::vector<double> y_full;
197 std::vector<double> a_full;
198 std::vector<double> r_full;
199 std::vector<double> s_full;
200 std::vector<double> w_max;
201
202 // Pre-computed reciprocal of y_full (avoids per-element division in kernels)
203 std::vector<double> inv_y_full;
204
205 // Multi-purpose parameters (meaning depends on shape)
206 std::vector<double> y_bot;
207 std::vector<double> a_bot;
208 std::vector<double> s_bot;
209 std::vector<double> r_bot;
210
211 // Per-link transect table pointers (IRREGULAR shapes only)
212 // Each pointer → a normalized table of N_TRANSECT_TBL entries.
213 std::vector<const double*> area_tables;
214 std::vector<const double*> hrad_tables;
215 std::vector<const double*> width_tables;
217
218 // Pre-allocated working buffers (avoids per-call allocation in hot loop)
219 mutable std::vector<double> buf_d;
220 mutable std::vector<double> buf_r;
221 mutable std::vector<double> buf_r2;
222
224 void resize(int n);
225};
226
227// ============================================================================
228// XSectGroups — the shape-grouped index over all links
229// ============================================================================
230
244public:
254 void build(const SimulationContext& ctx);
255
266
275 void build(const XSectParams* params, int n_links);
276
277 // ========================================================================
278 // Batch compute — results scattered to global link arrays
279 // ========================================================================
280
288 void computeAreas(const double* depths, double* areas, int n_links) const;
289
297 void computeHydRad(const double* depths, double* hydrad, int n_links) const;
298
306 void computeWidths(const double* depths, double* widths, int n_links) const;
307
316 void computeAreaAndHydRad(const double* depths, double* areas,
317 double* hydrad, int n_links) const;
318
325 const double* d1, const double* d2, const double* dm,
326 double* a1, double* a2, double* am,
327 double* hrad1, double* hrad_mid, int n_links) const;
328
333 const double* d1, const double* d2, const double* dm,
334 double* w1, double* w2, double* wm, int n_links) const;
335
352 const double* d1, const double* d2, const double* dm,
353 double* a1, double* a2, double* am,
354 double* hrad1, double* hrad_mid, int n_links,
355 int tid, int nthreads) const;
356
358 const double* d1, const double* d2, const double* dm,
359 double* w1, double* w2, double* wm, int n_links,
360 int tid, int nthreads) const;
361
388 void setBypassMask(const std::uint8_t* bypassed_by_link) const;
389
397 void computeSectionFactors(const double* areas, double* sfact, int n_links) const;
398
406 void computeDepthsFromArea(const double* areas, double* depths, int n_links) const;
407
408 // ========================================================================
409 // Accessors
410 // ========================================================================
411
413 int numGroups() const { return static_cast<int>(groups_.size()); }
414
416 const ShapeGroup& group(int i) const { return groups_[i]; }
417
419 const ShapeGroup* findGroup(XSectShape shape) const;
420
421private:
422 std::vector<ShapeGroup> groups_;
423
424 // Per-iteration bypass-mask state (see setBypassMask). packed_groups_[gi]
425 // is a packed view of groups_[gi] holding only the active links; it reuses
426 // the ShapeGroup layout so the gather/kernel/scatter path runs unchanged.
427 // packed_count_[gi]: kMaskFullGroup → no link in the group is bypassed
428 // (use the original group directly, no packing was done); 0..count →
429 // number of active links in the packed view. All mutable because the
430 // mask is per-Picard-iteration scratch while the compute API is const.
431 static constexpr int kMaskFullGroup = -1;
432 mutable std::vector<ShapeGroup> packed_groups_;
433 mutable std::vector<int> packed_count_;
434 mutable bool mask_active_ = false;
435
437 const ShapeGroup* maskedGroup(std::size_t gi) const {
438 const ShapeGroup* gp = &groups_[gi];
439 if (mask_active_) {
440 const int na = packed_count_[gi];
441 if (na == 0) return nullptr;
442 if (na != kMaskFullGroup) gp = &packed_groups_[gi];
443 }
444 return gp;
445 }
446};
447
448// ============================================================================
449// Shape-specific batch kernels (called by XSectGroups, also usable directly)
450// ============================================================================
451
452namespace xsect_batch {
453
461void area_circular(
462 const double* OPENSWMM_RESTRICT depth,
463 const double* OPENSWMM_RESTRICT y_full,
464 const double* OPENSWMM_RESTRICT a_full,
465 double* OPENSWMM_RESTRICT area,
466 int count
467);
468
470void area_rect(
471 const double* OPENSWMM_RESTRICT depth,
472 const double* OPENSWMM_RESTRICT w_max,
473 double* OPENSWMM_RESTRICT area,
474 int count
475);
476
479 const double* OPENSWMM_RESTRICT depth,
480 const double* OPENSWMM_RESTRICT y_bot,
481 const double* OPENSWMM_RESTRICT s_bot,
482 double* OPENSWMM_RESTRICT area,
483 int count
484);
485
487void area_triangular(
488 const double* OPENSWMM_RESTRICT depth,
489 const double* OPENSWMM_RESTRICT s_bot,
490 double* OPENSWMM_RESTRICT area,
491 int count
492);
493
495void area_parabolic(
496 const double* OPENSWMM_RESTRICT depth,
497 const double* OPENSWMM_RESTRICT r_bot,
498 double* OPENSWMM_RESTRICT area,
499 int count
500);
501
503void area_powerfunc(
504 const double* OPENSWMM_RESTRICT depth,
505 const double* OPENSWMM_RESTRICT s_bot,
506 const double* OPENSWMM_RESTRICT r_bot,
507 double* OPENSWMM_RESTRICT area,
508 int count
509);
510
512void area_tabulated(
513 const double* OPENSWMM_RESTRICT depth,
514 const double* OPENSWMM_RESTRICT y_full,
515 const double* OPENSWMM_RESTRICT a_full,
516 const double* table,
517 int table_size,
518 double* OPENSWMM_RESTRICT area,
519 int count
520);
521
525 const double* OPENSWMM_RESTRICT depth,
526 const double* OPENSWMM_RESTRICT nrm,
527 const double* OPENSWMM_RESTRICT scale,
528 const double* const* tables,
529 int table_size,
530 double* OPENSWMM_RESTRICT result,
531 int count
532);
533
537 const double* OPENSWMM_RESTRICT depth,
538 const double* OPENSWMM_RESTRICT nrm,
539 const double* OPENSWMM_RESTRICT scale_a,
540 const double* OPENSWMM_RESTRICT scale_b,
541 const double* const* tables_a,
542 const double* const* tables_b,
543 int table_size,
544 double* OPENSWMM_RESTRICT out_a,
545 double* OPENSWMM_RESTRICT out_b,
546 int count
547);
548
552 const double* OPENSWMM_RESTRICT depth,
553 const double* OPENSWMM_RESTRICT y_full,
554 const double* OPENSWMM_RESTRICT a_full,
555 const double* table,
556 int table_size,
557 const xsect::LocateLut* lut,
558 double* OPENSWMM_RESTRICT area,
559 int count
560);
561
562// --- Hydraulic radius batch kernels ---
563
564void hydrad_circular(
565 const double* OPENSWMM_RESTRICT depth,
566 const double* OPENSWMM_RESTRICT y_full,
567 const double* OPENSWMM_RESTRICT r_full,
568 double* OPENSWMM_RESTRICT hydrad,
569 int count
570);
571
574 const double* OPENSWMM_RESTRICT depth,
575 const double* OPENSWMM_RESTRICT y_full,
576 const double* OPENSWMM_RESTRICT a_full,
577 const double* OPENSWMM_RESTRICT r_full,
578 double* OPENSWMM_RESTRICT area,
579 double* OPENSWMM_RESTRICT hydrad,
580 int count
581);
582
584 const double* OPENSWMM_RESTRICT depth,
585 const double* OPENSWMM_RESTRICT y_bot,
586 const double* OPENSWMM_RESTRICT s_bot,
587 const double* OPENSWMM_RESTRICT r_bot,
588 double* OPENSWMM_RESTRICT hydrad,
589 int count
590);
591
593 const double* OPENSWMM_RESTRICT depth,
594 const double* OPENSWMM_RESTRICT s_bot,
595 const double* OPENSWMM_RESTRICT r_bot,
596 double* OPENSWMM_RESTRICT hydrad,
597 int count
598);
599
600void hydrad_rect(
601 const double* OPENSWMM_RESTRICT depth,
602 const double* OPENSWMM_RESTRICT w_max,
603 double* OPENSWMM_RESTRICT hydrad,
604 int count
605);
606
608 const double* OPENSWMM_RESTRICT depth,
609 const double* OPENSWMM_RESTRICT y_full,
610 const double* OPENSWMM_RESTRICT r_full,
611 const double* table,
612 int table_size,
613 double* OPENSWMM_RESTRICT hydrad,
614 int count
615);
616
617// --- Top width batch kernels ---
618
619void width_circular(
620 const double* OPENSWMM_RESTRICT depth,
621 const double* OPENSWMM_RESTRICT y_full,
622 const double* OPENSWMM_RESTRICT w_max,
623 double* OPENSWMM_RESTRICT width,
624 int count
625);
626
628 const double* OPENSWMM_RESTRICT depth,
629 const double* OPENSWMM_RESTRICT y_bot,
630 const double* OPENSWMM_RESTRICT s_bot,
631 double* OPENSWMM_RESTRICT width,
632 int count
633);
634
636 const double* OPENSWMM_RESTRICT depth,
637 const double* OPENSWMM_RESTRICT s_bot,
638 double* OPENSWMM_RESTRICT width,
639 int count
640);
641
642void width_rect(
643 const double* OPENSWMM_RESTRICT w_max,
644 double* OPENSWMM_RESTRICT width,
645 int count
646);
647
648void width_tabulated(
649 const double* OPENSWMM_RESTRICT depth,
650 const double* OPENSWMM_RESTRICT y_full,
651 const double* OPENSWMM_RESTRICT w_max,
652 const double* table,
653 int table_size,
654 double* OPENSWMM_RESTRICT width,
655 int count
656);
657
658} // namespace xsect_batch
659
660} // namespace openswmm
661
662#endif // OPENSWMM_XSECT_BATCH_HPP
#define OPENSWMM_RESTRICT
Definition XSectBatch.hpp:57
Bit-exact geometry-table interpolation — the single source of truth.
Shape-grouped cross-section manager for batch computation.
Definition XSectBatch.hpp:243
void computeAreas(const double *depths, double *areas, int n_links) const
Compute area for every link, reading depth from depths[link].
Definition XSectBatch.cpp:1192
void computeWidths(const double *depths, double *widths, int n_links) const
Compute top width for every link.
Definition XSectBatch.cpp:1244
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:1335
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:1279
void computeAreaAndHydRad(const double *depths, double *areas, double *hydrad, int n_links) const
Fused area + hydraulic radius computation (single gather/scatter).
Definition XSectBatch.cpp:1222
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:1319
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:1434
const ShapeGroup & group(int i) const
Access a specific shape group.
Definition XSectBatch.hpp:416
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:1404
void computeDepthsFromArea(const double *areas, double *depths, int n_links) const
Compute depth from area for every link (inverse).
Definition XSectBatch.cpp:1458
void computeHydRad(const double *depths, double *hydrad, int n_links) const
Compute hydraulic radius for every link.
Definition XSectBatch.cpp:1207
void computeSectionFactors(const double *areas, double *sfact, int n_links) const
Compute section factor for every link (from area, not depth).
Definition XSectBatch.cpp:1446
void attachTransectTables(const SimulationContext &ctx)
Attach transect tables to the IRREGULAR shape group.
Definition XSectBatch.cpp:216
int numGroups() const
Number of non-empty shape groups.
Definition XSectBatch.hpp:413
const ShapeGroup * findGroup(XSectShape shape) const
Find the group for a given shape (returns nullptr if no links have that shape).
Definition XSectBatch.cpp:265
Definition UnitConversion.cpp:31
Definition XSectBatch.cpp:276
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:317
void width_rect(const double *OPENSWMM_RESTRICT w_max, double *OPENSWMM_RESTRICT width, int count)
Definition XSectBatch.cpp:781
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:643
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:629
void width_triangular(const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT s_bot, double *OPENSWMM_RESTRICT width, int count)
Definition XSectBatch.cpp:770
void hydrad_rect(const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT w_max, double *OPENSWMM_RESTRICT hydrad, int count)
Definition XSectBatch.cpp:655
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:791
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:511
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:351
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:287
void perlink_tabulated_pair(const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT nrm, const double *OPENSWMM_RESTRICT scale_a, const double *OPENSWMM_RESTRICT scale_b, const double *const *tables_a, const double *const *tables_b, int table_size, double *OPENSWMM_RESTRICT out_a, double *OPENSWMM_RESTRICT out_b, int count)
Definition XSectBatch.cpp:415
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:304
void perlink_tabulated(const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT nrm, const double *OPENSWMM_RESTRICT scale, const double *const *tables, int table_size, double *OPENSWMM_RESTRICT result, int count)
Per-link tabulated lookup (for IRREGULAR shapes where each link has its own table).
Definition XSectBatch.cpp:490
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:723
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:758
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:362
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:742
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:532
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:329
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:340
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, const xsect::LocateLut *lut, double *OPENSWMM_RESTRICT area, int count)
Definition XSectBatch.cpp:378
Definition XSectBatch.hpp:149
double getAmax(const XSectParams &xs)
Definition XSection.cpp:229
double getdSdA(const XSectParams &xs, double a)
Definition XSection.cpp:227
double lookup(double x, const double *table, int n_items)
Definition XSection.cpp:215
double getYofA(const XSectParams &xs, double a)
Definition XSection.cpp:224
double getScircular(double alpha)
Definition XSection.cpp:219
double invLookup(double y, const double *table, int n_items, const LocateLut *lut=nullptr)
Definition XSection.cpp:216
double getWofY(const XSectParams &xs, double y)
Definition XSection.cpp:222
double getSofA(const XSectParams &xs, double a)
Definition XSection.cpp:225
double getRofY(const XSectParams &xs, double y)
Definition XSection.cpp:223
double getYcrit(const XSectParams &xs, double q)
Definition XSection.cpp:230
int locate(double y, const double *table, int n)
Definition XSection.cpp:214
double getAofY(const XSectParams &xs, double y)
Definition XSection.cpp:221
double getAofS(const XSectParams &xs, double s_factor)
Definition XSection.cpp:228
bool isOpen(int type)
Definition XSection.cpp:231
int setParams(XSectParams &xs, int type, const double p[], double ucf)
Definition XSection.cpp:245
double getRofA(const XSectParams &xs, double a)
Definition XSection.cpp:226
double getYcircular(double alpha)
Definition XSection.cpp:218
Definition NodeCoupling.cpp:16
XSectShape
Definition XSectBatch.hpp:77
@ POWERFUNC
Definition XSectBatch.hpp:86
@ MOD_BASKET
Definition XSectBatch.hpp:89
@ DUMMY
Definition XSectBatch.hpp:78
@ TRIANGULAR
Definition LinkData.hpp:76
@ RECT_CLOSED
Definition LinkData.hpp:73
@ ARCH
Arch pipe.
Definition LinkData.hpp:91
@ FORCE_MAIN
Circular force main (Hazen-Williams or D-W)
Definition LinkData.hpp:94
@ RECT_OPEN
Definition LinkData.hpp:74
@ BASKETHANDLE
Definition LinkData.hpp:85
@ STREET_XSECT
Street cross-section.
Definition LinkData.hpp:95
@ SEMICIRCULAR
Definition LinkData.hpp:86
@ IRREGULAR
User-supplied shape curve.
Definition LinkData.hpp:92
@ HORIZ_ELLIPSE
Horizontal elliptical pipe.
Definition LinkData.hpp:89
@ VERT_ELLIPSE
Vertical elliptical pipe.
Definition LinkData.hpp:90
@ CUSTOM
Shape from CURVE_SHAPE table.
Definition LinkData.hpp:93
@ RECT_ROUND
Rectangular-round bottom.
Definition LinkData.hpp:88
@ EGGSHAPED
Definition LinkData.hpp:80
@ SEMIELLIPTICAL
Definition LinkData.hpp:84
@ CATENARY
Definition LinkData.hpp:83
@ CIRCULAR
Definition LinkData.hpp:71
@ TRAPEZOIDAL
Definition LinkData.hpp:75
@ HORSESHOE
Definition LinkData.hpp:81
@ DUMMY
Dummy (no geometry)
Definition LinkData.hpp:96
@ PARABOLIC
Definition LinkData.hpp:77
@ RECT_TRIANG
Rectangular-triangular bottom.
Definition LinkData.hpp:87
@ FILLED_CIRCULAR
Definition LinkData.hpp:72
@ GOTHIC
Definition LinkData.hpp:82
double * y
Definition odesolve.c:28
SoA parameter block for all links of one cross-section shape.
Definition XSectBatch.hpp:188
std::vector< double > r_full
Hyd. radius at full (ft)
Definition XSectBatch.hpp:198
std::vector< const double * > hrad_tables
Per-link hyd-rad table.
Definition XSectBatch.hpp:214
std::vector< double > w_max
Max width (ft)
Definition XSectBatch.hpp:200
std::vector< double > buf_r
Scatter buffer for results.
Definition XSectBatch.hpp:220
std::vector< double > buf_r2
Second scatter buffer (for fused ops)
Definition XSectBatch.hpp:221
std::vector< double > inv_y_full
1.0 / y_full (or 0 if y_full==0)
Definition XSectBatch.hpp:203
XSectShape shape
Definition XSectBatch.hpp:189
int transect_tbl_size
Table size (same for all)
Definition XSectBatch.hpp:216
std::vector< double > r_bot
Definition XSectBatch.hpp:209
std::vector< double > s_bot
Definition XSectBatch.hpp:208
std::vector< double > y_bot
Definition XSectBatch.hpp:206
void resize(int n)
Resize all arrays to n elements.
Definition XSectBatch.cpp:77
std::vector< const double * > area_tables
Per-link area table.
Definition XSectBatch.hpp:213
std::vector< const double * > width_tables
Per-link width table.
Definition XSectBatch.hpp:215
std::vector< int > link_idx
link_idx[i] = index in SimulationContext
Definition XSectBatch.hpp:193
std::vector< double > buf_d
Gather buffer for depths.
Definition XSectBatch.hpp:219
int count
Definition XSectBatch.hpp:190
std::vector< double > a_bot
Definition XSectBatch.hpp:207
std::vector< double > a_full
Full area (ft2)
Definition XSectBatch.hpp:197
std::vector< double > s_full
Section factor at full.
Definition XSectBatch.hpp:199
std::vector< double > y_full
Full depth (ft)
Definition XSectBatch.hpp:196
Central, reentrant simulation context.
Definition SimulationContext.hpp:353
Definition XSectBatch.hpp:110
double s_full
Section factor when full (ft^4/3)
Definition XSectBatch.hpp:120
double s_bot
Slope of bottom section / exponent.
Definition XSectBatch.hpp:125
int culvert_code
Definition XSectBatch.hpp:112
const double * hrad_tbl
Normalized hyd-radius vs y/y_full.
Definition XSectBatch.hpp:135
int transect
Definition XSectBatch.hpp:113
int transect_tbl_size
Entry count of the tables above.
Definition XSectBatch.hpp:137
const double * width_tbl
Normalized width vs y/y_full.
Definition XSectBatch.hpp:136
double a_full
Area when full (ft2)
Definition XSectBatch.hpp:118
double r_bot
Radius of bottom section / coefficient.
Definition XSectBatch.hpp:126
double s_max
Section factor at max flow (ft^4/3)
Definition XSectBatch.hpp:121
int type
Definition XSectBatch.hpp:111
double a_bot
Area of bottom section.
Definition XSectBatch.hpp:124
const xsect::LocateLut * area_lut
Definition XSectBatch.hpp:142
double w_max
Width at widest point (ft)
Definition XSectBatch.hpp:116
double yw_max
Depth at widest point (ft)
Definition XSectBatch.hpp:117
double y_bot
Depth of bottom section / fill depth.
Definition XSectBatch.hpp:123
double y_full
Full depth (ft)
Definition XSectBatch.hpp:115
double r_full
Hydraulic radius when full (ft)
Definition XSectBatch.hpp:119
const double * area_tbl
Normalized area vs y/y_full.
Definition XSectBatch.hpp:134
Definition XSectLookup.hpp:182