Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hydraulicModel
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘乐
hydraulicModel
Commits
7a7924a1
Commit
7a7924a1
authored
Jul 06, 2020
by
刘乐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
inp
parent
06584466
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
10 deletions
+25
-10
CivHydrCalc.cpp
pandaAnalysis/CivHydrCalc.cpp
+5
-5
CivNewInp.cpp
pandaAnalysis/CivNewInp.cpp
+13
-1
CivNewInp.h
pandaAnalysis/CivNewInp.h
+1
-0
CivPgConn.cpp
pandaDbManager/CivPgConn.cpp
+6
-4
No files found.
pandaAnalysis/CivHydrCalc.cpp
View file @
7a7924a1
...
@@ -229,12 +229,12 @@ bool CivHydrCalc::qualitySimulation(char* inpFile, char* rptFile, char* binOutFi
...
@@ -229,12 +229,12 @@ bool CivHydrCalc::qualitySimulation(char* inpFile, char* rptFile, char* binOutFi
bool
CivHydrCalc
::
exportInp
(
char
*
fileName
)
bool
CivHydrCalc
::
exportInp
(
char
*
fileName
)
{
{
//1 ,获取管网组件
//
//
1 ,获取管网组件
if
(
!
mDbConn
)
//
if (!mDbConn)
return
false
;
//
return false;
if
(
!
mDbConn
->
open
())
//
if (!mDbConn->open())
return
false
;
//
return false;
CivBuilder
*
builder
=
new
CivInpBuilder
();
CivBuilder
*
builder
=
new
CivInpBuilder
();
builder
->
registDb
(
mPgConn
);
builder
->
registDb
(
mPgConn
);
...
...
pandaAnalysis/CivNewInp.cpp
View file @
7a7924a1
...
@@ -4,6 +4,11 @@
...
@@ -4,6 +4,11 @@
bool
CivNewInp
::
writeToFile
(
char
*
fileName
)
bool
CivNewInp
::
writeToFile
(
char
*
fileName
)
{
{
// 检查是否存在值
std
::
string
res
=
mTextStream
.
str
();
if
(
res
.
empty
())
return
false
;
std
::
ofstream
outFile
(
fileName
);
std
::
ofstream
outFile
(
fileName
);
if
(
!
outFile
)
if
(
!
outFile
)
{
{
...
@@ -13,7 +18,7 @@ bool CivNewInp::writeToFile(char* fileName)
...
@@ -13,7 +18,7 @@ bool CivNewInp::writeToFile(char* fileName)
}
}
else
else
{
{
outFile
<<
mTextStream
.
str
()
;
outFile
<<
res
;
outFile
.
close
();
outFile
.
close
();
mTextStream
.
clear
();
mTextStream
.
clear
();
mTextStream
.
str
(
""
);
mTextStream
.
str
(
""
);
...
@@ -50,7 +55,11 @@ std::string CivNewInp::currentTime()
...
@@ -50,7 +55,11 @@ std::string CivNewInp::currentTime()
void
CivNewInp
::
setNode
(
const
CivNode
&
node
)
void
CivNewInp
::
setNode
(
const
CivNode
&
node
)
{
{
auto
tables
=
node
.
mTables
;
auto
tables
=
node
.
mTables
;
if
(
tables
.
size
()
<=
0
)
return
;
writeHead
(
"JUNCTIONS"
);
writeHead
(
"JUNCTIONS"
);
for
(
auto
iter
=
tables
.
rbegin
();
iter
!=
tables
.
rend
();
iter
++
)
for
(
auto
iter
=
tables
.
rbegin
();
iter
!=
tables
.
rend
();
iter
++
)
{
{
...
@@ -66,6 +75,9 @@ void CivNewInp::setNode(const CivNode& node)
...
@@ -66,6 +75,9 @@ void CivNewInp::setNode(const CivNode& node)
void
CivNewInp
::
setPipes
(
const
CivPipe
&
pipes
)
void
CivNewInp
::
setPipes
(
const
CivPipe
&
pipes
)
{
{
auto
tables
=
pipes
.
mTables
;
auto
tables
=
pipes
.
mTables
;
if
(
tables
.
size
()
<=
0
)
return
;
writeHead
(
"PIPES"
);
writeHead
(
"PIPES"
);
for
(
auto
iter
=
tables
.
rbegin
();
iter
!=
tables
.
rend
();
iter
++
)
for
(
auto
iter
=
tables
.
rbegin
();
iter
!=
tables
.
rend
();
iter
++
)
{
{
...
...
pandaAnalysis/CivNewInp.h
View file @
7a7924a1
...
@@ -62,6 +62,7 @@ private:
...
@@ -62,6 +62,7 @@ private:
void
inline
writeStringFormat
(
const
std
::
string
&
s
,
const
std
::
string
&
sep
=
"
\t
"
);
void
inline
writeStringFormat
(
const
std
::
string
&
s
,
const
std
::
string
&
sep
=
"
\t
"
);
void
inline
writeHead
(
const
std
::
string
&
head
);
void
inline
writeHead
(
const
std
::
string
&
head
);
std
::
string
currentTime
();
std
::
string
currentTime
();
private
:
private
:
std
::
ostringstream
mTextStream
;
std
::
ostringstream
mTextStream
;
};
};
...
...
pandaDbManager/CivPgConn.cpp
View file @
7a7924a1
...
@@ -34,6 +34,8 @@ void CivPgConn::close()
...
@@ -34,6 +34,8 @@ void CivPgConn::close()
bool
CivPgConn
::
tableExist
(
StrQuote
tableName
)
bool
CivPgConn
::
tableExist
(
StrQuote
tableName
)
{
{
char
sql
[
256
]
=
"select count(*) from pg_class where relname = '"
;
char
sql
[
256
]
=
"select count(*) from pg_class where relname = '"
;
strcat_s
(
sql
,
tableName
.
c_str
());
strcat_s
(
sql
,
tableName
.
c_str
());
strcat_s
(
sql
,
"'"
);
strcat_s
(
sql
,
"'"
);
...
@@ -50,10 +52,10 @@ bool CivPgConn::tableExist(StrQuote tableName)
...
@@ -50,10 +52,10 @@ bool CivPgConn::tableExist(StrQuote tableName)
bool
CivPgConn
::
execSql
(
Str
sql
)
bool
CivPgConn
::
execSql
(
Str
sql
)
{
{
if
(
mConn
==
nullptr
)
if
(
sql
.
empty
()
)
return
false
;
return
false
;
if
(
sql
.
empty
())
if
(
!
open
())
return
false
;
return
false
;
mResult
=
PQexec
(
mConn
,
sql
.
c_str
());
mResult
=
PQexec
(
mConn
,
sql
.
c_str
());
...
@@ -100,7 +102,7 @@ bool CivPgConn::getNode(CivNode& node)
...
@@ -100,7 +102,7 @@ bool CivPgConn::getNode(CivNode& node)
nodeTable
.
PatternId
=
PQgetvalue
(
mResult
,
i
,
3
);
nodeTable
.
PatternId
=
PQgetvalue
(
mResult
,
i
,
3
);
node
.
addItem
(
nodeTable
);
node
.
addItem
(
nodeTable
);
}
}
PQclear
(
mResult
);
PQclear
(
mResult
);
return
true
;
return
true
;
}
}
...
@@ -376,7 +378,7 @@ bool CivPgConn::getParameter(std::vector<CivParameter>& params)
...
@@ -376,7 +378,7 @@ bool CivPgConn::getParameter(std::vector<CivParameter>& params)
pTable
.
name
=
PQgetvalue
(
mResult
,
i
,
0
);
pTable
.
name
=
PQgetvalue
(
mResult
,
i
,
0
);
pTable
.
val
=
PQgetvalue
(
mResult
,
i
,
1
);
pTable
.
val
=
PQgetvalue
(
mResult
,
i
,
1
);
char
*
type
=
PQgetvalue
(
mResult
,
i
,
1
);
char
*
type
=
PQgetvalue
(
mResult
,
i
,
2
);
tempMap
[
type
].
push_back
(
pTable
);
tempMap
[
type
].
push_back
(
pTable
);
}
}
// 遍历临时存储的数据拼接参数对象
// 遍历临时存储的数据拼接参数对象
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment