ASPECT
Functions
aspect::Plugins Namespace Reference

Functions

template<typename TestType , typename PluginType >
bool plugin_type_matches (const PluginType &object)
 
template<typename TestType , typename PluginType >
TestType & get_plugin_as_type (PluginType &object)
 

Function Documentation

§ plugin_type_matches()

template<typename TestType , typename PluginType >
bool aspect::Plugins::plugin_type_matches ( const PluginType &  object)
inline

This function returns if a given plugin (e.g. a material model returned from SimulatorAccess::get_material_model() ) matches a certain plugin type (e.g. MaterialModel::Simple). This check is needed, because often it is only possible to get a reference to an Interface, not the actual plugin type, but the actual plugin type might be important. For example a radial gravity model might only be implemented for spherical geometry models, and would want to check if the current geometry is in fact a spherical shell.

Definition at line 63 of file plugins.h.

§ get_plugin_as_type()

template<typename TestType , typename PluginType >
TestType& aspect::Plugins::get_plugin_as_type ( PluginType &  object)
inline

This function converts a reference to a type (in particular a reference to an interface class) into a reference to a different type (in particular a plugin class). This allows accessing members of the plugin that are not specified in the interface class. Note that you should first check if the plugin type is actually convertible by calling plugin_matches_type() before calling this function. If the plugin is not convertible this function throws an exception.

Definition at line 80 of file plugins.h.