CASM  1.1.0
A Clusters Approach to Statistical Mechanics
Adapter.hh
Go to the documentation of this file.
1 #ifndef CRYSTALLOGRAPHYADAPTER_HH
2 #define CRYSTALLOGRAPHYADAPTER_HH
3 
5 
6 namespace CASM {
7 
8 namespace adapter {
9 template <typename ToType, typename FromType>
10 struct Adapter;
11 
19 template <typename FromType>
20 struct Adapter<xtal::SymOp, FromType> {
21  xtal::SymOp operator()(const FromType &adaptable) {
22  return xtal::SymOp(get_matrix(adaptable), get_translation(adaptable),
23  get_time_reversal(adaptable));
24  }
25 };
26 
29 template <typename FromType>
30 struct Adapter<xtal::SymOpVector, FromType> {
31  template <typename FromTypeIt>
32  xtal::SymOpVector operator()(FromTypeIt begin, FromTypeIt end) {
33  xtal::SymOpVector casted_group;
35  for (auto it = begin; it != end; ++it) {
36  casted_group.emplace_back(to_symop_type(*it));
37  }
38  return casted_group;
39  }
40 
41  xtal::SymOpVector operator()(const FromType &adaptable) {
42  return this->operator()(adaptable.begin(), adaptable.end());
43  }
44 };
45 } // namespace adapter
46 } // namespace CASM
47 
48 #endif
SymOp is the Coordinate representation of a symmetry operation it keeps fraction (FRAC) and Cartesian...
Definition: SymOp.hh:28
const SymOp::matrix_type & get_matrix(const SymOp &op)
Definition: SymOp.cc:167
bool get_time_reversal(const SymOp &op)
Definition: SymOp.cc:171
const SymOp::vector_type & get_translation(const SymOp &op)
Definition: SymOp.cc:169
std::vector< SymOp > SymOpVector
Main CASM namespace.
Definition: APICommand.hh:8
xtal::SymOp operator()(const FromType &adaptable)
Definition: Adapter.hh:21
xtal::SymOpVector operator()(const FromType &adaptable)
Definition: Adapter.hh:41
xtal::SymOpVector operator()(FromTypeIt begin, FromTypeIt end)
Definition: Adapter.hh:32