17 json[
"DoF_type"] =
"OccupantDoF";
18 json[
"DoF_template_type"] =
"int";
19 json[
"m_type_name"] = m_type_name;
20 json[
"m_domain"] = m_domain;
21 json[
"m_current_state"] = m_current_state;
31 std::string name = json[
"m_type_name"].
get<std::string>();
33 int current_state = json[
"m_current_state"].
get<
int>();
46 json[
"DoF_type"] =
"OccupantDoF";
47 json[
"DoF_template_type"] =
"Molecule";
48 json[
"m_type_name"] = m_type_name;
50 json[
"m_domain"] = m_domain;
51 json[
"m_current_state"] = m_current_state;
64 std::string name = json[
"m_type_name"].
get<std::string>();
66 int current_state = json[
"m_current_state"].
get<
int>();
74 for(
int i = 0; i < json[
"m_domain"].
size(); i++) {
76 domain.push_back(mol);
98 dof =
ContinuousDoF(json[
"m_type_name"].get<std::string>(), json[
"min"].get<double>(), json[
"max"].get<double>());
119 if(json[
"DoF_type"] ==
"OccupantDoF") {
120 if(json[
"DoF_template_type"] ==
"int") {
130 else if(json[
"DoF_template_type"] ==
"Molecule") {
145 std::cerr <<
"Error in 'jsonParser from_json(DoF *dof, const jsonParser &json, const Lattice &lat)'" << std::endl;
146 std::cerr <<
"Unrecognized 'DoF_template_type': '" << json[
"DoF_template_type"] <<
"'." << std::endl;
150 else if(json[
"DoF_type"] ==
"ContinuousDoF") {
153 ContinuousDoF tdof(json[
"m_type_name"].get<std::string>(), 0.0, 0.0);
161 std::cerr <<
"Error in 'void from_json(DoF *dof, const jsonParser &json, const Lattice &lat)'" << std::endl;
162 std::cerr <<
"Unrecognized 'DoF_type': '" << json[
"DoF_type"] <<
"'." << std::endl;
163 std::cerr <<
"Options are: 'OccupantDoF', or 'ContinuousDoF'." << std::endl;
size_type size() const
Returns array size if *this is a JSON array, object size if *this is a JSON object, 1 otherwise.
void from_json(ClexDescription &desc, const jsonParser &json)
virtual jsonParser & to_json(jsonParser &json) const =0
void push_back(const T &toPush)
jsonParser & to_json(const ClexDescription &desc, jsonParser &json)
T get(Args...args) const
Get data from json, using one of several alternatives.
jsonParser & to_json(jsonParser &json) const
jsonParser & to_json(jsonParser &json) const override
jsonParser & put_obj()
Puts new empty JSON object.