For the complete documentation index, see llms.txt. This page is also available as Markdown.

ParmParse

Selector

The pp.select automates the selection of polymorphic objects by instantiating the object (using either static dispatch or dynamic dispatch) and relaying the parser to the model's Parse function. For example:

    pp.select<Model::AllenCahn,Model::CahnHilliard>("phase_field", value.model);

sets value.model to either Model::AllenCahn or Model::CahnHilliard depending on what is set in phase_field.type. The string that is matched is set as the name field in the corresponding class, for example,

public:
    static constexpr const char* name = "allencahn";

indicating that an input value of phase_field.type = allencahn will relay to the Allen Cahn integrator, and any subsequent arguments will be given the allencahn prefix (e.g. phase_field.allencahn.mobility=1 ).

Argument forwarding

Sometimes the model that is selected requires additional arguments upon construction. The IC::IC family of classes requires an amrex::Geometry argument and optionally a unit. These can be passed in using the pp.forward_args function as:

pp.select<IC::Constant,IC::Expression>("ic",value.ic,pp.forward_args(value.geom));

Last updated

Was this helpful?