mirror of
https://github.com/triqs/dft_tools
synced 2024-11-01 11:43:47 +01:00
af084f5d59
- new parameter class : parameters are viewed as form, built in C++, and filled in C++/python. Each field of the form as a precise C++ type (erased using standard techniques). First tests ok, to be reread/checked. TODO : serialization is commented. Lead to long compilation time & large code due to boost::serialization. Use h5 when possible. - wrapper : - separated the converters of the wrapped type in the TRIQS library - necessary for parameters (it used outside an .so) and potentially other codes, outside an .so module
30 lines
531 B
C++
30 lines
531 B
C++
#include <triqs/parameters.hpp>
|
|
#include <iostream>
|
|
#define TRIQS_ARRAYS_ENFORCE_BOUNDCHECK
|
|
|
|
using namespace triqs::params;
|
|
|
|
int main() {
|
|
|
|
parameters P;
|
|
P.add_field("a", 1, "?")
|
|
.add_field("d", 2.0, "")
|
|
.add_field("s", "", "");
|
|
|
|
P["a"] = long(1);
|
|
P["d"] = 2.7;
|
|
P["s"] = std::string("-14.3");
|
|
|
|
long j = P["a"];
|
|
double x = P["d"];
|
|
double y = P["a"];
|
|
double z = P["s"];
|
|
|
|
std::cout << j << std::endl ;
|
|
std::cout << x << std::endl;
|
|
std::cout << y << std::endl ;
|
|
std::cout << z << std::endl ;
|
|
|
|
return 0;
|
|
}
|