Loading...
Searching...
No Matches
SubSystemsManager.h
// Copyright (C) 2008-2017 Garth N. Wells
//
// This file is part of DOLFIN.
//
// DOLFIN is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// DOLFIN is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
#ifndef __SUB_SYSTEMS_MANAGER_H
#define __SUB_SYSTEMS_MANAGER_H
#include <string>
#ifdef HAS_PETSC
#include <petsc.h>
#endif
namespace dolfin
{
class SubSystemsManager
{
public:
static SubSystemsManager& singleton();
// Copy constructor
SubSystemsManager(const SubSystemsManager&) = delete;
static void init_mpi();
static int init_mpi(int argc, char* argv[], int required_thread_level);
static void init_petsc();
static void init_petsc(int argc, char* argv[]);
static void finalize();
static bool responsible_mpi();
static bool responsible_petsc();
static bool mpi_initialized();
static bool mpi_finalized();
#ifdef HAS_PETSC
static PetscErrorCode PetscDolfinErrorHandler(
MPI_Comm comm, int line, const char *fun, const char *file,
PetscErrorCode n, PetscErrorType p, const char *mess, void *ctx);
#endif
std::string petsc_err_msg;
private:
// Constructor (private)
SubSystemsManager();
// Destructor
~SubSystemsManager();
// Finalize MPI
static void finalize_mpi();
// Finalize PETSc
static void finalize_petsc();
// State variables
bool petsc_initialized;
bool control_mpi;
};
}
#endif
dolfin::SubSystemsManager::init_mpi
static void init_mpi()
Initialise MPI.
Definition SubSystemsManager.cpp:63
dolfin::SubSystemsManager::responsible_petsc
static bool responsible_petsc()
Definition SubSystemsManager.cpp:203
dolfin::SubSystemsManager::PetscDolfinErrorHandler
static PetscErrorCode PetscDolfinErrorHandler(MPI_Comm comm, int line, const char *fun, const char *file, PetscErrorCode n, PetscErrorType p, const char *mess, void *ctx)
Definition SubSystemsManager.cpp:289
dolfin::SubSystemsManager::mpi_initialized
static bool mpi_initialized()
Definition SubSystemsManager.cpp:260
dolfin::SubSystemsManager::responsible_mpi
static bool responsible_mpi()
Definition SubSystemsManager.cpp:198
dolfin::SubSystemsManager::finalize
static void finalize()
Definition SubSystemsManager.cpp:191
dolfin::SubSystemsManager::init_petsc
static void init_petsc()
Initialize PETSc without command-line arguments.
Definition SubSystemsManager.cpp:125
dolfin::SubSystemsManager::mpi_finalized
static bool mpi_finalized()
Definition SubSystemsManager.cpp:276
dolfin::SubSystemsManager::singleton
static SubSystemsManager & singleton()
Definition SubSystemsManager.cpp:46
dolfin::SubSystemsManager::petsc_err_msg
std::string petsc_err_msg
Last recorded PETSc error message.
Definition SubSystemsManager.h:89
dolfin
Definition adapt.h:30