Cantera  2.5.1
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 // Forward references
29 class VCS_SPECIES_THERMO;
30 
31 //! Class to keep track of time and iterations
32 /*!
33  * class keeps all of the counters together.
34  */
36 {
37 public:
38  //! Total number of iterations in the main loop
39  //! of vcs_TP() to solve for thermo equilibrium
40  int T_Its;
41 
42  //! Current number of iterations in the main loop
43  //! of vcs_TP() to solve for thermo equilibrium
44  int Its;
45 
46  //! Total number of optimizations of the components basis set done
48 
49  //! number of optimizations of the components basis set done
51 
52  //! Current number of times the initial thermo equilibrium estimator has
53  //! been called
55 
56  //! Current number of calls to vcs_TP
58 
59  //! Current time spent in vcs_TP
60  double T_Time_vcs_TP;
61 
62  //! Current time spent in vcs_TP
63  double Time_vcs_TP;
64 
65  //! Total Time spent in basopt
66  double T_Time_basopt;
67 
68  //! Current Time spent in basopt
69  double Time_basopt;
70 
71  //! Time spent in initial estimator
72  double T_Time_inest;
73 
74  //! Time spent in the vcs suite of programs
75  double T_Time_vcs;
76 };
77 
78 //! Definition of the function pointer for the root finder
79 /*!
80  * see vcsUtil_root1d for a definition of how to use this.
81  */
82 typedef double(*VCS_FUNC_PTR)(double xval, double Vtarget,
83  int varID, void* fptrPassthrough,
84  int* err);
85 
86 //! determine the l2 norm of a vector of doubles
87 /*!
88  * @param vec vector of doubles
89  * @returns the l2 norm of the vector
90  */
91 double vcs_l2norm(const vector_fp& vec);
92 
93 //! Returns a const char string representing the type of the species given by
94 //! the first argument
95 /*!
96  * @param speciesStatus Species status integer representing the type
97  * of the species.
98  * @param length Maximum length of the string to be returned.
99  * Shorter values will yield abbreviated strings.
100  * Defaults to a value of 100.
101  */
102 const char* vcs_speciesType_string(int speciesStatus, int length = 100);
103 
104 //! Simple routine to check whether two doubles are equal up to roundoff error
105 /*!
106  * Currently it's set to check for 10 digits of relative accuracy.
107  *
108  * @param d1 first double
109  * @param d2 second double
110  *
111  * @returns true if the doubles are "equal" and false otherwise
112  */
113 bool vcs_doubleEqual(double d1, double d2);
114 }
115 
116 #endif
Class to keep track of time and iterations.
Definition: vcs_internal.h:36
int Its
Current number of iterations in the main loop of vcs_TP() to solve for thermo equilibrium.
Definition: vcs_internal.h:44
int T_Calls_Inest
Current number of times the initial thermo equilibrium estimator has been called.
Definition: vcs_internal.h:54
double T_Time_basopt
Total Time spent in basopt.
Definition: vcs_internal.h:66
double T_Time_inest
Time spent in initial estimator.
Definition: vcs_internal.h:72
int T_Basis_Opts
Total number of optimizations of the components basis set done.
Definition: vcs_internal.h:47
double T_Time_vcs_TP
Current time spent in vcs_TP.
Definition: vcs_internal.h:60
int Basis_Opts
number of optimizations of the components basis set done
Definition: vcs_internal.h:50
double T_Time_vcs
Time spent in the vcs suite of programs.
Definition: vcs_internal.h:75
int T_Its
Total number of iterations in the main loop of vcs_TP() to solve for thermo equilibrium.
Definition: vcs_internal.h:40
int T_Calls_vcs_TP
Current number of calls to vcs_TP.
Definition: vcs_internal.h:57
double Time_basopt
Current Time spent in basopt.
Definition: vcs_internal.h:69
double Time_vcs_TP
Current time spent in vcs_TP.
Definition: vcs_internal.h:63
This file contains definitions for utility functions and text for modules, inputfiles,...
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
Definition: ct_defs.h:180
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:264
int vcs_timing_print_lvl
Global hook for turning on and off time printing.
Definition: vcs_solve.cpp:22
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:82
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:33
bool vcs_doubleEqual(double d1, double d2)
Simple routine to check whether two doubles are equal up to roundoff error.
Definition: vcs_util.cpp:91
double vcs_l2norm(const vector_fp &vec)
determine the l2 norm of a vector of doubles
Definition: vcs_util.cpp:21