libatomprobe
Library for Atom Probe Tomography (APT) computation
generate.h
Go to the documentation of this file.
1 /* generate.cpp : Crystal tiling functions
2  * Copyright (C) 2020 Daniel Haley
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef ATOMPROBE_CRYSTALGEN_H
19 #define ATOMPROBE_CRYSTALGEN_H
20 
21 //C++ standard lib
22 #include <vector>
23 
25 
26 namespace AtomProbe
27 {
28 
29 //This is an abstract base class for the generation of crystal data
30 class CrystalGen
31 {
32  protected:
33  //Point data
34  std::vector<IonHit> localData;
35 
36  //The generated crystal should lie within the box
37  //set by the origin and the bounding point "farPoint"
39 
40  public:
41  CrystalGen() {};
42  virtual ~CrystalGen() {};
43 
44  virtual unsigned int generateLattice() =0;
45 
46 // virtual bool checkSanity();
47  //Swap-out the ion hit data from this object, to obtain the internally gennerated lattice
48  virtual void swap(std::vector<IonHit> &data) {localData.swap(data);};
49  //Extract the point data from the object
50  virtual void extractPositions(std::vector<Point3D> &data);
51 
52  //Mirror the data across all 3 axes
53  virtual void mirrorOut();
54 };
55 
56 class SimpleCubicGen : public CrystalGen
57 {
58  private:
60  float spacing;
62  float massToCharge;
63  public:
64  SimpleCubicGen(float latticeSpacing, float massToC, const Point3D &p);
65  unsigned int generateLattice();
66 };
67 
69 {
70  private:
72  float spacing;
74  float massToChargeCorner, massToChargeFace[3];
75  public:
76  //The m/c for the faces should be a 3-wide array, with x,y and z normal-faces
77  FaceCentredCubicGen(float latticeSpacing, float mToCCorner,
78  const float *mToCFace,const Point3D &p);
79  unsigned int generateLattice();
80 };
81 
83 {
84  private:
86  float spacing;
88  float massToChargeCorner, massToChargeCentre;
89  public:
90  //The m/c for the unit cell corner and body atoms (centre)
91  BodyCentredCubicGen(float latticeSpacing, float mToCCentre,
92  const float mToCCorner,const Point3D &p);
93  //Generate the lattice, up to the specified point
94  unsigned int generateLattice();
95 };
96 enum
97 {
100 };
101 
102 #ifdef DEBUG
103 bool runGenerateTests();
104 #endif
105 
106 }
107 
108 #endif
109 
virtual void mirrorOut()
Definition: generate.cpp:33
virtual void swap(std::vector< IonHit > &data)
Definition: generate.h:48
virtual unsigned int generateLattice()=0
A 3D point data class storage.
Definition: point3D.h:39
virtual ~CrystalGen()
Definition: generate.h:42
std::vector< IonHit > localData
Definition: generate.h:34
virtual void extractPositions(std::vector< Point3D > &data)
Definition: generate.cpp:23