#include "./parameters.hpp" #include namespace triqs { namespace utility { void h5_read ( h5::group F, std::string const & subgroup_name, parameters & p){ auto gr = F.open_group(subgroup_name); std::vector ds_name = F.get_all_dataset_names(subgroup_name), grp_name = F.get_all_subgroup_names(subgroup_name); for (auto & x : grp_name) { //std::cerr << " loading group : "<< x <second(gr,x); } else { parameters p2; h5_read (gr,x,p2); p[x] = p2; } } for (auto & x : ds_name) { //std::cerr << " loading : "<< x <> missing; std::vector> wrong_t; std::vector> no_deft; #ifndef TRIQS_WORKAROUND_INTEL_COMPILER_BUGS std::vector desc{"key:", "description:"}; std::vector tdesc{"key:", "expected type:", "actual type:"}; #else std::vector desc; desc.push_back("key:"); desc.push_back("description:"); std::vector tdesc; tdesc.push_back("key:"); tdesc.push_back("expected type:"); tdesc.push_back("actual type:"); #endif if ( (flag & reject_key_without_default) ) { // check that no extra parameters are present for (auto const & pvp : *this) { auto key = pvp.first; if (!pdef.has_key(key)){ #ifndef TRIQS_WORKAROUND_INTEL_COMPILER_BUGS no_deft.push_back({key}); #else { std::vector v; v.push_back(key); no_deft.push_back(v);} #endif } } } for (auto const & pvp : pdef) { auto key = pvp.first; // check whether required parameters are present if (pdef.is_required(key) && (!this->has_key(key))){ // delay exception until all parameters have been checked if (!missing.size()) missing.push_back(desc); #ifndef TRIQS_WORKAROUND_INTEL_COMPILER_BUGS missing.push_back({key, pdef.doc(key)}); #else { std::vector v; v.push_back(key); v.push_back(pdef.doc(key)); missing.push_back(v);} #endif } if (this->has_key(key)) { // check whether the type is correct if (! have_same_type(pvp.second, (*this)[key])){ // delay exception until all parameters have been checked if (!wrong_t.size()) wrong_t.push_back(tdesc); #ifndef TRIQS_WORKAROUND_INTEL_COMPILER_BUGS wrong_t.push_back({key, pvp.second.type_name(), (*this)[key].type_name()}); #else { std::vector v; v.push_back(key); v.push_back(pvp.second.type_name()); v.push_back((*this)[key].type_name()); wrong_t.push_back(v);} #endif } } else { (*this)[key] = pvp.second; // insert the default } } // raise a runtime exception if errors occured if(missing.size()) TRIQS_RUNTIME_ERROR << "update with defaults : the following parameters are required but absent: \n"<< print_formatted(missing); if(wrong_t.size()) TRIQS_RUNTIME_ERROR << "update with defaults : the following parameters have incorrect type: \n"<< print_formatted(wrong_t); if(no_deft.size()) TRIQS_RUNTIME_ERROR << "update with defaults : the following parameters are absent from the defaults and no_parameter_without_default is ON: \n"<< print_formatted(no_deft); } }}