mirror of
https://github.com/triqs/dft_tools
synced 2024-12-24 13:23:37 +01:00
fixes in wrap_generator, parameters, h5 for strings
- string size in h5. Add +1 (or empty string is wrong). - parameters : modified flags from python - minor corrections in wrapper
This commit is contained in:
parent
3036fe6529
commit
a920697e78
@ -276,6 +276,7 @@ class class_ :
|
||||
# Init arithmetic
|
||||
# expect a tuple : "algebra", "scalar1", "scalar2", etc...
|
||||
self.number_protocol = {}
|
||||
if not isinstance(arithmetic, tuple) : arithmetic = (arithmetic,)
|
||||
if arithmetic :
|
||||
if not isinstance(arithmetic, tuple) : arithmetic = (arithmetic,)
|
||||
add = arithmetic[0] in ("algebra", "abelian_group", "vector_space", "only_add")
|
||||
|
@ -74,6 +74,8 @@ int main(int argc, char **argv) {
|
||||
h5_write(top,"C",C);
|
||||
h5_write(top,"D",D);
|
||||
|
||||
h5_write(top,"S","");
|
||||
|
||||
// testing scalar
|
||||
double x=2.3;
|
||||
h5_write(top, "x",x);
|
||||
|
@ -25,7 +25,7 @@ namespace triqs {
|
||||
|
||||
void h5_write (group g, std::string const & name, std::string const & value) {
|
||||
try {
|
||||
H5::StrType strdatatype(H5::PredType::C_S1, value.size());
|
||||
H5::StrType strdatatype(H5::PredType::C_S1, value.size() + 1); // +1 for the 0 terminating char
|
||||
H5::DataSet ds = g.create_dataset(name, strdatatype, H5::DataSpace());
|
||||
ds.write((void*)(value.c_str()), strdatatype );
|
||||
}
|
||||
|
@ -173,7 +173,10 @@ namespace params {
|
||||
#ifdef TRIQS_WITH_PYTHON_SUPPORT
|
||||
/// Convertions python <-> C++
|
||||
bool from_python_convertible(PyObject *ob) const { return p->from_python_convertible(ob); }
|
||||
void set_from_python(PyObject *ob) { p->set_from_python(ob); }
|
||||
void set_from_python(PyObject *ob) {
|
||||
p->set_from_python(ob);
|
||||
modified = true;
|
||||
}
|
||||
PyObject *to_python() const { return p->to_python(); }
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user