CASM  1.1.0
A Clusters Approach to Statistical Mechanics
CoordinateSystems.hh
Go to the documentation of this file.
1 #ifndef COORDINATESYSTEMS_HH
2 #define COORDINATESYSTEMS_HH
3 
4 #include <iostream>
5 
6 #include "casm/global/enum.hh"
7 
8 namespace CASM {
9 namespace xtal {
10 
15 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17 
19 
25 
39 
40 class COORD_MODE {
41  private:
46 
50 
51  public:
53  static bool IS_CART() { return ACTIVE_MODE == CART; };
55  static bool IS_FRAC() { return ACTIVE_MODE == FRAC; };
56 
58  static COORD_TYPE CHECK() { return ACTIVE_MODE; };
59 
61  static std::string NAME() { return NAME(ACTIVE_MODE); };
62  static std::string NAME(COORD_TYPE mode) {
63  if (mode == FRAC) return "Direct";
64  if (mode == CART) return "Cartesian";
65  return NAME(ACTIVE_MODE);
66  };
67 
68  COORD_MODE(COORD_TYPE new_mode) {
70  ACTIVE_MODE = new_mode;
71  };
73 
74  void set(const COORD_TYPE new_mode) { ACTIVE_MODE = new_mode; };
75  COORD_TYPE check() { return ACTIVE_MODE; };
76 
77  // static bool SelfTest();
78 };
79 
80 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
81 
83  private:
86 
87  public:
88  // static bool IS_PERIODIC() { return (ACTIVE_MODE == PERIODIC); }
89  // TODO: Revert back
90  // static bool IS_LOCAL() { return (ACTIVE_MODE == LOCAL); }
91  static bool IS_LOCAL() { return (ACTIVE_MODE == LOCAL); }
92  static bool IS_PERIODIC() { return (ACTIVE_MODE == PERIODIC); }
93  static PERIODICITY_TYPE CHECK() { return ACTIVE_MODE; }
94 
97  ACTIVE_MODE = new_mode;
98  };
100 
101  void set(const PERIODICITY_TYPE new_mode) { ACTIVE_MODE = new_mode; };
103 };
104 
107 } // namespace xtal
108 }; // namespace CASM
109 #endif
COORD_MODE specifies the current coordinate mode (Fractional or Cartesian)
COORD_MODE(COORD_TYPE new_mode)
static bool IS_CART()
Static method to check if mode is CART (call using COORD_MODE::IS_CART() )
static std::string NAME()
get a string with the name of the active mode
static std::string NAME(COORD_TYPE mode)
static COORD_TYPE ACTIVE_MODE
void set(const COORD_TYPE new_mode)
static bool IS_FRAC()
Static method to check if mode is FRAC (call using COORD_MODE::IS_FRAC() )
static COORD_TYPE CHECK()
get the current mode (call using COORD_MODE::CHECK())
static PERIODICITY_TYPE CHECK()
void set(const PERIODICITY_TYPE new_mode)
PERIODICITY_MODE(PERIODICITY_TYPE new_mode)
static PERIODICITY_TYPE ACTIVE_MODE
Main CASM namespace.
Definition: APICommand.hh:8
COORD_TYPE
Definition: enum.hh:6
const COORD_TYPE FRAC
Definition: enum.hh:8
const PERIODICITY_TYPE LOCAL
Definition: enum.hh:21
const PERIODICITY_TYPE PERIODIC
Definition: enum.hh:20
PERIODICITY_TYPE
Definition: enum.hh:13
const COORD_TYPE CART
Definition: enum.hh:9