Cantera 2.6.0
Namespaces | Macros | Functions
utilities.h File Reference

Various templated functions that carry out common vector operations (see Templated Utility Functions). More...

#include "ct_defs.h"
#include <numeric>
Include dependency graph for utilities.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  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 std::enable_if to allow selection of a particular template specialization based on the presence of that member function. More...
 

Functions

template<class V >
doublereal dot4 (const V &x, const V &y)
 Templated Inner product of two vectors of length 4. More...
 
template<class V >
doublereal dot5 (const V &x, const V &y)
 Templated Inner product of two vectors of length 5. More...
 
template<class InputIter , class InputIter2 >
doublereal 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 std::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 std::map< T, U > &m, const T &key, const U &default_val)
 Const accessor for a value in a std::map. More...
 

Detailed Description

Various templated functions that carry out common vector operations (see Templated Utility Functions).

Definition in file utilities.h.

Macro Definition Documentation

◆ CT_DEFINE_HAS_MEMBER

#define CT_DEFINE_HAS_MEMBER (   detector_name,
  func_name 
)
Value:
template <typename T> \
struct detector_name { \
typedef char (& yes)[1], (& no)[2]; \
template <typename C> static yes check(decltype(&C::func_name)); \
template <typename> static no check(...); \
static bool const value = sizeof(check<T>(0)) == sizeof(yes); \
};

A macro for generating member function detectors, which can then be used in combination with std::enable_if to allow selection of a particular template specialization based on the presence of that member function.

See MultiRate for examples of use.

Definition at line 193 of file utilities.h.