CASM  1.1.0
A Clusters Approach to Statistical Mechanics
definitions.hh
Go to the documentation of this file.
1 #ifndef CASM_GLOBAL_DEFINTIONS_HH
2 #define CASM_GLOBAL_DEFINTIONS_HH
3 
5 #include <utility>
6 
7 namespace boost {
8 namespace filesystem {
9 class path;
10 }
11 namespace program_options {}
12 } // namespace boost
13 
14 #ifdef EIGEN_DEFAULT_DENSE_INDEX_TYPE
15 #define INDEX_TYPE EIGEN_DEFAULT_DENSE_INDEX_TYPE
16 #else
17 #define INDEX_TYPE long
18 #endif
19 
20 namespace CASM {
21 
22 namespace fs = boost::filesystem;
23 namespace po = boost::program_options;
24 
25 typedef unsigned int uint;
26 typedef unsigned long int ulint;
27 typedef long int lint;
28 
29 // tolerance
30 const double TOL = 0.00001;
31 
32 // Boltzmann Constant
33 const double KB = 8.6173423E-05; // eV/K
34 
35 // Planck's Constant
36 const double PLANCK = 4.135667516E-15; // eV-s
37 
39 typedef INDEX_TYPE Index;
40 bool valid_index(Index i);
41 
42 template <typename T>
43 struct traits;
44 
45 //************************************************************
46 
58 template <typename BinaryCompare>
60  public:
62 
63  template <typename... CompareArgs>
64  UnaryCompare_f(const argument_type &lhs, const CompareArgs &... args)
65  : m_lhs(lhs), m_compare_method(args...) {}
66 
67  bool operator()(const argument_type &rhs) {
68  return m_compare_method(m_lhs, rhs);
69  }
70 
71  private:
72  // TODO: Is having this as a reference too scary? We could just make it a
73  // copy;
75  const BinaryCompare m_compare_method;
76 };
77 
78 //************************************************************
79 
82 template <typename Object, typename Transform, typename... Args>
83 Object &apply(const Transform &f, Object &obj, Args &&... args) {
84  obj.apply_sym(f, std::forward<Args>(args)...);
85  return obj;
86 }
87 
92 template <typename Object, typename Transform, typename... Args>
93 Object copy_apply(const Transform &f, Object obj, Args &&... args) {
94  return CASM::apply(f, obj, std::forward<Args>(args)...);
95 }
96 
97 } // namespace CASM
98 
99 #endif
UnaryCompare_f(const argument_type &lhs, const CompareArgs &... args)
Definition: definitions.hh:64
bool operator()(const argument_type &rhs)
Definition: definitions.hh:67
notstd::first_argument_type< BinaryCompare > argument_type
Definition: definitions.hh:61
const argument_type & m_lhs
Definition: definitions.hh:74
const BinaryCompare m_compare_method
Definition: definitions.hh:75
#define INDEX_TYPE
Definition: definitions.hh:17
Supercell & apply(const SymOp &op, Supercell &scel)
Apply symmetry operation to Supercell.
Definition: Supercell.cc:357
Main CASM namespace.
Definition: APICommand.hh:8
unsigned long int ulint
Definition: definitions.hh:26
MappingNode copy_apply(PermuteIterator const &_it, MappingNode const &_node, bool transform_cost_mat=true)
Reorders the permutation and compounds the spatial isometry (rotation.
const double TOL
Definition: definitions.hh:30
long int lint
Definition: definitions.hh:27
const double PLANCK
Definition: definitions.hh:36
unsigned int uint
Definition: definitions.hh:25
bool valid_index(Index i)
Definition: definitions.cc:5
INDEX_TYPE Index
For long integer indexing:
Definition: definitions.hh:39
const double KB
Definition: definitions.hh:33
typename std::decay< typename function_traits< F >::template arg< 0 >::type >::type first_argument_type
Definition: type_traits.hh:39