SpECTRE
v2024.12.16
|
Mark a struct as a compute tag by inheriting from this. More...
#include <Tag.hpp>
Mark a struct as a compute tag by inheriting from this.
A compute tag is used to identify an item in a DataBox that will be computed on-demand from other items in the DataBox. A compute tag must be derived from a simple tag corresponding to the type of object that is computed. This simple tag can be used to fetch the item corresponding to the compute tag from a DataBox.
A compute tag contains a member named function
that is either a static constexpr function pointer, or a static function. The compute tag must also have a a type alias argument_tags
that is a typelist of the tags that will be retrieved from the DataBox and whose data will be passed to the function (pointer). Compute tags must also contain a type alias named return_type
that is the type the function is mutating. The type must be default constructible.
By convention, the name of a compute tag should be the name of the simple tag that it derives from, appended by Compute
.
Derived Class Requires:
return_type
of the type of the item computedbase
that is the simple tag from which it is derivedfunction
that is either a function pointer, or a static constexpr function that is used to compute the item from the argument_tags
fetched from the DataBoxargument_tags
that is a tmpl::list
of the tags of the items that will be passed (in order) to the function specified by function
A compute tag may optionally specify a static std::string name()
method to override the default name produced by db::tag_name.
Compute tags are of the form:
where the function is:
You can also have function
be a function instead of a function pointer, which offers a lot of simplicity for very simple compute items.
Note that the arguments can be empty: