3 #include <Caribou/config.h>
4 #include <sofa/core/behavior/OdeSolver.h>
5 #include <sofa/simulation/MechanicalMatrixVisitor.h>
6 #include <sofa/core/behavior/MultiVec.h>
8 namespace SofaCaribou::ode {
10 using sofa::core::objectmodel::Data;
19 void solve (
const sofa::core::ExecParams* params ,
double dt, sofa::core::MultiVecCoordId xResult, sofa::core::MultiVecDerivId vResult)
override;
32 return p_squared_residuals;
39 return p_squared_initial_residual;
47 return p_iterative_linear_solver_squared_residuals;
55 return p_iterative_linear_solver_squared_rhs_norms;
103 double matrix[3][3] =
109 if (inputDerivative >= 3 || outputDerivative >= 3)
112 return matrix[outputDerivative][inputDerivative];
124 double vect[3] = { dt, 1, 1/dt};
125 if (outputDerivative >= 3)
128 return vect[outputDerivative];
135 Data<double> d_correction_tolerance_threshold;
136 Data<double> d_residual_tolerance_threshold;
137 Data<bool> d_shoud_diverge_when_residual_is_growing;
138 Data<bool> d_warm_start;
146 sofa::core::behavior::MultiVecDeriv dx;
149 sofa::core::behavior::MultiVecDeriv U;
152 std::vector<UNSIGNED_INTEGER_TYPE> p_times;
155 std::vector<FLOATING_POINT_TYPE> p_squared_residuals;
158 FLOATING_POINT_TYPE p_squared_initial_residual;
162 std::vector<std::vector<FLOATING_POINT_TYPE>> p_iterative_linear_solver_squared_residuals;
166 std::vector<FLOATING_POINT_TYPE> p_iterative_linear_solver_squared_rhs_norms;