Wildmeshing Toolkit
TagIntersectionOptions.cpp
Go to the documentation of this file.
2 
3 #include <wmtk/utils/Logger.hpp>
4 
6 
8 {
9  j = {
10  {"input", o.input},
11  {"output", o.output},
12  {"attributes", o.attributes},
13  {"values", o.values},
14  {"output_attributes", o.output_attributes},
15  {"output_values", o.output_values},
16  {"pass_through", o.pass_through}};
17 }
18 
20 {
21  o.input = j.at("input");
22  o.output = j.at("output");
23  o.attributes = j.at("attributes");
24  j.at("values").get_to(o.values);
25  o.output_attributes = j.at("output_attributes");
26  j.at("output_values").get_to(o.output_values);
27  j.at("pass_through").get_to(o.pass_through);
28 
29  if ((o.attributes.vertex_labels.size() != o.values.vertex_values.size()) ||
30  (o.attributes.edge_labels.size() != o.values.edge_values.size()) ||
31  (o.attributes.face_labels.size() != o.values.face_values.size()) ||
32  (o.attributes.tetrahedron_labels.size() != o.values.tetrahedron_values.size())) {
34  "One value must be given for each attribute.\n vertex_labels: {}, vertex_values: {}\n "
35  " edge_labels: {}, edge_values: {}\n face_labels: {}, face_values: {}\n "
36  "tetrahedron_labels: {}, tetrahedron_values: {}",
37  o.attributes.vertex_labels.size(),
38  o.values.vertex_values.size(),
39  o.attributes.edge_labels.size(),
40  o.values.edge_values.size(),
41  o.attributes.face_labels.size(),
42  o.values.face_values.size(),
44  o.values.tetrahedron_values.size());
45  }
46  if ((o.output_attributes.vertex_labels.size() != o.output_values.vertex_values.size()) ||
47  (o.output_attributes.edge_labels.size() != o.output_values.edge_values.size()) ||
48  (o.output_attributes.face_labels.size() != o.output_values.face_values.size()) ||
52  "One output value must be given for each output attribute.\n vertex_labels: {}, "
53  "vertex_values: {}\n edge_labels: {}, edge_values: {}\n face_labels: {}, face_values: "
54  "{}\n tetrahedron_labels: {}, tetrahedron_values: {}",
58  o.output_values.edge_values.size(),
60  o.output_values.face_values.size(),
63  }
64 }
65 
66 } // namespace wmtk::components::internal
void from_json(const nlohmann::json &j, RegularSpaceOptions &o)
void to_json(nlohmann::json &j, RegularSpaceOptions &o)
void log_and_throw_error(const std::string &msg)
Definition: Logger.cpp:101
nlohmann::json json
Definition: input.cpp:9