Class Context

Nested Relationships

Nested Types

Class Documentation

class Context

Specifies details of the MBPT formalism.

MBPT context contains:

  • csv: whether to use cluster-specific virtuals

  • an OpRegistry: maps operator labels to their OpClass

Can be accessed via get_default_mbpt_context(). Functions access this global context to validate operator types and properties.

Warning

Default construction creates a Context with null OpRegistry. Most MBPT functions require a registry. Can be initialized as:

set_default_mbpt_context(Context({.op_registry_ptr = make_minimal_registry()}));

Public Functions

Context(Options options = make_default_options())

Construct a Context object, uses default options if none are given.

~Context() = default

destructor

Context(Context&&) = default

move constructor

Context(Context const &other) = default

copy constructor

Context &operator=(Context const &other) = default

copy assignment

Context clone() const

clones this object and its OpRegistry

CSV csv() const
Returns:

the value of CSV in this context

std::shared_ptr<const OpRegistry> op_registry() const

Note

asserts that OpRegistry is not null

Returns:

a constant pointer to the OpRegistry for this context

std::shared_ptr<OpRegistry> mutable_op_registry() const

Note

asserts that OpRegistry is not null

Returns:

a pointer to the OpRegistry for this context

Context &set(const OpRegistry &op_registry)

sets the OpRegistry for this context

Context &set(std::shared_ptr<OpRegistry> op_registry)

sets the OpRegistry for this context

Context &set(CSV csv)

sets whether to use cluster-specific virtuals

Public Static Functions

static inline Options make_default_options()

makes default options for mbpt::Context

struct Defaults

Public Static Attributes

static constexpr auto csv = CSV::No
struct Options

Public Members

CSV csv = Defaults::csv

whether to use cluster-specific virtuals

std::shared_ptr<OpRegistry> op_registry_ptr = nullptr

shared pointer to operator registry

std::optional<OpRegistry> op_registry = std::nullopt

optional operator registry, use if no shared pointer is provided