Cantera  2.3.0
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 http://www.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 //! define this Cantera function to replace cout << endl;
21 /*!
22  * We use this to place an endl in the log file, and ensure that the IO buffers
23  * are flushed.
24  */
25 #define plogendl() writelogendl()
26 
27 //! Global hook for turning on and off time printing.
28 /*!
29  * Default is to allow printing. But, you can assign this to zero globally to
30  * turn off all time printing. This is helpful for test suite purposes where you
31  * are interested in differences in text files.
32  */
33 extern int vcs_timing_print_lvl;
34 
35 // Forward references
36 class VCS_SPECIES_THERMO;
37 class VCS_PROB;
38 
39 //! Class to keep track of time and iterations
40 /*!
41  * class keeps all of the counters together.
42  */
44 {
45 public:
46  //! Total number of iterations in the main loop
47  //! of vcs_TP() to solve for thermo equilibrium
48  int T_Its;
49 
50  //! Current number of iterations in the main loop
51  //! of vcs_TP() to solve for thermo equilibrium
52  int Its;
53 
54  //! Total number of optimizations of the components basis set done
56 
57  //! number of optimizations of the components basis set done
59 
60  //! Current number of times the initial thermo equilibrium estimator has
61  //! been called
63 
64  //! Current number of calls to vcs_TP
66 
67  //! Current time spent in vcs_TP
68  double T_Time_vcs_TP;
69 
70  //! Current time spent in vcs_TP
71  double Time_vcs_TP;
72 
73  //! Total Time spent in basopt
74  double T_Time_basopt;
75 
76  //! Current Time spent in basopt
77  double Time_basopt;
78 
79  //! Time spent in initial estimator
80  double T_Time_inest;
81 
82  //! Time spent in the vcs suite of programs
83  double T_Time_vcs;
84 };
85 
86 //! Definition of the function pointer for the root finder
87 /*!
88  * see vcsUtil_root1d for a definition of how to use this.
89  */
90 typedef double(*VCS_FUNC_PTR)(double xval, double Vtarget,
91  int varID, void* fptrPassthrough,
92  int* err);
93 
94 //! determine the l2 norm of a vector of doubles
95 /*!
96  * @param vec vector of doubles
97  * @returns the l2 norm of the vector
98  */
99 double vcs_l2norm(const vector_fp& vec);
100 
101 //! Finds the location of the maximum component in a double vector
102 /*!
103  * @param x pointer to a vector of doubles
104  * @param xSize pointer to a vector of doubles used as a multiplier to x[]
105  * before making the decision. Ignored if set to NULL.
106  * @param j lowest index to search from
107  * @param n highest index to search from
108  * @returns index of the greatest value on X(i) searched, j <= i < n
109  */
110 size_t vcs_optMax(const double* x, const double* xSize, size_t j, size_t n);
111 
112 //! Returns a const char string representing the type of the species given by
113 //! the first argument
114 /*!
115  * @param speciesStatus Species status integer representing the type
116  * of the species.
117  * @param length Maximum length of the string to be returned.
118  * Shorter values will yield abbreviated strings.
119  * Defaults to a value of 100.
120  */
121 const char* vcs_speciesType_string(int speciesStatus, int length = 100);
122 
123 //! Simple routine to check whether two doubles are equal up to roundoff error
124 /*!
125  * Currently it's set to check for 10 digits of relative accuracy.
126  *
127  * @param d1 first double
128  * @param d2 second double
129  *
130  * @returns true if the doubles are "equal" and false otherwise
131  */
132 bool vcs_doubleEqual(double d1, double d2);
133 }
134 
135 #endif
bool vcs_doubleEqual(double d1, double d2)
Simple routine to check whether two doubles are equal up to roundoff error.
Definition: vcs_util.cpp:116
int Its
Current number of iterations in the main loop of vcs_TP() to solve for thermo equilibrium.
Definition: vcs_internal.h:52
int T_Calls_Inest
Current number of times the initial thermo equilibrium estimator has been called. ...
Definition: vcs_internal.h:62
double Time_vcs_TP
Current time spent in vcs_TP.
Definition: vcs_internal.h:71
int Basis_Opts
number of optimizations of the components basis set done
Definition: vcs_internal.h:58
double T_Time_basopt
Total Time spent in basopt.
Definition: vcs_internal.h:74
int vcs_timing_print_lvl
Global hook for turning on and off time printing.
Definition: vcs_solve.cpp:22
This file contains definitions for utility functions and text for modules, inputfiles, logs, textlogs, (see Input File Handling, Diagnostic Output, and Writing messages to the screen).
int T_Basis_Opts
Total number of optimizations of the components basis set done.
Definition: vcs_internal.h:55
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:90
double T_Time_vcs_TP
Current time spent in vcs_TP.
Definition: vcs_internal.h:68
int T_Its
Total number of iterations in the main loop of vcs_TP() to solve for thermo equilibrium.
Definition: vcs_internal.h:48
double T_Time_inest
Time spent in initial estimator.
Definition: vcs_internal.h:80
double Time_basopt
Current Time spent in basopt.
Definition: vcs_internal.h:77
double vcs_l2norm(const vector_fp &vec)
determine the l2 norm of a vector of doubles
Definition: vcs_util.cpp:21
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:157
size_t vcs_optMax(const double *x, const double *xSize, size_t j, size_t n)
Finds the location of the maximum component in a double vector.
Definition: vcs_util.cpp:33
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:58
Class to keep track of time and iterations.
Definition: vcs_internal.h:43
double T_Time_vcs
Time spent in the vcs suite of programs.
Definition: vcs_internal.h:83
Namespace for the Cantera kernel.
Definition: application.cpp:29
int T_Calls_vcs_TP
Current number of calls to vcs_TP.
Definition: vcs_internal.h:65