10 #include "../utils/map_to_index.h" 11 #include "../utils/runtime_error.h" 19 const Str &child_name_)
34 check_required_keys({key_for_child_ids,
"xu",
"yu",
"zu"});
38 el_children->check_required_keys({
"id",
"xu",
"yu",
"zu"});
40 auto &children = el_children->get_data();
54 auto tmp_x = Json::array();
55 auto tmp_y = Json::array();
56 auto tmp_z = Json::array();
58 for (
const int &child_id : d[key_for_child_ids])
60 auto &child = children[id2index_child[child_id]];
62 tmp_x.push_back(child[
"xu"].get<double>() - x);
63 tmp_y.push_back(child[
"yu"].get<double>() - y);
64 tmp_z.push_back(child[
"zu"].get<double>() - z);
ShPtr< Element > ElPtr
An alias for a shared pointer of Element class.
virtual void compute_impl(Json &data, JsonToVoidFunc check_required_keys, JsonToBoolFunc check_optional_keys) override
This method overrides Updater::compute_impl.
std::function< bool(const Json &)> JsonToBoolFunc
An alias for a function accepts a Json object and returns a bool.
std::string Str
Str is an alias for string.
nlohmann::json Json
Json is an alias for nlohmann::json.
This file has a definition of AddChildPositions class, which is a subclass of Adder class...
ShPtr< Generator > ext_generator
Namespace for utility functions.
AddChildPositions(const ElPtr &elem, const Str &child_name_)
Constructor of AddChildPositions class.
std::function< void(const Json &)> JsonToVoidFunc
An alias for a function accepts a Json object.
Map< Json, int > map_to_index(const Json &data, const Str &key)
Create a Map object from values of selected property in an array Json object to corresponding index i...