KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
standard_linear_solver_factory.h
Go to the documentation of this file.
1 // | / |
2 // ' / __| _` | __| _ \ __|
3 // . \ | ( | | ( |\__ `
4 // _|\_\_| \__,_|\__|\___/ ____/
5 // Multi-Physics
6 //
7 // License: BSD License
8 // Kratos default license: kratos/license.txt
9 //
10 // Main authors: Riccardo Rossi
11 //
12 //
13 
14 #if !defined(KRATOS_STANDARD_LINEAR_SOLVER_FACTORY_H_INCLUDED )
15 #define KRATOS_STANDARD_LINEAR_SOLVER_FACTORY_H_INCLUDED
16 
17 // System includes
18 
19 // External includes
20 
21 // Project includes
22 #include "includes/define.h"
26 
27 namespace Kratos
28 {
31 
35 
39 
43 
47 
59 template <typename TSparseSpace, typename TLocalSpace, typename TLinearSolverType>
61  : public LinearSolverFactory<TSparseSpace,TLocalSpace>
62 {
65 
68 
70 protected:
73 
78  typename LinearSolverType::Pointer CreateSolver(Kratos::Parameters settings) const override
79  {
80  if(settings.Has("scaling") && settings["scaling"].GetBool()) {
81  auto pinner_solver = typename LinearSolverType::Pointer(new TLinearSolverType(settings));
82 
83  return typename LinearSolverType::Pointer(new ScalingSolver<TSparseSpace,TLocalSpace>(pinner_solver, true));
84 
85  } else
86  return typename LinearSolverType::Pointer(new TLinearSolverType(settings));
87  }
89 };
90 
92 
95 
99 
101 template <typename TSparseSpace, typename TLocalSpace, typename TLinearSolverType>
102 inline std::ostream& operator << (std::ostream& rOStream,
104 {
105  rOStream << "StandardLinearSolverFactory" << std::endl;
106  return rOStream;
107 }
108 
111 
112 void RegisterLinearSolvers();
113 
115 
116 } // namespace Kratos.
117 
118 #endif // KRATOS_STANDARD_LINEAR_SOLVER_FACTORY_H_INCLUDED defined
Here we add the functions needed for the registration of linear solvers.
Definition: linear_solver_factory.h:62
Base class for all the linear solvers in Kratos.
Definition: linear_solver.h:65
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
bool Has(const std::string &rEntry) const
This method checks if the Parameter contains a certain entry.
Definition: kratos_parameters.cpp:520
bool GetBool() const
This method returns the boolean contained in the current Parameter.
Definition: kratos_parameters.cpp:675
This solvers rescales in order to improve the conditioning of the system.
Definition: scaling_solver.h:64
Here we add the functions needed for the registration of linear solvers.
Definition: standard_linear_solver_factory.h:62
LinearSolverType::Pointer CreateSolver(Kratos::Parameters settings) const override
This method is an auxiliar method to create a new solver.
Definition: standard_linear_solver_factory.h:78
void RegisterLinearSolvers()
Definition: standard_linear_solver_factory.cpp:35
LinearSolver< TSpaceType< TDataType >, TLocalSpaceType< TOtherDataType > > TLinearSolverType
Definition: add_linear_solvers_to_python.cpp:50
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432