You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The library doesn't decrease the number of pipes (net.Npipes) when a pipe is removed from the network.
See this example:
#include<iostream>
#include<string>
#include"epanet2_2.h"
#include"types.h"intmain() {
int errcode=0;
EN_Project ph=NULL;
int errco = EN_createproject(&ph);
if (errco > 100) return1;
errco = EN_open(ph, "Net1.inp", "Net1.rpt", "");
if (errco > 100) return2;
// Print number of links and pipesint nlinks=0;
errco = EN_getcount(ph, EN_LINKCOUNT, &nlinks);
if (errco > 100) return1;
std::cout << "Number of links: " << nlinks << std::endl;
std::cout << "Number of pipes: " << ph->network.Npipes << std::endl;
std::cout << "Adding a pipe..." <<std::endl;
intindex=0;
errco = EN_addlink(ph, "newDupLink", EN_PIPE, "12", "13", &index);
if (errco > 100) return2;
errco = EN_setpipedata(ph, index, 5280, 12, 130, 0);
if (errcode > 100 ) return2;
errco = EN_getcount(ph, EN_LINKCOUNT, &nlinks);
if (errco > 100) return2;
std::cout << "Number of links: " << nlinks << std::endl;
std::cout << "Number of pipes: " << ph->network.Npipes << std::endl;
std::cout << "Removing the pipe..." <<std::endl;
errco = EN_getlinkindex(ph, "newDupLink", &index);
if (errco > 100) return3;
errco = EN_deletelink(ph, index, EN_UNCONDITIONAL);
errco = EN_getcount(ph, EN_LINKCOUNT, &nlinks);
if (errco > 100) return3;
std::cout << "Number of links: " << nlinks << std::endl;
std::cout << "Number of pipes: " << ph->network.Npipes << std::endl;
// Close EN_close(ph);
return0;
}
This is not a critical bug as the variable Npipes can not be retrieved (you can only get the number of links and net.Nlinks is correctly decreased) and is actually never used. Unless types.h is included and one specifically accesses p->network.Npipes it is not possible to see this error.
However, if in the future we allow to retrieve the number of pipes or this variable will be used for some reasons, this would become a critical bug.
The text was updated successfully, but these errors were encountered:
zannads
added a commit
to zannads/EPANET
that referenced
this issue
May 23, 2024
The library doesn't decrease the number of pipes (
net.Npipes
) when a pipe is removed from the network.See this example:
This is not a critical bug as the variable Npipes can not be retrieved (you can only get the number of links and net.Nlinks is correctly decreased) and is actually never used. Unless
types.h
is included and one specifically accessesp->network.Npipes
it is not possible to see this error.However, if in the future we allow to retrieve the number of pipes or this variable will be used for some reasons, this would become a critical bug.
The text was updated successfully, but these errors were encountered: