OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
openswmm_initial_quality.h File Reference

C API — [INITIAL_QUALITY] per-element initial concentrations (E-A4). More...

#include "openswmm_engine.h"
Include dependency graph for openswmm_initial_quality.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

SWMM_ENGINE_API int swmm_init_quality_count (SWMM_Engine engine)
 Number of [INITIAL_QUALITY] entries.
 
SWMM_ENGINE_API int swmm_init_quality_get (SWMM_Engine engine, int entry_idx, int *is_link, int *elem_idx, char *constituent_buf, int constituent_len, double *value)
 Read one entry.
 
SWMM_ENGINE_API int swmm_init_quality_set (SWMM_Engine engine, int is_link, int elem_idx, const char *constituent, double value)
 Upsert one entry keyed on (is_link, elem_idx, constituent).
 
SWMM_ENGINE_API int swmm_init_quality_remove (SWMM_Engine engine, int entry_idx)
 Remove the entry at entry_idx. Subsequent entries shift down by one — callers holding cached indices must re-enumerate.
 
SWMM_ENGINE_API int swmm_init_quality_file_get (SWMM_Engine engine, char *buf, int buflen)
 The FILE path as written ("" when none).
 
SWMM_ENGINE_API int swmm_init_quality_file_set (SWMM_Engine engine, const char *path)
 Set (or clear with "" / NULL) the FILE reference.
 
SWMM_ENGINE_API int swmm_init_quality_is_file (SWMM_Engine engine, int entry_idx)
 1 when row entry_idx was loaded from the FILE sidecar, else 0.
 

Detailed Description

C API — [INITIAL_QUALITY] per-element initial concentrations (E-A4).

Row-based surface over the section store, mirroring the swmm_ext_inflow_* family: entries are indexed 0..count-1 in file order, set is an UPSERT keyed on (is_link, elem_idx, constituent), and remove deletes by entry index (subsequent entries shift down by one).

Constituent is a name: a [POLLUTANTS] pollutant, or the reserved species "__WATER_AGE__" (value in HOURS, signed) or "__TEMPERATURE__" (value in degC). Pollutant values are concentrations in the pollutant's own units and must be non-negative.

Rows only seed state at initialize(), so mutation is guarded to the editable states (BUILDING/OPENED) — the same contract as swmm_pollutant_set_init_conc.

Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
License\n Apache-2.0

Function Documentation

◆ swmm_init_quality_count()

SWMM_ENGINE_API int swmm_init_quality_count ( SWMM_Engine engine)

Number of [INITIAL_QUALITY] entries.

Parameters
engineEngine handle.
Returns
Entry count, or -1 on a bad handle.

◆ swmm_init_quality_file_get()

SWMM_ENGINE_API int swmm_init_quality_file_get ( SWMM_Engine engine,
char * buf,
int buflen )

The FILE path as written ("" when none).

◆ swmm_init_quality_file_set()

SWMM_ENGINE_API int swmm_init_quality_file_set ( SWMM_Engine engine,
const char * path )

Set (or clear with "" / NULL) the FILE reference.

◆ swmm_init_quality_get()

SWMM_ENGINE_API int swmm_init_quality_get ( SWMM_Engine engine,
int entry_idx,
int * is_link,
int * elem_idx,
char * constituent_buf,
int constituent_len,
double * value )

Read one entry.

Parameters
engineEngine handle.
entry_idxEntry index (0..count-1).
is_link[out] 0 = node row, 1 = link row.
elem_idx[out] Resolved node/link index (-1 if unresolved).
constituent_buf[out] Constituent name (NUL-terminated).
constituent_lenBuffer size in bytes.
value[out] Raw value (pollutant units / hours / degC).
Returns
SWMM_OK, SWMM_ERR_BADINDEX, or SWMM_ERR_BADPARAM.
Here is the call graph for this function:

◆ swmm_init_quality_is_file()

SWMM_ENGINE_API int swmm_init_quality_is_file ( SWMM_Engine engine,
int entry_idx )

1 when row entry_idx was loaded from the FILE sidecar, else 0.

◆ swmm_init_quality_remove()

SWMM_ENGINE_API int swmm_init_quality_remove ( SWMM_Engine engine,
int entry_idx )

Remove the entry at entry_idx. Subsequent entries shift down by one — callers holding cached indices must re-enumerate.

BUILDING/OPENED only.

Returns
SWMM_OK, SWMM_ERR_LIFECYCLE, or SWMM_ERR_BADINDEX.
Here is the call graph for this function:

◆ swmm_init_quality_set()

SWMM_ENGINE_API int swmm_init_quality_set ( SWMM_Engine engine,
int is_link,
int elem_idx,
const char * constituent,
double value )

Upsert one entry keyed on (is_link, elem_idx, constituent).

BUILDING/OPENED only. Unknown constituent name, bad element index, or a negative pollutant value returns SWMM_ERR_BADPARAM. (Negative values are legal for "__WATER_AGE__" and "__TEMPERATURE__".)

Parameters
engineEngine handle.
is_link0 = node row, 1 = link row.
elem_idxNode/link index.
constituentPollutant name or reserved species name.
valueRaw value (pollutant units / hours / degC).
Returns
SWMM_OK, SWMM_ERR_LIFECYCLE, SWMM_ERR_BADINDEX, or SWMM_ERR_BADPARAM.
Here is the call graph for this function: