Ginkgo  Generated from pipelines/2969282958 branch based on develop. Ginkgo version 2.0.0
A numerical linear algebra library targeting many-core architectures
Public Types | Public Member Functions | Static Public Member Functions | List of all members
gko::EnableDefaultFactory< ConcreteFactory, ProductType, ParametersType, PolymorphicBase > Class Template Reference

This mixin provides a default implementation of a concrete factory. More...

#include <ginkgo/core/base/abstract_factory.hpp>

Inherits PolymorphicBase.

Inherited by gko::EnableDefaultReusableLinOpFactory< Factory, Multigrid, parameters_type, reuse_data_type >, gko::EnableDefaultReusableLinOpFactory< Factory, Pgm, parameters_type, reuse_data_type >, gko::batch::preconditioner::Jacobi< ValueType, IndexType >::Factory, gko::batch::solver::Bicgstab< ValueType >::Factory, gko::batch::solver::Cg< ValueType >::Factory, gko::EnableDefaultReusableLinOpFactory< ConcreteFactory, ConcreteLinOp, ParametersType, ReuseDataType, PolymorphicBase >, gko::experimental::distributed::preconditioner::Schwarz< ValueType, LocalIndexType, GlobalIndexType >::Factory, gko::experimental::reorder::ScaledReordered< ValueType, IndexType >::Factory, gko::experimental::solver::Direct< ValueType, IndexType >::Factory, gko::ext::cuda::solver::Cudss< ValueType, IndexType >::Factory, gko::factorization::Ic< ValueType, IndexType >::Factory, gko::factorization::Ilu< ValueType, IndexType >::Factory, gko::factorization::ParIc< ValueType, IndexType >::Factory, gko::factorization::ParIct< ValueType, IndexType >::Factory, gko::factorization::ParIlu< ValueType, IndexType >::Factory, gko::factorization::ParIlut< ValueType, IndexType >::Factory, gko::multigrid::FixedCoarsening< ValueType, IndexType >::Factory, gko::multigrid::Pmis< ValueType, IndexType >::Factory, gko::multigrid::Rs< ValueType, IndexType >::Factory, gko::multigrid::UniformCoarsening< ValueType, IndexType >::Factory, gko::preconditioner::Ic< ValueType, IndexType >::Factory, gko::preconditioner::Ilu< ValueType, ReverseApply, IndexType >::Factory, gko::preconditioner::Isai< IsaiType, ValueType, IndexType >::Factory, gko::preconditioner::Jacobi< ValueType, IndexType >::Factory, gko::preconditioner::NullspaceProjection< ValueType >::Factory, gko::reorder::Rcm< ValueType, IndexType >::Factory, gko::solver::Bicg< ValueType >::Factory, gko::solver::Bicgstab< ValueType >::Factory, gko::solver::CbGmres< ValueType >::Factory, gko::solver::Cg< ValueType >::Factory, gko::solver::Cgs< ValueType >::Factory, gko::solver::Chebyshev< ValueType >::Factory, gko::solver::Fcg< ValueType >::Factory, gko::solver::Gcr< ValueType >::Factory, gko::solver::Gmres< ValueType >::Factory, gko::solver::Idr< ValueType >::Factory, gko::solver::Ir< ValueType >::Factory, gko::solver::LowerTrs< ValueType, IndexType >::Factory, gko::solver::Minres< ValueType >::Factory, gko::solver::PipeCg< ValueType >::Factory, gko::solver::UpperTrs< ValueType, IndexType >::Factory, gko::stop::AbsoluteResidualNorm< ValueType >::Factory, gko::stop::Combined::Factory, gko::stop::ImplicitResidualNorm< ValueType >::Factory, gko::stop::Iteration::Factory, gko::stop::RelativeResidualNorm< ValueType >::Factory, gko::stop::ResidualNorm< ValueType >::Factory, gko::stop::ResidualNormReduction< ValueType >::Factory, and gko::stop::Time::Factory.

Collaboration diagram for gko::EnableDefaultFactory< ConcreteFactory, ProductType, ParametersType, PolymorphicBase >:
[legend]

Public Types

using product_type = ProductType
 
using parameters_type = ParametersType
 
using polymorphic_base = PolymorphicBase
 
using abstract_product_type = typename PolymorphicBase::abstract_product_type
 
using components_type = typename PolymorphicBase::components_type
 

Public Member Functions

template<typename... Args>
std::unique_ptr< product_type > generate (Args &&... args) const
 
const parameters_type & get_parameters () const noexcept
 Returns the parameters of the factory. More...
 

Static Public Member Functions

static parameters_type create ()
 Creates a new ParametersType object which can be used to instantiate a new ConcreteFactory. More...
 

Detailed Description

template<typename ConcreteFactory, typename ProductType, typename ParametersType, typename PolymorphicBase>
class gko::EnableDefaultFactory< ConcreteFactory, ProductType, ParametersType, PolymorphicBase >

This mixin provides a default implementation of a concrete factory.

It implements all the methods of AbstractFactory and PolymorphicObject. Its implementation of the generate_impl() method delegates the creation of the product by calling the ProductType::ProductType(const ConcreteFactory *, const components_type &) constructor. The factory also supports parameters by using the ParametersType structure, which is defined by the user.

For a simple example, see IntFactory in core/test/base/abstract_factory.cpp.

Template Parameters
ConcreteFactorythe concrete factory which is being implemented [CRTP parameter]
ProductTypethe concrete type of products which this factory produces, has to be a subclass of PolymorphicBase::abstract_product_type
ParametersTypea type representing the parameters of the factory, has to inherit from the enable_parameters_type mixin
PolymorphicBaseparent of ConcreteFactory in the polymorphic hierarchy, has to be a subclass of AbstractFactory

Member Function Documentation

◆ create()

template<typename ConcreteFactory , typename ProductType , typename ParametersType , typename PolymorphicBase >
static parameters_type gko::EnableDefaultFactory< ConcreteFactory, ProductType, ParametersType, PolymorphicBase >::create ( )
inlinestatic

Creates a new ParametersType object which can be used to instantiate a new ConcreteFactory.

This method does not construct the factory directly, but returns a new parameters_type object, which can be used to set the parameters of the factory. Once the parameters have been set, the parameters_type::on() method can be used to obtain an instance of the factory with those parameters.

Returns
a default parameters_type object

◆ get_parameters()

template<typename ConcreteFactory , typename ProductType , typename ParametersType , typename PolymorphicBase >
const parameters_type& gko::EnableDefaultFactory< ConcreteFactory, ProductType, ParametersType, PolymorphicBase >::get_parameters ( ) const
inlinenoexcept

Returns the parameters of the factory.

Returns
the parameters of the factory

The documentation for this class was generated from the following file: