Cantera  3.1.0a1
vcs_internal.h
Go to the documentation of this file.
1 /**
2  * @file vcs_internal.h Internal declarations for the VCSnonideal package
3  */
4 
5 // This file is part of Cantera. See License.txt in the top-level directory or
6 // at https://cantera.org/license.txt for license and copyright information.
7 
8 #ifndef _VCS_INTERNAL_H
9 #define _VCS_INTERNAL_H
10 
11 #include "cantera/base/global.h"
12 namespace Cantera
13 {
14 //! define this %Cantera function to replace printf
15 /*!
16  * We can replace this with printf easily
17  */
18 #define plogf writelogf
19 
20 //! Global hook for turning on and off time printing.
21 /*!
22  * Default is to allow printing. But, you can assign this to zero globally to
23  * turn off all time printing. This is helpful for test suite purposes where you
24  * are interested in differences in text files.
25  */
26 extern int vcs_timing_print_lvl;
27 
28 //! Class to keep track of time and iterations
29 /*!
30  * class keeps all of the counters together.
31  */
33 {
34 public:
35  //! Total number of iterations in the main loop
36  //! of vcs_TP() to solve for thermo equilibrium
37  int T_Its;
38 
39  //! Current number of iterations in the main loop
40  //! of vcs_TP() to solve for thermo equilibrium
41  int Its;
42 
43  //! Total number of optimizations of the components basis set done
45 
46  //! number of optimizations of the components basis set done
48 
49  //! Current number of times the initial thermo equilibrium estimator has
50  //! been called
52 
53  //! Current number of calls to vcs_TP
55 
56  //! Current time spent in vcs_TP
57  double T_Time_vcs_TP;
58 
59  //! Current time spent in vcs_TP
60  double Time_vcs_TP;
61 
62  //! Total Time spent in basopt
63  double T_Time_basopt;
64 
65  //! Current Time spent in basopt
66  double Time_basopt;
67 
68  //! Time spent in initial estimator
69  double T_Time_inest;
70 
71  //! Time spent in the vcs suite of programs
72  double T_Time_vcs;
73 };
74 
75 //! Definition of the function pointer for the root finder
76 /*!
77  * see vcsUtil_root1d for a definition of how to use this.
78  */
79 typedef double(*VCS_FUNC_PTR)(double xval, double Vtarget,
80  int varID, void* fptrPassthrough,
81  int* err);
82 
83 //! determine the l2 norm of a vector of doubles
84 /*!
85  * @param vec vector of doubles
86  * @returns the l2 norm of the vector
87  */
88 double vcs_l2norm(const vector<double>& vec);
89 
90 //! Returns a const char string representing the type of the species given by
91 //! the first argument
92 /*!
93  * @param speciesStatus Species status integer representing the type
94  * of the species.
95  * @param length Maximum length of the string to be returned.
96  * Shorter values will yield abbreviated strings.
97  * Defaults to a value of 100.
98  */
99 const char* vcs_speciesType_string(int speciesStatus, int length = 100);
100 
101 //! Simple routine to check whether two doubles are equal up to roundoff error
102 /*!
103  * Currently it's set to check for 10 digits of relative accuracy.
104  *
105  * @param d1 first double
106  * @param d2 second double
107  *
108  * @returns true if the doubles are "equal" and false otherwise
109  */
110 bool vcs_doubleEqual(double d1, double d2);
111 }
112 
113 #endif
Class to keep track of time and iterations.
Definition: vcs_internal.h:33
int Its
Current number of iterations in the main loop of vcs_TP() to solve for thermo equilibrium.
Definition: vcs_internal.h:41
int T_Calls_Inest
Current number of times the initial thermo equilibrium estimator has been called.
Definition: vcs_internal.h:51
double T_Time_basopt
Total Time spent in basopt.
Definition: vcs_internal.h:63
double T_Time_inest
Time spent in initial estimator.
Definition: vcs_internal.h:69
int T_Basis_Opts
Total number of optimizations of the components basis set done.
Definition: vcs_internal.h:44
double T_Time_vcs_TP
Current time spent in vcs_TP.
Definition: vcs_internal.h:57
int Basis_Opts
number of optimizations of the components basis set done
Definition: vcs_internal.h:47
double T_Time_vcs
Time spent in the vcs suite of programs.
Definition: vcs_internal.h:72
int T_Its
Total number of iterations in the main loop of vcs_TP() to solve for thermo equilibrium.
Definition: vcs_internal.h:37
int T_Calls_vcs_TP
Current number of calls to vcs_TP.
Definition: vcs_internal.h:54
double Time_basopt
Current Time spent in basopt.
Definition: vcs_internal.h:66
double Time_vcs_TP
Current time spent in vcs_TP.
Definition: vcs_internal.h:60
This file contains definitions for utility functions and text for modules, inputfiles and logging,...
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:564
int vcs_timing_print_lvl
Global hook for turning on and off time printing.
Definition: vcs_solve.cpp:42
double(* VCS_FUNC_PTR)(double xval, double Vtarget, int varID, void *fptrPassthrough, int *err)
Definition of the function pointer for the root finder.
Definition: vcs_internal.h:79
const char * vcs_speciesType_string(int speciesStatus, int length)
Returns a const char string representing the type of the species given by the first argument.
Definition: vcs_util.cpp:31
bool vcs_doubleEqual(double d1, double d2)
Simple routine to check whether two doubles are equal up to roundoff error.
Definition: vcs_util.cpp:89
double vcs_l2norm(const vector< double > &vec)
determine the l2 norm of a vector of doubles
Definition: vcs_util.cpp:19