diff --git a/Applications/Utils/CMakeLists.txt b/Applications/Utils/CMakeLists.txt index abbe2a36bfd26e40df43915a2dbc4daa2cea8199..81a1269d85762f1836876b8057a8b0ef7986e72d 100644 --- a/Applications/Utils/CMakeLists.txt +++ b/Applications/Utils/CMakeLists.txt @@ -15,4 +15,6 @@ else() add_subdirectory(ModelPreparation/PartitionMesh) endif() # OGS_BUILD_GUI -include(Tests.cmake) +if(OGS_BUILD_SWMM) + add_subdirectory(SWMMConverter) +endif() diff --git a/Applications/Utils/SWMMConverter/CMakeLists.txt b/Applications/Utils/SWMMConverter/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..e434d6a3fd07947cff8241b59910293e12c030c1 --- /dev/null +++ b/Applications/Utils/SWMMConverter/CMakeLists.txt @@ -0,0 +1,10 @@ +add_executable(SWMMInterface SWMMInterface.cpp) + +target_link_libraries(SWMMInterface + MeshLib + swmm5interface +) + +ADD_VTK_DEPENDENCY(SWMMInterface) + +set_target_properties(SWMMInterface PROPERTIES FOLDER Utilities) diff --git a/Applications/Utils/SWMMConverter/SWMMInterface.cpp b/Applications/Utils/SWMMConverter/SWMMInterface.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c7ccfdd593c2220b76db812389c0fbe8df51d89d --- /dev/null +++ b/Applications/Utils/SWMMConverter/SWMMInterface.cpp @@ -0,0 +1,36 @@ + + +#include <string> +#include <iostream> +#include "ThirdParty/SWMMInterface/swmm5_iface.h" + +int main(int argc, char *argv[]) +{ + // Open outfile as a SWMM output file + std::string outfile = argv[1]; + int r = OpenSwmmOutFile(const_cast<char*>(outfile.c_str())); + if (r == 1) + { + printf("\nInvalid results in SWMM output file.\n"); + } + else if (r == 2) + { + printf("\nFile is not a SWMM output file.\n"); + } + else + { + printf("\nTime Total Total Total"); + printf("\nPeriod Rainfall Runoff Outflow"); + printf("\n===================================="); + for (int i=1; i<=SWMM_Nperiods; i++) + { + float x, y, z; + GetSwmmResult(3, 0, 1, i, &x); + GetSwmmResult(3, 0, 4, i, &y); + GetSwmmResult(3, 0, 11, i, &z); + printf("\n%6d %8.2f %8.2f %8.2f", i, x, y, z); + } + CloseSwmmOutFile(); + } + return 0; +} \ No newline at end of file diff --git a/ThirdParty/CMakeLists.txt b/ThirdParty/CMakeLists.txt index 049268fa81a98ed38801f168a7ad74a226489484..8f75c2e6a6077fc893827b78302c0a2d6798c038 100644 --- a/ThirdParty/CMakeLists.txt +++ b/ThirdParty/CMakeLists.txt @@ -50,3 +50,8 @@ if(NOT TARGET vtkGUISupportQt AND OGS_BUILD_GUI) include_directories(SYSTEM ${VTK_INCLUDE_DIRS}) add_subdirectory(${CMAKE_SOURCE_DIR}/ThirdParty/vtkGUISupportQt) endif() + +if(OGS_BUILD_SWMM) + add_subdirectory(${CMAKE_SOURCE_DIR}/ThirdParty/SWMMInterface/swmm5) + add_subdirectory(${CMAKE_SOURCE_DIR}/ThirdParty/SWMMInterface) +endif()