Loading [MathJax]/extensions/tex2jax.js
OGS
IntegrationPointMetaData.h
Go to the documentation of this file.
1
10#include <concepts>
11#include <range/v3/range/concepts.hpp>
12#include <range/v3/range/traits.hpp>
13#if defined(__cpp_lib_containers_ranges) && \
14 __cpp_lib_containers_ranges >= 202202L
15#include <ranges>
16#else
17#include <range/v3/to_container.hpp>
18#endif
19#include <string>
20#include <string_view>
21#include <vector>
22
23#pragma once
24
25namespace MeshLib
26{
38
41{
42public:
44 explicit IntegrationPointMetaData(std::string_view const json_string);
45
46 explicit IntegrationPointMetaData(ranges::input_range auto&& range)
47 requires(std::convertible_to<ranges::range_reference_t<decltype(range)>,
49 :
50#if defined(__cpp_lib_containers_ranges) && \
51 __cpp_lib_containers_ranges >= 202202L
52 fields_(std::from_range, std::forward<decltype(range)>(range))
53#else
54 fields_(ranges::to<std::vector<IntegrationPointMetaDataSingleField>>(
55 std::forward<decltype(range)>(range)))
56#endif
57 {
59 }
61 std::string toJsonString() const;
62
63 constexpr bool empty() const { return fields_.empty(); }
64
66 std::string const& field_name) const;
67
68 auto operator<=>(IntegrationPointMetaData const&) const = default;
69
70private:
71 void checkFieldNamesAreUnique() const;
72
73private:
74 std::vector<IntegrationPointMetaDataSingleField> fields_;
75};
76
80 std::optional<IntegrationPointMetaData> const& ip_meta_data,
81 std::string const& field_name);
82} // namespace MeshLib
Description of the stored integration point meta data for all fields.
IntegrationPointMetaData(std::string_view const json_string)
Constructs integration point meta data from a JSON encoded string.
std::string toJsonString() const
Converts integration point meta data to a JSON string.
auto operator<=>(IntegrationPointMetaData const &) const =default
IntegrationPointMetaDataSingleField const & operator[](std::string const &field_name) const
std::vector< IntegrationPointMetaDataSingleField > fields_
IntegrationPointMetaData(ranges::input_range auto &&range)
IntegrationPointMetaDataSingleField getIntegrationPointMetaDataSingleField(std::optional< IntegrationPointMetaData > const &ip_meta_data, std::string const &field_name)
auto operator<=>(IntegrationPointMetaDataSingleField const &) const =default