Skip to content

Commit

Permalink
add API function to delete an opening. Not working yet
Browse files Browse the repository at this point in the history
  • Loading branch information
lrntct committed Dec 12, 2017
1 parent 199850c commit e09a327
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
1 change: 1 addition & 0 deletions include/toolkitAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ int DLLEXPORT swmm_setOutfallStage(int index, double stage);

int DLLEXPORT swmm_setNodeOpening(int nodeID, int idx, int oType, double A,
double l, double Co, double Cfw, double Csw);
int DLLEXPORT swmm_deleteNodeOpening(int nodeID, int idx);
int DLLEXPORT swmm_getNodeOpeningParam(int nodeID, int idx, int Param, double *value);
int DLLEXPORT swmm_getNodeOpeningFlow(int nodeID, int idx, double *inflow);
int DLLEXPORT swmm_getNodeOpeningType(int nodeID, int idx, int *type);
Expand Down
11 changes: 2 additions & 9 deletions src/coupling.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,17 +261,10 @@ void coupling_deleteOpening(int j, int idx)
// Input: j = node index
// idx = opening index
// Output: none
// Purpose: deletes an opening from a node.
// Purpose: delete an opening from a node.
//
{
TCoverOpening* opening;

opening = Node[j].coverOpening;
while ( opening )
{
if ( opening->ID == idx ) free(opening);
opening = opening->next;
}
// need to find the correct way to do it and preserve linked list.
}

//=============================================================================
Expand Down
18 changes: 18 additions & 0 deletions src/toolkitAPI.c
Original file line number Diff line number Diff line change
Expand Up @@ -1287,6 +1287,24 @@ int DLLEXPORT swmm_setNodeOpening(int nodeID, int idx, int oType, double A,
return(errcode);
}

int DLLEXPORT swmm_deleteNodeOpening(int nodeID, int idx)
//
// Input: nodeID = Index of desired node
// idx = opening's index
// Return: API Error
// Purpose: Sets Node opening parameters.
{
// Check if Open
if(swmm_IsOpenFlag() == FALSE) return(ERR_API_INPUTNOTOPEN);
// Check if Simulation is Running
if(swmm_IsStartedFlag() == TRUE) return(ERR_API_SIM_NRUNNING);
// Check if object index is within bounds
if (nodeID < 0 || nodeID >= Nobjects[NODE]) return(ERR_API_OBJECT_INDEX);

coupling_deleteOpening(nodeID, idx);
return(0);
}

int DLLEXPORT swmm_getNodeOpeningParam(int nodeID, int idx, int Param, double *value)
//
// Input: nodeID = Index of desired node
Expand Down

0 comments on commit e09a327

Please sign in to comment.