MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
eigjdqz.h
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/mbdyn/base/eigjdqz.h,v 1.8 2017/01/12 14:46:09 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 /*
33 
34 3.1 User supplied subroutines
35 The user has to supply three problem dependent routines: one for the mul-
36 tiplication of a vector with the operator A, one for multiplication with B,
37 and one for performing the preconditioning operation. The subroutine to
38 multiply with A must be called AMUL and must have the following header:
39 
40  subroutine AMUL( n, q, r )
41 c...............................................
42 c... Subroutine to compute r = Aq
43 c...............................................
44  integer n
45  double complex q(n), r(n)
46 
47 q is the input vector, r the output vector. n is the dimension of the problem.
48 The subroutine to multiply with B must be called BMUL and must have the
49 following header:
50 
51  subroutine BMUL( n, q, r )
52 c...............................................
53 c... Subroutine to compute r = Bq
54 c...............................................
55  integer n
56  double complex q(n), r(n)
57 
58 Finally, the routine to perform the preconditioning operation must be called
59 PRECON and must have the header
60 
61  subroutine PRECON( n, q )
62 c...............................................
63 c... Subroutine to compute q = K^-1 q
64 c...............................................
65  integer n
66  double complex q(n)
67 
68 The preconditioning matrix should be an approximation of the matrix A -
69  B, with the prechosen target value. Preconditioning within the JDQZ
70 algorithm is described in section 3.4 of [1]. Preconditioning is not essential
71 for the correct behavior of the algorithm. It should improve the rate of
72 convergence, but leaving the vector q untouched should have no influence on
73 the correctness of the results.
74 
75 */
76 
77 #ifndef EIGJDQZ_H
78 #define EIGJDQZ_H
79 
80 #ifdef USE_JDQZ
81 
82 #include "ac/jdqz.h"
83 #include "naivemh.h"
84 
85 extern "C" int
86 __FC_DECL__(amul)(integer *n, doublecomplex *q, doublecomplex *r);
87 
88 extern "C" int
89 __FC_DECL__(bmul)(integer *n, doublecomplex *q, doublecomplex *r);
90 
91 extern "C" int
92 __FC_DECL__(precon)(integer *n, doublecomplex *q);
93 
94 class MBJDQZ {
95 protected:
96  const NaiveMatrixHandler& A;
97  const NaiveMatrixHandler& B;
98 
99  unsigned cnt;
100 
101  void Mul(integer n, doublecomplex *q, doublecomplex *r, const NaiveMatrixHandler& M);
102 
103 public:
104  MBJDQZ(const NaiveMatrixHandler& A, const NaiveMatrixHandler& B);
105  virtual ~MBJDQZ(void);
106 
107  void AMul(integer n, doublecomplex *q, doublecomplex *r);
108  void BMul(integer n, doublecomplex *q, doublecomplex *r);
109 
110  unsigned Cnt(void) const;
111 };
112 
113 extern MBJDQZ* mbjdqzp;
114 
115 #endif // USE_JDQZ
116 
117 #endif // ! EIGJDQZ_H
int __FC_DECL__() precon(integer *n, doublecomplex *q)
Definition: eigjdqz.cc:104
int __FC_DECL__() amul(integer *n, doublecomplex *q, doublecomplex *r)
Definition: eigjdqz.cc:84
int __FC_DECL__() bmul(integer *n, doublecomplex *q, doublecomplex *r)
Definition: eigjdqz.cc:94
long int integer
Definition: colamd.c:51
MBJDQZ * mbjdqzp
Definition: eigjdqz.cc:81