56 std::optional<std::string>
const tabular_file,
57 std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>
const&
65 auto const path_to_tabular_file =
71 "Not found the tabular file with the specified file path: {:s}",
72 path_to_tabular_file);
75 INFO(
"Found the tabular file: {:s}", path_to_tabular_file);
77 std::ifstream in(path_to_tabular_file);
80 OGS_FATAL(
"Couldn't open the tabular file: {:s}.",
81 path_to_tabular_file);
86 std::getline(in, line);
87 std::vector<std::string> field_names;
88 boost::split(field_names, line, boost::is_any_of(
"\t "));
91 std::vector<std::string> input_field_names;
92 std::copy_if(field_names.begin(), field_names.end(),
93 std::back_inserter(input_field_names),
94 [](
auto const& field_name) ->
bool
95 { return field_name.find(
"_new") == std::string::npos; });
98 std::map<std::string, std::vector<double>> tabular_data;
99 while (std::getline(in, line))
101 std::vector<std::string> field_data;
102 boost::split(field_data, line, boost::is_any_of(
"\t "));
104 assert(field_data.size() == field_names.size());
105 for (std::size_t field_id = 0; field_id < field_data.size(); ++field_id)
107 tabular_data[field_names[field_id]].push_back(
108 std::stod(field_data[field_id]));
113 std::vector<Field> input_fields;
114 input_fields.reserve(input_field_names.size());
115 for (
auto const& field_name : input_field_names)
117 auto pv = std::find_if(process_variables.begin(),
118 process_variables.end(),
119 [&field_name](
auto const& v) ->
bool
121 return v[0].get().getName() == field_name ||
122 v[0].get().getName() +
"_prev" ==
126 if (pv == process_variables.end())
129 "Not found field name {:s} in the group of process variables "
130 "defined in the project file.",
134 auto const process_id =
135 static_cast<int>(std::distance(process_variables.cbegin(), pv));
137 auto seed_points = tabular_data[field_name];
140 std::vector<std::vector<std::size_t>> point_id_groups;
141 for (
auto const seed_point : seed_points)
143 auto const point_id_group =
144 getIndexVector(tabular_data[field_name], seed_point);
145 point_id_groups.push_back(point_id_group);
148 input_fields.emplace_back(point_id_groups, seed_points, field_name,
152 return std::make_unique<LookupTable>(std::move(input_fields),
153 std::move(tabular_data));