Skip to content

Commit 0a78d5e

Browse files
committed
WIP API and bindings unit testing; cleaning up #204, #162, #163, #184, #180
1 parent 14e0a0a commit 0a78d5e

File tree

4 files changed

+5
-9
lines changed

4 files changed

+5
-9
lines changed

src/solver/lid.c

+2-3
Original file line numberDiff line numberDiff line change
@@ -1789,8 +1789,7 @@ double getImpervAreaRunoff(int j)
17891789
{
17901790
q *= Subcatch[j].subArea[IMPERV0].fOutlet;
17911791
}
1792-
nonLidArea = Subcatch[j].area - Subcatch[j].lidArea;
1793-
nonLidArea = 0.0 < nonLidArea ? 0.0 : nonLidArea;
1792+
nonLidArea = MAX(0.0, Subcatch[j].area - Subcatch[j].lidArea);
17941793
return q * nonLidArea;
17951794
}
17961795

@@ -1816,7 +1815,7 @@ double getPervAreaRunoff(int j)
18161815
{
18171816
q *= Subcatch[j].subArea[PERV].fOutlet;
18181817
}
1819-
nonLidArea = max(0.0, Subcatch[j].area - Subcatch[j].lidArea);
1818+
nonLidArea = MAX(0.0, Subcatch[j].area - Subcatch[j].lidArea);
18201819
return q * nonLidArea;
18211820
}
18221821

src/solver/qualrout.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,7 @@ void findNodeQual(int j)
250250

251251
// --- Calculate bounded externally provided api pollutant flux and update mass balance
252252
// --- Positive fluxes are added in the addExternalInflows function in routing.c (This really needs to be refactored for consistency)
253-
cOut = -Node[j].apiExtQualMassFlux[p] / qNode;
254-
cOut = cOut < 0.0 ? 0.0 : cOut > cIn ? cIn : cOut;
253+
cOut = MIN(cIn, MAX(0.0, -Node[j].apiExtQualMassFlux[p] / qNode));
255254
cIn -= cOut;
256255
massbal_addOutflowQual(p, cOut * qNode, FALSE);
257256

src/solver/subcatch.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -675,8 +675,7 @@ double subcatch_getRunoff(int j, double tStep)
675675
// --- find volume of inflow to non-LID portion of subcatchment as existing
676676
// ponded water + any runon volume from upstream areas;
677677
// rainfall and snowmelt will be added as each sub-area is analyzed
678-
nonLidArea = Subcatch[j].area - Subcatch[j].lidArea;
679-
nonLidArea = nonLidArea < 0.0 ? 0.0 : nonLidArea;
678+
nonLidArea = MAX(0.0, Subcatch[j].area - Subcatch[j].lidArea);
680679
vRunon = Subcatch[j].runon * tStep * nonLidArea;
681680
Vinflow = vRunon + subcatch_getDepth(j) * nonLidArea;
682681

src/solver/surfqual.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,7 @@ void surfqual_getBuildup(int j, double tStep)
128128
newBuildup = MAX(newBuildup, oldBuildup);
129129

130130
//--- add bounded building from external API
131-
newBuildup = newBuildup + Subcatch[j].apiExtBuildup[p] * area;
132-
newBuildup = newBuildup < 0.0 ? 0.0 : newBuildup;
131+
newBuildup = MAX(0.0, newBuildup + Subcatch[j].apiExtBuildup[p] * area);
133132

134133
Subcatch[j].landFactor[i].buildup[p] = newBuildup;
135134
massbal_updateLoadingTotals(BUILDUP_LOAD, p,

0 commit comments

Comments
 (0)