Cantera  3.1.0a1
utilities.h File Reference

Various templated functions that carry out common vector and polynomial operations (see Templated Array and Polynomial Operations). More...

#include "ct_defs.h"
#include <numeric>
Include dependency graph for utilities.h:

Detailed Description

Various templated functions that carry out common vector and polynomial operations (see Templated Array and Polynomial Operations).

Definition in file utilities.h.

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 Cantera
 Namespace for the Cantera kernel.
 

Macros

#define CT_DEFINE_HAS_MEMBER(detector_name, func_name)
 A macro for generating member function detectors, which can then be used in combination with if constexpr to condition behavior on the availability of that member function. More...
 

Functions

template<class V >
double dot4 (const V &x, const V &y)
 Templated Inner product of two vectors of length 4. More...
 
template<class V >
double dot5 (const V &x, const V &y)
 Templated Inner product of two vectors of length 5. More...
 
template<class InputIter , class InputIter2 >
double dot (InputIter x_begin, InputIter x_end, InputIter2 y_begin)
 Function that calculates a templated inner product. More...
 
template<class InputIter , class OutputIter , class S >
void scale (InputIter begin, InputIter end, OutputIter out, S scale_factor)
 Multiply elements of an array by a scale factor. More...
 
template<class D , class R >
poly6 (D x, R *c)
 Templated evaluation of a polynomial of order 6. More...
 
template<class D , class R >
poly8 (D x, R *c)
 Templated evaluation of a polynomial of order 8. More...
 
template<class D , class R >
poly5 (D x, R *c)
 Templated evaluation of a polynomial of order 5. More...
 
template<class D , class R >
poly4 (D x, R *c)
 Evaluates a polynomial of order 4. More...
 
template<class D , class R >
poly3 (D x, R *c)
 Templated evaluation of a polynomial of order 3. More...
 
void checkFinite (const double tmp)
 Check to see that a number is finite (not NaN, +Inf or -Inf) More...
 
void checkFinite (const string &name, double *values, size_t N)
 Check to see that all elements in an array are finite. More...
 
template<class T , class U >
const U & getValue (const map< T, U > &m, const T &key, const U &default_val)
 Const accessor for a value in a map. More...
 
template<class T , class U = int>
len (const T &container)
 Get the size of a container, cast to a signed integer type. More...
 

Macro Definition Documentation

◆ CT_DEFINE_HAS_MEMBER

#define CT_DEFINE_HAS_MEMBER (   detector_name,
  func_name 
)
Value:
template<class T, class=void> \
struct detector_name : std::false_type {}; \
template<class T> \
struct detector_name<T, std::void_t<decltype(&T::func_name)>> : std::true_type {};

A macro for generating member function detectors, which can then be used in combination with if constexpr to condition behavior on the availability of that member function.

See MultiRate for examples of use.

Definition at line 205 of file utilities.h.