MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
solverdiagnostics.h
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/mbdyn/base/solverdiagnostics.h,v 1.25 2017/01/12 14:46:10 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 #ifndef SOLVERDIAGNOSTICS_H
33 #define SOLVERDIAGNOSTICS_H
34 
35 #include "drive.h"
36 #include "mh.h"
37 
39 protected:
40  unsigned OutputFlags;
42 
43  enum {
44  OUTPUT_NONE = 0x0000,
45 
46  OUTPUT_ITERS = 0x0001,
47  OUTPUT_RES = 0x0002,
48  OUTPUT_SOL = 0x0004,
49  OUTPUT_JAC = 0x0008,
50 
51  OUTPUT_BAILOUT = 0x0010,
52  OUTPUT_MSG = 0x0020,
53  OUTPUT_COUNTER = 0x0040,
58  OUTPUT_CPU_TIME = 0x800,
62 
63  OUTPUT_MASK = 0x07FF
64  };
65 public:
66 
67  SolverDiagnostics(unsigned OF = OUTPUT_DEFAULT, DriveCaller *pOM = 0);
68  virtual ~SolverDiagnostics(void);
69 
70  void SetNoOutput(void);
71 
72  void SetOutputMeter(DriveCaller *pOM);
73  void SetOutputDriveHandler(const DriveHandler *pDH);
74 
75  void SetOutputFlags(unsigned OF);
76  void AddOutputFlags(unsigned OF);
77  void DelOutputFlags(unsigned OF);
78  inline MatrixHandler::Norm_t GetCondMatNorm(void) const;
79 
80  inline bool outputMeter(void) const {
81  return (!pOutputMeter || pOutputMeter->dGet());
82  };
83 
84  inline bool outputIters(void) const {
85  return outputMeter() && (OutputFlags & OUTPUT_ITERS);
86  };
87 
88  inline bool outputRes(void) const {
89  return outputMeter() && (OutputFlags & OUTPUT_RES);
90  };
91 
92  inline bool outputSol(void) const {
93  return outputMeter() && (OutputFlags & OUTPUT_SOL);
94  };
95 
96  inline bool outputJac(void) const {
97  return outputMeter() && (OutputFlags & OUTPUT_JAC);
98  };
99 
100  inline bool outputStep(void) const {
101  return outputMeter() && (OutputFlags & OUTPUT_STEP);
102  };
103 
104  inline bool outputBailout(void) const {
105  // NOTE: this is NOT conditioned by output meter
106  return (OutputFlags & OUTPUT_BAILOUT);
107  };
108 
109  inline bool outputCounter(void) const {
110  return (OutputFlags & OUTPUT_COUNTER);
111  };
112 
113  inline bool outputMatrixConditionNumber(void) const {
114  return (OutputFlags & OUTPUT_MAT_COND_NUM);
115  };
116 
117  inline bool outputSolverConditionNumber(void) const {
119  }
120 
121  inline bool outputSolverConditionStat(void) const {
123  }
124 
125  inline bool outputCPUTime(void) const {
126  return (OutputFlags & OUTPUT_CPU_TIME);
127  }
128 
129  // all messages not protected behind any other condition
130  // must be protected by a "if (outputMsg())" condition
131  inline bool outputMsg(void) const {
132  return (OutputFlags & OUTPUT_MSG);
133  };
134 };
135 
137 {
138  switch (OutputFlags & OUTPUT_MAT_COND_NUM) {
140  return MatrixHandler::NORM_1;
143  default:
144  ASSERT(0);
146  }
147 }
148 
149 #endif /* SOLVERDIAGNOSTICS_H */
150 
bool outputMatrixConditionNumber(void) const
bool outputMeter(void) const
bool outputIters(void) const
bool outputCounter(void) const
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
bool outputBailout(void) const
void SetOutputMeter(DriveCaller *pOM)
void SetOutputFlags(unsigned OF)
MatrixHandler::Norm_t GetCondMatNorm(void) const
bool outputMsg(void) const
bool outputRes(void) const
bool outputJac(void) const
bool outputStep(void) const
bool outputSolverConditionNumber(void) const
DriveCaller * pOutputMeter
bool outputSol(void) const
void AddOutputFlags(unsigned OF)
SolverDiagnostics(unsigned OF=OUTPUT_DEFAULT, DriveCaller *pOM=0)
void DelOutputFlags(unsigned OF)
#define ASSERT(expression)
Definition: colamd.c:977
void SetOutputDriveHandler(const DriveHandler *pDH)
virtual doublereal dGet(const doublereal &dVar) const =0
bool outputCPUTime(void) const
bool outputSolverConditionStat(void) const
virtual ~SolverDiagnostics(void)