Revision f841b8affc701382c44ad5a88be28532924f506b authored by Lars Bilke on 26 July 2021, 09:00:10 UTC, committed by Lars Bilke on 26 July 2021, 09:37:44 UTC
1 parent ded400f
MatrixVectorTraits.h
/**
* \file
* \copyright
* Copyright (c) 2012-2021, 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
#include <memory>
#include "MatrixSpecifications.h"
namespace MathLib
{
template<typename Matrix>
struct MatrixVectorTraits;
}
#define SPECIALIZE_MATRIX_VECTOR_TRAITS(MATVEC, IDX) \
template <> \
struct MatrixVectorTraits<MATVEC> \
{ \
using Index = IDX; \
static std::unique_ptr<MATVEC> newInstance(); \
static std::unique_ptr<MATVEC> newInstance(MATVEC const& A); \
static std::unique_ptr<MATVEC> newInstance( \
MatrixSpecifications const& spec); \
static std::unique_ptr<MATVEC> newInstance(Index const length); \
};
#ifdef USE_PETSC
#include "MathLib/LinAlg/PETSc/PETScMatrix.h"
#include "MathLib/LinAlg/PETSc/PETScVector.h"
namespace MathLib
{
SPECIALIZE_MATRIX_VECTOR_TRAITS(PETScMatrix, PETScMatrix::IndexType);
SPECIALIZE_MATRIX_VECTOR_TRAITS(PETScVector, PETScVector::IndexType);
}
#else
#include "MathLib/LinAlg/Eigen/EigenMatrix.h"
#include "MathLib/LinAlg/Eigen/EigenVector.h"
namespace MathLib
{
SPECIALIZE_MATRIX_VECTOR_TRAITS(EigenMatrix, EigenMatrix::IndexType)
SPECIALIZE_MATRIX_VECTOR_TRAITS(EigenVector, EigenVector::IndexType)
}
#endif
#undef SPECIALIZE_MATRIX_VECTOR_TRAITS
Computing file changes ...