30#include <c10/util/SmallVector.h>
31#include <c10/util/ArrayRef.h>
36inline const std::string
STATE =
"state";
38inline const std::string
FORCES =
"forces";
62 template <
typename...
S>
65 validate_item_name(
name);
66 _item_names.push_back(
name);
68 (validate_item_name(
names), ...);
69 (_item_names.push_back(
names), ...);
72 template <
typename...
S>
75 validate_item_name(
name);
76 _item_names.push_back(
name);
78 (validate_item_name(
names), ...);
79 (_item_names.push_back(
names), ...);
83 typename =
typename std::enable_if_t<
84 !std::is_convertible_v<Container, std::string> &&
85 std::is_convertible_v<
typename std::iterator_traits<
86 decltype(std::declval<Container>().begin())>::value_type,
88 std::is_convertible_v<
typename std::iterator_traits<
89 decltype(std::declval<Container>().end())>::value_type,
93 _item_names.append(
c.begin(),
c.end());
94 for (
const auto &
name : _item_names)
95 validate_item_name(
name);
98 using iterator = c10::SmallVector<std::string>::iterator;
113 explicit operator std::vector<std::string>()
const;
115 const c10::SmallVector<std::string> &
vec()
const {
return _item_names; }
162 void validate_item_name(
const std::string &)
const;
164 c10::SmallVector<std::string> _item_names;
168bool operator==(
const LabeledAxisAccessor & a,
const LabeledAxisAccessor & b);
171bool operator!=(
const LabeledAxisAccessor & a,
const LabeledAxisAccessor & b);
177bool operator<(
const LabeledAxisAccessor & a,
const LabeledAxisAccessor & b);
183std::ostream &
operator<<(std::ostream & os,
const LabeledAxisAccessor & accessor);
The wrapper (decorator) for cross-referencing unresolved values at parse time.
Definition CrossRef.h:54
The accessor containing all the information needed to access an item in a LabeledAxis.
Definition LabeledAxisAccessor.h:58
bool is_old_force() const
Definition LabeledAxisAccessor.cxx:134
LabeledAxisAccessor(const std::string &name, S &&... names)
Definition LabeledAxisAccessor.h:73
size_t size() const
Definition LabeledAxisAccessor.cxx:50
bool is_parameter() const
Definition LabeledAxisAccessor.cxx:146
bool is_state() const
Definition LabeledAxisAccessor.cxx:116
const_iterator begin() const
Definition LabeledAxisAccessor.h:109
c10::SmallVector< std::string >::const_iterator const_iterator
Definition LabeledAxisAccessor.h:99
LabeledAxisAccessor append(const LabeledAxisAccessor &axis) const
Append another accessor.
Definition LabeledAxisAccessor.cxx:70
LabeledAxisAccessor current() const
Returns the "current" counterpart.
Definition LabeledAxisAccessor.cxx:152
LabeledAxisAccessor prepend(const LabeledAxisAccessor &axis) const
Prepend another accessor.
Definition LabeledAxisAccessor.cxx:76
LabeledAxisAccessor(const char *name, S &&... names)
Definition LabeledAxisAccessor.h:63
bool empty() const
Definition LabeledAxisAccessor.cxx:44
bool start_with(const LabeledAxisAccessor &axis) const
Check if this accessor begins with another accessor.
Definition LabeledAxisAccessor.cxx:110
LabeledAxisAccessor with_suffix(const std::string &suffix) const
Append a suffix to the final item name.
Definition LabeledAxisAccessor.cxx:62
LabeledAxisAccessor remount(const LabeledAxisAccessor &axis, int64_t n=1) const
A combination of slice and prepend.
Definition LabeledAxisAccessor.cxx:104
LabeledAxisAccessor old() const
Returns the "old" counterpart.
Definition LabeledAxisAccessor.cxx:164
LabeledAxisAccessor(const Container &c)
Definition LabeledAxisAccessor.h:91
c10::SmallVector< std::string >::iterator iterator
Definition LabeledAxisAccessor.h:98
bool is_residual() const
Definition LabeledAxisAccessor.cxx:140
iterator end()
Definition LabeledAxisAccessor.h:108
bool is_force() const
Definition LabeledAxisAccessor.cxx:128
const_iterator end() const
Definition LabeledAxisAccessor.h:110
LabeledAxisAccessor()=default
iterator begin()
Definition LabeledAxisAccessor.h:107
LabeledAxisAccessor slice(int64_t n) const
Remove the leading n items from the labels.
Definition LabeledAxisAccessor.cxx:84
const c10::SmallVector< std::string > & vec() const
Definition LabeledAxisAccessor.h:115
bool is_old_state() const
Definition LabeledAxisAccessor.cxx:122
const std::string & operator[](size_t i) const
Definition LabeledAxisAccessor.cxx:56
Definition CrossRef.cxx:31
bool operator!=(const TraceableSize &lhs, const TraceableSize &rhs)
Definition types.cxx:66
const std::string OLD_STATE
Definition LabeledAxisAccessor.h:37
const std::string STATE
Definition LabeledAxisAccessor.h:36
std::string name(ElasticConstant p)
Definition ElasticityConverter.cxx:30
LabeledAxisAccessor VariableName
Definition parser_utils.h:33
const std::string OLD_FORCES
Definition LabeledAxisAccessor.h:39
const std::string RESIDUAL
Definition LabeledAxisAccessor.h:40
const std::string FORCES
Definition LabeledAxisAccessor.h:38
const std::string PARAMETERS
Definition LabeledAxisAccessor.h:41
std::ostream & operator<<(std::ostream &os, const EnumSelection &es)
Definition EnumSelection.cxx:31
bool operator<(const LabeledAxisAccessor &a, const LabeledAxisAccessor &b)
The (strict) smaller than operator is created so as to use LabeledAxisAccessor in sorted data structu...
Definition LabeledAxisAccessor.cxx:199
std::vector< std::string > reserved_subaxis_names()
Definition LabeledAxisAccessor.cxx:32
bool operator==(const TraceableSize &lhs, const TraceableSize &rhs)
Definition types.cxx:60