Ginkgo  Generated from pipelines/1554403166 branch based on develop. Ginkgo version 1.9.0
A numerical linear algebra library targeting many-core architectures
Public Types | Public Member Functions | List of all members
gko::ConvertibleTo< ResultType > Class Template Referenceabstract

ConvertibleTo interface is used to mark that the implementer can be converted to the object of ResultType. More...

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

Inherited by gko::matrix::Dense< value_type >, gko::matrix::Dense< value_type >, gko::matrix::Dense< value_type >, gko::matrix::Dense< value_type >, gko::matrix::Dense< value_type >, gko::matrix::Dense< value_type >, gko::matrix::Dense< value_type >, gko::matrix::Dense< value_type >, gko::matrix::Dense< value_type >, gko::matrix::Dense< value_type >, gko::matrix::Dense< value_type >, gko::matrix::Dense< value_type >, gko::matrix::Dense< value_type >, gko::matrix::Dense< value_type >, gko::matrix::Dense< value_type >, and gko::EnablePolymorphicAssignment< ConcreteType, ResultType >.

Public Types

using result_type = ResultType
 

Public Member Functions

virtual void convert_to (result_type *result) const =0
 Converts the implementer to an object of type result_type. More...
 
void convert_to (ptr_param< result_type > result) const
 
virtual void move_to (result_type *result)=0
 Converts the implementer to an object of type result_type by moving data from this object. More...
 
void move_to (ptr_param< result_type > result)
 

Detailed Description

template<typename ResultType>
class gko::ConvertibleTo< ResultType >

ConvertibleTo interface is used to mark that the implementer can be converted to the object of ResultType.

This interface is used to enable conversions between polymorphic objects. To mark that an object of type U can be converted to an object of type V, U should implement ConvertibleTo<V>. Then, the implementation of PolymorphicObject::copy_from automatically generated by EnablePolymorphicObject mixin will use RTTI to figure out that U implements the interface and convert it using the convert_to / move_to methods of the interface.

As an example, the following function:

{c++}
void my_function(const U *u, V *v) {
v->copy_from(u);
}

will convert object u to object v by checking that u can be dynamically casted to ConvertibleTo\<V\>, and calling ConvertibleTo<V>::convert_to(V*)` to do the actual conversion.

In case u is passed as a unique_ptr, call to convert_to will be replaced by a call to move_to and trigger move semantics.

Template Parameters
ResultTypethe type to which the implementer can be converted to, has to be a subclass of PolymorphicObject

Member Function Documentation

◆ convert_to()

template<typename ResultType>
virtual void gko::ConvertibleTo< ResultType >::convert_to ( result_type *  result) const
pure virtual

Converts the implementer to an object of type result_type.

Parameters
resultthe object used to store the result of the conversion

Implemented in gko::EnablePolymorphicAssignment< ConcreteType, ResultType >, gko::EnablePolymorphicAssignment< Factorization< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< Lu< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< Isai< IsaiType, ValueType, IndexType > >, gko::EnablePolymorphicAssignment< SparsityCsr< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< Vector< ValueType > >, gko::EnablePolymorphicAssignment< Mc64< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< Diagonal< ValueType > >, gko::EnablePolymorphicAssignment< Pgm< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< Dense< ValueType > >, gko::EnablePolymorphicAssignment< UpperTrs< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< Amd< IndexType > >, gko::EnablePolymorphicAssignment< Matrix< ValueType, LocalIndexType, GlobalIndexType > >, gko::EnablePolymorphicAssignment< Hybrid< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< Identity< ValueType > >, gko::EnablePolymorphicAssignment< ConcreteLinOp >, gko::EnablePolymorphicAssignment< Rcm< IndexType > >, gko::EnablePolymorphicAssignment< Fft3 >, gko::EnablePolymorphicAssignment< Partition< LocalIndexType, GlobalIndexType > >, gko::EnablePolymorphicAssignment< Composition< ValueType > >, gko::EnablePolymorphicAssignment< ConcreteBatchLinOp >, gko::EnablePolymorphicAssignment< RowGatherer< IndexType > >, gko::EnablePolymorphicAssignment< Cholesky< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< Fft2 >, gko::EnablePolymorphicAssignment< FixedCoarsening< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< Fbcsr< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< LowerTrs< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< Combination< ValueType > >, gko::EnablePolymorphicAssignment< Bicgstab< ValueType > >, gko::EnablePolymorphicAssignment< MultiVector< ValueType > >, gko::EnablePolymorphicAssignment< Multigrid >, gko::EnablePolymorphicAssignment< Gmres< ValueType > >, gko::EnablePolymorphicAssignment< GaussSeidel< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< CbGmres< ValueType > >, gko::EnablePolymorphicAssignment< Csr< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< ConcreteSolver >, gko::EnablePolymorphicAssignment< Ir< ValueType > >, gko::EnablePolymorphicAssignment< Coo< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< Fcg< ValueType > >, gko::EnablePolymorphicAssignment< Rcm< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< Sor< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< Fft >, gko::EnablePolymorphicAssignment< BlockOperator >, gko::EnablePolymorphicAssignment< Direct< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< Idr< ValueType > >, gko::EnablePolymorphicAssignment< ConcreteFactory >, gko::EnablePolymorphicAssignment< Cgs< ValueType > >, gko::EnablePolymorphicAssignment< Ell< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< Ilu< LSolverType, USolverType, ReverseApply, IndexType > >, gko::EnablePolymorphicAssignment< Ic< LSolverType, IndexType > >, gko::EnablePolymorphicAssignment< Permutation< IndexType > >, gko::EnablePolymorphicAssignment< ScaledPermutation< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< Jacobi< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< Gcr< ValueType > >, gko::EnablePolymorphicAssignment< Schwarz< ValueType, LocalIndexType, GlobalIndexType > >, gko::EnablePolymorphicAssignment< Cg< ValueType > >, gko::EnablePolymorphicAssignment< ScaledReordered< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< Sellp< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< Bicg< ValueType > >, gko::EnablePolymorphicAssignment< Perturbation< ValueType > >, and gko::preconditioner::Jacobi< ValueType, IndexType >.

◆ move_to()

template<typename ResultType>
virtual void gko::ConvertibleTo< ResultType >::move_to ( result_type *  result)
pure virtual

Converts the implementer to an object of type result_type by moving data from this object.

This method is used when the implementer is a temporary object, and move semantics can be used.

Parameters
resultthe object used to emplace the result of the conversion
Note
ConvertibleTo::move_to can be implemented by simply calling ConvertibleTo::convert_to. However, this operation can often be optimized by exploiting the fact that implementer's data can be moved to the result.

Implemented in gko::EnablePolymorphicAssignment< ConcreteType, ResultType >, gko::EnablePolymorphicAssignment< Factorization< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< Lu< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< Isai< IsaiType, ValueType, IndexType > >, gko::EnablePolymorphicAssignment< SparsityCsr< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< Vector< ValueType > >, gko::EnablePolymorphicAssignment< Mc64< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< Diagonal< ValueType > >, gko::EnablePolymorphicAssignment< Pgm< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< Dense< ValueType > >, gko::EnablePolymorphicAssignment< UpperTrs< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< Amd< IndexType > >, gko::EnablePolymorphicAssignment< Matrix< ValueType, LocalIndexType, GlobalIndexType > >, gko::EnablePolymorphicAssignment< Hybrid< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< Identity< ValueType > >, gko::EnablePolymorphicAssignment< ConcreteLinOp >, gko::EnablePolymorphicAssignment< Rcm< IndexType > >, gko::EnablePolymorphicAssignment< Fft3 >, gko::EnablePolymorphicAssignment< Partition< LocalIndexType, GlobalIndexType > >, gko::EnablePolymorphicAssignment< Composition< ValueType > >, gko::EnablePolymorphicAssignment< ConcreteBatchLinOp >, gko::EnablePolymorphicAssignment< RowGatherer< IndexType > >, gko::EnablePolymorphicAssignment< Cholesky< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< Fft2 >, gko::EnablePolymorphicAssignment< FixedCoarsening< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< Fbcsr< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< LowerTrs< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< Combination< ValueType > >, gko::EnablePolymorphicAssignment< Bicgstab< ValueType > >, gko::EnablePolymorphicAssignment< MultiVector< ValueType > >, gko::EnablePolymorphicAssignment< Multigrid >, gko::EnablePolymorphicAssignment< Gmres< ValueType > >, gko::EnablePolymorphicAssignment< GaussSeidel< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< CbGmres< ValueType > >, gko::EnablePolymorphicAssignment< Csr< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< ConcreteSolver >, gko::EnablePolymorphicAssignment< Ir< ValueType > >, gko::EnablePolymorphicAssignment< Coo< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< Fcg< ValueType > >, gko::EnablePolymorphicAssignment< Rcm< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< Sor< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< Fft >, gko::EnablePolymorphicAssignment< BlockOperator >, gko::EnablePolymorphicAssignment< Direct< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< Idr< ValueType > >, gko::EnablePolymorphicAssignment< ConcreteFactory >, gko::EnablePolymorphicAssignment< Cgs< ValueType > >, gko::EnablePolymorphicAssignment< Ell< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< Ilu< LSolverType, USolverType, ReverseApply, IndexType > >, gko::EnablePolymorphicAssignment< Ic< LSolverType, IndexType > >, gko::EnablePolymorphicAssignment< Permutation< IndexType > >, gko::EnablePolymorphicAssignment< ScaledPermutation< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< Jacobi< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< Gcr< ValueType > >, gko::EnablePolymorphicAssignment< Schwarz< ValueType, LocalIndexType, GlobalIndexType > >, gko::EnablePolymorphicAssignment< Cg< ValueType > >, gko::EnablePolymorphicAssignment< ScaledReordered< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< Sellp< ValueType, IndexType > >, gko::EnablePolymorphicAssignment< Bicg< ValueType > >, gko::EnablePolymorphicAssignment< Perturbation< ValueType > >, and gko::preconditioner::Jacobi< ValueType, IndexType >.


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