Cantera  3.1.0a1
Loading...
Searching...
No Matches
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

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 if constexpr to condition behavior on the availability of that member function.
 

Functions

template<class V >
double dot4 (const V &x, const V &y)
 Templated Inner product of two vectors of length 4.
 
template<class V >
double dot5 (const V &x, const V &y)
 Templated Inner product of two vectors of length 5.
 
template<class InputIter , class InputIter2 >
double dot (InputIter x_begin, InputIter x_end, InputIter2 y_begin)
 Function that calculates a templated inner product.
 
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.
 
template<class D , class R >
poly6 (D x, R *c)
 Templated evaluation of a polynomial of order 6.
 
template<class D , class R >
poly8 (D x, R *c)
 Templated evaluation of a polynomial of order 8.
 
template<class D , class R >
poly5 (D x, R *c)
 Templated evaluation of a polynomial of order 5.
 
template<class D , class R >
poly4 (D x, R *c)
 Evaluates a polynomial of order 4.
 
template<class D , class R >
poly3 (D x, R *c)
 Templated evaluation of a polynomial of order 3.
 
void checkFinite (const double tmp)
 Check to see that a number is finite (not NaN, +Inf or -Inf)
 
void checkFinite (const string &name, double *values, size_t N)
 Check to see that all elements in an array are finite.
 
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.
 
template<class T , class U = int>
len (const T &container)
 Get the size of a container, cast to a signed integer type.
 

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.