23 #include "../Core/Utils/Signal.hpp"
24 #include "../Core/Utils/Timer.hpp"
25 #include "../Core/Utils/CppTools.hpp"
27 #ifndef BOGUS_MECHE_INTERFACE_HPP
28 #define BOGUS_MECHE_INTERFACE_HPP
33 template<
unsigned Dimension >
struct PrimalFrictionProblem ;
34 template<
unsigned Dimension >
struct DualFrictionProblem ;
43 MatrixFreeGaussSeidel,
64 double admmProjStepSize ;
65 double admmFpStepSize ;
79 const unsigned int * ndof,
80 const double *
const * MassMat,
86 const int *
const ObjA,
87 const int *
const ObjB,
88 const double *
const HA[],
89 const double *
const HB[]
93 double solve(
double * r,
96 double problemRegularization,
101 double solve(
double * r,
105 unsigned maxIters = 0,
106 bool staticProblem =
false,
107 double regularization = 0.,
108 bool useInfinityNorm =
false,
109 bool useProjectedGradient =
false,
110 unsigned cadouxIters = 0
119 unsigned nDegreesOfFreedom()
const ;
120 unsigned nContacts()
const ;
130 bool dumpToFile(
const char* fileName,
const double *r0 = BOGUS_NULL_PTR(
const double) )
const ;
136 bool fromFile(
const char* fileName,
double* &r0 ) ;
139 void ackCurrentResidual(
unsigned GSIter,
double err ) ;
144 const DualFrictionProblem<3u> & dual()
const {
return *m_dual ; }
146 PrimalFrictionProblem<3u> & primal() {
return *m_primal ; }
147 DualFrictionProblem<3u> & dual() {
return *m_dual ; }
149 double *f (){
return m_f ; }
150 double *w (){
return m_w ; }
151 double *mu(){
return m_mu ; }
163 double m_lastSolveTime ;
178 std::ostream *m_out ;
unsigned cadouxIters
If staticProblem is false and cadouxIters is greater than zero, use the Cadoux algorithm to solve the...
Definition: MecheInterface.hpp:52
void computeDual(double regularization)
Computes the dual from the primal.
Definition: MecheInterface.cpp:189
double gsRegularization
Solver algorithm;.
Definition: MecheInterface.hpp:61
void reset()
Cleams up the problem, then allocates a new PrimalFrictionProblem and make m_primal point to it...
Definition: MecheInterface.cpp:91
bool dumpToFile(const char *fileName, const double *r0=(static_cast< const double * >(0))) const
Dumps the current primal() to fileName.
Definition: MecheInterface.cpp:415
bool fromFile(const char *fileName, double *&r0)
Loads the primal from a previously saved problem file.
Definition: MecheInterface.cpp:435
unsigned maxIters
Max number of iterations. 0 means GS's default.
Definition: MecheInterface.hpp:51
ADMM (Alternating Direction Method of Multipliers ) iterative solver.
Definition: ADMM.hpp:44
bool gsColoring
Use coloring for parallel GS; slower but deterministic.
Definition: MecheInterface.hpp:62
void setOutStream(std::ostream *out)
Sets the standard output stream ( out can be NULL to remove all output )
Definition: MecheInterface.cpp:409
Projected Gradient iterative solver.
Definition: ProjectedGradient.hpp:41
Simple timer class. Starts when constructed.
Definition: Timer.hpp:24
Dual AMA iterative solver (Alternating Minimization Algorithm on dual formuation of quadratic optimiz...
Definition: ADMM.hpp:191
double solve(double *r, double *v, bool staticProblem, double problemRegularization, const Options &options)
Solves the friction problem.
Definition: MecheInterface.cpp:247
Projected Gauss-Seidel iterative solver.
Definition: GaussSeidel.hpp:43
Definition: MecheInterface.hpp:48
bool useInfinityNorm
Whether to use the infinity norm to evaluate the residual of the friction problem,.
Definition: MecheInterface.hpp:55
double lastSolveTime() const
Time spent in last solver call. In seconds.
Definition: MecheInterface.hpp:154
void fromPrimal(unsigned int NObj, const unsigned int *ndof, const double *const *MassMat, const double *f_in, unsigned int n_in, const double *mu_in, const double *E_in, const double *w_in, const int *const ObjA, const int *const ObjB, const double *const HA[], const double *const HB[])
Allocates and sets up the primal friction problem.
Definition: MecheInterface.cpp:99
int maxThreads
Maximum number of threads that the GS will use.
Definition: MecheInterface.hpp:49
double tolerance
Solver tolerance.
Definition: MecheInterface.hpp:54
Signal< unsigned, double, double > & callback()
Signal< interationNumber, error, elapsedTime > that will be triggered every few iterations.
Definition: MecheInterface.hpp:126
Definition: MecheInterface.hpp:36