MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
solman.h
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/libraries/libmbmath/solman.h,v 1.53 2017/01/12 14:43:54 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  * SOLUTION MANAGER *
35  * *
36  *****************************************************************************/
37 
38 /* Pierangelo Masarati */
39 
40 
41 #ifndef SOLMAN_H
42 #define SOLMAN_H
43 
44 #include <cmath>
45 #include <iostream>
46 #include "ac/f2c.h"
47 
48 /* per il debugging */
49 #include "myassert.h"
50 #include "mynewmem.h"
51 #include "except.h"
52 
53 #include "vh.h"
54 #include "mh.h"
55 
56 #include "matvec3.h"
57 
58 /* classi virtuali dichiarate in questo file */
59 class MatrixHandler; /* gestore matrice */
61 class VectorHandler; /* gestore vettore */
62 class SolutionManager; /* gestore della soluzione */
63 
64 /* classi usate in questo file */
65 class SubMatrixHandler;
69 class SubVectorHandler;
70 class Vec3;
71 class Mat3x3;
72 class LinearSolver;
73 
74 /* SolutionDataManager - begin */
75 
77 public:
78  virtual ~SolutionDataManager(void);
79 
81  public:
83  };
84 
85  /* Collega il DataManager ed il DriveHandler ai vettori soluzione */
86  virtual void
88  VectorHandler& XPrimeCurr) = 0;
89 
90  /* Assembla il residuo */
91  virtual void AssRes(VectorHandler& ResHdl, doublereal dCoef) = 0;
92 };
93 
94 /* SolutionDataManager - end */
95 
96 
97 /* SolutionManager - begin */
98 
100 public:
101  // whether matrix scaling should be performed, and when, using dgeequ()
102  enum ScaleWhen {
106  };
107 
118  };
119 
120  enum ScaleFlags {
122  SCALEF_WARN = 0x1u,
127  };
128 
129  struct ScaleOpt {
132  integer iMaxIter = 100,
133  doublereal dTol = sqrt(std::numeric_limits<doublereal>::epsilon()),
134  unsigned flags = SCALEF_DEFAULT):
135  when(when),
136  algorithm(alg),
138  dTol(dTol),
139  uFlags(flags)
140  {
141 
142  }
143 
148  unsigned uFlags;
149  };
150 protected:
152 
153 public:
154  SolutionManager(void);
155 
156  /* Distruttore: dealloca le matrici e distrugge gli oggetti propri */
157  virtual ~SolutionManager(void);
158 
159  virtual void
161  VectorHandler& XPrimeCurr);
162 
163 #ifdef DEBUG
164  virtual void IsValid(void) const = 0;
165 #endif /* DEBUG */
166 
167  /* Inizializzatore generico */
168  virtual void MatrReset(void) = 0;
169 
170  /* Inizializzatore "speciale" */
171  virtual void MatrInitialize(void);
172 
173  /* Risolve il sistema */
174  virtual void Solve(void) = 0;
175  virtual void SolveT(void);
176 
177  /* Rende disponibile l'handler per la matrice */
178  virtual MatrixHandler* pMatHdl(void) const = 0;
179 
180  /* Rende disponibile l'handler per il termine noto */
181  virtual VectorHandler* pResHdl(void) const = 0;
182 
183  /* Rende disponibile l'handler per la soluzione (e' lo stesso
184  * del termine noto, ma concettualmente sono separati) */
185  virtual VectorHandler* pSolHdl(void) const = 0;
186 
187  /* sposta il puntatore al vettore del residuo */
189 
190  /* sposta il puntatore al vettore della soluzione */
192 
193  /* return true if the condition number is available */
194  bool bGetConditionNumber(doublereal& dCond) const;
195 };
196 
197 /* SolutionManager - end */
198 
199 #endif /* SOLMAN_H */
200 
virtual VectorHandler * pResHdl(void) const =0
ChangedEquationStructure(MBDYN_EXCEPT_ARGS_DECL)
Definition: solman.h:82
Definition: matvec3.h:98
doublereal * pdSetSolVec(doublereal *pd)
Definition: solman.cc:101
#define MBDYN_EXCEPT_ARGS_PASSTHRU
Definition: except.h:55
virtual void LinkToSolution(VectorHandler &XCurr, VectorHandler &XPrimeCurr)=0
SolutionManager(void)
Definition: solman.cc:57
#define MBDYN_EXCEPT_ARGS_DECL
Definition: except.h:43
ScaleOpt(ScaleWhen when=SCALEW_NEVER, ScaleAlgorithm alg=SCALEA_UNDEF, integer iMaxIter=100, doublereal dTol=sqrt(std::numeric_limits< doublereal >::epsilon()), unsigned flags=SCALEF_DEFAULT)
Definition: solman.h:130
virtual void SolveT(void)
Definition: solman.cc:78
virtual MatrixHandler * pMatHdl(void) const =0
doublereal * pdSetResVec(doublereal *pd)
Definition: solman.cc:93
virtual void MatrReset(void)=0
virtual ~SolutionDataManager(void)
Definition: solman.cc:47
virtual void Solve(void)=0
GradientExpression< UnaryExpr< FuncSqrt, Expr > > sqrt(const GradientExpression< Expr > &u)
Definition: gradient.h:2974
virtual void MatrInitialize(void)
Definition: solman.cc:72
virtual void LinkToSolution(VectorHandler &XCurr, VectorHandler &XPrimeCurr)
Definition: solman.cc:85
virtual void AssRes(VectorHandler &ResHdl, doublereal dCoef)=0
virtual ~SolutionManager(void)
Definition: solman.cc:63
bool bGetConditionNumber(doublereal &dCond) const
Definition: solman.cc:107
ScaleAlgorithm algorithm
Definition: solman.h:145
LinearSolver * pLS
Definition: solman.h:151
virtual VectorHandler * pSolHdl(void) const =0
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51