1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/modules/module-nonsmooth-node/mbdyn_siconos.h,v 1.9 2017/01/12 14:55:58 masarati Exp $ */
2 /*
3  * MBDyn (C) is a multibody analysis code.
4  * http://www.mbdyn.org
5  *
6  * Copyright (C) 1996-2017
7  *
8  * Pierangelo Masarati	<masarati@aero.polimi.it>
9  * Paolo Mantegazza	<mantegazza@aero.polimi.it>
10  *
11  * Dipartimento di Ingegneria Aerospaziale - Politecnico di Milano
12  * via La Masa, 34 - 20156 Milano, Italy
13  * http://www.aero.polimi.it
14  *
15  * Changing this copyright notice is forbidden.
16  *
17  * This program is free software; you can redistribute it and/or modify
18  * it under the terms of the GNU General Public License as published by
19  * the Free Software Foundation (version 2 of the License).
20  *
21  *
22  * This program is distributed in the hope that it will be useful,
23  * but WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25  * GNU General Public License for more details.
26  *
27  * You should have received a copy of the GNU General Public License
28  * along with this program; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
30  */
31 /*
32  * Author: Matteo Fancello <matteo.fancello@gmail.com>
33  * Nonsmooth dynamics element;
34  * uses SICONOS <http://siconos.gforge.inria.fr/>
35  */
36 
37 #ifndef MBDYN_SICONOS_H
38 #define MBDYN_SICONOS_H
39 
40 enum LCPsolver {
41 	// quadratic programming formulation
42 	QP,
43 
44 	// CPG (Conjugated Projected Gradient) solver for LCP based on quadratic minimization.
45 	CPG,
46 
47 	// PGS is a basic Projected Gauss-Seidel solver for LCP.
48 	PGS,
49 
50 	// Regularized Projected Gauss-Seidel, is a solver for LCP,
51 	// able to handle matrices with null diagonal terms
52 	RPGS,
53 
54 	// Projected Succesive over relaxation solver for LCP. See cottle, Pang Stone Chap 5
55 	PSOR,
56 
57 	// quadratic programm formulation for solving an non symmetric LCP
58 	NSQP,
59 
60 	// (LArge Time INcrements) is a basic latin solver for LCP.
61 	LATIN,
62 
63 	// (LArge Time INcrements) is a basic latin solver with relaxation for LCP
64 	LATIN_W,
65 
66 	// direct solver for LCP based on pivoting method principle for degenerate problem.
67 	// Choice of pivot variable is performed via lexicographic ordering
68 	LEXICO_LEMKE,
69 
70 	// nonsmooth Newton method based on the min formulation (or max formulation) of the LCP
71 	NEWTON_MIN,
72 
73 	// uses a nonsmooth newton method based on the Fischer-Bursmeister convex function
74 	NEWTON_FB
75 
76 #if 0
77 	// Gauss-Seidel solver based on a Sparse-Block storage for the matrix M of the LCP.
78 	// Can't be used here because Matrix M of the LCP must be formulated as SparseBlockStructuredMatrix.
79 	NSGS_SBM
80 #endif
81 };
82 
83 struct solver_parameters {
84 	// input parameters
85 	LCPsolver solver;
86 	double solvertol;
87 	int solveritermax;
88 
89 	// output
90 	int info;
91 
92 	// only for: CPG, PGS, RPGS, NEWTON, LATIN, PSOR
93 	int processed_iterations;
94 	double resulting_error;
95 };
96 
97 extern void mbdyn_siconos_LCP_call(int size, double M[], double blcp[], double zlem[], double wlem[], solver_parameters& solparam);
98 
99 #endif // MBDYN_SICONOS_H
100