CSol
Public Member Functions | List of all members
PipeNetwork Class Reference

#include <pn/csol_pn.h>

Public Member Functions

 PipeNetwork ()
 PipeNetwork constructor. More...
 
 PipeNetwork (const PipeNetwork &)
 PipeNetwork copy constructor. More...
 
 ~PipeNetwork ()
 PipeNetwork destructor. More...
 
bool check (bool)
 PipeNetwork integrity check. More...
 
void clearData ()
 Clears PipeNetwork internal data. More...
 
void clearNetwork ()
 Clears PipeNetwork sites and pipes. More...
 
REAL get_outlet_flow (int id)
 
REAL get_outlet_head (int id)
 
const std::vector< Pipe * > & getPipes () const
 
const std::vector< Site * > & getSites () const
 
void inc_outlet_head (int id, REAL dhead)
 
bool init (CSol_Solver &, int workGroupSize_=0)
 PipeNetwork initialisation. More...
 
void parseControl (QXmlStreamReader &, std::vector< Site * > &)
 PipeNetwork xml control node parsing. More...
 
void parseJunction (QXmlStreamReader &, std::vector< Site * > &)
 PipeNetwork xml junction parsing. More...
 
void parsePipe (QXmlStreamReader &, std::vector< Pipe * > &)
 PipeNetwork xml pipe parsing. More...
 
void parseTerminator (QXmlStreamReader &, std::vector< Site * > &)
 PipeNetwork xml terminator parsing. More...
 
bool read (QString, bool)
 PipeNetwork xml data read. More...
 
bool reorderCuthillMcKee ()
 PipeNetwork reordering operation. More...
 
void set_outlet_head (int id, REAL head)
 
void setPipes (std::vector< Pipe * > pipes)
 Set the pipe network pipes. More...
 
void setSites (std::vector< Site * > sites)
 Set the pipe network sites. More...
 
REAL sign (REAL)
 Mathematical sign function implementation. More...
 
bool solve ()
 PipeNetwork solve step. More...
 
QString uniqueString (QString, QString)
 Unique string function. More...
 
bool write (QString)
 PipeNetwork xml data write. More...
 

Constructor & Destructor Documentation

PipeNetwork ( const PipeNetwork r)

Member Function Documentation

bool check ( bool  reorder)

Checks nodes and connections are correctly ordered for solving.

Parameters
reorderapply Cuthill-McKee re-ordering.
void clearData ( )
void clearNetwork ( )
REAL get_outlet_flow ( int  id)
inline
REAL get_outlet_head ( int  id)
inline
const std::vector<Pipe *>& getPipes ( ) const
inline
const std::vector<Site *>& getSites ( ) const
inline
void inc_outlet_head ( int  id,
REAL  dhead 
)
inline
bool init ( CSol_Solver solver,
int  workGroupSize_ = 0 
)
Parameters
solversolver handle.
workGroupSize_OpenCL workgroup size to use.
void parseControl ( QXmlStreamReader &  xmlStream,
std::vector< Site * > &  controls 
)
Parameters
xmlStreamxml stream handle.
controlscontrol node list.
void parseJunction ( QXmlStreamReader &  xmlStream,
std::vector< Site * > &  junctions 
)
Parameters
xmlStreamxml stream handle.
junctionsjunction list.
void parsePipe ( QXmlStreamReader &  xmlStream,
std::vector< Pipe * > &  pipes 
)
Parameters
xmlStreamxml stream handle.
pipespipe list.
void parseTerminator ( QXmlStreamReader &  xmlStream,
std::vector< Site * > &  terminators 
)
Parameters
xmlStreamxml stream handle.
terminatorsterminator list.
bool read ( QString  dataFileName,
bool  reorder 
)

Read a pipe network from an xml network file.

Parameters
dataFileNamexml file name.
reorderapply Cuthill-McKee re-ordering.
bool reorderCuthillMcKee ( )

Reorders nodes to reduce matrix bandwidth using Cuthill-McKee algorithm.

void set_outlet_head ( int  id,
REAL  head 
)
inline
void setPipes ( std::vector< Pipe * >  pipes)
void setSites ( std::vector< Site * >  sites)
REAL sign ( REAL  a)
bool solve ( )

Solves the pipe network for pressure heads in sites and flow rates in pipes \ using a pressure relaxation method.

QString uniqueString ( QString  id0,
QString  id1 
)

Returns a unique string r from id0 and id1 with the property that r(id0, id1) == r(id1, id0). This is used to uniquely identify site connection irrespective of the order the sites are given.

bool write ( QString  dataFileName)

Writes a pipe network to an xml network file.

Parameters
dataFileNamexml file name.