Commit bf0bd3c8 authored by 刘乐's avatar 刘乐

1,水力模型接口

parent 0151749c
...@@ -2,3 +2,9 @@ EPNAET2/x64/ ...@@ -2,3 +2,9 @@ EPNAET2/x64/
pandaAnalysis/x64/ pandaAnalysis/x64/
pandaDbManager/x64/ pandaDbManager/x64/
.vs/ .vs/
/pandaHydrCalcMiddle/x64/Release
/pandaHydrDemo/bin/Release
/pandaHydrDemo/obj/Debug
/pandaHydrDemo/obj/Release
/pandaHydrDemo/bin/Debug
/EPNAET2/Release
...@@ -9,7 +9,9 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pandaAnalysis", "pandaAnaly ...@@ -9,7 +9,9 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pandaAnalysis", "pandaAnaly
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EPNAET2", "EPNAET2\EPNAET2.vcxproj", "{BE73E098-3D8C-4F80-88DD-B36A2BB68B64}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EPNAET2", "EPNAET2\EPNAET2.vcxproj", "{BE73E098-3D8C-4F80-88DD-B36A2BB68B64}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "pandaHydrCalc", "pandaHydrCalc\pandaHydrCalc.csproj", "{CBCA26F6-849E-4298-9AC0-07A01C21A543}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pandaHydrCalcMiddle", "pandaHydrCalcMiddle\pandaHydrCalcMiddle.vcxproj", "{26FC1DC0-4EEE-44DA-B409-8F392D37B67E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "pandaHydrDemo", "pandaHydrDemo\pandaHydrDemo.csproj", "{5BDF427E-7ACB-4CE9-95B2-CCD9EA5879CD}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
...@@ -51,18 +53,28 @@ Global ...@@ -51,18 +53,28 @@ Global
{BE73E098-3D8C-4F80-88DD-B36A2BB68B64}.Release|x64.Build.0 = Release|x64 {BE73E098-3D8C-4F80-88DD-B36A2BB68B64}.Release|x64.Build.0 = Release|x64
{BE73E098-3D8C-4F80-88DD-B36A2BB68B64}.Release|x86.ActiveCfg = Release|Win32 {BE73E098-3D8C-4F80-88DD-B36A2BB68B64}.Release|x86.ActiveCfg = Release|Win32
{BE73E098-3D8C-4F80-88DD-B36A2BB68B64}.Release|x86.Build.0 = Release|Win32 {BE73E098-3D8C-4F80-88DD-B36A2BB68B64}.Release|x86.Build.0 = Release|Win32
{CBCA26F6-849E-4298-9AC0-07A01C21A543}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {26FC1DC0-4EEE-44DA-B409-8F392D37B67E}.Debug|Any CPU.ActiveCfg = Debug|Win32
{CBCA26F6-849E-4298-9AC0-07A01C21A543}.Debug|Any CPU.Build.0 = Debug|Any CPU {26FC1DC0-4EEE-44DA-B409-8F392D37B67E}.Debug|x64.ActiveCfg = Debug|x64
{CBCA26F6-849E-4298-9AC0-07A01C21A543}.Debug|x64.ActiveCfg = Debug|Any CPU {26FC1DC0-4EEE-44DA-B409-8F392D37B67E}.Debug|x64.Build.0 = Debug|x64
{CBCA26F6-849E-4298-9AC0-07A01C21A543}.Debug|x64.Build.0 = Debug|Any CPU {26FC1DC0-4EEE-44DA-B409-8F392D37B67E}.Debug|x86.ActiveCfg = Debug|Win32
{CBCA26F6-849E-4298-9AC0-07A01C21A543}.Debug|x86.ActiveCfg = Debug|Any CPU {26FC1DC0-4EEE-44DA-B409-8F392D37B67E}.Debug|x86.Build.0 = Debug|Win32
{CBCA26F6-849E-4298-9AC0-07A01C21A543}.Debug|x86.Build.0 = Debug|Any CPU {26FC1DC0-4EEE-44DA-B409-8F392D37B67E}.Release|Any CPU.ActiveCfg = Release|Win32
{CBCA26F6-849E-4298-9AC0-07A01C21A543}.Release|Any CPU.ActiveCfg = Release|Any CPU {26FC1DC0-4EEE-44DA-B409-8F392D37B67E}.Release|x64.ActiveCfg = Release|x64
{CBCA26F6-849E-4298-9AC0-07A01C21A543}.Release|Any CPU.Build.0 = Release|Any CPU {26FC1DC0-4EEE-44DA-B409-8F392D37B67E}.Release|x64.Build.0 = Release|x64
{CBCA26F6-849E-4298-9AC0-07A01C21A543}.Release|x64.ActiveCfg = Release|Any CPU {26FC1DC0-4EEE-44DA-B409-8F392D37B67E}.Release|x86.ActiveCfg = Release|Win32
{CBCA26F6-849E-4298-9AC0-07A01C21A543}.Release|x64.Build.0 = Release|Any CPU {26FC1DC0-4EEE-44DA-B409-8F392D37B67E}.Release|x86.Build.0 = Release|Win32
{CBCA26F6-849E-4298-9AC0-07A01C21A543}.Release|x86.ActiveCfg = Release|Any CPU {5BDF427E-7ACB-4CE9-95B2-CCD9EA5879CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CBCA26F6-849E-4298-9AC0-07A01C21A543}.Release|x86.Build.0 = Release|Any CPU {5BDF427E-7ACB-4CE9-95B2-CCD9EA5879CD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5BDF427E-7ACB-4CE9-95B2-CCD9EA5879CD}.Debug|x64.ActiveCfg = Debug|Any CPU
{5BDF427E-7ACB-4CE9-95B2-CCD9EA5879CD}.Debug|x64.Build.0 = Debug|Any CPU
{5BDF427E-7ACB-4CE9-95B2-CCD9EA5879CD}.Debug|x86.ActiveCfg = Debug|Any CPU
{5BDF427E-7ACB-4CE9-95B2-CCD9EA5879CD}.Debug|x86.Build.0 = Debug|Any CPU
{5BDF427E-7ACB-4CE9-95B2-CCD9EA5879CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5BDF427E-7ACB-4CE9-95B2-CCD9EA5879CD}.Release|Any CPU.Build.0 = Release|Any CPU
{5BDF427E-7ACB-4CE9-95B2-CCD9EA5879CD}.Release|x64.ActiveCfg = Release|Any CPU
{5BDF427E-7ACB-4CE9-95B2-CCD9EA5879CD}.Release|x64.Build.0 = Release|Any CPU
{5BDF427E-7ACB-4CE9-95B2-CCD9EA5879CD}.Release|x86.ActiveCfg = Release|Any CPU
{5BDF427E-7ACB-4CE9-95B2-CCD9EA5879CD}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include "CivTypes.h" #include "CivTypes.h"
#include "CivCommonUtils.h" #include "CivCommonUtils.h"
#include "Epanet2.h" #include "Epanet2.h"
#include "CivInp.h"
#include <iostream> #include <iostream>
...@@ -17,7 +18,7 @@ CivHydrCalc::~CivHydrCalc() ...@@ -17,7 +18,7 @@ CivHydrCalc::~CivHydrCalc()
delete mDbConn; delete mDbConn;
} }
bool CivHydrCalc::simulation(char* fileName, char* rptFile, char* binOutFile) bool CivHydrCalc::hydrSimulation(char* fileName, char* rptFile, char* binOutFile)
{ {
if (!exportInp(fileName)) if (!exportInp(fileName))
...@@ -79,6 +80,12 @@ bool CivHydrCalc::simulation(char* fileName, char* rptFile, char* binOutFile) ...@@ -79,6 +80,12 @@ bool CivHydrCalc::simulation(char* fileName, char* rptFile, char* binOutFile)
return true; return true;
} }
bool CivHydrCalc::qualitySimulation(char* inpFile, char* rptFile, char* binOutFile)
{
return true;
}
bool CivHydrCalc::exportInp(char* fileName) bool CivHydrCalc::exportInp(char* fileName)
{ {
//1 ,获取管网组件 //1 ,获取管网组件
...@@ -410,20 +417,3 @@ void CivHydrCalc::getLinkResult(short time) ...@@ -410,20 +417,3 @@ void CivHydrCalc::getLinkResult(short time)
} }
mDbConn->updateLink(linkItems); mDbConn->updateLink(linkItems);
} }
bool DLLEXPORT dynamicCompute(std::string uri, std::string netName, std::string flag)
{
char* finalUri = const_cast<char*>(uri.c_str());
CivHydrCalc calc(finalUri, netName);
char fileName[20];
char rptR[20];
char outBinFile[20];
const char* file = "test.inp";
strcpy_s(fileName, "test.inp");
strcpy_s(rptR, "test.rpt");
strcpy_s(outBinFile, "test.bin");
return calc.simulation(fileName, rptR, outBinFile);
}
\ No newline at end of file
...@@ -21,14 +21,21 @@ public: ...@@ -21,14 +21,21 @@ public:
*@binOutFile: 二进制输出文件 *@binOutFile: 二进制输出文件
*@pviewprog: 回调函数 *@pviewprog: 回调函数
*/ */
bool simulation(char* inpFile, char* rptFile, char* binOutFile); bool hydrSimulation(char* inpFile, char* rptFile, char* binOutFile);
/**
*@brief 水质模拟计算
*@inpFile:inp文件
*@rptFile: 输出文件
*@binOutFile: 二进制输出文件
*@pviewprog: 回调函数
*/
bool qualitySimulation(char* inpFile, char* rptFile, char* binOutFile);
/** /**
*@brief 导出inp文件 *@brief 导出inp文件
*/ */
bool exportInp(char* fileName); bool exportInp(char* fileName);
private: private:
/** /**
*@brief 解析表字段名,按顺序写入 *@brief 解析表字段名,按顺序写入
...@@ -49,17 +56,13 @@ private: ...@@ -49,17 +56,13 @@ private:
*/ */
void getLinkResult(short time); void getLinkResult(short time);
/**
*@brief 获取运行过程产生的错误
*/
std::string getLastError() { return mLastError; }
private: private:
CivDbConnection* mDbConn; CivDbConnection* mDbConn;
std::string mNetname; std::string mNetname;
std::string mLastError;
}; };
#if defined(__cplusplus)
extern "C" {
#endif
// 动态计算接口
bool DLLEXPORT dynamicCompute(std::string uri, std::string netName, std::string flag);
#if defined(__cplusplus)
}
#endif
...@@ -17,7 +17,7 @@ int main(int argc, char* argv[]) ...@@ -17,7 +17,7 @@ int main(int argc, char* argv[])
strcpy_s(outBinFile, "test.bin"); strcpy_s(outBinFile, "test.bin");
// calc->exportInp(fileName); // calc->exportInp(fileName);
calc->simulation(fileName, rptR, outBinFile); // calc->simulation(fileName, rptR, outBinFile);
delete calc; delete calc;
return 0; return 0;
} }
\ No newline at end of file
...@@ -123,6 +123,8 @@ ...@@ -123,6 +123,8 @@
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(OUTDIR)..\lib</AdditionalLibraryDirectories>
<ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
...@@ -143,7 +145,12 @@ ...@@ -143,7 +145,12 @@
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>libpq.lib;pandaDbManager.lib;EPNAET2.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>libpq.lib;pandaDbManager.lib;EPNAET2.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OUTDIR)..\lib</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(OUTDIR)..\lib</AdditionalLibraryDirectories>
<ImportLibrary>$(OutDir)..\lib\$(TargetName).lib</ImportLibrary>
</Link> </Link>
<PostBuildEvent>
<Command>copy CivHydrCalc.h $(OutDir)..\include /y
copy CivInp.h $(OutDir)..\include /y</Command>
</PostBuildEvent>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\pandaDbManager\CivCommonUtils.cpp" /> <ClCompile Include="..\pandaDbManager\CivCommonUtils.cpp" />
......
...@@ -106,12 +106,10 @@ bool CivDbConnection::updateNode(const NodeResultItems& nodeItems) ...@@ -106,12 +106,10 @@ bool CivDbConnection::updateNode(const NodeResultItems& nodeItems)
PQstatus(mConn); PQstatus(mConn);
if (PQstatus(mConn) != PGRES_COMMAND_OK) // or conn==NULL if (PQstatus(mConn) != PGRES_COMMAND_OK) // or conn==NULL
{ {
std::cout << PQerrorMessage(mConn) << std::endl; mLastError = PQresultErrorMessage(result);
std::cout << PQresultErrorMessage(result) << std::endl;
continue; continue;
} }
std::cout << PQerrorMessage(mConn) << std::endl;
std::cout << PQresultErrorMessage(result) << std::endl;
PQclear(result); PQclear(result);
} }
...@@ -170,12 +168,9 @@ bool CivDbConnection::updateLink(const LinkResultItems& lineItems) ...@@ -170,12 +168,9 @@ bool CivDbConnection::updateLink(const LinkResultItems& lineItems)
PQstatus(mConn); PQstatus(mConn);
if (PQstatus(mConn) != PGRES_COMMAND_OK ) // or conn==NULL if (PQstatus(mConn) != PGRES_COMMAND_OK ) // or conn==NULL
{ {
std::cout << PQerrorMessage(mConn) << std::endl; mLastError = PQresultErrorMessage(result);
std::cout << PQresultErrorMessage(result) << std::endl;
continue; continue;
} }
std::cout << PQerrorMessage(mConn) << std::endl;
std::cout << PQresultErrorMessage(result) << std::endl;
PQclear(result); PQclear(result);
} }
......
...@@ -55,6 +55,8 @@ private: ...@@ -55,6 +55,8 @@ private:
bool mIsOpen = false; bool mIsOpen = false;
char* mUri; char* mUri;
char* mLastError;
char mLinkParam[256]; char mLinkParam[256];
char mNodeParam[256]; char mNodeParam[256];
}; };
\ No newline at end of file
...@@ -78,6 +78,7 @@ ...@@ -78,6 +78,7 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
<OutDir>..\..\hModelProgram\Program\</OutDir>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
...@@ -123,6 +124,8 @@ ...@@ -123,6 +124,8 @@
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<ImportLibrary>$(OutDir)..\lib\$(TargetName).lib</ImportLibrary>
<AdditionalDependencies>libpq.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
......
#include "CivHydrCalcMiddle.h"
namespace CivHydr {
CivHydrCalcMiddle::CivHydrCalcMiddle(String^ uri, String^ netName)
{
char* curi = StringToCharStar(uri);
std::string cNetName = StringToCharStar(netName);
mHydrCalc = new CivHydrCalc(curi, cNetName);
}
CivHydrCalcMiddle::~CivHydrCalcMiddle()
{
delete mHydrCalc;
}
Boolean CivHydrCalcMiddle::simulation(String^ flag)
{
if (flag == "HDY")
return hyDrCompute();
else if (flag == "QUALITY")
return qualityCompute();
return false;
}
Boolean CivHydrCalcMiddle::hyDrCompute()
{
return mHydrCalc->hydrSimulation(mInpFile, mRptFile, mBinOutFile);
}
Boolean CivHydrCalcMiddle::qualityCompute()
{
return mHydrCalc->qualitySimulation(mInpFile, mRptFile, mBinOutFile);
}
void CivHydrCalcMiddle::setInpFile(String^ inpFileName)
{
mInpFile = StringToCharStar(inpFileName);
}
void CivHydrCalcMiddle::setReportFile(String^ rptFile)
{
mRptFile = StringToCharStar(rptFile);
}
void CivHydrCalcMiddle::setOutBinFile(String^ outBinFile)
{
mBinOutFile = StringToCharStar(outBinFile);
}
String^ CivHydrCalcMiddle::getLastError()
{
return mLastError;
}
}
\ No newline at end of file
#pragma once
#include "CivHydrCalc.h"
using namespace System;
using namespace System::Runtime::InteropServices;
namespace CivHydr {
/**
*@brief c#和c++类型转换函数
*/
static char* StringToCharStar(String^ str)
{
char* ch2 = (char*)(void*)Marshal::StringToHGlobalAnsi(str);
return ch2;
}
public ref class CivHydrCalcMiddle {
public:
/**
*@brief 带参对象构造函数
*@uri: 管网数据库连接地址,格式:"host=192.168.12.7 port=5432 dbname=2222 user=postgres password=admin";
*@netName: 管网名
*/
CivHydrCalcMiddle(String^ uri, String^ netName);
~CivHydrCalcMiddle();
/**
*@brief 水力计算
*@flag: 计算标志, HDY:水力计算 QUALITY:水质计算
*/
Boolean simulation(String^ flag);
void setInpFile(String^ inpFileName);
void setReportFile(String^ rptFile);
void setOutBinFile(String^ outBinFile);
private:
/**
*@brief 动态水力计算
*/
Boolean hyDrCompute();
/**
*@brief 水质计算
*/
Boolean qualityCompute();
String^ getLastError();
private:
CivHydrCalc* mHydrCalc;
char* mInpFile = "test.inp"; // inp文件路径
char* mRptFile = "test.rpt"; // 报告文件
char* mBinOutFile = "test.bin";
String^ mLastError;
};
}
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{26fc1dc0-4eee-44da-b409-8f392d37b67e}</ProjectGuid>
<RootNamespace>pandaHydrCalcMiddle</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<TargetFrameworkVersion>
</TargetFrameworkVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<CLRSupport>true</CLRSupport>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>..\..\hModelProgram\Program\</OutDir>
<IncludePath>$(OUTDIR)..\include;$(IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>false</ConformanceMode>
<OpenMPSupport>true</OpenMPSupport>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(OUTDIR)..\lib</AdditionalLibraryDirectories>
<AdditionalDependencies>pandaAnalysis.lib</AdditionalDependencies>
<ImportLibrary>$(OutDir)..\lib\$(TargetName).lib</ImportLibrary>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="CivHydrCalcMiddle.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="CivHydrCalcMiddle.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="CivHydrCalcMiddle.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="CivHydrCalcMiddle.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CivHydr;
namespace pandaHydrDemo
{
class Program
{
static void Main(string[] args)
{
String uri = "host=192.168.12.7 port=5432 dbname=2222 user=postgres password=admin";
String netName = "进贤水力模型";
CivHydrCalcMiddle calc = new CivHydrCalcMiddle(uri, netName);
calc.setInpFile("test.inp");
calc.setReportFile("test.rpt");
calc.setOutBinFile("test.bin");
String flag = "HDY";
Boolean sucess = calc.simulation(flag);
Console.WriteLine(sucess);
}
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("pandaHydrDemo")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("pandaHydrDemo")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("5bdf427e-7acb-4ce9-95b2-ccd9ea5879cd")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{5BDF427E-7ACB-4CE9-95B2-CCD9EA5879CD}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>pandaHydrDemo</RootNamespace>
<AssemblyName>pandaHydrDemo</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>x64</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\hModelProgram\Program\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>3</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\pandaHydrCalcMiddle\pandaHydrCalcMiddle.vcxproj">
<Project>{26fc1dc0-4eee-44da-b409-8f392d37b67e}</Project>
<Name>pandaHydrCalcMiddle</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<EnableUnmanagedDebugging>true</EnableUnmanagedDebugging>
</PropertyGroup>
</Project>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment