GCC Code Coverage Report


Directory: src/solver/
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 80.3% 171 / 0 / 213
Functions: 100.0% 1 / 0 / 1
Branches: 67.6% 73 / 0 / 108

inputrpt.c
Line Branch Exec Source
1 //-----------------------------------------------------------------------------
2 // inputrpt.c
3 //
4 // Project: EPA SWMM5
5 // Version: 5.2
6 // Date: 11/01/21 (Build 5.2.0)
7 // Author: L. Rossman
8 //
9 // Report writing functions for input data summary.
10 //
11 // Update History
12 // ==============
13 // Build 5.2.0:
14 // - Support added for reporting Street geometry tables.
15 //-----------------------------------------------------------------------------
16 #define _CRT_SECURE_NO_DEPRECATE
17
18 #include <string.h>
19 #include <time.h>
20 #include "headers.h"
21 #include "lid.h"
22
23 #define WRITE(x) (report_writeLine((x)))
24
25 //=============================================================================
26
27 40 void inputrpt_writeInput()
28 //
29 // Input: none
30 // Output: none
31 // Purpose: writes summary of input data to report file.
32 //
33 {
34 int m;
35 int i, k;
36 40 int lidCount = 0;
37
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 40 times.
40 if ( ErrorCode ) return;
38
39 40 WRITE("");
40 40 WRITE("*************");
41 40 WRITE("Element Count");
42 40 WRITE("*************");
43 40 fprintf(Frpt.file, "\n Number of rain gages ...... %d", Nobjects[GAGE]);
44 40 fprintf(Frpt.file, "\n Number of subcatchments ... %d", Nobjects[SUBCATCH]);
45 40 fprintf(Frpt.file, "\n Number of nodes ........... %d", Nobjects[NODE]);
46 40 fprintf(Frpt.file, "\n Number of links ........... %d", Nobjects[LINK]);
47 40 fprintf(Frpt.file, "\n Number of pollutants ...... %d", Nobjects[POLLUT]);
48 40 fprintf(Frpt.file, "\n Number of land uses ....... %d", Nobjects[LANDUSE]);
49
50
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 35 times.
40 if ( Nobjects[POLLUT] > 0 )
51 {
52 5 WRITE("");
53 5 WRITE("");
54 5 WRITE("*****************");
55 5 WRITE("Pollutant Summary");
56 5 WRITE("*****************");
57 5 fprintf(Frpt.file,
58 "\n Ppt. GW Kdecay");
59 5 fprintf(Frpt.file,
60 "\n Name Units Concen. Concen. 1/days CoPollutant");
61 5 fprintf(Frpt.file,
62 "\n -----------------------------------------------------------------------");
63
2/2
✓ Branch 0 taken 14 times.
✓ Branch 1 taken 5 times.
19 for (i = 0; i < Nobjects[POLLUT]; i++)
64 {
65 14 fprintf(Frpt.file, "\n %-20s %5s%10.2f%10.2f%10.2f", Pollut[i].ID,
66 14 QualUnitsWords[Pollut[i].units], Pollut[i].pptConcen,
67 14 Pollut[i].gwConcen, Pollut[i].kDecay*SECperDAY);
68
2/2
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 13 times.
14 if ( Pollut[i].coPollut >= 0 )
69 1 fprintf(Frpt.file, " %-s (%.2f)",
70 1 Pollut[Pollut[i].coPollut].ID, Pollut[i].coFraction);
71 }
72 }
73
74
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 36 times.
40 if ( Nobjects[LANDUSE] > 0 )
75 {
76 4 WRITE("");
77 4 WRITE("");
78 4 WRITE("***************");
79 4 WRITE("Landuse Summary");
80 4 WRITE("***************");
81 4 fprintf(Frpt.file,
82 "\n Sweeping Maximum Last");
83 4 fprintf(Frpt.file,
84 "\n Name Interval Removal Swept");
85 4 fprintf(Frpt.file,
86 "\n ---------------------------------------------------");
87
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 4 times.
10 for (i=0; i<Nobjects[LANDUSE]; i++)
88 {
89 6 fprintf(Frpt.file, "\n %-20s %10.2f%10.2f%10.2f", Landuse[i].ID,
90 6 Landuse[i].sweepInterval, Landuse[i].sweepRemoval,
91 6 Landuse[i].sweepDays0);
92 }
93 }
94
95
2/2
✓ Branch 0 taken 28 times.
✓ Branch 1 taken 12 times.
40 if ( Nobjects[GAGE] > 0 )
96 {
97 28 WRITE("");
98 28 WRITE("");
99 28 WRITE("****************");
100 28 WRITE("Raingage Summary");
101 28 WRITE("****************");
102 28 fprintf(Frpt.file,
103 "\n Data Recording");
104 28 fprintf(Frpt.file,
105 "\n Name Data Source Type Interval ");
106 28 fprintf(Frpt.file,
107 "\n ------------------------------------------------------------------------");
108
2/2
✓ Branch 0 taken 40 times.
✓ Branch 1 taken 28 times.
68 for (i = 0; i < Nobjects[GAGE]; i++)
109 {
110
2/2
✓ Branch 0 taken 36 times.
✓ Branch 1 taken 4 times.
40 if ( Gage[i].tSeries >= 0 )
111 {
112 36 fprintf(Frpt.file, "\n %-20s %-30s ",
113 36 Gage[i].ID, Tseries[Gage[i].tSeries].ID);
114 36 fprintf(Frpt.file, "%-10s %3d min.",
115 36 RainTypeWords[Gage[i].rainType],
116 36 (Gage[i].rainInterval)/60);
117 }
118 4 else fprintf(Frpt.file, "\n %-20s %-30s",
119 4 Gage[i].ID, Gage[i].fname);
120 }
121 }
122
123
2/2
✓ Branch 0 taken 25 times.
✓ Branch 1 taken 15 times.
40 if ( Nobjects[SUBCATCH] > 0 )
124 {
125 25 WRITE("");
126 25 WRITE("");
127 25 WRITE("********************");
128 25 WRITE("Subcatchment Summary");
129 25 WRITE("********************");
130 25 fprintf(Frpt.file,
131 "\n Name Area Width %%Imperv %%Slope Rain Gage Outlet ");
132 25 fprintf(Frpt.file,
133 "\n -----------------------------------------------------------------------------------------------------------");
134
2/2
✓ Branch 0 taken 62 times.
✓ Branch 1 taken 25 times.
87 for (i = 0; i < Nobjects[SUBCATCH]; i++)
135 {
136 186 fprintf(Frpt.file,"\n %-20s %10.2f%10.2f%10.2f%10.4f %-20s ",
137 62 Subcatch[i].ID, Subcatch[i].area*UCF(LANDAREA),
138 62 Subcatch[i].width*UCF(LENGTH), Subcatch[i].fracImperv*100.0,
139 62 Subcatch[i].slope*100.0, Gage[Subcatch[i].gage].ID);
140
2/2
✓ Branch 0 taken 50 times.
✓ Branch 1 taken 12 times.
62 if ( Subcatch[i].outNode >= 0 )
141 {
142 50 fprintf(Frpt.file, "%-20s", Node[Subcatch[i].outNode].ID);
143 }
144
1/2
✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
12 else if ( Subcatch[i].outSubcatch >= 0 )
145 {
146 12 fprintf(Frpt.file, "%-20s", Subcatch[Subcatch[i].outSubcatch].ID);
147 }
148
2/2
✓ Branch 0 taken 11 times.
✓ Branch 1 taken 51 times.
62 if ( Subcatch[i].lidArea ) lidCount++;
149 }
150 }
151
2/2
✓ Branch 0 taken 11 times.
✓ Branch 1 taken 29 times.
40 if ( lidCount > 0 ) lid_writeSummary();
152
153
1/2
✓ Branch 0 taken 40 times.
✗ Branch 1 not taken.
40 if ( Nobjects[NODE] > 0 )
154 {
155 40 WRITE("");
156 40 WRITE("");
157 40 WRITE("************");
158 40 WRITE("Node Summary");
159 40 WRITE("************");
160 40 fprintf(Frpt.file,
161 "\n Invert Max. Ponded External");
162 40 fprintf(Frpt.file,
163 "\n Name Type Elev. Depth Area Inflow ");
164 40 fprintf(Frpt.file,
165 "\n -------------------------------------------------------------------------------");
166
2/2
✓ Branch 0 taken 3633 times.
✓ Branch 1 taken 40 times.
3673 for (i = 0; i < Nobjects[NODE]; i++)
167 {
168 10899 fprintf(Frpt.file, "\n %-20s %-16s%10.2f%10.2f%10.1f", Node[i].ID,
169 3633 NodeTypeWords[Node[i].type-JUNCTION],
170 3633 Node[i].invertElev*UCF(LENGTH),
171 3633 Node[i].fullDepth*UCF(LENGTH),
172 3633 Node[i].pondedArea*UCF(LENGTH)*UCF(LENGTH));
173
6/6
✓ Branch 0 taken 3576 times.
✓ Branch 1 taken 57 times.
✓ Branch 2 taken 681 times.
✓ Branch 3 taken 2895 times.
✓ Branch 4 taken 135 times.
✓ Branch 5 taken 546 times.
3633 if ( Node[i].extInflow || Node[i].dwfInflow || Node[i].rdiiInflow )
174 {
175 3087 fprintf(Frpt.file, " Yes");
176 }
177 }
178 }
179
180
2/2
✓ Branch 0 taken 30 times.
✓ Branch 1 taken 10 times.
40 if ( Nobjects[LINK] > 0 )
181 {
182 30 WRITE("");
183 30 WRITE("");
184 30 WRITE("************");
185 30 WRITE("Link Summary");
186 30 WRITE("************");
187 30 fprintf(Frpt.file,
188 "\n Name From Node To Node Type Length %%Slope Roughness");
189 30 fprintf(Frpt.file,
190 "\n ---------------------------------------------------------------------------------------------");
191
2/2
✓ Branch 0 taken 3609 times.
✓ Branch 1 taken 30 times.
3639 for (i = 0; i < Nobjects[LINK]; i++)
192 {
193 // --- list end nodes in their original orientation
194
2/2
✓ Branch 0 taken 3372 times.
✓ Branch 1 taken 237 times.
3609 if ( Link[i].direction == 1 )
195 3372 fprintf(Frpt.file, "\n %-16s %-16s %-16s ",
196 3372 Link[i].ID, Node[Link[i].node1].ID, Node[Link[i].node2].ID);
197 else
198 237 fprintf(Frpt.file, "\n %-16s %-16s %-16s ",
199 237 Link[i].ID, Node[Link[i].node2].ID, Node[Link[i].node1].ID);
200
201 // --- list link type
202
2/2
✓ Branch 0 taken 14 times.
✓ Branch 1 taken 3595 times.
3609 if ( Link[i].type == PUMP )
203 {
204 14 k = Link[i].subIndex;
205 14 fprintf(Frpt.file, "%-5s PUMP ",
206 14 PumpTypeWords[Pump[k].type]);
207 }
208 3595 else fprintf(Frpt.file, "%-12s",
209 3595 LinkTypeWords[Link[i].type-CONDUIT]);
210
211 // --- list length, slope and roughness for conduit links
212
2/2
✓ Branch 0 taken 3590 times.
✓ Branch 1 taken 19 times.
3609 if (Link[i].type == CONDUIT)
213 {
214 3590 k = Link[i].subIndex;
215 3590 fprintf(Frpt.file, "%10.1f%10.4f%10.4f",
216 3590 Conduit[k].length*UCF(LENGTH),
217 3590 Conduit[k].slope*100.0*Link[i].direction,
218 3590 Conduit[k].roughness);
219 }
220 }
221
222 30 WRITE("");
223 30 WRITE("");
224 30 WRITE("*********************");
225 30 WRITE("Cross Section Summary");
226 30 WRITE("*********************");
227 30 fprintf(Frpt.file,
228 "\n Full Full Hyd. Max. No. of Full");
229 30 fprintf(Frpt.file,
230 "\n Conduit Shape Depth Area Rad. Width Barrels Flow");
231 30 fprintf(Frpt.file,
232 "\n ---------------------------------------------------------------------------------------");
233
2/2
✓ Branch 0 taken 3609 times.
✓ Branch 1 taken 30 times.
3639 for (i = 0; i < Nobjects[LINK]; i++)
234 {
235
2/2
✓ Branch 0 taken 3590 times.
✓ Branch 1 taken 19 times.
3609 if (Link[i].type == CONDUIT)
236 {
237 3590 k = Link[i].subIndex;
238 3590 fprintf(Frpt.file, "\n %-16s ", Link[i].ID);
239
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3590 times.
3590 if ( Link[i].xsect.type == CUSTOM )
240 fprintf(Frpt.file, "%-16s ", Curve[Link[i].xsect.transect].ID);
241
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3590 times.
3590 else if ( Link[i].xsect.type == IRREGULAR )
242 fprintf(Frpt.file, "%-16s ",
243 Transect[Link[i].xsect.transect].ID);
244
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 3578 times.
3590 else if ( Link[i].xsect.type == STREET_XSECT )
245 12 fprintf(Frpt.file, "%-16s ",
246 12 Street[Link[i].xsect.transect].ID);
247 3578 else fprintf(Frpt.file, "%-16s ",
248 3578 XsectTypeWords[Link[i].xsect.type]);
249 3590 fprintf(Frpt.file, "%8.2f %8.2f %8.2f %8.2f %3d %8.2f",
250 3590 Link[i].xsect.yFull*UCF(LENGTH),
251 3590 Link[i].xsect.aFull*UCF(LENGTH)*UCF(LENGTH),
252 3590 Link[i].xsect.rFull*UCF(LENGTH),
253 3590 Link[i].xsect.wMax*UCF(LENGTH),
254 3590 Conduit[k].barrels,
255 3590 Link[i].qFull*UCF(FLOW));
256 }
257 }
258 }
259
260
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 40 times.
40 if (Nobjects[SHAPE] > 0)
261 {
262 WRITE("");
263 WRITE("");
264 WRITE("*************");
265 WRITE("Shape Summary");
266 WRITE("*************");
267 for (i = 0; i < Nobjects[SHAPE]; i++)
268 {
269 k = Shape[i].curve;
270 fprintf(Frpt.file, "\n\n Shape %s", Curve[k].ID);
271 fprintf(Frpt.file, "\n Area: ");
272 for ( m = 1; m < N_SHAPE_TBL; m++)
273 {
274 if ( m % 5 == 1 ) fprintf(Frpt.file,"\n ");
275 fprintf(Frpt.file, "%10.4f ", Shape[i].areaTbl[m]);
276 }
277 fprintf(Frpt.file, "\n Hrad: ");
278 for ( m = 1; m < N_SHAPE_TBL; m++)
279 {
280 if ( m % 5 == 1 ) fprintf(Frpt.file,"\n ");
281 fprintf(Frpt.file, "%10.4f ", Shape[i].hradTbl[m]);
282 }
283 fprintf(Frpt.file, "\n Width: ");
284 for ( m = 1; m < N_SHAPE_TBL; m++)
285 {
286 if ( m % 5 == 1 ) fprintf(Frpt.file,"\n ");
287 fprintf(Frpt.file, "%10.4f ", Shape[i].widthTbl[m]);
288 }
289 }
290 }
291
292
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 40 times.
40 if (Nobjects[TRANSECT] > 0)
293 {
294 WRITE("");
295 WRITE("");
296 WRITE("****************");
297 WRITE("Transect Summary");
298 WRITE("****************");
299 for (i = 0; i < Nobjects[TRANSECT]; i++)
300 {
301 fprintf(Frpt.file, "\n\n Transect %s", Transect[i].ID);
302 fprintf(Frpt.file, "\n Area: ");
303 for ( m = 1; m < N_TRANSECT_TBL; m++)
304 {
305 if ( m % 5 == 1 ) fprintf(Frpt.file,"\n ");
306 fprintf(Frpt.file, "%10.4f ", Transect[i].areaTbl[m]);
307 }
308 fprintf(Frpt.file, "\n Hrad: ");
309 for ( m = 1; m < N_TRANSECT_TBL; m++)
310 {
311 if ( m % 5 == 1 ) fprintf(Frpt.file,"\n ");
312 fprintf(Frpt.file, "%10.4f ", Transect[i].hradTbl[m]);
313 }
314 fprintf(Frpt.file, "\n Width: ");
315 for ( m = 1; m < N_TRANSECT_TBL; m++)
316 {
317 if ( m % 5 == 1 ) fprintf(Frpt.file,"\n ");
318 fprintf(Frpt.file, "%10.4f ", Transect[i].widthTbl[m]);
319 }
320 }
321 }
322
323
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 37 times.
40 if (Nobjects[STREET] > 0)
324 {
325 3 WRITE("");
326 3 WRITE("");
327 3 WRITE("**************");
328 3 WRITE("Street Summary");
329 3 WRITE("**************");
330
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 3 times.
6 for (i = 0; i < Nobjects[STREET]; i++)
331 {
332 3 fprintf(Frpt.file, "\n\n Street %s", Street[i].ID);
333 3 fprintf(Frpt.file, "\n Area: ");
334
2/2
✓ Branch 0 taken 150 times.
✓ Branch 1 taken 3 times.
153 for (m = 1; m < Street[i].transect.nTbl; m++)
335 {
336
2/2
✓ Branch 0 taken 30 times.
✓ Branch 1 taken 120 times.
150 if (m % 5 == 1) fprintf(Frpt.file, "\n ");
337 150 fprintf(Frpt.file, "%10.4f ", Street[i].transect.areaTbl[m]);
338 }
339 3 fprintf(Frpt.file, "\n Hrad: ");
340
2/2
✓ Branch 0 taken 150 times.
✓ Branch 1 taken 3 times.
153 for (m = 1; m < Street[i].transect.nTbl; m++)
341 {
342
2/2
✓ Branch 0 taken 30 times.
✓ Branch 1 taken 120 times.
150 if (m % 5 == 1) fprintf(Frpt.file, "\n ");
343 150 fprintf(Frpt.file, "%10.4f ", Street[i].transect.hradTbl[m]);
344 }
345 3 fprintf(Frpt.file, "\n Width: ");
346
2/2
✓ Branch 0 taken 150 times.
✓ Branch 1 taken 3 times.
153 for (m = 1; m < Street[i].transect.nTbl; m++)
347 {
348
2/2
✓ Branch 0 taken 30 times.
✓ Branch 1 taken 120 times.
150 if (m % 5 == 1) fprintf(Frpt.file, "\n ");
349 150 fprintf(Frpt.file, "%10.4f ", Street[i].transect.widthTbl[m]);
350 }
351 }
352 }
353 40 WRITE("");
354 }
355