diff --git a/Applications/Utils/FileConverter/ConvertSHPToGLI.cpp b/Applications/Utils/FileConverter/ConvertSHPToGLI.cpp index 2781660f04f1de7450be1b0160321ceb73459455..d96b70b33a4cc481b20dcd425aad852706809157 100644 --- a/Applications/Utils/FileConverter/ConvertSHPToGLI.cpp +++ b/Applications/Utils/FileConverter/ConvertSHPToGLI.cpp @@ -12,9 +12,13 @@ * */ -// STL #include <tclap/CmdLine.h> +#ifdef USE_PETSC +#include <mpi.h> +#endif + +// STL #include <fstream> #include <vector> @@ -181,6 +185,10 @@ int main(int argc, char* argv[]) cmd.parse(argc, argv); +#ifdef USE_PETSC + MPI_Init(&argc, &argv); +#endif + std::string fname(shapefile_arg.getValue()); int shape_type; @@ -199,6 +207,9 @@ int main(int argc, char* argv[]) ERR("Shape file contains {:d} polylines.", number_of_elements); ERR("This programme only handles only files containing points."); SHPClose(hSHP); +#ifdef USE_PETSC + MPI_Finalize(); +#endif return EXIT_SUCCESS; } SHPClose(hSHP); @@ -293,5 +304,8 @@ int main(int argc, char* argv[]) ERR("Could not open the database file."); } +#ifdef USE_PETSC + MPI_Finalize(); +#endif return EXIT_SUCCESS; } diff --git a/Applications/Utils/FileConverter/FEFLOW2OGS.cpp b/Applications/Utils/FileConverter/FEFLOW2OGS.cpp index 34efeec06a02b3e4d2720e07ac4c29a4e4480760..82b54a2eda56d13f86d9fb9c5996589adefad7d2 100644 --- a/Applications/Utils/FileConverter/FEFLOW2OGS.cpp +++ b/Applications/Utils/FileConverter/FEFLOW2OGS.cpp @@ -13,6 +13,10 @@ // ThirdParty #include <tclap/CmdLine.h> +#ifdef USE_PETSC +#include <mpi.h> +#endif + // BaseLib #include "BaseLib/FileTools.h" #include "BaseLib/RunTime.h" @@ -57,6 +61,10 @@ int main(int argc, char* argv[]) cmd.parse(argc, argv); +#ifdef USE_PETSC + MPI_Init(&argc, &argv); +#endif + // *** read mesh INFO("Reading {:s}.", feflow_mesh_arg.getValue()); #ifndef WIN32 @@ -72,6 +80,9 @@ int main(int argc, char* argv[]) if (mesh == nullptr) { INFO("Could not read mesh from {:s}.", feflow_mesh_arg.getValue()); +#ifdef USE_PETSC + MPI_Finalize(); +#endif return EXIT_FAILURE; } #ifndef WIN32 @@ -87,5 +98,8 @@ int main(int argc, char* argv[]) INFO("Writing {:s}.", ogs_mesh_fname); MeshLib::IO::writeMeshToFile(*mesh, ogs_mesh_fname); INFO("\tDone."); +#ifdef USE_PETSC + MPI_Finalize(); +#endif return EXIT_SUCCESS; } diff --git a/Applications/Utils/FileConverter/GMSH2OGS.cpp b/Applications/Utils/FileConverter/GMSH2OGS.cpp index 955e66b79cb64f8dc124e837a2f9bb2efd8d0418..0b40597a1adbc32740678f385ac3cdfdf4e2ceff 100644 --- a/Applications/Utils/FileConverter/GMSH2OGS.cpp +++ b/Applications/Utils/FileConverter/GMSH2OGS.cpp @@ -19,6 +19,10 @@ // ThirdParty #include <tclap/CmdLine.h> +#ifdef USE_PETSC +#include <mpi.h> +#endif + // BaseLib #include "BaseLib/FileTools.h" #include "BaseLib/RunTime.h" @@ -164,6 +168,10 @@ int main(int argc, char* argv[]) cmd.parse(argc, argv); +#ifdef USE_PETSC + MPI_Init(&argc, &argv); +#endif + // *** read mesh INFO("Reading {:s}.", gmsh_mesh_arg.getValue()); #ifndef WIN32 @@ -177,6 +185,9 @@ int main(int argc, char* argv[]) if (mesh == nullptr) { INFO("Could not read mesh from {:s}.", gmsh_mesh_arg.getValue()); +#ifdef USE_PETSC + MPI_Finalize(); +#endif return -1; } #ifndef WIN32 @@ -266,4 +277,8 @@ int main(int argc, char* argv[]) MeshLib::IO::writeMeshToFile(*mesh, ogs_mesh_arg.getValue()); delete mesh; +#ifdef USE_PETSC + MPI_Finalize(); +#endif + return EXIT_SUCCESS; } diff --git a/Applications/Utils/FileConverter/GocadSGridReader.cpp b/Applications/Utils/FileConverter/GocadSGridReader.cpp index 0c21febf281244bdf37148230b33b359e9b8c49e..0b9fbf9a567a55a2ee747cc6607219e7ee9d0dd4 100644 --- a/Applications/Utils/FileConverter/GocadSGridReader.cpp +++ b/Applications/Utils/FileConverter/GocadSGridReader.cpp @@ -12,6 +12,10 @@ #include <spdlog/spdlog.h> #include <tclap/CmdLine.h> +#ifdef USE_PETSC +#include <mpi.h> +#endif + #include <fstream> #include <sstream> #include <string> @@ -56,6 +60,10 @@ int main(int argc, char* argv[]) cmd.parse(argc, argv); +#ifdef USE_PETSC + MPI_Init(&argc, &argv); +#endif + // read the Gocad SGrid INFO("Start reading Gocad SGrid."); FileIO::Gocad::GocadSGridReader reader(sg_file_arg.getValue()); @@ -73,6 +81,8 @@ int main(int argc, char* argv[]) INFO("Writing mesh to '{:s}'.", mesh_output_arg.getValue()); MeshLib::IO::writeMeshToFile(*mesh, mesh_output_arg.getValue()); - - return 0; +#ifdef USE_PETSC + MPI_Finalize(); +#endif + return EXIT_SUCCESS; } diff --git a/Applications/Utils/FileConverter/GocadTSurfaceReader.cpp b/Applications/Utils/FileConverter/GocadTSurfaceReader.cpp index 46b364a4efb4265481a238e1b47bd0efec5bf74c..7a876e3e66e26ed9f6426490b75b63760d2c9808 100644 --- a/Applications/Utils/FileConverter/GocadTSurfaceReader.cpp +++ b/Applications/Utils/FileConverter/GocadTSurfaceReader.cpp @@ -9,6 +9,10 @@ #include <tclap/CmdLine.h> +#ifdef USE_PETSC +#include <mpi.h> +#endif + #include "Applications/FileIO/GocadIO/GocadAsciiReader.h" #include "InfoLib/GitInfo.h" #include "MeshLib/IO/VtkIO/VtuInterface.h" @@ -61,10 +65,17 @@ int main(int argc, char* argv[]) cmd.parse(argc, argv); +#ifdef USE_PETSC + MPI_Init(&argc, &argv); +#endif + if (export_lines_arg.isSet() && export_surfaces_arg.isSet()) { ERR("Both the 'lines-only'-flag and 'surfaces-only'-flag are set. Only " "one is allowed at a time."); +#ifdef USE_PETSC + MPI_Finalize(); +#endif return 2; } @@ -83,6 +94,9 @@ int main(int argc, char* argv[]) if (!FileIO::Gocad::GocadAsciiReader::readFile(file_name, meshes, t)) { ERR("Error reading file."); +#ifdef USE_PETSC + MPI_Finalize(); +#endif return 1; } INFO("{:d} meshes found.", meshes.size()); @@ -101,5 +115,8 @@ int main(int argc, char* argv[]) MeshLib::IO::VtuInterface vtu(mesh.get(), data_mode, compressed); vtu.writeToFile(dir + delim + mesh->getName() + ".vtu"); } +#ifdef USE_PETSC + MPI_Finalize(); +#endif return 0; } diff --git a/Applications/Utils/FileConverter/Mesh2Raster.cpp b/Applications/Utils/FileConverter/Mesh2Raster.cpp index eaf9f88f94ea17b273cd55f8bcab8f9b313dda96..6964259dbb3e3d0599188060623db7c4b0b61c21 100644 --- a/Applications/Utils/FileConverter/Mesh2Raster.cpp +++ b/Applications/Utils/FileConverter/Mesh2Raster.cpp @@ -9,6 +9,10 @@ #include <tclap/CmdLine.h> +#ifdef USE_PETSC +#include <mpi.h> +#endif + #include <filesystem> #include <fstream> #include <memory> @@ -48,18 +52,28 @@ int main(int argc, char* argv[]) cmd.add(input_arg); cmd.parse(argc, argv); +#ifdef USE_PETSC + MPI_Init(&argc, &argv); +#endif + INFO("Rasterising mesh..."); std::unique_ptr<MeshLib::Mesh> const mesh( MeshLib::IO::readMeshFromFile(input_arg.getValue())); if (mesh == nullptr) { ERR("Error reading mesh file."); +#ifdef USE_PETSC + MPI_Finalize(); +#endif return 1; } if (mesh->getDimension() != 2) { ERR("The programme requires a mesh containing two-dimensional elements " "(i.e. triangles or quadrilaterals."); +#ifdef USE_PETSC + MPI_Finalize(); +#endif return 2; } @@ -161,5 +175,8 @@ int main(int argc, char* argv[]) } out.close(); INFO("Result written to {:s}", output_name); +#ifdef USE_PETSC + MPI_Finalize(); +#endif return 0; } diff --git a/Applications/Utils/FileConverter/Mesh2Shape.cpp b/Applications/Utils/FileConverter/Mesh2Shape.cpp index 7824818302c9705fce29daa132e834475be03818..0ed1c02f7d669f3fc3333f5edd25b3f0b7480214 100644 --- a/Applications/Utils/FileConverter/Mesh2Shape.cpp +++ b/Applications/Utils/FileConverter/Mesh2Shape.cpp @@ -9,6 +9,10 @@ #include <tclap/CmdLine.h> +#ifdef USE_PETSC +#include <mpi.h> +#endif + #include "Applications/FileIO/SHPInterface.h" #include "InfoLib/GitInfo.h" #include "MeshLib/IO/readMeshFromFile.h" @@ -39,12 +43,22 @@ int main(int argc, char* argv[]) cmd.parse(argc, argv); +#ifdef USE_PETSC + MPI_Init(&argc, &argv); +#endif + std::string const file_name(input_arg.getValue()); std::unique_ptr<MeshLib::Mesh> const mesh( MeshLib::IO::readMeshFromFile(file_name)); if (FileIO::SHPInterface::write2dMeshToSHP(output_arg.getValue(), *mesh)) { +#ifdef USE_PETSC + MPI_Finalize(); +#endif return EXIT_SUCCESS; } +#ifdef USE_PETSC + MPI_Finalize(); +#endif return EXIT_FAILURE; } diff --git a/Applications/Utils/FileConverter/NetCdfConverter.cpp b/Applications/Utils/FileConverter/NetCdfConverter.cpp index d834caee8fc319610829777188968f170cfb1655..55f90fce5e66b57fe0c2cd4486c6c5df5ba7a173 100644 --- a/Applications/Utils/FileConverter/NetCdfConverter.cpp +++ b/Applications/Utils/FileConverter/NetCdfConverter.cpp @@ -7,9 +7,13 @@ * http://www.opengeosys.org/project/license */ -// STL #include <tclap/CmdLine.h> +#ifdef USE_PETSC +#include <mpi.h> +#endif + +// STL #include <cctype> #include <iostream> #include <limits> @@ -735,11 +739,18 @@ int main(int argc, char* argv[]) cmd.add(arg_input); cmd.parse(argc, argv); +#ifdef USE_PETSC + MPI_Init(&argc, &argv); +#endif + NcFile dataset(arg_input.getValue().c_str(), NcFile::read); if (dataset.isNull()) { ERR("Error opening file."); +#ifdef USE_PETSC + MPI_Finalize(); +#endif return -1; } @@ -749,6 +760,9 @@ int main(int argc, char* argv[]) { ERR("Only one output format can be specified (single-file, multi-file, " "or images)"); +#ifdef USE_PETSC + MPI_Finalize(); +#endif return EXIT_FAILURE; } @@ -768,6 +782,9 @@ int main(int argc, char* argv[]) if (var.isNull()) { ERR("Variable \"{:s}\" not found in file.", arg_varname.getValue()); +#ifdef USE_PETSC + MPI_Finalize(); +#endif return EXIT_FAILURE; } @@ -778,7 +795,12 @@ int main(int argc, char* argv[]) is_time_dep = arg_dim_time.isSet(); if (!assignDimParams(var, dim_idx_map, arg_dim_time, arg_dim1, arg_dim2, arg_dim3)) + { +#ifdef USE_PETSC + MPI_Finalize(); +#endif return EXIT_FAILURE; + } } else { @@ -832,8 +854,16 @@ int main(int argc, char* argv[]) if (!convert(dataset, var, output_name, dim_idx_map, is_time_dep, time_bounds, output, elem_type)) + { +#ifdef USE_PETSC + MPI_Finalize(); +#endif return EXIT_FAILURE; + } std::cout << "Conversion finished successfully.\n"; +#ifdef USE_PETSC + MPI_Finalize(); +#endif return EXIT_SUCCESS; } diff --git a/Applications/Utils/FileConverter/OGS2VTK.cpp b/Applications/Utils/FileConverter/OGS2VTK.cpp index 77df492a7981b9614a6b358940c2f15aa24ac82f..f63bded6856a5520daf385ba1a3a907f48e387e9 100644 --- a/Applications/Utils/FileConverter/OGS2VTK.cpp +++ b/Applications/Utils/FileConverter/OGS2VTK.cpp @@ -13,6 +13,10 @@ #include <tclap/CmdLine.h> +#ifdef USE_PETSC +#include <mpi.h> +#endif + #include <memory> #include <string> @@ -48,10 +52,17 @@ int main(int argc, char* argv[]) cmd.add(use_ascii_arg); cmd.parse(argc, argv); +#ifdef USE_PETSC + MPI_Init(&argc, &argv); +#endif + std::unique_ptr<MeshLib::Mesh const> mesh( MeshLib::IO::readMeshFromFile(mesh_in.getValue())); if (!mesh) { +#ifdef USE_PETSC + MPI_Finalize(); +#endif return EXIT_FAILURE; } INFO("Mesh read: {:d} nodes, {:d} elements.", mesh->getNumberOfNodes(), @@ -62,5 +73,8 @@ int main(int argc, char* argv[]) MeshLib::IO::writeVtu(*mesh, mesh_out.getValue(), data_mode); +#ifdef USE_PETSC + MPI_Finalize(); +#endif return EXIT_SUCCESS; } diff --git a/Applications/Utils/FileConverter/PVD2XDMF.cpp b/Applications/Utils/FileConverter/PVD2XDMF.cpp index 7e5c43211da039d912221f88fc72d7d6d30dd2f6..ec085ca3d3de5341631363ff7773f1fc28bd09e6 100644 --- a/Applications/Utils/FileConverter/PVD2XDMF.cpp +++ b/Applications/Utils/FileConverter/PVD2XDMF.cpp @@ -9,6 +9,10 @@ #include <tclap/CmdLine.h> +#ifdef USE_PETSC +#include <mpi.h> +#endif + #include <array> #include <boost/property_tree/ptree.hpp> #include <boost/property_tree/xml_parser.hpp> @@ -137,6 +141,9 @@ int main(int argc, char* argv[]) cmd.add(outdir_arg); cmd.parse(argc, argv); +#ifdef USE_PETSC + MPI_Init(&argc, &argv); +#endif BaseLib::setConsoleLogLevel(log_level_arg.getValue()); auto const pvd_file_dir = BaseLib::extractPath(pvd_file_arg.getValue()); @@ -229,4 +236,8 @@ int main(int argc, char* argv[]) mesh_xdmf_hdf_writer->writeStep(time); } +#ifdef USE_PETSC + MPI_Finalize(); +#endif + return EXIT_SUCCESS; } diff --git a/Applications/Utils/FileConverter/TIN2VTK.cpp b/Applications/Utils/FileConverter/TIN2VTK.cpp index 7c5bd1ab728c0323b76ea14107a027caf907d018..fc006984cb83d675ba7b8e6b0d72ee3841f531b4 100644 --- a/Applications/Utils/FileConverter/TIN2VTK.cpp +++ b/Applications/Utils/FileConverter/TIN2VTK.cpp @@ -7,9 +7,13 @@ * http://www.opengeosys.org/project/license */ -// STL #include <tclap/CmdLine.h> +#ifdef USE_PETSC +#include <mpi.h> +#endif + +// STL #include <memory> #include <string> #include <vector> @@ -49,6 +53,10 @@ int main(int argc, char* argv[]) cmd.add(outArg); cmd.parse(argc, argv); +#ifdef USE_PETSC + MPI_Init(&argc, &argv); +#endif + INFO("reading the TIN file..."); const std::string tinFileName(inArg.getValue()); std::string point_vec_name{"SurfacePoints"}; @@ -58,6 +66,9 @@ int main(int argc, char* argv[]) GeoLib::IO::TINInterface::readTIN(tinFileName, point_vec)); if (!sfc) { +#ifdef USE_PETSC + MPI_Finalize(); +#endif return EXIT_FAILURE; } INFO("TIN read: {:d} points, {:d} triangles", point_vec.size(), @@ -74,5 +85,8 @@ int main(int argc, char* argv[]) MeshLib::IO::VtuInterface writer(mesh.get()); writer.writeToFile(outArg.getValue()); +#ifdef USE_PETSC + MPI_Finalize(); +#endif return EXIT_SUCCESS; } diff --git a/Applications/Utils/FileConverter/TecPlotTools.cpp b/Applications/Utils/FileConverter/TecPlotTools.cpp index 537e1f9d7853a635366a2e7dacf0cfb4e46d31b8..5d7d104758469201df752aa394d14a1e838e82e5 100644 --- a/Applications/Utils/FileConverter/TecPlotTools.cpp +++ b/Applications/Utils/FileConverter/TecPlotTools.cpp @@ -9,6 +9,10 @@ #include <tclap/CmdLine.h> +#ifdef USE_PETSC +#include <mpi.h> +#endif + #include <iostream> #include <memory> #include <string> @@ -476,15 +480,25 @@ int main(int argc, char* argv[]) cmd.add(input_arg); cmd.parse(argc, argv); +#ifdef USE_PETSC + MPI_Init(&argc, &argv); +#endif + if (!input_arg.isSet()) { ERR("No input file given. Please specify TecPlot (*.plt) file"); +#ifdef USE_PETSC + MPI_Finalize(); +#endif return -1; } if (convert_arg.getValue() && !output_arg.isSet()) { ERR("No output file given. Please specify OGS mesh (*.vtu) file"); +#ifdef USE_PETSC + MPI_Finalize(); +#endif return -1; } @@ -492,12 +506,18 @@ int main(int argc, char* argv[]) if (!in.is_open()) { ERR("Could not open file {:s}.", input_arg.getValue()); +#ifdef USE_PETSC + MPI_Finalize(); +#endif return -2; } if (!convert_arg.isSet() && !split_arg.isSet()) { INFO("Nothing to do. Use -s to split or -c to convert."); +#ifdef USE_PETSC + MPI_Finalize(); +#endif return 0; } @@ -514,5 +534,8 @@ int main(int argc, char* argv[]) } in.close(); +#ifdef USE_PETSC + MPI_Finalize(); +#endif return return_val; } diff --git a/Applications/Utils/FileConverter/VTK2OGS.cpp b/Applications/Utils/FileConverter/VTK2OGS.cpp index b768656020af22b3af79738308cd02795bfe98d5..f86b928b3db2ad34a89d2c0168abbc4ba100cd08 100644 --- a/Applications/Utils/FileConverter/VTK2OGS.cpp +++ b/Applications/Utils/FileConverter/VTK2OGS.cpp @@ -14,6 +14,10 @@ // STL #include <tclap/CmdLine.h> +#ifdef USE_PETSC +#include <mpi.h> +#endif + #include <string> #include "InfoLib/GitInfo.h" @@ -43,6 +47,10 @@ int main(int argc, char* argv[]) cmd.add(mesh_out); cmd.parse(argc, argv); +#ifdef USE_PETSC + MPI_Init(&argc, &argv); +#endif + MeshLib::Mesh* mesh( MeshLib::IO::VtuInterface::readVTUFile(mesh_in.getValue())); INFO("Mesh read: {:d} nodes, {:d} elements.", mesh->getNumberOfNodes(), @@ -52,5 +60,8 @@ int main(int argc, char* argv[]) meshIO.setMesh(mesh); BaseLib::IO::writeStringToFile(meshIO.writeToString(), mesh_out.getValue()); +#ifdef USE_PETSC + MPI_Finalize(); +#endif return EXIT_SUCCESS; } diff --git a/Applications/Utils/FileConverter/VTK2TIN.cpp b/Applications/Utils/FileConverter/VTK2TIN.cpp index a1d5603a65f8eade0aec5639a3f208edc8290e4f..285a1f64e5a1271b15a92b3a151b906087fc3afb 100644 --- a/Applications/Utils/FileConverter/VTK2TIN.cpp +++ b/Applications/Utils/FileConverter/VTK2TIN.cpp @@ -7,9 +7,13 @@ * http://www.opengeosys.org/project/license */ -// STL #include <tclap/CmdLine.h> +#ifdef USE_PETSC +#include <mpi.h> +#endif + +// STL #include <fstream> #include <memory> #include <string> @@ -52,6 +56,9 @@ int main(int argc, char* argv[]) cmd.add(mesh_out); cmd.parse(argc, argv); +#ifdef USE_PETSC + MPI_Init(&argc, &argv); +#endif std::unique_ptr<MeshLib::Mesh> mesh( MeshLib::IO::VtuInterface::readVTUFile(mesh_in.getValue())); INFO("Mesh read: {:d} nodes, {:d} elements.", mesh->getNumberOfNodes(), @@ -67,5 +74,8 @@ int main(int argc, char* argv[]) mesh_out.getValue()); } +#ifdef USE_PETSC + MPI_Finalize(); +#endif return EXIT_SUCCESS; } diff --git a/Applications/Utils/FileConverter/convertGEO.cpp b/Applications/Utils/FileConverter/convertGEO.cpp index 172cf3cd6a7df38453c3d9e7748533401ec2370a..4ca9f84d9e933a8b4ed4e1fbda7eb07d9fd092c8 100644 --- a/Applications/Utils/FileConverter/convertGEO.cpp +++ b/Applications/Utils/FileConverter/convertGEO.cpp @@ -9,6 +9,10 @@ #include <tclap/CmdLine.h> +#ifdef USE_PETSC +#include <mpi.h> +#endif + #include <string> #include <vector> @@ -46,6 +50,10 @@ int main(int argc, char* argv[]) cmd.add(gmsh_path_arg); cmd.parse(argc, argv); +#ifdef USE_PETSC + MPI_Init(&argc, &argv); +#endif + GeoLib::GEOObjects geoObjects; FileIO::readGeometryFromFile(argInputFileName.getValue(), geoObjects, gmsh_path_arg.getValue()); @@ -55,5 +63,8 @@ int main(int argc, char* argv[]) FileIO::writeGeometryToFile(geo_names[0], geoObjects, argOutputFileName.getValue()); +#ifdef USE_PETSC + MPI_Finalize(); +#endif return EXIT_SUCCESS; } diff --git a/Applications/Utils/FileConverter/generateMatPropsFromMatID.cpp b/Applications/Utils/FileConverter/generateMatPropsFromMatID.cpp index aed8bc546169a2d0f4a423a86fb7642e96248bb6..7bb834e7b28cb00337d7ec819ff5cb77f6653a68 100644 --- a/Applications/Utils/FileConverter/generateMatPropsFromMatID.cpp +++ b/Applications/Utils/FileConverter/generateMatPropsFromMatID.cpp @@ -14,6 +14,10 @@ #include <tclap/CmdLine.h> +#ifdef USE_PETSC +#include <mpi.h> +#endif + #include <memory> #include "BaseLib/FileTools.h" @@ -45,6 +49,10 @@ int main(int argc, char* argv[]) cmd.parse(argc, argv); +#ifdef USE_PETSC + MPI_Init(&argc, &argv); +#endif + // read mesh std::unique_ptr<MeshLib::Mesh> mesh( MeshLib::IO::readMeshFromFile(mesh_arg.getValue())); @@ -52,6 +60,9 @@ int main(int argc, char* argv[]) if (!mesh) { INFO("Could not read mesh from file '{:s}'.", mesh_arg.getValue()); +#ifdef USE_PETSC + MPI_Finalize(); +#endif return EXIT_FAILURE; } @@ -80,6 +91,9 @@ int main(int argc, char* argv[]) else { ERR("Could not create property '{:s}' file.", new_matname); +#ifdef USE_PETSC + MPI_Finalize(); +#endif return EXIT_FAILURE; } @@ -91,5 +105,8 @@ int main(int argc, char* argv[]) INFO("New files '{:s}' and '{:s}' written.", new_mshname, new_matname); +#ifdef USE_PETSC + MPI_Finalize(); +#endif return EXIT_SUCCESS; } diff --git a/Applications/Utils/SWMMConverter/SWMMConverter.cpp b/Applications/Utils/SWMMConverter/SWMMConverter.cpp index 602d78ad18143a34deb24677de8c590581c665f2..1707691c58fb2e871cb1bd9a3ad992be92b8d50a 100644 --- a/Applications/Utils/SWMMConverter/SWMMConverter.cpp +++ b/Applications/Utils/SWMMConverter/SWMMConverter.cpp @@ -8,6 +8,10 @@ #include <tclap/CmdLine.h> +#ifdef USE_PETSC +#include <mpi.h> +#endif + #include "Applications/FileIO/SWMM/SWMMInterface.h" #include "BaseLib/FileTools.h" #include "BaseLib/StringTools.h" @@ -194,11 +198,18 @@ int main(int argc, char* argv[]) cmd.add(add_system_arg); cmd.parse(argc, argv); +#ifdef USE_PETSC + MPI_Init(&argc, &argv); +#endif + if (!(geo_output_arg.isSet() || mesh_output_arg.isSet() || csv_output_arg.isSet())) { ERR("No output format given. Please specify OGS geometry or mesh " "output file."); +#ifdef USE_PETSC + MPI_Finalize(); +#endif return -1; } @@ -207,6 +218,9 @@ int main(int argc, char* argv[]) { ERR("Please specify csv output file for exporting subcatchment or " "system parameters."); +#ifdef USE_PETSC + MPI_Finalize(); +#endif return -1; } @@ -225,5 +239,8 @@ int main(int argc, char* argv[]) add_subcatchments_arg.getValue(), add_system_arg.getValue()); +#ifdef USE_PETSC + MPI_Finalize(); +#endif return 0; }