Set/Get node & link tags added

This commit is contained in:
Lew Rossman
2025-02-19 09:49:09 -05:00
parent c8db9c1655
commit 7a1673994c
20 changed files with 252 additions and 61 deletions

View File

@@ -7,7 +7,7 @@ Description: parses network data from a line of an EPANET input file
Authors: see AUTHORS
Copyright: see AUTHORS
License: see LICENSE
Last Updated: 02/11/2025
Last Updated: 02/14/2025
******************************************************************************
*/
@@ -2023,7 +2023,7 @@ int optionchoice(Project *pr, int n)
int optionvalue(Project *pr, int n)
/*
**-------------------------------------------------------------
** Input: *line = line read from input file
** Input: n = index of last input token
** Output: returns error code
** Purpose: processes numerical value [OPTIONS] data
** Formats:
@@ -2170,7 +2170,42 @@ int optionvalue(Project *pr, int n)
return 0;
}
int tagdata(Project *pr)
/*
**-------------------------------------------------------------
** Input: none
** Output: returns error code
** Purpose: processes [TAGS] data
** Formats:
** NODE id tag
** LINK id tag
**--------------------------------------------------------------
*/
{
Network *net = &pr->network;
Parser *parser = &pr->parser;
int j, n;
// Check for sufficient data
n = parser->Ntokens;
if (n < 3) return 201;
// First keyword is NODE
if (match(parser->Tok[0], w_NODE))
{
if ((j = findnode(net, parser->Tok[1])) == 0) return setError(parser, 0, 203);
xstrcpy(&net->Node[j].Tag, parser->Tok[2], MAXMSG);
}
// First keyword is LINK
else if (match(parser->Tok[0], w_LINK))
{
if ((j = findlink(net, parser->Tok[1])) == 0) return setError(parser, 0, 203);
xstrcpy(&net->Link[j].Tag, parser->Tok[2], MAXMSG);
}
return 0;
}
void changestatus(Network *net, int j, StatusType status, double y)
/*
**--------------------------------------------------------------