CASM
AClustersApproachtoStatisticalMechanics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
CoordinateSystems.hh
Go to the documentation of this file.
1 #ifndef COORDINATESYSTEMS_HH
2 #define COORDINATESYSTEMS_HH
3 
4 #include <iostream>
6 
7 namespace CASM {
8 
13  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 
17 
23 
38 
39 
40  class COORD_MODE {
41 
42  private:
46 
49  public:
50 
52  static bool IS_CART() {
53  return ACTIVE_MODE == CART;
54  };
56  static bool IS_FRAC() {
57  return ACTIVE_MODE == FRAC;
58  };
59 
61  static COORD_TYPE CHECK() {
62  return ACTIVE_MODE;
63  };
64 
66  static std::string NAME() {
67  return NAME(ACTIVE_MODE);
68  };
69  static std::string NAME(COORD_TYPE mode) {
70  if(mode == FRAC) return "Direct";
71  if(mode == CART) return "Cartesian";
72  return NAME(ACTIVE_MODE);
73  };
74 
75  COORD_MODE(COORD_TYPE new_mode) {
76  old_mode = ACTIVE_MODE;
77  ACTIVE_MODE = new_mode;
78  };
80  ACTIVE_MODE = old_mode;
81  };
82 
83  void set(const COORD_TYPE new_mode) {
84  ACTIVE_MODE = new_mode;
85  };
87  return ACTIVE_MODE;
88  };
89 
90  //static bool SelfTest();
91  };
92 
93  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
94 
96 
97  private:
100  public:
101 
102  // static bool IS_PERIODIC() { return (ACTIVE_MODE == PERIODIC); }
103  // TODO: Revert back
104  // static bool IS_LOCAL() { return (ACTIVE_MODE == LOCAL); }
105  static bool IS_LOCAL() {
106  return (ACTIVE_MODE == LOCAL);
107  }
108  static bool IS_PERIODIC() {
109  return (ACTIVE_MODE == PERIODIC);
110  }
112  return ACTIVE_MODE;
113  }
114 
115 
117  old_mode = ACTIVE_MODE;
118  ACTIVE_MODE = new_mode;
119  };
121  ACTIVE_MODE = old_mode;
122  };
123 
124  void set(const PERIODICITY_TYPE new_mode) {
125  ACTIVE_MODE = new_mode;
126  };
128  return ACTIVE_MODE;
129  };
130  };
131 
134 };
135 #endif
static COORD_TYPE ACTIVE_MODE
PERIODICITY_MODE(PERIODICITY_TYPE new_mode)
COORD_MODE(COORD_TYPE new_mode)
Main CASM namespace.
Definition: complete.cpp:8
void set(const PERIODICITY_TYPE new_mode)
COORD_TYPE old_mode
old_mode specifies the value of ACTIVE_MODE when this COORD_MODE object was instantiated ...
static std::string NAME(COORD_TYPE mode)
COORD_MODE specifies the current coordinate mode (Fractional or Cartesian)
PERIODICITY_TYPE check()
static PERIODICITY_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 std::string NAME()
get a string with the name of the active mode
static bool IS_CART()
Static method to check if mode is CART (call using COORD_MODE::IS_CART() )
static PERIODICITY_TYPE CHECK()
PERIODICITY_TYPE old_mode
static COORD_TYPE CHECK()
get the current mode (call using COORD_MODE::CHECK())