Skip to content
Snippets Groups Projects
Commit 40cb1dd7 authored by Christoph Lehmann's avatar Christoph Lehmann
Browse files

[MaL] moved part of NumConf and MatSpecs to separate files

parent c4936192
No related branches found
No related tags found
No related merge requests found
/**
* \copyright
* Copyright (c) 2012-2016, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
*/
#ifndef MATHLIB_LINALG_GLOBALMATRIXVECTORTYPES_H
#define MATHLIB_LINALG_GLOBALMATRIXVECTORTYPES_H
#include "SparsityPattern.h"
//
// Global vector/matrix types and linear solver.
//
#if defined(OGS_USE_EIGENLIS)
#include "MathLib/LinAlg/Eigen/EigenMatrix.h"
#include "MathLib/LinAlg/Eigen/EigenVector.h"
#include "MathLib/LinAlg/EigenLis/EigenLisLinearSolver.h"
namespace detail
{
using GlobalVectorType = MathLib::EigenVector;
using GlobalMatrixType = MathLib::EigenMatrix;
using LinearSolverType = MathLib::EigenLisLinearSolver;
}
#elif defined(USE_PETSC)
#include "MathLib/LinAlg/PETSc/PETScVector.h"
#include "MathLib/LinAlg/PETSc/PETScMatrix.h"
#include "MathLib/LinAlg/PETSc/PETScLinearSolver.h"
namespace detail
{
using GlobalVectorType = MathLib::PETScVector;
using GlobalMatrixType = MathLib::PETScMatrix;
using LinearSolverType = MathLib::PETScLinearSolver;
}
#else
#ifdef OGS_USE_EIGEN
#include "MathLib/LinAlg/Eigen/EigenVector.h"
#include "MathLib/LinAlg/Eigen/EigenMatrix.h"
#include "MathLib/LinAlg/Eigen/EigenLinearSolver.h"
namespace detail
{
using GlobalVectorType = MathLib::EigenVector;
using GlobalMatrixType = MathLib::EigenMatrix;
using LinearSolverType = MathLib::EigenLinearSolver;
}
#else // OGS_USE_EIGEN
#include "MathLib/LinAlg/Dense/DenseVector.h"
#include "MathLib/LinAlg/Dense/GlobalDenseMatrix.h"
#include "MathLib/LinAlg/Solvers/GaussAlgorithm.h"
namespace detail
{
using GlobalVectorType = MathLib::DenseVector<double>;
using GlobalMatrixType = MathLib::GlobalDenseMatrix<double>;
using LinearSolverType =
MathLib::GaussAlgorithm<GlobalMatrixType, GlobalVectorType>;
}
#endif // USE_LIS
#endif // OGS_USE_EIGEN
/// A type used for indexing of global vectors and matrices. It is equal to the
/// GlobalMatrixType::IndexType and the GlobalVectorType::IndexType.
using GlobalIndexType = detail::GlobalMatrixType::IndexType;
using GlobalSparsityPattern = MathLib::SparsityPattern<GlobalIndexType>;
#endif // MATHLIB_LINALG_GLOBALMATRIXVECTORTYPES_H
/**
* \copyright
* Copyright (c) 2012-2016, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
*/
#ifndef MATHLIB_LINALG_MATRIXSPECIFICATIONS_H
#define MATHLIB_LINALG_MATRIXSPECIFICATIONS_H
#include "GlobalMatrixVectorTypes.h"
namespace MathLib
{
struct MatrixSpecifications
{
MatrixSpecifications(std::size_t const nrows_, std::size_t const ncols_,
std::vector<GlobalIndexType> const*const ghost_indices_,
GlobalSparsityPattern const*const sparsity_pattern_)
: nrows(nrows_), ncols(ncols_), ghost_indices(ghost_indices_)
, sparsity_pattern(sparsity_pattern_)
{
}
std::size_t const nrows;
std::size_t const ncols;
std::vector<GlobalIndexType> const*const ghost_indices;
GlobalSparsityPattern const*const sparsity_pattern;
};
} // namespace MathLib
#endif // MATHLIB_LINALG_MATRIXSPECIFICATIONS_H
......@@ -12,31 +12,11 @@
#include <cstddef>
#include "NumLib/NumericsConfig.h"
namespace NumLib { class LocalToGlobalIndexMap; }
namespace MeshLib { class Mesh; }
#include "MathLib/LinAlg/MatrixSpecifications.h"
namespace MathLib
{
struct MatrixSpecifications
{
MatrixSpecifications(std::size_t const nrows_, std::size_t const ncols_,
GlobalSparsityPattern const*const sparsity_pattern_,
NumLib::LocalToGlobalIndexMap const*const dof_table_,
MeshLib::Mesh const*const mesh_)
: nrows(nrows_), ncols(ncols_), sparsity_pattern(sparsity_pattern_)
, dof_table(dof_table_), mesh(mesh_)
{}
std::size_t const nrows;
std::size_t const ncols;
GlobalSparsityPattern const*const sparsity_pattern;
NumLib::LocalToGlobalIndexMap const*const dof_table;
MeshLib::Mesh const*const mesh;
};
class MatrixSpecificationsProvider
{
public:
......
......@@ -11,8 +11,7 @@
#define APPLICATIONS_NUMERICSCONFIG_H_
#include <type_traits>
#include "MathLib/LinAlg/SparsityPattern.h"
#include "MathLib/LinAlg/GlobalMatrixVectorTypes.h"
/**
* This file provides a configuration of the global matrix/vector and
......@@ -22,64 +21,6 @@
* The existence of the GlobalSetupType is checked at the end of the file.
*/
//
// Global vector/matrix types and linear solver.
//
#if defined(OGS_USE_EIGENLIS)
#include "MathLib/LinAlg/Eigen/EigenMatrix.h"
#include "MathLib/LinAlg/Eigen/EigenVector.h"
#include "MathLib/LinAlg/EigenLis/EigenLisLinearSolver.h"
namespace detail
{
using GlobalVectorType = MathLib::EigenVector;
using GlobalMatrixType = MathLib::EigenMatrix;
using LinearSolverType = MathLib::EigenLisLinearSolver;
}
#elif defined(USE_PETSC)
#include "MathLib/LinAlg/PETSc/PETScVector.h"
#include "MathLib/LinAlg/PETSc/PETScMatrix.h"
#include "MathLib/LinAlg/PETSc/PETScLinearSolver.h"
namespace detail
{
using GlobalVectorType = MathLib::PETScVector;
using GlobalMatrixType = MathLib::PETScMatrix;
using LinearSolverType = MathLib::PETScLinearSolver;
}
#else
#ifdef OGS_USE_EIGEN
#include "MathLib/LinAlg/Eigen/EigenVector.h"
#include "MathLib/LinAlg/Eigen/EigenMatrix.h"
#include "MathLib/LinAlg/Eigen/EigenLinearSolver.h"
namespace detail
{
using GlobalVectorType = MathLib::EigenVector;
using GlobalMatrixType = MathLib::EigenMatrix;
using LinearSolverType = MathLib::EigenLinearSolver;
}
#else // OGS_USE_EIGEN
#include "MathLib/LinAlg/Dense/DenseVector.h"
#include "MathLib/LinAlg/Dense/GlobalDenseMatrix.h"
#include "MathLib/LinAlg/Solvers/GaussAlgorithm.h"
namespace detail
{
using GlobalVectorType = MathLib::DenseVector<double>;
using GlobalMatrixType = MathLib::GlobalDenseMatrix<double>;
using LinearSolverType =
MathLib::GaussAlgorithm<GlobalMatrixType, GlobalVectorType>;
}
#endif // USE_LIS
#endif // OGS_USE_EIGEN
//
// Global vector/matrix builder.
//
......@@ -127,9 +68,4 @@ static_assert(std::is_same<detail::GlobalMatrixType::IndexType,
"The global matrix and vector index types do not match.");
// Both types are integral types and equal, define a single GlobalIndexType.
/// A type used for indexing of global vectors and matrices. It is equal to the
/// GlobalMatrixType::IndexType and the GlobalVectorType::IndexType.
using GlobalIndexType = detail::GlobalMatrixType::IndexType;
using GlobalSparsityPattern = MathLib::SparsityPattern<GlobalIndexType>;
#endif // APPLICATIONS_NUMERICSCONFIG_H_
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment