27#include <unordered_map>
29#include "neml2/misc/utils.h"
30#include "neml2/models/LabeledAxisAccessor.h"
126 const std::vector<const LabeledAxis *> &
subaxes()
const;
150 void cache_reserved_subaxis(
const std::string &
axis_name);
153 void ensure_setup_dbg()
const;
165 std::map<std::string, Size> _variables;
168 std::map<std::string, std::shared_ptr<LabeledAxis>> _subaxes;
178 std::map<LabeledAxisAccessor, std::size_t> _variable_to_id_map;
180 std::vector<LabeledAxisAccessor> _id_to_variable_map;
182 std::vector<Size> _id_to_variable_size_map;
184 std::vector<indexing::Slice> _id_to_variable_slice_map;
195 std::vector<const LabeledAxis *> _sorted_subaxes;
197 std::map<std::string, std::size_t> _subaxis_to_id_map;
199 std::vector<std::string> _id_to_subaxis_map;
201 std::vector<Size> _id_to_subaxis_size_map;
203 std::vector<indexing::Slice> _id_to_subaxis_slice_map;
208 bool _has_state =
false;
209 bool _has_old_state =
false;
210 bool _has_forces =
false;
211 bool _has_old_forces =
false;
212 bool _has_residual =
false;
213 bool _has_parameters =
false;
217std::ostream &
operator<<(std::ostream & os,
const LabeledAxis & axis);
219bool operator==(
const LabeledAxis & a,
const LabeledAxis & b);
221bool operator!=(
const LabeledAxis & a,
const LabeledAxis & b);
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
A labeled axis used to associate layout of a tensor with human-interpretable names.
Definition LabeledAxis.h:47
const std::vector< indexing::Slice > & variable_slices() const
Get the variable slicing indices (in assembly order)
Definition LabeledAxis.cxx:251
bool equals(const LabeledAxis &other) const
Check to see if two axes are equivalent.
Definition LabeledAxis.cxx:407
void add_variable(const LabeledAxisAccessor &name, Size sz)
Add a variable with known storage size.
Definition LabeledAxis.cxx:54
std::size_t nsubaxis() const
Definition LabeledAxis.cxx:294
LabeledAxis()=default
Empty constructor.
bool is_setup() const
Whether the axis has been set up.
Definition LabeledAxis.h:56
bool has_variable(const LabeledAxisAccessor &name) const
Check the existence of a variable by its name.
Definition LabeledAxis.cxx:212
const std::vector< Size > & variable_sizes() const
Get the variable storage sizes (in assembly order)
Definition LabeledAxis.cxx:265
bool has_forces() const
Definition LabeledAxis.h:65
friend std::ostream & operator<<(std::ostream &os, const LabeledAxis &axis)
Definition LabeledAxis.cxx:454
indexing::Slice subaxis_slice(const LabeledAxisAccessor &name) const
Get the slicing indices of a sub-axis by name.
Definition LabeledAxis.cxx:369
std::size_t nvariable() const
Definition LabeledAxis.cxx:198
bool has_old_forces() const
Definition LabeledAxis.h:66
bool has_residual() const
Definition LabeledAxis.h:67
LabeledAxis & add_subaxis(const std::string &name)
Add a sub-axis.
Definition LabeledAxis.cxx:41
bool has_subaxis(const LabeledAxisAccessor &name) const
Check the existence of a subaxis by its name.
Definition LabeledAxis.cxx:300
indexing::Slice slice(const LabeledAxisAccessor &name) const
Get the slicing indices of a variable or a local sub-axis.
Definition LabeledAxis.cxx:179
void setup_layout()
Setup the layout of all items recursively.
Definition LabeledAxis.cxx:72
Size subaxis_size(const LabeledAxisAccessor &name) const
Get the storage size of a sub-axis by name.
Definition LabeledAxis.cxx:394
const std::vector< LabeledAxisAccessor > & variable_names() const
Get the variable names.
Definition LabeledAxis.cxx:244
std::size_t variable_id(const LabeledAxisAccessor &name) const
Get the assembly ID of a variable.
Definition LabeledAxis.cxx:230
const std::vector< indexing::Slice > & subaxis_slices() const
Get the sub-axis slicing indices (in assembly order)
Definition LabeledAxis.cxx:362
Size variable_size(const LabeledAxisAccessor &name) const
Get the storage size of a variable by name.
Definition LabeledAxis.cxx:272
Size size() const
Get the storage size of the entire axis.
Definition LabeledAxis.cxx:132
const std::vector< Size > & subaxis_sizes() const
Get the sub-axis storage sizes (in assembly order)
Definition LabeledAxis.cxx:387
bool has_parameters() const
Definition LabeledAxis.h:68
void add_variable(const LabeledAxisAccessor &name)
Add a variable.
Definition LabeledAxis.h:79
bool has_old_state() const
Definition LabeledAxis.h:64
std::size_t subaxis_id(const std::string &name) const
Get the assembly ID of a sub-axis.
Definition LabeledAxis.cxx:313
LabeledAxisAccessor qualify(const LabeledAxisAccessor &accessor) const
Return the fully qualified name of an item (i.e. this axis is a sub-axis)
Definition LabeledAxis.cxx:35
const std::vector< std::string > & subaxis_names() const
Get the sub-axis names.
Definition LabeledAxis.cxx:355
bool has_state() const
Definition LabeledAxis.h:63
const LabeledAxis & subaxis(const LabeledAxisAccessor &name) const
Get a sub-axis by name.
Definition LabeledAxis.cxx:333
const indexing::Slice & variable_slice(const LabeledAxisAccessor &name) const
Get the slicing indices of a variable by name.
Definition LabeledAxis.cxx:258
const std::vector< const LabeledAxis * > & subaxes() const
Get the sub-axes (in assembly order)
Definition LabeledAxis.cxx:326
Size storage_size(TensorShapeRef shape)
The flattened storage size of a tensor with given shape.
Definition utils.cxx:55
Definition CrossRef.cxx:31
bool operator!=(const TraceableSize &lhs, const TraceableSize &rhs)
Definition types.cxx:66
std::string name(ElasticConstant p)
Definition ElasticityConverter.cxx:30
int64_t Size
Definition types.h:33
std::ostream & operator<<(std::ostream &os, const EnumSelection &es)
Definition EnumSelection.cxx:31
bool operator==(const TraceableSize &lhs, const TraceableSize &rhs)
Definition types.cxx:60