25#include "neml2/tensors/LabeledAxisAccessor.h"
26#include "neml2/misc/error.h"
33 for (
const auto & name : _item_names)
34 validate_item_name(name);
45 _item_names =
other._item_names;
49LabeledAxisAccessor::operator std::vector<std::string>()
const {
return _item_names; }
54 return _item_names.empty();
60 return _item_names.size();
74 return axis.
on(*
this);
109LabeledAxisAccessor::validate_item_name(
const std::string & name)
const
111 const auto x = name.find_first_of(
" .,;/\t\n\v\f\r");
113 "Invalid item name: ",
115 ". The item names cannot contain whitespace, '.', ',', ';', or '/'.");
121 return a.vec() != b.vec();
127 return a.vec() == b.vec();
133 return a.vec() < b.vec();
The wrapper (decorator) for cross-referencing unresolved values at parse time.
Definition CrossRef.h:52
The accessor containing all the information needed to access an item in a LabeledAxis.
Definition LabeledAxisAccessor.h:44
size_t size() const
Definition LabeledAxisAccessor.cxx:58
LabeledAxisAccessor append(const LabeledAxisAccessor &axis) const
Add a new item.
Definition LabeledAxisAccessor.cxx:72
bool empty() const
Definition LabeledAxisAccessor.cxx:52
bool start_with(const LabeledAxisAccessor &axis) const
Check if this accessor begins with another accessor.
Definition LabeledAxisAccessor.cxx:103
LabeledAxisAccessor with_suffix(const std::string &suffix) const
Append a suffix to the item name.
Definition LabeledAxisAccessor.cxx:64
LabeledAxisAccessor slice(size_t n) const
Remove the leading n items from the labels.
Definition LabeledAxisAccessor.cxx:86
LabeledAxisAccessor()=default
LabeledAxisAccessor & operator=(const LabeledAxisAccessor &other)
Assignment operator.
Definition LabeledAxisAccessor.cxx:43
LabeledAxisAccessor on(const LabeledAxisAccessor &axis) const
Re-mount the LabeledAxisAccessor on an axis by the axis accessor.
Definition LabeledAxisAccessor.cxx:78
Definition CrossRef.cxx:32
std::ostream & operator<<(std::ostream &os, const OptionCollection &p)
Definition OptionCollection.cxx:37
bool operator==(const LabeledAxis &a, const LabeledAxis &b)
Definition LabeledAxis.cxx:461
bool operator!=(const LabeledAxis &a, const LabeledAxis &b)
Definition LabeledAxis.cxx:467
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:131
void neml_assert(bool assertion, Args &&... args)
Definition error.h:73