6#include <spdlog/fmt/ranges.h>
8#include <nlohmann/json.hpp>
9#include <range/v3/algorithm/find.hpp>
10#include <range/v3/iterator/operations.hpp>
11#include <range/v3/range/conversion.hpp>
12#include <range/v3/view/transform.hpp>
23 std::string_view
const json_string)
25 json
const meta_data = json::parse(json_string);
27 fields_ = meta_data[
"integration_point_arrays"] |
28 ranges::views::transform(
32 md[
"name"], md[
"number_of_components"],
33 md[
"integration_order"]};
35 ranges::to<std::vector>;
41 std::string
const& field_name)
const
43 auto it = ranges::find(
48 OGS_FATAL(
"No integration point meta data with name '{:s}' found.",
57 json_meta_data[
"integration_point_arrays"] = json::array();
59 for (
auto const& field :
fields_)
61 json_meta_data[
"integration_point_arrays"].push_back(
62 {{
"name", field.field_name},
63 {
"number_of_components", field.n_components},
64 {
"integration_order", field.integration_order}});
67 return json_meta_data.dump();
73 fields_ | ranges::views::transform(
76 if (!duplicates.empty())
78 OGS_FATAL(
"Duplicate integration point meta data names found: {:s}.",
79 fmt::join(duplicates,
", "));
84 std::optional<IntegrationPointMetaData>
const& ip_meta_data,
85 std::string
const& field_name)
90 "The required 'IntegrationPointMetaData' array is not available in "
91 "the vtk field data but is needed to evaluate the integration "
92 "point property '{:s}'.",
95 return (*ip_meta_data)[field_name];
std::vector< ranges::range_value_t< Range > > getDuplicates(Range &&range)
IntegrationPointMetaDataSingleField getIntegrationPointMetaDataSingleField(std::optional< IntegrationPointMetaData > const &ip_meta_data, std::string const &field_name)