GCC Code Coverage Report


Directory: src/solver/
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 79.3% 169 / 0 / 213
Functions: 100.0% 1 / 0 / 1
Branches: 64.8% 70 / 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 38 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 38 int lidCount = 0;
37
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 38 times.
38 if ( ErrorCode ) return;
38
39 38 WRITE("");
40 38 WRITE("*************");
41 38 WRITE("Element Count");
42 38 WRITE("*************");
43 38 fprintf(Frpt.file, "\n Number of rain gages ...... %d", Nobjects[GAGE]);
44 38 fprintf(Frpt.file, "\n Number of subcatchments ... %d", Nobjects[SUBCATCH]);
45 38 fprintf(Frpt.file, "\n Number of nodes ........... %d", Nobjects[NODE]);
46 38 fprintf(Frpt.file, "\n Number of links ........... %d", Nobjects[LINK]);
47 38 fprintf(Frpt.file, "\n Number of pollutants ...... %d", Nobjects[POLLUT]);
48 38 fprintf(Frpt.file, "\n Number of land uses ....... %d", Nobjects[LANDUSE]);
49
50
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 33 times.
38 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 34 times.
38 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 25 times.
✓ Branch 1 taken 13 times.
38 if ( Nobjects[GAGE] > 0 )
96 {
97 25 WRITE("");
98 25 WRITE("");
99 25 WRITE("****************");
100 25 WRITE("Raingage Summary");
101 25 WRITE("****************");
102 25 fprintf(Frpt.file,
103 "\n Data Recording");
104 25 fprintf(Frpt.file,
105 "\n Name Data Source Type Interval ");
106 25 fprintf(Frpt.file,
107 "\n ------------------------------------------------------------------------");
108
2/2
✓ Branch 0 taken 28 times.
✓ Branch 1 taken 25 times.
53 for (i = 0; i < Nobjects[GAGE]; i++)
109 {
110
2/2
✓ Branch 0 taken 24 times.
✓ Branch 1 taken 4 times.
28 if ( Gage[i].tSeries >= 0 )
111 {
112 24 fprintf(Frpt.file, "\n %-20s %-30s ",
113 24 Gage[i].ID, Tseries[Gage[i].tSeries].ID);
114 24 fprintf(Frpt.file, "%-10s %3d min.",
115 24 RainTypeWords[Gage[i].rainType],
116 24 (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 13 times.
38 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 27 times.
38 if ( lidCount > 0 ) lid_writeSummary();
152
153
1/2
✓ Branch 0 taken 38 times.
✗ Branch 1 not taken.
38 if ( Nobjects[NODE] > 0 )
154 {
155 38 WRITE("");
156 38 WRITE("");
157 38 WRITE("************");
158 38 WRITE("Node Summary");
159 38 WRITE("************");
160 38 fprintf(Frpt.file,
161 "\n Invert Max. Ponded External");
162 38 fprintf(Frpt.file,
163 "\n Name Type Elev. Depth Area Inflow ");
164 38 fprintf(Frpt.file,
165 "\n -------------------------------------------------------------------------------");
166
2/2
✓ Branch 0 taken 186 times.
✓ Branch 1 taken 38 times.
224 for (i = 0; i < Nobjects[NODE]; i++)
167 {
168 558 fprintf(Frpt.file, "\n %-20s %-16s%10.2f%10.2f%10.1f", Node[i].ID,
169 186 NodeTypeWords[Node[i].type-JUNCTION],
170 186 Node[i].invertElev*UCF(LENGTH),
171 186 Node[i].fullDepth*UCF(LENGTH),
172 186 Node[i].pondedArea*UCF(LENGTH)*UCF(LENGTH));
173
4/6
✓ Branch 0 taken 143 times.
✓ Branch 1 taken 43 times.
✓ Branch 2 taken 143 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 143 times.
186 if ( Node[i].extInflow || Node[i].dwfInflow || Node[i].rdiiInflow )
174 {
175 43 fprintf(Frpt.file, " Yes");
176 }
177 }
178 }
179
180
2/2
✓ Branch 0 taken 28 times.
✓ Branch 1 taken 10 times.
38 if ( Nobjects[LINK] > 0 )
181 {
182 28 WRITE("");
183 28 WRITE("");
184 28 WRITE("************");
185 28 WRITE("Link Summary");
186 28 WRITE("************");
187 28 fprintf(Frpt.file,
188 "\n Name From Node To Node Type Length %%Slope Roughness");
189 28 fprintf(Frpt.file,
190 "\n ---------------------------------------------------------------------------------------------");
191
2/2
✓ Branch 0 taken 113 times.
✓ Branch 1 taken 28 times.
141 for (i = 0; i < Nobjects[LINK]; i++)
192 {
193 // --- list end nodes in their original orientation
194
1/2
✓ Branch 0 taken 113 times.
✗ Branch 1 not taken.
113 if ( Link[i].direction == 1 )
195 113 fprintf(Frpt.file, "\n %-16s %-16s %-16s ",
196 113 Link[i].ID, Node[Link[i].node1].ID, Node[Link[i].node2].ID);
197 else
198 fprintf(Frpt.file, "\n %-16s %-16s %-16s ",
199 Link[i].ID, Node[Link[i].node2].ID, Node[Link[i].node1].ID);
200
201 // --- list link type
202
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 108 times.
113 if ( Link[i].type == PUMP )
203 {
204 5 k = Link[i].subIndex;
205 5 fprintf(Frpt.file, "%-5s PUMP ",
206 5 PumpTypeWords[Pump[k].type]);
207 }
208 108 else fprintf(Frpt.file, "%-12s",
209 108 LinkTypeWords[Link[i].type-CONDUIT]);
210
211 // --- list length, slope and roughness for conduit links
212
2/2
✓ Branch 0 taken 103 times.
✓ Branch 1 taken 10 times.
113 if (Link[i].type == CONDUIT)
213 {
214 103 k = Link[i].subIndex;
215 103 fprintf(Frpt.file, "%10.1f%10.4f%10.4f",
216 103 Conduit[k].length*UCF(LENGTH),
217 103 Conduit[k].slope*100.0*Link[i].direction,
218 103 Conduit[k].roughness);
219 }
220 }
221
222 28 WRITE("");
223 28 WRITE("");
224 28 WRITE("*********************");
225 28 WRITE("Cross Section Summary");
226 28 WRITE("*********************");
227 28 fprintf(Frpt.file,
228 "\n Full Full Hyd. Max. No. of Full");
229 28 fprintf(Frpt.file,
230 "\n Conduit Shape Depth Area Rad. Width Barrels Flow");
231 28 fprintf(Frpt.file,
232 "\n ---------------------------------------------------------------------------------------");
233
2/2
✓ Branch 0 taken 113 times.
✓ Branch 1 taken 28 times.
141 for (i = 0; i < Nobjects[LINK]; i++)
234 {
235
2/2
✓ Branch 0 taken 103 times.
✓ Branch 1 taken 10 times.
113 if (Link[i].type == CONDUIT)
236 {
237 103 k = Link[i].subIndex;
238 103 fprintf(Frpt.file, "\n %-16s ", Link[i].ID);
239
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 103 times.
103 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 103 times.
103 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 91 times.
103 else if ( Link[i].xsect.type == STREET_XSECT )
245 12 fprintf(Frpt.file, "%-16s ",
246 12 Street[Link[i].xsect.transect].ID);
247 91 else fprintf(Frpt.file, "%-16s ",
248 91 XsectTypeWords[Link[i].xsect.type]);
249 103 fprintf(Frpt.file, "%8.2f %8.2f %8.2f %8.2f %3d %8.2f",
250 103 Link[i].xsect.yFull*UCF(LENGTH),
251 103 Link[i].xsect.aFull*UCF(LENGTH)*UCF(LENGTH),
252 103 Link[i].xsect.rFull*UCF(LENGTH),
253 103 Link[i].xsect.wMax*UCF(LENGTH),
254 103 Conduit[k].barrels,
255 103 Link[i].qFull*UCF(FLOW));
256 }
257 }
258 }
259
260
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 38 times.
38 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 38 times.
38 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 35 times.
38 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 38 WRITE("");
354 }
355