TBTK
Need a break? Support the development by playing Polarity Puzzles
SpacePartition.h
1 /* Copyright 2017 Kristofer Björnson
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
17 
24 #ifndef COM_DAFER45_TBTK_SPACE_PARTITION
25 #define COM_DAFER45_TBTK_SPACE_PARTITION
26 
27 #include "TBTK/Index.h"
28 #include "TBTK/Vector3d.h"
29 
30 #include <vector>
31 
32 namespace TBTK{
33 
36 class SpacePartition{
37 public:
46  enum class MeshType {Nodal, Interior};
47 
49  SpacePartition();
50 
52  SpacePartition(
53  const std::vector<std::vector<double>> &basisVectors,
54  MeshType meshType
55  );
56 
58  virtual ~SpacePartition();
59 
61  unsigned int getNumDimensions() const;
62 
65  virtual Index getMajorCellIndex(
66  const std::vector<double> &coordinate
67  ) const = 0;
68 
72  virtual Index getMinorCellIndex(
73  const std::vector<double> &coordinate,
74  const std::vector<unsigned int> &numMeshPoints
75  ) const = 0;
76 
79  virtual std::vector<std::vector<double>> getMajorMesh(
80  const std::vector<unsigned int> &numMeshPoints
81  ) const = 0;
82 
85  virtual std::vector<std::vector<double>> getMinorMesh(
86  const std::vector<unsigned int> &numMeshPoints
87  ) const = 0;
88 
95  virtual std::vector<double> getMinorMeshPoint(
96  const std::vector<unsigned int> &meshPoint,
97  const std::vector<unsigned int> &numMeshPoints
98  ) const = 0;
99 protected:
101  const std::vector<Vector3d>& getBasisVectors() const;
102 
104  MeshType getMeshType() const;
105 private:
107  unsigned dimensions;
108 
113  std::vector<Vector3d> basisVectors;
114 
116  MeshType meshType;
117 };
118 
119 inline unsigned int SpacePartition::getNumDimensions() const{
120  return dimensions;
121 }
122 
123 inline const std::vector<Vector3d>& SpacePartition::getBasisVectors() const{
124  return basisVectors;
125 }
126 
127 inline SpacePartition::MeshType SpacePartition::getMeshType() const{
128  return meshType;
129 }
130 
131 }; //End namespace TBTK
132 
133 #endif
134 
Physical index.
Three-dimensional vector with components of double type.
Definition: Boolean.h:32