|
template<class from_ContainerType , class ContainerType , class ... Params> |
void | dg::assign (const from_ContainerType &from, ContainerType &to, Params &&... ps) |
| Generic way to assign the contents of a from_ContainerType object to a ContainerType object optionally given additional parameters. More...
|
|
template<class ContainerType , class from_ContainerType , class ... Params> |
ContainerType | dg::construct (const from_ContainerType &from, Params &&... ps) |
| Generic way to construct an object of ContainerType given a from_ContainerType object and optional additional parameters. More...
|
|
template<class MatrixType , class ContainerType1 , class ContainerType2 > |
void | dg::apply (get_value_type< ContainerType1 > alpha, MatrixType &&M, const ContainerType1 &x, get_value_type< ContainerType1 > beta, ContainerType2 &y) |
| \( y = \alpha M(x) + \beta y \); (alias for dg::blas2::symv ) More...
|
|
template<class MatrixType , class ContainerType1 , class ContainerType2 > |
void | dg::apply (MatrixType &&M, const ContainerType1 &x, ContainerType2 &y) |
| \( y = M( x)\); (alias for dg::blas2::symv ) More...
|
|
template<class from_ContainerType , class ContainerType , class ... Params>
void dg::assign |
( |
const from_ContainerType & |
from, |
|
|
ContainerType & |
to, |
|
|
Params &&... |
ps |
|
) |
| |
|
inline |
Generic way to assign the contents of a from_ContainerType
object to a ContainerType
object optionally given additional parameters.
The idea of this function is to convert between types with the same data layout but different execution policies (e.g. from a thrust::host_vector to a thrust::device_vector). If the layout differs, additional parameters can be used to achieve what you want.
For example
std::vector<dg::DVec> device_vec(3);
void assign(const from_ContainerType &from, ContainerType &to, Params &&... ps)
Generic way to assign the contents of a from_ContainerType object to a ContainerType object optionall...
Definition: blas1.h:665
thrust::host_vector< double > HVec
Host Vector.
Definition: typedefs.h:19
thrust::device_vector< double > DVec
Device Vector. The device can be an OpenMP parallelized cpu or a gpu. This depends on the value of th...
Definition: typedefs.h:23
- Parameters
-
from | source vector |
to | target vector contains a copy of from on output (memory is automatically resized if necessary) |
ps | additional parameters usable for the transfer operation |
- Note
- it is possible to assign a
from_ContainerType
to a std::array<ContainerType, N>
(all elements are initialized with from_ContainerType) and also a std::vector<ContainerType>
( the desired size of the std::vector
must be provided as an additional parameter)
- Template Parameters
-
from_ContainerType | must have the same data policy derived from AnyVectorTag as ContainerType (with the exception of std::array and std::vector ) but can have different execution policy |
Params | in some cases additional parameters that are necessary to assign objects of Type ContainerType |
ContainerType | Any class for which a specialization of TensorTraits exists and which fulfills the requirements of the there defined data and execution policies derived from AnyVectorTag and AnyPolicyTag . Among others
dg::HVec (serial), dg::DVec (cuda / omp), dg::MHVec (mpi + serial) or dg::MDVec (mpi + cuda / omp)
std::vector<dg::DVec> (vector of shared device vectors), std::array<double, 4> (array of 4 doubles) or std::map < std::string, dg::DVec> ( a map of named vectors)
double (scalar) and other primitive types ...
If there are several ContainerTypes in the argument list, then TensorTraits must exist for all of them |
- See also
- See The dg dispatch system for a detailed explanation of our type dispatch system
template<class ContainerType , class from_ContainerType , class ... Params>
ContainerType dg::construct |
( |
const from_ContainerType & |
from, |
|
|
Params &&... |
ps |
|
) |
| |
|
inline |
Generic way to construct an object of ContainerType
given a from_ContainerType
object and optional additional parameters.
The idea of this function is to convert between types with the same data layout but different execution policies (e.g. from a thrust::host_vector to a thrust::device_vector) If the layout differs, additional parameters can be used to achieve what you want.
For example
dg::DVec device = dg::construct<dg::DVec>( host );
std::array<dg::DVec, 3> device_arr = dg::construct<std::array<dg::DVec, 3>>( host );
std::vector<dg::DVec> device_vec = dg::construct<std::vector<dg::DVec>>( host, 3);
- Parameters
-
from | source vector |
ps | additional parameters necessary to construct a ContainerType object |
- Returns
from
converted to the new format (memory is allocated accordingly)
- Note
- it is possible to construct a
std::array<ContainerType, N>
(all elements are initialized with from_ContainerType) and also a std::vector<ContainerType>
( the desired size of the std::vector
must be provided as an additional parameter) given a from_ContainerType
- Template Parameters
-
from_ContainerType | must have the same data policy derived from AnyVectorTag as ContainerType (with the exception of std::array and std::vector ) but can have different execution policy |
Params | in some cases additional parameters that are necessary to construct objects of Type ContainerType |
ContainerType | Any class for which a specialization of TensorTraits exists and which fulfills the requirements of the there defined data and execution policies derived from AnyVectorTag and AnyPolicyTag . Among others
dg::HVec (serial), dg::DVec (cuda / omp), dg::MHVec (mpi + serial) or dg::MDVec (mpi + cuda / omp)
std::vector<dg::DVec> (vector of shared device vectors), std::array<double, 4> (array of 4 doubles) or std::map < std::string, dg::DVec> ( a map of named vectors)
double (scalar) and other primitive types ...
If there are several ContainerTypes in the argument list, then TensorTraits must exist for all of them |
- See also
- See The dg dispatch system for a detailed explanation of our type dispatch system