26 template <
class data_type,
int atype>
30 "Unsupported attribute type");
32 (std::string(
"Incompatible data types between ")+
35 (std::string(
"Incompatible data types between ")+
41 (std::string(
"Numbers of components do not match between ")+
44 std::vector<const Pane*> apanes, xpanes, ypanes;
45 std::vector<Pane*> zpanes;
52 (std::string(
"Numbers of panes do not match between ")+
55 (std::string(
"Numbers of panes do not match between ")+
58 std::vector<Pane*>::iterator zit, zend;
59 std::vector<const Pane*>::const_iterator xit, yit;
61 const Pane** ait=NULL;
63 const data_type *aval=NULL;
66 aval =
reinterpret_cast<const data_type *
>( ain);
68 a =
reinterpret_cast<const Attribute*
>(ain);
73 (std::string(
"Numbers of panes do not match between ")+
79 aval =
reinterpret_cast<const data_type *
>( a->
pointer());
88 (std::string(
"Numbers of components do not match between ")+
91 for(zit=zpanes.begin(),zend=zpanes.end(),xit=xpanes.begin(),yit=ypanes.begin();
92 zit != zend; ++zit, ait+=(atype!=
BLAS_VOID&&ait), ++xit, ++yit) {
95 int zstrd=get_stride<BLAS_VEC2D>(pz);
96 const bool zstg = num_dims!=zstrd;
99 int xstrd = get_stride<BLAS_VEC2D>(px);
101 (std::string(
"Numbers of items do not match between ")+
103 " on pane "+
to_str((*zit)->id())).c_str());
104 const bool xstg = num_dims!=xstrd || xstrd==0;
107 int ystrd = get_stride<BLAS_VEC2D>(py);
109 (std::string(
"Numbers of items do not match between ")+
111 " on pane "+
to_str((*zit)->id())).c_str());
113 const bool ystg = num_dims!=ystrd || ystrd==0;
116 int astrd = get_stride<atype>(pa);
117 const bool astg = pa && (anum_dims!=num_dims || anum_dims!=astrd);
120 (std::string(
"Numbers of items do not match between ")+
122 " on pane "+
to_str((*zit)->id())).c_str());
125 if ( !xstg && !zstg && !ystg && !astg && atype !=
BLAS_VEC
126 && (atype !=
BLAS_SCNE || num_dims==1)) {
127 const data_type *xval = (
const data_type *)px->
pointer();
128 const data_type *yval = (
const data_type *)py->
pointer();
129 data_type *zval = (data_type *)pz->
pointer();
133 aval =
reinterpret_cast<const data_type *
>(pa->
pointer());
136 for(
Size i = 0,
s = length*num_dims;
i<
s; ++
i, ++zval, ++xval, ++yval)
137 *zval = getref<data_type,atype,0>(aval,
i,0,1)* *xval+ *yval;
141 for(
int i = 0;
i < num_dims; ++
i) {
142 Attribute *pz_i = num_dims==1?pz:(*zit)->attribute(z->
id()+
i+1);
143 data_type *zval = (data_type *)pz_i->
pointer();
144 zstrd=get_stride<BLAS_VEC2D>(pz_i);
146 const Attribute *px_i = num_dims==1?px:(*xit)->attribute(x->
id()+
i+1);
147 const data_type *xval = (
const data_type *)px_i->
pointer();
148 xstrd=get_stride<BLAS_VEC2D>(px_i);
150 const Attribute *py_i = num_dims==1?py:(*yit)->attribute(y->
id()+
i+1);
151 const data_type *yval = (
const data_type *)py_i->
pointer();
152 ystrd=get_stride<BLAS_VEC2D>(py_i);
155 const Attribute *pa_i=anum_dims==1?pa:(*ait)->attribute(a->
id()+
i+1);
156 aval =
reinterpret_cast<const data_type *
>( pa_i->
pointer());
157 astrd = get_stride<atype>( pa_i);
161 for(
int j=0;
j<
length; ++
j, xval+=xstrd, zval+=zstrd, yval+=ystrd)
162 *zval = getref<data_type,atype,1>(aval,
j,
i,astrd) * *xval + *yval;
178 axpy_gen<int,BLAS_SCALAR>(a,
x,
y,
z);
180 axpy_gen<int,BLAS_VEC>(a,
x,
y,
z);
184 axpy_gen<int,BLAS_SCNE>(a,
x,
y,
z);
186 axpy_gen<int,BLAS_VEC2D>(a,
x,
y,
z);
191 (std::string(
"Unsupported data type in ")+
196 axpy_gen<double,BLAS_SCALAR>(a,
x,
y,
z);
198 axpy_gen<double,BLAS_VEC>(a,
x,
y,
z);
202 axpy_gen<double,BLAS_SCNE>(a,
x,
y,
z);
204 axpy_gen<double,BLAS_VEC2D>(a,
x,
y,
z);
215 axpy_gen<int,BLAS_VOID>(a,
x,
y,
z);
217 axpy_gen<double,BLAS_VOID>(a,
x,
y,
z);
int COM_Type
Indices for derived data types.
A Pane object contains a mesh, pane attribute, and field variables.
An Attribute object is a data member of a window.
void int int REAL REAL * y
#define COM_assertion_msg(EX, msg)
bool is_windowed() const
Checks whether the attribute is associated with the window.
const std::string & name() const
Obtain the window's name.
const Window * window() const
Obtain a constant pointer to the parent window of the attribute.
double length(Vector3D *const v, int n)
static void axpy(const Attribute *a, const Attribute *x, const Attribute *y, Attribute *z)
Operation wrapper for z = a * x + y.
const void * pointer() const
Obtain a constant pointer to the physical address.
void int int int REAL REAL REAL * z
static void axpy_scalar(const void *a, const Attribute *x, const Attribute *y, Attribute *z)
Operation wrapper for z = a * x + y (a is a scalar pointer).
int COM_compatible_types(COM_Type type1, COM_Type type2)
Definition for Rocblas API.
static std::string to_str(int i)
static void axpy_gen(const void *a, const Attribute *x, const Attribute *y, Attribute *z)
Performs the operation: z = a*x + y.
COM_Type data_type() const
Obtain the data type of each component of the attribute.
int id() const
Obtain the id (or index) of the attribute.
void panes(std::vector< int > &ps, int rank=-2)
Obtain all the local panes of the window.
int size_of_items() const
Obtain the number of items in the attribute.
std::string fullname() const
Obtain the full name of the attribute including window name suitable for printing out error messages...
int size_of_components() const
Obtain the number of components in the attribute.