10 #if !defined(KRATOS_EIGEN_SOLVER_H_INCLUDED)
11 #define KRATOS_EIGEN_SOLVER_H_INCLUDED
15 #include <Eigen/Sparse>
28 template <
typename Scalar>
51 :
public DirectSolver<TSparseSpaceType, TDenseSpaceType, TReordererType>
71 typedef typename TSparseSpaceType::DataType
DataType;
99 const auto&
a = m_a_wrapper.
matrix();
101 const bool success = m_solver.Compute(
a);
115 Eigen::Map<Kratos::EigenDynamicVector<DataType>>
x(rX.data().begin(), rX.size());
116 Eigen::Map<Kratos::EigenDynamicVector<DataType>>
b(rB.data().begin(), rB.size());
118 const bool success = m_solver.Solve(
b,
x);
120 KRATOS_ERROR_IF(!success) <<
"Solving failed!\n" << m_solver.GetSolverErrorMessages() << std::endl;
155 m_solver.PrintInfo(rOStream);
176 class TSparseSpaceType,
177 class TDenseSpaceType,
178 class TReordererType>
180 std::istream &rIStream,
191 class TSparseSpaceType,
192 class TDenseSpaceType,
196 std::ostream &rOStream,
200 rOStream << std::endl;
Definition: direct_solver.h:48
Definition: eigen_direct_solver.h:52
bool Solve(SparseMatrixType &rA, DenseMatrixType &rX, DenseMatrixType &rB) override
Definition: eigen_direct_solver.h:145
TDenseSpaceType::MatrixType DenseMatrixType
Definition: eigen_direct_solver.h:73
EigenDirectSolver(Parameters settings)
Definition: eigen_direct_solver.h:79
TSparseSpaceType::VectorType VectorType
Definition: eigen_direct_solver.h:69
DirectSolver< TSparseSpaceType, TDenseSpaceType, TReordererType > BaseType
Definition: eigen_direct_solver.h:65
StandardLinearSolverFactory< TSparseSpaceType, TDenseSpaceType, EigenDirectSolver > FactoryType
Definition: eigen_direct_solver.h:75
TSparseSpaceType::DataType DataType
Definition: eigen_direct_solver.h:71
void PrintData(std::ostream &rOStream) const override
Definition: eigen_direct_solver.h:161
void InitializeSolutionStep(SparseMatrixType &rA, VectorType &rX, VectorType &rB) override
Definition: eigen_direct_solver.h:95
KRATOS_CLASS_POINTER_DEFINITION(EigenDirectSolver)
bool Solve(SparseMatrixType &rA, VectorType &rX, VectorType &rB) override
Definition: eigen_direct_solver.h:130
static StandardLinearSolverFactory< TSparseSpaceType, TDenseSpaceType, EigenDirectSolver > Factory()
Definition: eigen_direct_solver.h:165
EigenDirectSolver()
Definition: eigen_direct_solver.h:77
TSparseSpaceType::MatrixType SparseMatrixType
Definition: eigen_direct_solver.h:67
void PrintInfo(std::ostream &rOStream) const override
Definition: eigen_direct_solver.h:153
~EigenDirectSolver() override
Definition: eigen_direct_solver.h:84
void PerformSolutionStep(SparseMatrixType &rA, VectorType &rX, VectorType &rB) override
Definition: eigen_direct_solver.h:113
Definition: amatrix_interface.h:41
TSparseSpaceType::MatrixType SparseMatrixType
Definition: linear_solver.h:73
TDenseSpaceType::MatrixType DenseMatrixType
Definition: linear_solver.h:81
TSparseSpaceType::VectorType VectorType
Definition: linear_solver.h:77
virtual void Initialize(SparseMatrixType &rA, VectorType &rX, VectorType &rB)
Definition: linear_solver.h:131
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
Base class for all reorderer objects in Kratos used in linear solvers.
Definition: reorderer.h:60
Here we add the functions needed for the registration of linear solvers.
Definition: standard_linear_solver_factory.h:62
A class template for handling data types, matrices, and vectors in a Ublas space.
Definition: ublas_space.h:121
const Eigen::Map< const TEigenSparseMatrix > & matrix() const
Definition: ublas_wrapper.h:53
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
DenseMatrix< std::complex< double > > ComplexMatrix
Definition: ublas_complex_interface.h:58
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
TABLE_NUMBER_ANGULAR_VELOCITY TABLE_NUMBER_MOMENT I33 BEAM_INERTIA_ROT_UNIT_LENGHT_Y KRATOS_DEFINE_APPLICATION_VARIABLE(DEM_APPLICATION, double, BEAM_INERTIA_ROT_UNIT_LENGHT_Z) typedef std double
Definition: DEM_application_variables.h:182
compressed_matrix< std::complex< double > > ComplexCompressedMatrix
Definition: ublas_complex_interface.h:67
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
a
Definition: generate_stokes_twofluid_element.py:77
b
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:31
x
Definition: sensitivityMatrix.py:49
namespace
Definition: array_1d.h:793
Definition: eigen_direct_solver.h:29