TBTK
FileReader.h
Go to the documentation of this file.
1 /* Copyright 2016 Kristofer Björnson and Andreas Theiler
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 
24 #ifndef COM_DAFER45_TBTK_FILE_READER
25 #define COM_DAFER45_TBTK_FILE_READER
26 
27 #include "AmplitudeSet.h"
28 #include "Geometry.h"
29 #include "EigenValues.h"
30 #include "DOS.h"
31 #include "Density.h"
32 #include "Magnetization.h"
33 #include "LDOS.h"
34 #include "SpinPolarizedLDOS.h"
35 #include "ParameterSet.h"
36 #include <fstream>
37 #include <stdio.h>
38 
39 namespace TBTK{
40 
46 class FileReader{
47 public:
49  static Model* readModel(
50  std::string name = "Model",
51  std::string path = "/"
52  );
53 
56  std::string name = "AmplitudeSet",
57  std::string path = "/"
58  );
59 
61  static Geometry* readGeometry(
62  Model *model,
63  std::string name = "Geometry",
64  std::string path = "/"
65  );
66 
68 /* static void readEigenValues(
69  double **ev,
70  int *size,
71  std::string name = "EV",
72  std::string path = "/"
73  );*/
75  std::string name = "EigenValues",
76  std::string path = "/"
77  );
78 
80 /* static void readDOS(
81  double **dos,
82  double *l_lim,
83  double *u_lim,
84  int *resolution,
85  std::string name = "DOS",
86  std::string path = "/"
87  );*/
88  static Property::DOS* readDOS(
89  std::string name = "DOS",
90  std::string path = "/"
91  );
92 
94 /* static void readDensity(
95  double **density,
96  int *rank,
97  int **dims,
98  std::string name = "Density",
99  std::string path = "/"
100  );*/
102  std::string name = "Density",
103  std::string path = "/"
104  );
105 
107 /* static void readMAG(
108  std::complex<double> **mag,
109  int *rank,
110  int **dims,
111  std::string name = "MAG",
112  std::string path = "/"
113  );*/
115  std::string name = "Magnetization",
116  std::string path = "/"
117  );
118 
120 /* static void readLDOS(
121  double **ldos,
122  int *rank,
123  int **dims,
124  double *l_lim,
125  double *u_lim,
126  int *resolution,
127  std::string name = "LDOS",
128  std::string path = "/"
129  );*/
130  static Property::LDOS* readLDOS(
131  std::string name = "LDOS",
132  std::string path = "/"
133  );
134 
136 /* static void readSP_LDOS(
137  std::complex<double> **sp_ldos,
138  int *rank,
139  int **dims,
140  double *l_lim,
141  double *u_lim,
142  int *resolution,
143  std::string name = "SP_LDOS",
144  std::string path = "/"
145  );*/
147  std::string name = "SpinPolarizedLDOS",
148  std::string path = "/"
149  );
150 
153  std::string name = "ParameterSet",
154  std::string path = "/"
155  );
156 
158  static void read(
159  double **data,
160  int *rank,
161  int **dims,
162  std::string name,
163  std::string path = "/"
164  );
165 
167  static void readAttributes(
168  int *attributes,
169  std::string *attribute_names,
170  int num,
171  std::string name,
172  std::string path = "/"
173  );
174 
176  static void readAttributes(
177  double *attributes,
178  std::string *attribute_names,
179  int num,
180  std::string name,
181  std::string path = "/"
182  );
183 
185  static void setFileName(std::string filename);
186 
189  static void clear();
190 
192  static bool exists();
193 private:
195  static bool isInitialized;
196 
198  static std::string filename;
199 };
200 
201 inline void FileReader::setFileName(std::string filename){
202  FileReader::filename = filename;
203  isInitialized = false;
204 }
205 
206 inline void FileReader::clear(){
207  remove(filename.c_str());
208  isInitialized = false;
209 }
210 
211 }; //End of namespace TBTK
212 
213 #endif
214 
static void readAttributes(int *attributes, std::string *attribute_names, int num, std::string name, std::string path="/")
Definition: LDOS.h:33
static Property::EigenValues * readEigenValues(std::string name="EigenValues", std::string path="/")
Definition: FileReader.cpp:287
Definition: EigenValues.h:33
static void setFileName(std::string filename)
Definition: FileReader.h:201
Definition: Magnetization.h:35
static Property::SpinPolarizedLDOS * readSpinPolarizedLDOS(std::string name="SpinPolarizedLDOS", std::string path="/")
Definition: FileReader.cpp:621
Property container for eigen values.
Property container for local density of states (LDOS)
Set of parameters.
Definition: FileReader.h:46
static Geometry * readGeometry(Model *model, std::string name="Geometry", std::string path="/")
Definition: FileReader.cpp:185
static void read(double **data, int *rank, int **dims, std::string name, std::string path="/")
Definition: FileReader.cpp:711
Property container for spin-polarized local density of states (spin-polarized LDOS) ...
Property container for density.
static Property::LDOS * readLDOS(std::string name="LDOS", std::string path="/")
Definition: FileReader.cpp:565
static Util::ParameterSet * readParameterSet(std::string name="ParameterSet", std::string path="/")
Definition: FileReader.cpp:896
Property container for magnetization.
static void clear()
Definition: FileReader.h:206
HoppingAmplitude container.
static Model * readModel(std::string name="Model", std::string path="/")
Definition: FileReader.cpp:42
Definition: AbstractOperator.h:26
Definition: SpinPolarizedLDOS.h:37
Definition: Density.h:33
static Property::DOS * readDOS(std::string name="DOS", std::string path="/")
Definition: FileReader.cpp:348
Property container for density of states (DOS)
static AmplitudeSet * readAmplitudeSet(std::string name="AmplitudeSet", std::string path="/")
Definition: FileReader.cpp:78
static bool exists()
Definition: FileReader.cpp:1045
Definition: Geometry.h:32
Definition: ParameterSet.h:35
Definition: DOS.h:33
static Property::Density * readDensity(std::string name="Density", std::string path="/")
Definition: FileReader.cpp:418
Definition: Model.h:40
static Property::Magnetization * readMagnetization(std::string name="Magnetization", std::string path="/")
Definition: FileReader.cpp:485
Contains geometric inforamtion about a model.
Definition: AmplitudeSet.h:45