MFMv2.0.10
Movable Feast Machine Simulator 2.0.10
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Element_Xtal_L12.h
Go to the documentation of this file.
1 /* -*- mode:C++ -*-
2  Element_Xtal_L12.h Left-tipped, knight's-L-move crystal
3  Copyright (C) 2014 The Regents of the University of New Mexico. All rights reserved.
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this library; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
18  USA
19 */
20 
27 #ifndef ELEMENT_XTAL_L12_H
28 #define ELEMENT_XTAL_L12_H
29 
30 #include "Element.h"
31 #include "EventWindow.h"
32 #include "ElementTable.h"
33 #include "AbstractElement_Xtal.h"
34 #include "itype.h"
35 
36 namespace MFM
37 {
38 
39 #define ELT_VERSION 1
40 
41  template <class CC>
43  {
44  // Extract short names for parameter types
45  typedef typename CC::ATOM_TYPE T;
46  typedef typename CC::PARAM_CONFIG P;
47  enum { R = P::EVENT_WINDOW_RADIUS };
48 
49  private:
50 
51  public:
52 
53  static Element_Xtal_L12 THE_INSTANCE;
54 
55  Element_Xtal_L12(const UUID & uuid) : AbstractElement_Xtal<CC>(uuid)
56  {
57  }
58 
59  Element_Xtal_L12() : AbstractElement_Xtal<CC>(MFM_UUID_FOR("XtalL12", ELT_VERSION))
60  {
62  Element<CC>::SetName("L1,2 crystal");
63  }
64 
65  virtual u32 DefaultPhysicsColor() const
66  {
67  return 0xff11bb33;
68  }
69 
70  virtual u32 LocalPhysicsColor(const T& atom, u32 selector) const
71  {
72  return DefaultPhysicsColor();
73  }
74 
75  typedef typename MFM::AbstractElement_Xtal<CC>::XtalSites XtalSites;
76 
77  virtual u32 GetSymI(T &atom, EventWindow<CC>& window) const
78  {
79  return (u32) PSYM_NORMAL;
80  }
81 
82  virtual void GetSites(T & atom, XtalSites & sites, EventWindow<CC>& window) const
83  {
84  static XtalSites isites;
85  static bool initted = false;
86  if (!initted)
87  {
88  const SPoint ones[] = {
89  SPoint(0,0),
90  SPoint(2,-1),
91  SPoint(-1,-2),
92  SPoint(-2,1),
93  SPoint(1,2),
94  SPoint(1,-3),
95  SPoint(-3,-1),
96  SPoint(-1,3),
97  SPoint(3,1)
98  };
99  for (u32 i = 0; i < sizeof(ones)/sizeof(ones[0]); ++i)
100  {
101  this->WriteBit(isites, ones[i], true);
102  }
103  initted = true;
104  }
105  sites = isites;
106  }
107 
108  };
109 
110  template <class CC>
111  Element_Xtal_L12<CC> Element_Xtal_L12<CC>::THE_INSTANCE;
112 
113 }
114 
115 #endif /* ELEMENT_XTAL_L12_H */
void SetName(const char *name)
Definition: Element.h:209
void SetAtomicSymbol(const char *symbol)
Definition: Element.h:193
virtual u32 LocalPhysicsColor(const T &atom, u32 selector) const
Definition: Element_Xtal_L12.h:70
virtual u32 DefaultPhysicsColor() const
Definition: Element_Xtal_L12.h:65
Definition: Element_Xtal_L12.h:42
Definition: AbstractElement_Xtal.h:40
Definition: ElementTable.h:43
Definition: UUID.h:44