From afd9f356c98b39d8df59f09ecbd6a5ce350cf143 Mon Sep 17 00:00:00 2001 From: Wenqing Wang <wenqing.wang@ufz.de> Date: Mon, 2 Feb 2015 16:48:45 +0100 Subject: [PATCH] [CLI] Added PETSc and MPI stuffs in main function of CLI. --- Applications/CLI/ogs.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/Applications/CLI/ogs.cpp b/Applications/CLI/ogs.cpp index 97f7d452b67..6d9b23162c6 100644 --- a/Applications/CLI/ogs.cpp +++ b/Applications/CLI/ogs.cpp @@ -13,6 +13,14 @@ #include <boost/property_tree/ptree.hpp> #include <boost/property_tree/xml_parser.hpp> +#ifdef USE_MPI +#include <mpi.h> +#endif + +#ifdef USE_PETSC +#include <petsc.h> +#endif + // ThirdParty/logog #include "logog/include/logog.hpp" @@ -77,6 +85,15 @@ int main(int argc, char *argv[]) { using ConfigTree = boost::property_tree::ptree; +#ifdef USE_MPI + MPI_Init(&argc, &argv); +#endif + +#ifdef USE_PETSC + char help[] = "ogs6 with PETSc \n"; + PetscInitialize(&argc, &argv, nullptr, help); +#endif + // logog LOGOG_INITIALIZE(); BaseLib::LogogSimpleFormatter *fmt(new BaseLib::LogogSimpleFormatter); @@ -135,6 +152,18 @@ int main(int argc, char *argv[]) solveProcesses(project); +#ifdef USE_PETSC + for (auto p_it = project.processesBegin(); p_it != project.processesEnd(); ++p_it) + { + (*p_it)->releaseEquationMemory(); + } + PetscFinalize(); +#endif + +#ifdef USE_MPI + MPI_Finalize(); +#endif + delete fmt; delete logog_cout; LOGOG_SHUTDOWN(); -- GitLab