MFMv2.0.10
Movable Feast Machine Simulator 2.0.10
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Element_Xtal_Sq1.h
Go to the documentation of this file.
1 /* -*- mode:C++ -*-
2  Element_Xtal_Sq1.h Square, spacing 1 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_SQ1_H
28 #define ELEMENT_XTAL_SQ1_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_Sq1 THE_INSTANCE;
54 
55  Element_Xtal_Sq1() : AbstractElement_Xtal<CC>(MFM_UUID_FOR("XtalSq1", ELT_VERSION))
56  {
58  Element<CC>::SetName("Square crystal spacing 1");
59  }
60 
61  virtual u32 DefaultPhysicsColor() const
62  {
63  return 0xff11bb33;
64  }
65 
66  virtual u32 LocalPhysicsColor(const T& atom, u32 selector) const
67  {
68  return DefaultPhysicsColor();
69  }
70 
71  typedef typename MFM::AbstractElement_Xtal<CC>::XtalSites XtalSites;
72 
73  virtual u32 GetSymI(T &atom, EventWindow<CC>& window) const
74  {
75  return (u32) PSYM_NORMAL;
76  }
77 
78  virtual void GetSites(T & atom, XtalSites & sites, EventWindow<CC>& window) const
79  {
80  static XtalSites isites;
81  static bool initted = false;
82  if (!initted)
83  {
84  for (s32 x = -R; x <= R; ++x)
85  {
86  for (s32 y = -R; y <= R; ++y)
87  {
88  if (!(x&1) && !(y&1))
89  {
90  SPoint c(x,y);
91  if (c.GetManhattanLength() <= R)
92  {
93  this->WriteBit(isites, c, true);
94  }
95  }
96  }
97  }
98  initted = true;
99  }
100  sites = isites;
101  }
102 
103  };
104 
105  template <class CC>
106  Element_Xtal_Sq1<CC> Element_Xtal_Sq1<CC>::THE_INSTANCE;
107 
108 }
109 
110 #endif /* ELEMENT_XTAL_SQ1_H */
virtual u32 LocalPhysicsColor(const T &atom, u32 selector) const
Definition: Element_Xtal_Sq1.h:66
Definition: Element_Xtal_Sq1.h:42
void SetName(const char *name)
Definition: Element.h:209
void SetAtomicSymbol(const char *symbol)
Definition: Element.h:193
Definition: AbstractElement_Xtal.h:40
virtual u32 DefaultPhysicsColor() const
Definition: Element_Xtal_Sq1.h:61
Definition: ElementTable.h:43