gko::config::type_descriptor#
Pins the template parameters used when materialising a Ginkgo factory from a configuration document. Carries the value type, local index type, and (for distributed factories) the global index type as runtime strings that the parser uses to pick the right C++ instantiation.
auto td = gko::config::type_descriptor{"float64", "int32"};
auto factory = gko::config::parse(pnode, registry, td);
Most users will construct a type_descriptor once at program start
and reuse it across all parse calls.
-
class type_descriptor#
This class describes the value and index types to be used when building a Ginkgo type from a configuration file.
A type_descriptor is passed in order to define the parse function defines which template parameters, in terms of value_type and/or index_type, the created object will have. For example, a CG solver created like this:
will have the value typeauto cg = parse(config, context, type_descriptor("float64", "int32"));
float64and the index typeint32. Any Ginkgo object that does not require one of these types will just ignore it. In value_type, one additional valuevoidcan be used to specify that no default type is provided. In this case, the configuration has to provide the necessary template types.If the configuration specifies one field (only allow value_type now):
this type will take precedence over the type_descriptor.value_type: "some_value_type"
Public Functions
- explicit type_descriptor(
- std::string value_typestr = "float64",
- std::string index_typestr = "int32",
- std::string global_index_typestr = "int64",
type_descriptor constructor. There is free function
make_type_descriptorto create the object by template.Note
there is no way to call the constructor with explicit template, so we create another free function to handle it.
- Parameters:
value_typestr – the value type string. “void” means no default.
index_typestr – the (local) index type string.
global_index_typestr – the global index type string.
-
const std::string &get_value_typestr() const#
Get the value type string.
-
const std::string &get_index_typestr() const#
Get the index type string
-
const std::string &get_local_index_typestr() const#
Get the local index type string, which gives the same result as get_index_typestr()
-
const std::string &get_global_index_typestr() const#
Get the global index type string