Unified fluent builder for declaring both field-backed and shared-backed components.
More...
ComponentDeclaration is the preferred entry point for all component declarations. It accumulates declaration metadata through a fluent chain of setters and then materializes either a field-backed component (via .field<A>().declare()) or a shared-backed component (via .shared<A>(source).declare()).
The builder transitions through implementation-detail intermediate types as the fluent chain accumulates type information; use auto to hold these intermediate results.
The backend is selected explicitly by calling .field<A>() for a field-backed component or .shared<A>(source) for a shared-backed component, then .declare().
- Field-backed example:
auto velocity = decl.rank(NODE_RANK)
.name("velocity")
.role(Ioss::Field::TRANSIENT)
.field<mundy::math::Vector3<double>>()
.declare();
ComponentDeclaration(stk::mesh::MetaData &meta_data)
Construct with a MetaData reference (required for field-backed declarations; optional for shared).
Definition DeclareComponent.hpp:105
- Shared-backed example:
auto stiffness = decl.
rank(ELEMENT_RANK)
.declare();
auto shared(SharedSource &&source) const
Commit to a shared-backed component with the given access shape and source.
Definition DeclareComponent.hpp:179
ComponentDeclaration rank(stk::mesh::EntityRank rank) const
Set the entity rank of the component.
Definition DeclareComponent.hpp:121
ComponentDeclaration name(const std::string &component_name) const
Set the name of the component.
Definition DeclareComponent.hpp:129
- Tagged field component:
.
field<mundy::math::Vector3<double>>()
.declare();
auto field() const
Commit to a field-backed component with the given access shape.
Definition DeclareComponent.hpp:171
auto tag() const
Attach a semantic tag before choosing a component backend.
Definition DeclareComponent.hpp:197
A small helper type for tying a Tag to an underlying value.
Definition aggregate.hpp:52
- Snapshot reuse:
- Intermediate builder values are copyable and may be reused to declare multiple components that share common properties:
auto node_vec3 = decl.
rank(NODE_RANK)
.
role(Ioss::Field::TRANSIENT)
.
field<mundy::math::Vector3<double>>();
auto velocity = node_vec3.name("velocity").declare();
auto force = node_vec3.name("force").declare();
ComponentDeclaration role(Ioss::Field::RoleType field_role) const
Set the I/O role for field-backed components.
Definition DeclareComponent.hpp:139