13#ifndef SANDALS_SEMIEXPLICIT_SYSTEM_HH
14#define SANDALS_SEMIEXPLICIT_SYSTEM_HH
41 template <
typename Real, Integer N, Integer M = 0>
45 using Pointer = std::shared_ptr<SemiExplicit<Real, N, M>>;
49 using TensorTA =
typename std::vector<MatrixJF>;
55 mutable Eigen::FullPivLU<MatrixA>
m_lu;
84 return this->
A(x, t)*x_dot - this->
b(x, t);
106 return -this->
Jf_x(x, x_dot, t);
126 return this->
A(x, t);
142 this->m_lu.compute(this->
A(x, t));
144 "Sandals:SemiExplicit::f(...): singular mass matrix A detected.");
145 return this->m_lu.solve(this->
b(x, t));
167 for (
Integer i{0}; i < N; ++i) {tAp.col(i) =
TA_x[i] * x_dot;}
168 this->m_lu.compute(this->
A(x, t));
170 "Sandals:SemiExplicit::Jf_x(...): singular mass matrix A detected.");
171 return this->m_lu.solve(this->
Jb_x(x, t) - tAp);
258 template <
typename Real, Integer N, Integer M = 0>
262 using Pointer = std::shared_ptr<SemiExplicitWrapper<Real, N, M>>;
380 return this->
m_A(x, t);
398 return this->
m_TA_x(x, t);
409 return this->
m_b(x, t);
427 return this->
m_Jb_x(x, t);
439 return this->
m_h(x, t);
457 return this->
m_Jh_x(x, t);
#define SANDALS_ASSERT(COND, MSG)
Definition Sandals.hh:44
Explicit(Type t_type, std::string t_name)
Definition Explicit.hh:55
typename Implicit< Real, N, M >::Type Type
Definition Explicit.hh:47
typename Implicit< Real, N, M >::MatrixJF MatrixJF
Definition Explicit.hh:46
typename Implicit< Real, N, M >::VectorF VectorF
Definition Explicit.hh:45
Eigen::Vector< Real, M > VectorH
Definition Implicit.hh:48
Eigen::Matrix< Real, M, N > MatrixJH
Definition Implicit.hh:49
virtual MatrixA A(VectorF const &x, Real const t) const =0
virtual TensorTA TA_x(VectorF const &x, Real const t) const =0
SemiExplicit(std::string t_name)
Definition SemiExplicit.hh:67
MatrixJF Jf_x(VectorF const &x, Real const t) const override
Definition SemiExplicit.hh:188
typename Explicit< Real, N, M >::MatrixJF MatrixJB
Definition SemiExplicit.hh:51
typename Explicit< Real, N, M >::Type Type
Definition SemiExplicit.hh:52
MatrixJF Jf_x(VectorF const &x, VectorF const &x_dot, Real const t) const
Definition SemiExplicit.hh:163
SemiExplicit()
Definition SemiExplicit.hh:61
typename Explicit< Real, N, M >::VectorF VectorF
Definition SemiExplicit.hh:46
typename Explicit< Real, N, M >::MatrixJF MatrixJF
Definition SemiExplicit.hh:47
std::shared_ptr< SemiExplicit< Real, N, M > > Pointer
Definition SemiExplicit.hh:45
MatrixJF JF_x_dot(VectorF const &x, VectorF const &, Real const t) const override
Definition SemiExplicit.hh:124
VectorF F(VectorF const &x, VectorF const &x_dot, Real const t) const override
Definition SemiExplicit.hh:82
Eigen::FullPivLU< MatrixA > m_lu
Definition SemiExplicit.hh:55
virtual MatrixJB Jb_x(VectorF const &x, Real const t) const =0
typename Explicit< Real, N, M >::VectorF VectorB
Definition SemiExplicit.hh:50
VectorF f(VectorF const &x, Real const t) const override
Definition SemiExplicit.hh:140
MatrixJF JF_x(VectorF const &x, VectorF const &x_dot, Real const t) const override
Definition SemiExplicit.hh:104
typename Explicit< Real, N, M >::MatrixJF MatrixA
Definition SemiExplicit.hh:48
typename std::vector< MatrixJF > TensorTA
Definition SemiExplicit.hh:49
virtual VectorB b(VectorF const &x, Real const t) const =0
VectorH h(VectorF const &x, Real const t) const override
Definition SemiExplicit.hh:437
FunctionTA & TA_x()
Definition SemiExplicit.hh:340
std::function< MatrixJB(VectorF const &, Real const)> FunctionJB
Definition SemiExplicit.hh:273
FunctionID m_in_domain
Definition SemiExplicit.hh:289
std::shared_ptr< SemiExplicitWrapper< Real, N, M > > Pointer
Definition SemiExplicit.hh:262
FunctionJB m_Jb_x
Definition SemiExplicit.hh:286
FunctionJH & Jh_x()
Definition SemiExplicit.hh:364
static const FunctionH DefaultH
Definition SemiExplicit.hh:278
bool in_domain(VectorF const &x, Real const t) const override
Definition SemiExplicit.hh:467
std::function< bool(VectorF const &, Real const)> FunctionID
Definition SemiExplicit.hh:276
std::function< VectorH(VectorF const &, Real const)> FunctionH
Definition SemiExplicit.hh:274
VectorB b(VectorF const &x, Real const t) const override
Definition SemiExplicit.hh:407
FunctionB & b()
Definition SemiExplicit.hh:346
~SemiExplicitWrapper()
Definition SemiExplicit.hh:328
MatrixJH Jh_x(VectorF const &x, Real const t) const override
Definition SemiExplicit.hh:455
std::function< VectorB(VectorF const &, Real const)> FunctionB
Definition SemiExplicit.hh:272
std::function< TensorTA(VectorF const &, Real const)> FunctionTA
Definition SemiExplicit.hh:271
FunctionJB & Jb_x()
Definition SemiExplicit.hh:352
std::function< MatrixA(VectorF const &, Real const)> FunctionA
Definition SemiExplicit.hh:270
static const FunctionJH DefaultJH
Definition SemiExplicit.hh:279
FunctionB m_b
Definition SemiExplicit.hh:285
MatrixA A(VectorF const &x, Real const t) const override
Definition SemiExplicit.hh:378
static const FunctionID DefaultID
Definition SemiExplicit.hh:280
SemiExplicitWrapper(FunctionA t_A, FunctionTA t_TA_x, FunctionB t_b, FunctionJB t_Jb_x, FunctionH t_h=DefaultH, FunctionJH t_Jh_x=DefaultJH, FunctionID t_in_domain=DefaultID)
Definition SemiExplicit.hh:302
FunctionID & in_domain()
Definition SemiExplicit.hh:370
FunctionJH m_Jh_x
Definition SemiExplicit.hh:288
FunctionH m_h
Definition SemiExplicit.hh:287
FunctionTA m_TA_x
Definition SemiExplicit.hh:284
SemiExplicitWrapper(std::string t_name, FunctionA t_A, FunctionTA t_TA_x, FunctionB t_b, FunctionJB t_Jb_x, FunctionH t_h=DefaultH, FunctionJH t_Jh_x=DefaultJH, FunctionID t_in_domain=DefaultID)
Definition SemiExplicit.hh:319
std::function< MatrixJH(VectorF const &, Real const)> FunctionJH
Definition SemiExplicit.hh:275
TensorTA TA_x(VectorF const &x, Real const t) const override
Definition SemiExplicit.hh:396
FunctionA m_A
Definition SemiExplicit.hh:283
FunctionA & A()
Definition SemiExplicit.hh:334
FunctionH & h()
Definition SemiExplicit.hh:358
MatrixJB Jb_x(VectorF const &x, Real const t) const override
Definition SemiExplicit.hh:425
The namespace for the Sandals library.
Definition Sandals.hh:89
SANDALS_DEFAULT_INTEGER_TYPE Integer
The Integer type as used for the API.
Definition Sandals.hh:97