MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
ls.h
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/libraries/libmbmath/ls.h,v 1.25 2017/01/12 14:43:53 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 LS_H
42 #define LS_H
43 
44 #include <cmath>
45 #include <iostream>
46 #include "ac/f2c.h"
47 
48 #include <vector>
49 
50 /* per il debugging */
51 #include "myassert.h"
52 #include "mynewmem.h"
53 #include "except.h"
54 
55 /* LinearSolver - begin */
56 
57 class LinearSolver {
58 public:
59  struct ErrFactor : public ErrGeneric {
63  };
64  struct ErrNoPivot : public ErrFactor {
66  };
67  struct ErrNullColumn : public ErrFactor {
69  };
70 
71 protected:
73  mutable bool bHasBeenReset;
76 
77 public:
79  virtual ~LinearSolver(void);
80 
81 #ifdef DEBUG
82  void IsValid(void) const;
83 #endif /* DEBUG */
84 
85  virtual void Reset(void);
86  virtual void Solve(void) const = 0;
87  virtual void SolveT(void) const;
88 
89  bool bReset(void) const { return bHasBeenReset; };
91  doublereal *pdGetResVec(void) const;
92  doublereal *pdGetSolVec(void) const;
95 
96  virtual void MakeCompactForm(SparseMatrixHandler& mh,
97  std::vector<doublereal>& Ax,
98  std::vector<integer>& Ar,
99  std::vector<integer>& Ac,
100  std::vector<integer>& Ap) const;
101 
102  /* returns true if the condition number is available, and sets dCond */
103  virtual bool bGetConditionNumber(doublereal& dCond);
104 };
105 
106 /* LinearSolver - end */
107 
108 #endif /* LS_H */
109 
virtual void Reset(void)
Definition: ls.cc:68
virtual void SolveT(void) const
Definition: ls.cc:74
#define MBDYN_EXCEPT_ARGS_PASSTHRU
Definition: except.h:55
bool bHasBeenReset
Definition: ls.h:73
virtual bool bGetConditionNumber(doublereal &dCond)
Definition: ls.cc:132
#define MBDYN_EXCEPT_ARGS_DECL
Definition: except.h:43
#define NO_OP
Definition: myassert.h:74
void SetSolutionManager(SolutionManager *pSM)
Definition: ls.cc:81
doublereal * pdGetSolVec(void) const
Definition: ls.cc:106
doublereal * pdSetResVec(doublereal *pd)
Definition: ls.cc:95
doublereal * pdSetSolVec(doublereal *pd)
Definition: ls.cc:113
SolutionManager * pSM
Definition: ls.h:72
integer iCol
Definition: ls.h:60
virtual void Solve(void) const =0
doublereal * pdSol
Definition: ls.h:75
virtual ~LinearSolver(void)
Definition: ls.cc:52
ErrFactor(integer i, MBDYN_EXCEPT_ARGS_DECL)
Definition: ls.h:61
doublereal * pdRhs
Definition: ls.h:74
doublereal * pdGetResVec(void) const
Definition: ls.cc:88
LinearSolver(SolutionManager *pSM=NULL)
Definition: ls.cc:46
ErrNullColumn(integer i, MBDYN_EXCEPT_ARGS_DECL)
Definition: ls.h:68
ErrNoPivot(integer i, MBDYN_EXCEPT_ARGS_DECL)
Definition: ls.h:65
bool bReset(void) const
Definition: ls.h:89
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51
virtual void MakeCompactForm(SparseMatrixHandler &mh, std::vector< doublereal > &Ax, std::vector< integer > &Ar, std::vector< integer > &Ac, std::vector< integer > &Ap) const
Definition: ls.cc:123