MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
ls.cc
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/libraries/libmbmath/ls.cc,v 1.24 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 /* solution manager */
33 
34 #include "mbconfig.h" /* This goes first in every *.c,*.cc file */
35 
36 #include <string.h> /* for memset() */
37 
38 #include <iostream>
39 #include <iomanip>
40 
41 #include "solman.h"
42 #include "ls.h"
43 
44 /* LinearSolver - begin */
45 
47 : pSM(psm), bHasBeenReset(true), pdRhs(0), pdSol(0)
48 {
49  NO_OP;
50 }
51 
53 {
54  NO_OP;
55 }
56 
57 #ifdef DEBUG
58 void
59 LinearSolver::IsValid(void) const
60 {
61  ASSERT(pSM);
62  ASSERT(pdRhs);
63  ASSERT(pdSol);
64 }
65 #endif /* DEBUG */
66 
67 void
69 {
70  bHasBeenReset = true;
71 }
72 
73 void
75 {
76  silent_cerr("LinearSolver::SolveT() not supported" << std::endl);
78 }
79 
80 void
82 {
83  pSM = psm;
84 }
85 
86 /* ritorna il puntatore al vettore del residuo */
87 doublereal *
89 {
90  return pdRhs;
91 }
92 
93 /* sposta il puntatore al vettore del residuo */
94 doublereal *
96 {
97  doublereal *p = pdRhs;
98 
99  pdRhs = pd;
100 
101  return p;
102 }
103 
104 /* ritorna il puntatore al vettore della soluzione */
105 doublereal *
107 {
108  return pdSol;
109 }
110 
111 /* sposta il puntatore al vettore della soluzione */
112 doublereal *
114 {
115  doublereal *p = pdSol;
116 
117  pdSol = pd;
118 
119  return p;
120 }
121 
122 void
124  std::vector<doublereal>& Ax,
125  std::vector<integer>& Ar,
126  std::vector<integer>& Ac,
127  std::vector<integer>& Ap) const
128 {
129  NO_OP;
130 }
131 
133 {
134  return false; // true means that the condition number was returned in dCond
135 }
136 
137 /* LinearSolver - end */
138 
virtual void Reset(void)
Definition: ls.cc:68
virtual void SolveT(void) const
Definition: ls.cc:74
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
bool bHasBeenReset
Definition: ls.h:73
virtual bool bGetConditionNumber(doublereal &dCond)
Definition: ls.cc:132
#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
Definition: mbdyn.h:77
#define ASSERT(expression)
Definition: colamd.c:977
doublereal * pdSol
Definition: ls.h:75
virtual ~LinearSolver(void)
Definition: ls.cc:52
doublereal * pdRhs
Definition: ls.h:74
doublereal * pdGetResVec(void) const
Definition: ls.cc:88
LinearSolver(SolutionManager *pSM=NULL)
Definition: ls.cc:46
double doublereal
Definition: colamd.c:52
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