TBTK
Need a break? Support the development by playing Polarity Puzzles
Field.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_FIELD
25 #define COM_DAFER45_TBTK_FIELD
26 
27 #include "TBTK/TBTKMacros.h"
28 
29 #include <initializer_list>
30 
31 namespace TBTK{
32 
34 template<typename DataType, typename ArgumentType>
35 class Field{
36 public:
38  Field(bool isCompact = false);
39 
41  virtual DataType operator()(std::initializer_list<ArgumentType> argument) const = 0;
42 
45  bool getIsCompact() const;
46 
48 // virtual const std::vector<double>& getCoordinates() const = 0;
49  virtual const std::vector<ArgumentType>& getCoordinates() const;
50 
52 // virtual double getExtent() const = 0;
53  virtual ArgumentType getExtent() const;
54 private:
56  bool isCompact;
57 };
58 
59 template<typename DataType, typename ArgumentType>
60 Field<DataType, ArgumentType>::Field(bool isCompact){
61  this->isCompact = isCompact;
62 }
63 
64 template<typename DataType, typename ArgumentType>
65 bool Field<DataType, ArgumentType>::getIsCompact() const{
66  return isCompact;
67 }
68 
69 template<typename DataType, typename ArgumentType>
70 const std::vector<ArgumentType>& Field<DataType, ArgumentType>::getCoordinates() const{
71  TBTKExit(
72  "Field::getCoordinates()",
73  "The Field is not compact.",
74  ""
75  );
76 }
77 
78 template<typename DataType, typename ArgumentType>
79 ArgumentType Field<DataType, ArgumentType>::getExtent() const{
80  TBTKExit(
81  "Field::getCoordinates()",
82  "Field is not compact.",
83  ""
84  );
85 }
86 
87 }; //End namespace TBTK
88 
89 #endif
90 
Precompiler macros.
Definition: Boolean.h:32