Ginkgo
Generated from pipelines/1554403166 branch based on develop. Ginkgo version 1.9.0
A numerical linear algebra library targeting many-core architectures
|
A PolymorphicObject is the abstract base for all "heavy" objects in Ginkgo that behave polymorphically. More...
#include <ginkgo/core/base/polymorphic_object.hpp>
Public Member Functions | |
PolymorphicObject & | operator= (const PolymorphicObject &) |
std::unique_ptr< PolymorphicObject > | create_default (std::shared_ptr< const Executor > exec) const |
Creates a new "default" object of the same dynamic type as this object. More... | |
std::unique_ptr< PolymorphicObject > | create_default () const |
Creates a new "default" object of the same dynamic type as this object. More... | |
std::unique_ptr< PolymorphicObject > | clone (std::shared_ptr< const Executor > exec) const |
Creates a clone of the object. More... | |
std::unique_ptr< PolymorphicObject > | clone () const |
Creates a clone of the object. More... | |
PolymorphicObject * | copy_from (const PolymorphicObject *other) |
Copies another object into this object. More... | |
template<typename Derived , typename Deleter > | |
std::enable_if_t< std::is_base_of< PolymorphicObject, std::decay_t< Derived > >::value, PolymorphicObject > * | copy_from (std::unique_ptr< Derived, Deleter > &&other) |
Moves another object into this object. More... | |
template<typename Derived , typename Deleter > | |
std::enable_if_t< std::is_base_of< PolymorphicObject, std::decay_t< Derived > >::value, PolymorphicObject > * | copy_from (const std::unique_ptr< Derived, Deleter > &other) |
Copies another object into this object. More... | |
PolymorphicObject * | copy_from (const std::shared_ptr< const PolymorphicObject > &other) |
Copies another object into this object. More... | |
PolymorphicObject * | move_from (ptr_param< PolymorphicObject > other) |
Moves another object into this object. More... | |
PolymorphicObject * | clear () |
Transforms the object into its default state. More... | |
std::shared_ptr< const Executor > | get_executor () const noexcept |
Returns the Executor of the object. More... | |
Public Member Functions inherited from gko::log::EnableLogging< PolymorphicObject > | |
void | add_logger (std::shared_ptr< const Logger > logger) override |
void | remove_logger (const Logger *logger) override |
void | remove_logger (ptr_param< const Logger > logger) |
const std::vector< std::shared_ptr< const Logger > > & | get_loggers () const override |
void | clear_loggers () override |
Public Member Functions inherited from gko::log::Loggable | |
void | remove_logger (ptr_param< const Logger > logger) |
A PolymorphicObject is the abstract base for all "heavy" objects in Ginkgo that behave polymorphically.
It defines the basic utilities (copying moving, cloning, clearing the objects) for all such objects. It takes into account that these objects are dynamically allocated, managed by smart pointers, and used polymorphically. Additionally, it assumes their data can be allocated on different executors, and that they can be copied between those executors.
|
inline |
Transforms the object into its default state.
Equivalent to this->copy_from(this->create_default())
.
|
inline |
Creates a clone of the object.
This is a shorthand for clone(std::shared_ptr<const Executor>) that uses the executor of this object to construct the new object.
|
inline |
Creates a clone of the object.
This is the polymorphic equivalent of the executor copy constructor decltype(*this)(exec, this)
.
exec | the executor where the clone will be created |
References create_default().
|
inline |
Copies another object into this object.
This is the polymorphic equivalent of the copy assignment operator.
other | the object to copy |
Referenced by copy_from().
|
inline |
Copies another object into this object.
This is the polymorphic equivalent of the copy assignment operator.
other | the object to copy |
References copy_from().
|
inline |
Copies another object into this object.
This is the polymorphic equivalent of the copy assignment operator.
other | the object to copy |
Derived | the actual pointee type of the parameter, it needs to be derived from PolymorphicObject. |
Deleter | the deleter of the unique_ptr parameter |
References copy_from().
|
inline |
Moves another object into this object.
This is the polymorphic equivalent of the move assignment operator.
other | the object to move from |
Derived | the actual pointee type of the parameter, it needs to be derived from PolymorphicObject. |
Deleter | the deleter of the unique_ptr parameter |
|
inline |
Creates a new "default" object of the same dynamic type as this object.
This is a shorthand for create_default(std::shared_ptr<const Executor>) that uses the executor of this object to construct the new object.
Referenced by clone().
|
inline |
Creates a new "default" object of the same dynamic type as this object.
This is the polymorphic equivalent of the executor default constructor decltype(*this)(exec);
.
exec | the executor where the object will be created |
|
inlinenoexcept |
Returns the Executor of the object.
Referenced by gko::LinOp::apply(), gko::preconditioner::Ic< LSolverType, IndexType >::conj_transpose(), gko::preconditioner::Ilu< LSolverType, USolverType, ReverseApply, IndexType >::conj_transpose(), gko::preconditioner::Ic< LSolverType, IndexType >::Ic(), gko::preconditioner::Ilu< LSolverType, USolverType, ReverseApply, IndexType >::Ilu(), gko::matrix::Csr< ValueType, IndexType >::inv_scale(), gko::preconditioner::Ic< LSolverType, IndexType >::operator=(), gko::preconditioner::Ilu< LSolverType, USolverType, ReverseApply, IndexType >::operator=(), gko::matrix::Csr< ValueType, IndexType >::scale(), gko::preconditioner::Ic< LSolverType, IndexType >::transpose(), and gko::preconditioner::Ilu< LSolverType, USolverType, ReverseApply, IndexType >::transpose().
|
inline |
Moves another object into this object.
This is the polymorphic equivalent of the move assignment operator.
other | the object to move from |
References gko::ptr_param< T >::get().