OpenMEEG
om_common.h
Go to the documentation of this file.
1 // Project Name: OpenMEEG (http://openmeeg.github.io)
2 // © INRIA and ENPC under the French open source license CeCILL-B.
3 // See full copyright notice in the file LICENSE.txt
4 // If you make a copy of this file, you must either:
5 // - provide also LICENSE.txt and modify this header to refer to it.
6 // - replace this header by the LICENSE.txt content.
7 
8 #pragma once
9 
10 #include <iostream>
11 #include <string>
12 #include <vector>
13 #include <cmath>
14 #include <OMassert.H>
15 #include <limits>
16 
17 namespace OpenMEEG {
18 
19  // a vector of string is called Strings
20  using Strings = std::vector<std::string>;
21 
22  // how to compare doubles and floats
23  template<class T>
24  bool almost_equal(T x, T y, double eps = 1e3) {
25  return (std::abs(x-y) < std::numeric_limits<T>::epsilon() * std::abs(x+y) * eps) || std::abs(x-y) < std::numeric_limits<T>::min();
26  }
27 }
28 
bool almost_equal(T x, T y, double eps=1e3)
Definition: om_common.h:24
std::vector< std::string > Strings
Definition: om_common.h:20