Forked from
ogs / ogs
3351 commits behind the upstream repository.
-
Dmitri Naumov authored
This unifies the doxygen headers. If the (doxygen) header is not starting with \file, the following documentation is attributed to a different entity resulting is multiple copyright blocks and the like in the doxygen's html files.
Dmitri Naumov authoredThis unifies the doxygen headers. If the (doxygen) header is not starting with \file, the following documentation is attributed to a different entity resulting is multiple copyright blocks and the like in the doxygen's html files.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
LinearSolverLibrarySetup.h 1.99 KiB
/**
* \file
* \copyright
* Copyright (c) 2012-2023, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
*/
#pragma once
/// The LinearSolverLibrarySetup takes care of proper initialization and
/// shutting down of an external linear solver library. The concrete
/// implementation is chosen by the build system.
/// An object of this class must be created at the beginning of the scope where
/// it is used. When the scope closes (or the object is destroyed explicitly)
/// library shutting down functions are automatically called.
/// The default implementation is empty providing polymorphic behaviour when
/// using this class.
#include "NumLib/DOF/GlobalMatrixProviders.h"
#if defined(USE_PETSC)
#include <petsc.h>
#include <mpi.h>
namespace ApplicationsLib
{
struct LinearSolverLibrarySetup final
{
LinearSolverLibrarySetup(int argc, char* argv[])
{
MPI_Init(&argc, &argv);
char help[] = "ogs6 with PETSc \n";
PetscInitialize(&argc, &argv, nullptr, help);
MPI_Comm_set_errhandler(PETSC_COMM_WORLD, MPI_ERRORS_RETURN);
}
~LinearSolverLibrarySetup()
{
NumLib::cleanupGlobalMatrixProviders();
PetscFinalize();
MPI_Finalize();
}
};
} // ApplicationsLib
#elif defined(USE_LIS)
#include <lis.h>
namespace ApplicationsLib
{
struct LinearSolverLibrarySetup final
{
LinearSolverLibrarySetup(int argc, char* argv[])
{
lis_initialize(&argc, &argv);
}
~LinearSolverLibrarySetup()
{
NumLib::cleanupGlobalMatrixProviders();
lis_finalize();
}
};
} // ApplicationsLib
#else
namespace ApplicationsLib
{
struct LinearSolverLibrarySetup final
{
LinearSolverLibrarySetup(int /*argc*/, char* /*argv*/[]) {}
~LinearSolverLibrarySetup()
{
NumLib::cleanupGlobalMatrixProviders();
}
};
} // namespace ApplicationsLib
#endif