Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Rocblas Class Reference

#include <Rocblas.h>

Classes

struct  acosa
 
struct  assn
 
struct  limit1v
 
struct  maxof
 
struct  maxv
 
struct  minv
 
struct  nega
 
struct  random
 
struct  random< double >
 
struct  sqrta
 
struct  sumv
 
struct  swapp
 

Static Public Member Functions

static void init (const std::string &name)
 Creates window for Rocblas and registers functions. More...
 
static void finalize (const std::string &name)
 Delete window for Rocblas. More...
 
static void add (const Attribute *x, const Attribute *y, Attribute *z)
 Operation wrapper for addition. More...
 
static void sub (const Attribute *x, const Attribute *y, Attribute *z)
 Operation wrapper for subtraction. More...
 
static void mul (const Attribute *x, const Attribute *y, Attribute *z)
 Operation wrapper for multiplication. More...
 
static void limit1 (const Attribute *x, const Attribute *y, Attribute *z)
 Operation wrapper for limit1. More...
 
static void div (const Attribute *x, const Attribute *y, Attribute *z)
 Operation wrapper for division. More...
 
static void add_scalar (const Attribute *x, const void *y, Attribute *z, int swap=0)
 Operation wrapper for addition with y as a scalar pointer. More...
 
static void sub_scalar (const Attribute *x, const void *y, Attribute *z, int swap=0)
 Operation wrapper for subtraction with y as a scalar pointer. More...
 
static void mul_scalar (const Attribute *x, const void *y, Attribute *z, int swap=0)
 Operation wrapper for multiplication with y as a scalar pointer. More...
 
static void div_scalar (const Attribute *x, const void *y, Attribute *z, int swap=0)
 Operation wrapper for division with y as a scalar pointer. More...
 
static void maxof_scalar (const Attribute *x, const void *y, Attribute *z, int swap=0)
 Operation wrapper for addition with y as a scalar pointer. More...
 
static void dot (const Attribute *x, const Attribute *y, Attribute *z, const Attribute *mults=NULL)
 Wrapper for dot product. More...
 
static void dot_scalar (const Attribute *x, const Attribute *y, void *z, const Attribute *mults=NULL)
 Wrapper for 2-norm with z as a scalar pointer. More...
 
static void dot_MPI (const Attribute *x, const Attribute *y, Attribute *z, const MPI_Comm *comm=NULL, const Attribute *mults=NULL)
 Wrapper for dot product. More...
 
static void dot_scalar_MPI (const Attribute *x, const Attribute *y, void *z, const MPI_Comm *comm=NULL, const Attribute *mults=NULL)
 Wrapper for 2-norm with z as a scalar pointer. More...
 
static void nrm2 (const Attribute *x, Attribute *y, const Attribute *mults=NULL)
 Wrapper for 2-norm. More...
 
static void nrm2_scalar (const Attribute *x, void *y, const Attribute *mults=NULL)
 Wrapper for 2-norm with y as a scalar pointer. More...
 
static void nrm2_MPI (const Attribute *x, Attribute *y, const MPI_Comm *comm=NULL, const Attribute *mults=NULL)
 Wrapper for 2-norm with MPI. More...
 
static void nrm2_scalar_MPI (const Attribute *x, void *y, const MPI_Comm *comm, const Attribute *mults=NULL)
 Wrapper for 2-norm with y as a scalar pointer with MPI. More...
 
static void swap (Attribute *x, Attribute *y)
 Wrapper for swap. More...
 
static void copy (const Attribute *x, Attribute *y)
 Wrapper for copy. More...
 
static void rand (const Attribute *a, Attribute *z)
 Generate a random number between 0 and $a$ for each entry in z. More...
 
static void copy_scalar (const void *x, Attribute *y)
 Operation wrapper for copy (x is a scalar pointer). More...
 
static void rand_scalar (const void *a, Attribute *z)
 Generate a random number between 0 and $a$ for each entry in z. More...
 
static void neg (const Attribute *x, Attribute *y)
 Wrapper for neg (y=-x). More...
 
static void sqrt (const Attribute *x, Attribute *y)
 Wrapper for sqrt (y=sqrt(x)). More...
 
static void acos (const Attribute *x, Attribute *y)
 Wrapper for acos (y=acos(x)). More...
 
static void max_MPI (const Attribute *x, Attribute *y, const MPI_Comm *comm=NULL)
 Wrapper for max. More...
 
static void max_scalar_MPI (const Attribute *x, void *y, const MPI_Comm *comm=NULL)
 Operation wrapper for max (y is a scalar pointer). More...
 
static void min_MPI (const Attribute *x, Attribute *y, const MPI_Comm *comm=NULL)
 Wrapper for min. More...
 
static void min_scalar_MPI (const Attribute *x, void *y, const MPI_Comm *comm=NULL)
 Operation wrapper for min (y is a scalar pointer). More...
 
static void sum_MPI (const Attribute *x, Attribute *y, const MPI_Comm *comm=NULL)
 Wrapper for sum. More...
 
static void sum_scalar_MPI (const Attribute *x, void *y, const MPI_Comm *comm=NULL)
 Operation wrapper for sum (y is a scalar pointer). More...
 
static void axpy (const Attribute *a, const Attribute *x, const Attribute *y, Attribute *z)
 Operation wrapper for z = a * x + y. More...
 
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). More...
 

Protected Types

enum  {
  BLAS_VOID, BLAS_SCALAR, BLAS_VEC, BLAS_SCNE,
  BLAS_VEC2D
}
 

Static Protected Member Functions

template<class FuncType , int ytype>
static void calc (Attribute *z, const Attribute *x, const void *yin, FuncType opp, bool swap=false)
 Performs the operation: z = x op y. More...
 
template<class data_type , int ztype>
static void calcDot (void *zout, const Attribute *x, const Attribute *y, const MPI_Comm *comm=NULL, const Attribute *mults=NULL)
 Performs the operation: z = <x, y> More...
 
template<class FuncType , int ytype>
static void gen2arg (Attribute *z, void *yin, FuncType opp)
 Performs the operation opp(x, y) More...
 
template<class data_type , int atype>
static void axpy_gen (const void *a, const Attribute *x, const Attribute *y, Attribute *z)
 Performs the operation: z = a*x + y. More...
 
template<class FuncType >
static void calcChoose (const Attribute *x, const Attribute *y, Attribute *z, FuncType opp)
 Chooses which calc function to call based on type of y. More...
 
template<class Op >
static void copy_helper (const Attribute *x, Attribute *z)
 
template<int attr_type>
static int get_stride (const Attribute *attr)
 
template<class data_type , int attr_type, bool is_staggered>
static data_type & getref (data_type *base, const int r, const int c, const int nc)
 
template<class data_type , int attr_type, bool is_staggered>
static const data_type & getref (const data_type *base, const int r, const int c, const int nc)
 
template<class OPint , class OPdbl , int OPMPI>
static void reduce_MPI (const Attribute *x, Attribute *z, const MPI_Comm *comm, int, double)
 
template<class OPint , class OPdbl , int OPMPI>
static void reduce_scalar_MPI (const Attribute *x, void *y, const MPI_Comm *comm, int, double)
 
static std::string to_str (int i)
 

Private Types

typedef unsigned int Size
 

Detailed Description

Definition at line 37 of file Rocblas.h.

Member Typedef Documentation

typedef unsigned int Size
private

Definition at line 38 of file Rocblas.h.

Member Enumeration Documentation

anonymous enum
protected
Enumerator
BLAS_VOID 
BLAS_SCALAR 
BLAS_VEC 
BLAS_SCNE 
BLAS_VEC2D 

Definition at line 259 of file Rocblas.h.

Member Function Documentation

void acos ( const Attribute x,
Attribute y 
)
static

Wrapper for acos (y=acos(x)).

Definition at line 545 of file op2args.C.

References BLAS_SCALAR, BLAS_SCNE, BLAS_VEC, BLAS_VEC2D, COM_assertion_msg, COM_DOUBLE, COM_DOUBLE_PRECISION, COM_INT, COM_INTEGER, Attribute::data_type(), Attribute::fullname(), Attribute::is_windowed(), Attribute::size_of_components(), x, and z.

Referenced by init().

545  {
546  COM_Type att_type = x->data_type();
547  const int xncomp = x->size_of_components();
548 
549  if ( att_type == COM_INT || att_type == COM_INTEGER) {
550  if ( x->is_windowed()) {
551  if ( xncomp == 1)
552  gen2arg<acosa<int>,BLAS_SCALAR>(z, const_cast<Attribute*>(x), acosa<int>());
553  else
554  gen2arg<acosa<int>,BLAS_VEC>(z, const_cast<Attribute*>(x), acosa<int>());
555  }
556  else {
557  if ( xncomp == 1)
558  gen2arg<acosa<int>,BLAS_SCNE>(z, const_cast<Attribute*>(x), acosa<int>());
559  else
560  gen2arg<acosa<int>,BLAS_VEC2D>(z, const_cast<Attribute*>(x), acosa<int>());
561  }
562  }
563  else {
564  COM_assertion_msg( att_type==COM_DOUBLE || att_type==COM_DOUBLE_PRECISION,
565  (std::string("Unsupported data type in ")+
566  x->fullname()).c_str());
567  if ( x->is_windowed()) {
568  if ( xncomp == 1)
569  gen2arg<acosa<double>,BLAS_SCALAR>(z, const_cast<Attribute*>(x), acosa<double>());
570  else
571  gen2arg<acosa<double>,BLAS_VEC>(z, const_cast<Attribute*>(x), acosa<double>());
572  }
573  else {
574  if ( xncomp == 1)
575  gen2arg<acosa<double>,BLAS_SCNE>(z, const_cast<Attribute*>(x), acosa<double>());
576  else
577  gen2arg<acosa<double>,BLAS_VEC2D>(z, const_cast<Attribute*>(x), acosa<double>());
578  }
579  }
580 }
int COM_Type
Indices for derived data types.
Definition: roccom_basic.h:122
An Attribute object is a data member of a window.
Definition: Attribute.h:51
#define COM_assertion_msg(EX, msg)
bool is_windowed() const
Checks whether the attribute is associated with the window.
Definition: Attribute.h:188
void int int int REAL REAL REAL * z
Definition: write.cpp:76
void int int REAL * x
Definition: read.cpp:74
COM_Type data_type() const
Obtain the data type of each component of the attribute.
Definition: Attribute.h:197
std::string fullname() const
Obtain the full name of the attribute including window name suitable for printing out error messages...
Definition: Attribute.C:82
int size_of_components() const
Obtain the number of components in the attribute.
Definition: Attribute.h:203

Here is the call graph for this function:

Here is the caller graph for this function:

void add ( const Attribute x,
const Attribute y,
Attribute z 
)
static

Operation wrapper for addition.

Definition at line 221 of file op3args.C.

References calcChoose(), COM_assertion_msg, COM_DOUBLE, COM_DOUBLE_PRECISION, COM_INT, COM_INTEGER, Attribute::data_type(), and Attribute::fullname().

Referenced by FaceOffset_3::balance_mass(), update_py::burn_get_burning_rate1d(), init(), Window_manifold_2::perturb_mesh(), Rocprop::propagate(), FaceOffset_3::rescale_displacements(), and FaceOffset_3::time_stepping().

222 {
223  COM_Type att_type = z->data_type();
224 
225  if(att_type == COM_INT || att_type == COM_INTEGER)
226  calcChoose(x, y, z, std::plus<int>());
227  else {
228  COM_assertion_msg(att_type == COM_DOUBLE||att_type == COM_DOUBLE_PRECISION,
229  (std::string("Unsupported data type in ")+
230  z->fullname()).c_str());
231 
232  calcChoose(x, y, z, std::plus<double>());
233  }
234 }
int COM_Type
Indices for derived data types.
Definition: roccom_basic.h:122
#define COM_assertion_msg(EX, msg)
static void calcChoose(const Attribute *x, const Attribute *y, Attribute *z, FuncType opp)
Chooses which calc function to call based on type of y.
Definition: op3args.C:192
COM_Type data_type() const
Obtain the data type of each component of the attribute.
Definition: Attribute.h:197
std::string fullname() const
Obtain the full name of the attribute including window name suitable for printing out error messages...
Definition: Attribute.C:82

Here is the call graph for this function:

Here is the caller graph for this function:

void add_scalar ( const Attribute x,
const void *  y,
Attribute z,
int  swap = 0 
)
static

Operation wrapper for addition with y as a scalar pointer.

Definition at line 299 of file op3args.C.

References BLAS_VOID, COM_assertion_msg, COM_DOUBLE, COM_DOUBLE_PRECISION, COM_INT, COM_INTEGER, Attribute::data_type(), x, y, and z.

Referenced by init(), and rescale_object().

301 {
302  COM_Type att_type = z->data_type();
303 
304  if(att_type == COM_INT || att_type == COM_INTEGER)
305  calc<std::plus<int>,BLAS_VOID>(z, x, y, std::plus<int>(), swap);
306  else {
307  COM_assertion_msg(att_type == COM_DOUBLE||att_type == COM_DOUBLE_PRECISION,
308  (std::string("Unsupported data type in ")+
309  z->fullname()).c_str());
310  calc<std::plus<double>,BLAS_VOID>(z, x, y, std::plus<double>(), swap);
311  }
312 }
int COM_Type
Indices for derived data types.
Definition: roccom_basic.h:122
void int int REAL REAL * y
Definition: read.cpp:74
#define COM_assertion_msg(EX, msg)
void int int int REAL REAL REAL * z
Definition: write.cpp:76
void int int REAL * x
Definition: read.cpp:74
static void swap(Attribute *x, Attribute *y)
Wrapper for swap.
Definition: op2args.C:271
COM_Type data_type() const
Obtain the data type of each component of the attribute.
Definition: Attribute.h:197
std::string fullname() const
Obtain the full name of the attribute including window name suitable for printing out error messages...
Definition: Attribute.C:82

Here is the call graph for this function:

Here is the caller graph for this function:

void axpy ( const Attribute a,
const Attribute x,
const Attribute y,
Attribute z 
)
static

Operation wrapper for z = a * x + y.

Definition at line 170 of file axpy.C.

References COM_assertion_msg, COM_DOUBLE, COM_DOUBLE_PRECISION, COM_INT, COM_INTEGER, Attribute::data_type(), Attribute::fullname(), Attribute::is_windowed(), Attribute::size_of_components(), x, y, and z.

Referenced by init().

171  {
172  COM_Type att_type = z->data_type();
173  const int ancomp = a->size_of_components();
174 
175  if(att_type == COM_INT || att_type == COM_INTEGER) {
176  if ( a->is_windowed()) {
177  if ( ancomp == 1)
178  axpy_gen<int,BLAS_SCALAR>(a, x, y, z);
179  else
180  axpy_gen<int,BLAS_VEC>(a, x, y, z);
181  }
182  else {
183  if ( ancomp == 1)
184  axpy_gen<int,BLAS_SCNE>(a, x, y, z);
185  else
186  axpy_gen<int,BLAS_VEC2D>(a, x, y, z);
187  }
188  }
189  else {
190  COM_assertion_msg( att_type==COM_DOUBLE || att_type==COM_DOUBLE_PRECISION,
191  (std::string("Unsupported data type in ")+
192  z->fullname()).c_str());
193 
194  if ( a->is_windowed()) {
195  if ( ancomp == 1)
196  axpy_gen<double,BLAS_SCALAR>(a, x, y, z);
197  else
198  axpy_gen<double,BLAS_VEC>(a, x, y, z);
199  }
200  else {
201  if ( ancomp == 1)
202  axpy_gen<double,BLAS_SCNE>(a, x, y, z);
203  else
204  axpy_gen<double,BLAS_VEC2D>(a, x, y, z);
205  }
206  }
207 }
int COM_Type
Indices for derived data types.
Definition: roccom_basic.h:122
void int int REAL REAL * y
Definition: read.cpp:74
#define COM_assertion_msg(EX, msg)
bool is_windowed() const
Checks whether the attribute is associated with the window.
Definition: Attribute.h:188
void int int int REAL REAL REAL * z
Definition: write.cpp:76
void int int REAL * x
Definition: read.cpp:74
COM_Type data_type() const
Obtain the data type of each component of the attribute.
Definition: Attribute.h:197
std::string fullname() const
Obtain the full name of the attribute including window name suitable for printing out error messages...
Definition: Attribute.C:82
int size_of_components() const
Obtain the number of components in the attribute.
Definition: Attribute.h:203

Here is the call graph for this function:

Here is the caller graph for this function:

void axpy_gen ( const void *  a,
const Attribute x,
const Attribute y,
Attribute z 
)
staticprotected

Performs the operation: z = a*x + y.

Definition at line 27 of file axpy.C.

References BLAS_SCNE, BLAS_VEC, BLAS_VEC2D, BLAS_VOID, COM_assertion_msg, COM_compatible_types(), Attribute::data_type(), Attribute::fullname(), i, Attribute::id(), Attribute::is_windowed(), j, Mesquite::length(), Window::name(), Window::panes(), Attribute::pointer(), s, Attribute::size_of_components(), Attribute::size_of_items(), to_str(), and Attribute::window().

28  {
29  COM_assertion_msg(!x->is_windowed() && !y->is_windowed() && !z->is_windowed(),
30  "Unsupported attribute type");
32  (std::string("Incompatible data types between ")+
33  x->fullname()+" and "+y->fullname()).c_str());
35  (std::string("Incompatible data types between ")+
36  x->fullname()+" and "+z->fullname()).c_str());
37 
38  int num_dims = z->size_of_components();
39  COM_assertion_msg(num_dims == x->size_of_components() &&
40  num_dims == y->size_of_components(),
41  (std::string("Numbers of components do not match between ")+
42  x->fullname()+" and "+y->fullname()).c_str());
43 
44  std::vector<const Pane*> apanes, xpanes, ypanes;
45  std::vector<Pane*> zpanes;
46 
47  x->window()->panes(xpanes);
48  y->window()->panes(ypanes);
49  z->window()->panes(zpanes);
50 
51  COM_assertion_msg( xpanes.size() == ypanes.size(),
52  (std::string("Numbers of panes do not match between ")+
53  x->window()->name()+" and "+y->window()->name()).c_str());
54  COM_assertion_msg( xpanes.size() == zpanes.size(),
55  (std::string("Numbers of panes do not match between ")+
56  x->window()->name()+" and "+z->window()->name()).c_str());
57 
58  std::vector<Pane*>::iterator zit, zend;
59  std::vector<const Pane*>::const_iterator xit, yit;
60 
61  const Pane** ait=NULL;
62  const Attribute *a=NULL;
63  const data_type *aval=NULL;
64 
65  if ( atype == BLAS_VOID)
66  aval = reinterpret_cast<const data_type *>( ain);
67  else {
68  a = reinterpret_cast<const Attribute*>(ain);
69 
70  if ( !a->is_windowed()) {
71  a->window()->panes( apanes);
72  COM_assertion_msg(xpanes.size() == ypanes.size(),
73  (std::string("Numbers of panes do not match between ")+
74  x->window()->name()+" and "+y->window()->name()).c_str());
75  ait = &apanes[0];
76  }
77  else {
78  COM_assertion_msg( a->size_of_items()==1, "Size of items do not match");
79  aval = reinterpret_cast<const data_type *>( a->pointer());
80 
81  COM_assertion_msg( aval, (std::string("Caught NULL pointer in ")+
82  a->fullname()).c_str());
83  }
84  }
85 
86  const int anum_dims = atype!=BLAS_VOID ? a->size_of_components() : 0;
87  COM_assertion_msg( atype==BLAS_VOID || (anum_dims==1 || anum_dims==num_dims),
88  (std::string("Numbers of components do not match between ")+
89  a->fullname()+" and "+z->fullname()).c_str());
90 
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) {
93  Attribute *pz = (*zit)->attribute(z->id());
94  const int length = pz->size_of_items();
95  int zstrd=get_stride<BLAS_VEC2D>(pz);
96  const bool zstg = num_dims!=zstrd;
97 
98  const Attribute *px = (*xit)->attribute(x->id());
99  int xstrd = get_stride<BLAS_VEC2D>(px);
100  COM_assertion_msg(length == px->size_of_items() || xstrd==0,
101  (std::string("Numbers of items do not match between ")+
102  x->fullname()+" and "+z->fullname()+
103  " on pane "+to_str((*zit)->id())).c_str());
104  const bool xstg = num_dims!=xstrd || xstrd==0;
105 
106  const Attribute *py = (*yit)->attribute(y->id());
107  int ystrd = get_stride<BLAS_VEC2D>(py);
108  COM_assertion_msg(length == py->size_of_items() || ystrd==0,
109  (std::string("Numbers of items do not match between ")+
110  y->fullname()+" and "+z->fullname()+
111  " on pane "+to_str((*zit)->id())).c_str());
112 
113  const bool ystg = num_dims!=ystrd || ystrd==0;
114 
115  const Attribute *pa = (atype!=BLAS_VOID&&ait)?(*ait)->attribute(a->id()):a;
116  int astrd = get_stride<atype>(pa);
117  const bool astg = pa && (anum_dims!=num_dims || anum_dims!=astrd);
118  COM_assertion_msg( atype!=BLAS_SCNE && atype!=BLAS_VEC2D ||
119  length == int(pa->size_of_items()) || astrd==0,
120  (std::string("Numbers of items do not match between ")+
121  a->fullname()+" and "+z->fullname()+
122  " on pane "+to_str((*zit)->id())).c_str());
123 
124  // Optimized version for contiguous attributes
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();
130 
131  // Get address for a if a is not window attribute
132  if ( atype != BLAS_VOID && ait)
133  aval = reinterpret_cast<const data_type *>(pa->pointer());
134 
135  //Loop for each element/node and for each dimension
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;
138  }
139  else { // General version
140  //Loop for each dimension.
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);
145 
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);
149 
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);
153 
154  if ( atype != BLAS_VOID && ait) {
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);
158  }
159 
160  //Loop for each element/node.
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;
163  }
164  } // end if
165  } // end for
166 }
A Pane object contains a mesh, pane attribute, and field variables.
Definition: Pane.h:43
An Attribute object is a data member of a window.
Definition: Attribute.h:51
#define COM_assertion_msg(EX, msg)
double s
Definition: blastest.C:80
bool is_windowed() const
Checks whether the attribute is associated with the window.
Definition: Attribute.h:188
const std::string & name() const
Obtain the window&#39;s name.
Definition: Window.h:92
const Window * window() const
Obtain a constant pointer to the parent window of the attribute.
Definition: Attribute.C:80
double length(Vector3D *const v, int n)
const void * pointer() const
Obtain a constant pointer to the physical address.
Definition: Attribute.h:150
int COM_compatible_types(COM_Type type1, COM_Type type2)
Definition: roccom_c++.h:563
blockLoc i
Definition: read.cpp:79
static std::string to_str(int i)
Definition: Rocblas.h:283
unsigned int Size
Definition: Rocblas.h:38
j indices j
Definition: Indexing.h:6
COM_Type data_type() const
Obtain the data type of each component of the attribute.
Definition: Attribute.h:197
int id() const
Obtain the id (or index) of the attribute.
Definition: Attribute.h:120
void panes(std::vector< int > &ps, int rank=-2)
Obtain all the local panes of the window.
Definition: Window.C:809
int size_of_items() const
Obtain the number of items in the attribute.
Definition: Attribute.C:111
std::string fullname() const
Obtain the full name of the attribute including window name suitable for printing out error messages...
Definition: Attribute.C:82
int size_of_components() const
Obtain the number of components in the attribute.
Definition: Attribute.h:203

Here is the call graph for this function:

void axpy_scalar ( const void *  a,
const Attribute x,
const Attribute y,
Attribute z 
)
static

Operation wrapper for z = a * x + y (a is a scalar pointer).

Definition at line 210 of file axpy.C.

References COM_DOUBLE, COM_DOUBLE_PRECISION, COM_INT, COM_INTEGER, Attribute::data_type(), x, y, and z.

Referenced by init().

211  {
212  COM_Type att_type = z->data_type();
213 
214  if(att_type == COM_INT || att_type == COM_INTEGER)
215  axpy_gen<int,BLAS_VOID>(a, x, y, z);
216  else if (att_type == COM_DOUBLE || att_type == COM_DOUBLE_PRECISION)
217  axpy_gen<double,BLAS_VOID>(a, x, y, z);
218 }
int COM_Type
Indices for derived data types.
Definition: roccom_basic.h:122
void int int REAL REAL * y
Definition: read.cpp:74
void int int int REAL REAL REAL * z
Definition: write.cpp:76
void int int REAL * x
Definition: read.cpp:74
COM_Type data_type() const
Obtain the data type of each component of the attribute.
Definition: Attribute.h:197

Here is the call graph for this function:

Here is the caller graph for this function:

void calc ( Attribute z,
const Attribute x,
const void *  yin,
FuncType  opp,
bool  swap = false 
)
staticprotected

Performs the operation: z = x op y.

Definition at line 49 of file op3args.C.

References BLAS_SCNE, BLAS_VEC, BLAS_VEC2D, BLAS_VOID, COM_assertion_msg, COM_compatible_types(), Attribute::data_type(), Attribute::fullname(), i, Attribute::id(), Attribute::is_windowed(), j, Mesquite::length(), Window::name(), Window::panes(), Attribute::pointer(), s, Attribute::size_of_components(), Attribute::size_of_items(), to_str(), Attribute::window(), and y.

51 {
52  typedef typename FuncType::result_type data_type;
53 
55  (std::string("Unsupported data type in ")+
56  x->fullname()).c_str());
58  (std::string("Incompatible data types between ")+
59  x->fullname()+" and "+z->fullname()).c_str());
60 
61  int num_dims = z->size_of_components();
62  COM_assertion_msg( num_dims == x->size_of_components(),
63  (std::string("Numbers of components do not match between ")+
64  x->fullname()+" and "+z->fullname()).c_str());
65 
66  std::vector<Pane*> zpanes;
67  std::vector<const Pane*> xpanes, ypanes;
68 
69  z->window()->panes(zpanes);
70  x->window()->panes(xpanes);
71 
72  COM_assertion_msg( xpanes.size() == zpanes.size(),
73  (std::string("Numbers of panes do not match between ")+
74  x->window()->name()+" and "+z->window()->name()).c_str());
75 
76  std::vector<Pane*>::iterator zit, zend;
77  std::vector<const Pane*>::const_iterator xit;
78  const Pane **yit=NULL;
79 
80  const Attribute *y=NULL;
81  const data_type *yval=NULL;
82 
83  // Obtain yval for BLAS_VOID or window attributes
84  if ( ytype==BLAS_VOID)
85  yval = reinterpret_cast<const data_type *>( yin);
86  else {
87  y = reinterpret_cast<const Attribute *>(yin);
88 
89  if ( !y->is_windowed()) {
90  y->window()->panes(ypanes);
91  COM_assertion_msg(xpanes.size() == ypanes.size(),
92  (std::string("Numbers of panes do not match between ")+
93  x->window()->name()+" and "+
94  y->window()->name()).c_str());
95  yit = &ypanes[0];
96  }
97  else {
99  (std::string("Numbers of items do not match between ")+
100  x->fullname()+" and "+y->fullname()).c_str());
101 
102  yval = reinterpret_cast<const data_type *>( y->pointer());
103 
104  COM_assertion_msg( yval, (std::string("Caught NULL pointer in ")+
105  y->fullname()).c_str());
106  }
107  }
108 
109  const int ynum_dims = ytype!=BLAS_VOID ? y->size_of_components() : 0;
110  COM_assertion_msg( ytype==BLAS_VOID || (ynum_dims==1 || ynum_dims==num_dims),
111  (std::string("Numbers of components do not match between ")+
112  z->fullname()+" and "+y->fullname()).c_str());
113 
114  for( zit=zpanes.begin(), zend=zpanes.end(), xit=xpanes.begin(); zit!=zend;
115  ++zit, ++xit, yit+=( ytype!=BLAS_VOID && yit!=NULL)) {
116  Attribute *pz = (*zit)->attribute(z->id());
117  const int length = pz->size_of_items();
118  int zstrd=get_stride<BLAS_VEC2D>(pz);
119  const bool zstg = num_dims!=zstrd;
120 
121  const Attribute *px = (*xit)->attribute(x->id());
122  int xstrd = get_stride<BLAS_VEC2D>(px);
123  COM_assertion_msg(length == px->size_of_items() || xstrd==0,
124  (std::string("Numbers of items do not match between ")+
125  x->fullname()+" and "+z->fullname()+
126  " on pane "+to_str((*zit)->id())).c_str());
127 
128  const bool xstg = num_dims!=xstrd || xstrd==0;
129 
130  const Attribute *py = (ytype!=BLAS_VOID&&yit)?(*yit)->attribute(y->id()):y;
131  int ystrd = get_stride<ytype>(py);
132  COM_assertion_msg( ytype!=BLAS_SCNE && ytype!=BLAS_VEC2D ||
133  (length == int(py->size_of_items()) || ystrd==0),
134  (std::string("Numbers of items do not match between ")+
135  y->fullname()+" and "+z->fullname()+
136  " on pane "+to_str((*zit)->id())).c_str());
137 
138  const bool ystg = py && (ynum_dims!=num_dims || ynum_dims!=ystrd);
139 
140  // Optimized version for contiguous attributes
141  if ( !xstg && !zstg && !ystg && ytype != BLAS_VEC
142  && (ytype != BLAS_SCNE || num_dims==1)) {
143  const data_type *xval = (const data_type *)px->pointer();
144  data_type *zval = (data_type *)pz->pointer();
145 
146  // Get address for y if y is not window attribute
147  if ( ytype != BLAS_VOID && yit)
148  yval = reinterpret_cast<const data_type *>(py->pointer());
149 
150  //Loop for each element/node and for each dimension
151  if ( swap == false)
152  for(Size i = 0, s = length*num_dims; i<s; ++i, ++zval, ++xval)
153  *zval = opp( *xval, getref<data_type,ytype,0>(yval,i,0,1));
154  else
155  for(Size i = 0, s = length*num_dims; i<s; ++i, ++zval, ++xval)
156  *zval = opp( getref<data_type,ytype,0>(yval,i,0,1), *xval);
157  }
158  else { // General version
159  //Loop for each dimension.
160  for(int i = 0; i < num_dims; ++i) {
161  Attribute *pz_i = num_dims==1?pz:(*zit)->attribute(z->id()+i+1);
162  data_type *zval = (data_type *)pz_i->pointer();
163  zstrd=get_stride<BLAS_VEC2D>(pz_i);
164 
165  const Attribute *px_i = num_dims==1?px:(*xit)->attribute(x->id()+i+1);
166  const data_type *xval = (const data_type *)px_i->pointer();
167  xstrd=get_stride<BLAS_VEC2D>(px_i);
168 
169  if ( ytype != BLAS_VOID && yit) {
170  const Attribute *py_i=ynum_dims==1?py:(*yit)->attribute(y->id()+i+1);
171  yval = reinterpret_cast<const data_type *>( py_i->pointer());
172  ystrd = get_stride<ytype>( py_i);
173  }
174 
175  // Loop for each element/node.
176  if ( swap == false) {
177  for(int j = 0; j < length; ++j, zval+=zstrd, xval+=xstrd)
178  *zval = opp( *xval, getref<data_type,ytype,1>(yval,j,i,ystrd));
179  }
180  else {
181  for(int j = 0; j < length; ++j, zval+=zstrd, xval+=xstrd)
182  *zval = opp( getref<data_type,ytype,1>(yval,j,i,ystrd), *xval);
183  }
184  } // end for i
185  } // end if
186  } // end for
187 }
A Pane object contains a mesh, pane attribute, and field variables.
Definition: Pane.h:43
An Attribute object is a data member of a window.
Definition: Attribute.h:51
void int int REAL REAL * y
Definition: read.cpp:74
#define COM_assertion_msg(EX, msg)
double s
Definition: blastest.C:80
bool is_windowed() const
Checks whether the attribute is associated with the window.
Definition: Attribute.h:188
const std::string & name() const
Obtain the window&#39;s name.
Definition: Window.h:92
const Window * window() const
Obtain a constant pointer to the parent window of the attribute.
Definition: Attribute.C:80
double length(Vector3D *const v, int n)
const void * pointer() const
Obtain a constant pointer to the physical address.
Definition: Attribute.h:150
int COM_compatible_types(COM_Type type1, COM_Type type2)
Definition: roccom_c++.h:563
blockLoc i
Definition: read.cpp:79
static std::string to_str(int i)
Definition: Rocblas.h:283
unsigned int Size
Definition: Rocblas.h:38
j indices j
Definition: Indexing.h:6
static void swap(Attribute *x, Attribute *y)
Wrapper for swap.
Definition: op2args.C:271
COM_Type data_type() const
Obtain the data type of each component of the attribute.
Definition: Attribute.h:197
int id() const
Obtain the id (or index) of the attribute.
Definition: Attribute.h:120
void panes(std::vector< int > &ps, int rank=-2)
Obtain all the local panes of the window.
Definition: Window.C:809
int size_of_items() const
Obtain the number of items in the attribute.
Definition: Attribute.C:111
std::string fullname() const
Obtain the full name of the attribute including window name suitable for printing out error messages...
Definition: Attribute.C:82
int size_of_components() const
Obtain the number of components in the attribute.
Definition: Attribute.h:203

Here is the call graph for this function:

void calcChoose ( const Attribute x,
const Attribute y,
Attribute z,
FuncType  opp 
)
staticprotected

Chooses which calc function to call based on type of y.

Definition at line 192 of file op3args.C.

References Attribute::is_windowed(), Attribute::size_of_components(), x, y, and z.

Referenced by add(), div(), limit1(), mul(), and sub().

194 {
195  typedef typename FuncType::result_type data_type;
196 
197  if (x->is_windowed()) {
198  if ( x->size_of_components() == 1)
199  calc<FuncType,BLAS_SCALAR>(z, y, x, opp, true);
200  else
201  calc<FuncType,BLAS_VEC>(z, y, x, opp, true);
202  }
203  else if (y->is_windowed()) {
204  if ( y->size_of_components() == 1)
205  calc<FuncType,BLAS_SCALAR>(z, x, y, opp, false);
206  else
207  calc<FuncType,BLAS_VEC>(z, x, y, opp, false);
208  }
209  else if ( x->size_of_components()<y->size_of_components()) {
210  calc<FuncType,BLAS_SCNE>(z, y, x, opp, true);
211  }
212  else {
213  if ( y->size_of_components() == 1)
214  calc<FuncType,BLAS_SCNE>(z, x, y, opp, false);
215  else
216  calc<FuncType,BLAS_VEC2D>(z, x, y, opp, false);
217  }
218 }
void int int REAL REAL * y
Definition: read.cpp:74
bool is_windowed() const
Checks whether the attribute is associated with the window.
Definition: Attribute.h:188
void int int int REAL REAL REAL * z
Definition: write.cpp:76
void int int REAL * x
Definition: read.cpp:74
int size_of_components() const
Obtain the number of components in the attribute.
Definition: Attribute.h:203

Here is the call graph for this function:

Here is the caller graph for this function:

void calcDot ( void *  zout,
const Attribute x,
const Attribute y,
const MPI_Comm *  comm = NULL,
const Attribute mults = NULL 
)
staticprotected

Performs the operation: z = <x, y>

Definition at line 27 of file dots.C.

References BLAS_SCALAR, BLAS_VEC, BLAS_VOID, COM_assertion_msg, COM_compatible_types(), COM_INT, COM_INTEGER, COMMPI_Initialized(), Attribute::data_type(), Attribute::fullname(), i, Attribute::id(), Attribute::is_windowed(), j, Mesquite::length(), MPI_SUM, n, Window::name(), ni, nj, Window::panes(), Attribute::pointer(), s, Attribute::size_of_components(), Attribute::size_of_items(), Attribute::stride(), to_str(), Attribute::window(), and y.

28  {
29 
30  COM_assertion_msg( !x->is_windowed() && !z->is_windowed(),
31  "Unsupported attribute type");
33  (std::string("Incompatible data types between ")+
34  x->fullname()+" and "+z->fullname()).c_str());
35 
36  int num_dims = z->size_of_components();
37  COM_assertion_msg( num_dims == x->size_of_components(),
38  (std::string("Numbers of components do not match between ")+
39  x->fullname()+" and "+z->fullname()).c_str());
40 
41  std::vector<const Pane*> xpanes, zpanes, mpanes;
42  std::vector<Pane*> ypanes;
43 
44  z->window()->panes(zpanes);
45  x->window()->panes(xpanes);
46 
47  COM_assertion_msg( xpanes.size() == zpanes.size(),
48  (std::string("Numbers of panes do not match between ")+
49  x->window()->name()+" and "+z->window()->name()).c_str());
50 
51  std::vector<const Pane*>::const_iterator zit, zend, xit;
52  Pane **yit=NULL;
53 
54  Attribute *y=NULL;
55  data_type *yval=NULL;
56 
57  if ( ytype == BLAS_VOID) {
58  yval = reinterpret_cast<data_type *>( yout);
59  *yval = data_type(0);
60  }
61  else {
62  y = reinterpret_cast<Attribute *>(yout);
63 
64  if ( !y->is_windowed()) {
65  y->window()->panes(ypanes);
66  COM_assertion_msg(xpanes.size() == ypanes.size(),
67  (std::string("Numbers of panes do not match between ")+
68  x->fullname()+" and "+y->fullname()).c_str());
69  yit = &ypanes[0];
70  }
71  else {
73  (std::string("Numbers of items do not match between ")+
74  x->fullname()+" and "+y->fullname()).c_str());
75  yval = reinterpret_cast<data_type *>( y->pointer());
76 
77  COM_assertion_msg( yval, (std::string("Caught NULL pointer in ")+
78  y->fullname()).c_str());
79  }
80  }
81 
82  const int ynum_dims = ytype != BLAS_VOID?y->size_of_components():0;
83  COM_assertion_msg( ytype==BLAS_VOID || (ynum_dims==1 || ynum_dims==num_dims),
84  (std::string("Numbers of components do not match between ")+
85  z->fullname()+" and "+y->fullname()).c_str());
86 
87  // Initialize pointer to multiplicities
88  const Pane ** mit=NULL;
89  const int *mval=NULL;
90  if ( mults != NULL) {
92  mults->size_of_components()==1,
93  (std::string("Multiplier ")+mults->fullname()+
94  "must be integer scalars.").c_str());
95 
96  mults->window()->panes(mpanes);
97  COM_assertion_msg(xpanes.size() == mpanes.size(),
98  (std::string("Numbers of panes do not match between ")+
99  x->window()->name()+" and "+
100  mults->window()->name()).c_str());
101  mit = &mpanes[0];
102  }
103 
104  // Initialize y to 0 for BLAS_VOID or window attribute
105  if ( ytype == BLAS_VOID) {
106  *yval = data_type(0);
107  }
108  else {
109  if ( y->is_windowed()) {
110  for ( int i=0; i<ynum_dims; ++i) yval[i] = data_type(0);
111  }
112  }
113 
114  for( zit=zpanes.begin(), zend=zpanes.end(), xit=xpanes.begin();
115  zit!=zend; ++zit, ++xit, yit+=( ytype!=BLAS_VOID && yit)) {
116  const Attribute *pz = (*zit)->attribute(z->id());
117  const int length = pz->size_of_items();
118  int zstrd=get_stride<BLAS_VEC2D>(pz);
119  const bool zstg = num_dims!=zstrd;
120 
121  const Attribute *px = (*xit)->attribute(x->id());
122  int xstrd = get_stride<BLAS_VEC2D>(px);
123  COM_assertion_msg(length == px->size_of_items(),
124  (std::string("Numbers of items do not match between ")+
125  x->fullname()+" and "+z->fullname()+
126  " on pane "+to_str((*zit)->id())).c_str());
127 
128  const bool xstg = num_dims!=xstrd;
129 
130  Attribute *py = y;
131  if ( ytype != BLAS_VOID && !y->is_windowed()) {
132  // Obtain py and initialize to 0
133  py = (*yit)->attribute(y->id());
134  const int ynum_comp = py->size_of_components();
135  const int ylen = py->size_of_items();
136  COM_assertion_msg( ylen==1 || ylen==length,
137  (std::string("Numbers of items do not match between ")+
138  y->fullname()+" and "+z->fullname()+
139  " on pane "+to_str((*zit)->id())).c_str());
140 
141  yval = reinterpret_cast<data_type *>( py->pointer());
142 
143  if ( py->stride()==ynum_comp) {
144  for ( int i=0, ni=ynum_comp*ylen; i<ni; ++i) yval[i] = data_type(0);
145  }
146  else {
147  // Loop through the number of components
148  for (int i=0; i<ynum_comp; ++i) {
149  Attribute *py_i = ynum_comp>1?(*yit)->attribute( y->id()+i+1):py;
150  data_type *yv_i = reinterpret_cast<data_type*>(py_i->pointer());
151  const int strd=get_stride<BLAS_VEC2D>(py_i);
152  // loop through the stride
153  for ( int j=0, nj=ylen*strd; j<nj; j+=strd) yv_i[j] = data_type(0);
154  }
155  }
156  }
157  int ystrd = get_stride<ytype>(py);
158  const bool ystg = py && (ynum_dims!=num_dims || ynum_dims!=ystrd);
159 
160  // Obtain the multiplier
161  if ( mults != NULL) {
162  const Attribute *pm = (*mit)->attribute(mults->id());
164  (std::string("Numbers of items do not match between ")+
165  mults->fullname()+" and "+z->fullname()+
166  " on pane "+to_str((*zit)->id())).c_str());
167 
168  mval = reinterpret_cast<const int*>( pm->pointer());
169  ++mit;
170  }
171 
172  // Optimized version for contiguous attributes
173  if ( !xstg && !zstg && !ystg && mval == NULL) {
174  const data_type *xval = (const data_type *)px->pointer();
175  const data_type *zval = (const data_type *)pz->pointer();
176 
177  //Loop for each element/node and for each dimension
178  for(Size i = 0, s = length*num_dims; i<s; ++i, ++xval, ++zval)
179  getref<data_type,ytype,0>(yval,i,0,1) += *xval* *zval;
180  }
181  else { // General version
182  //Loop for each dimension.
183  for(int i = 0; i < num_dims; ++i) {
184  const Attribute *pz_i = num_dims==1?pz:(*zit)->attribute(z->id()+i+1);
185  const data_type *zval = (const data_type *)pz_i->pointer();
186  zstrd=get_stride<BLAS_VEC2D>(pz_i);
187 
188  const Attribute *px_i = num_dims==1?px:(*xit)->attribute(x->id()+i+1);
189  const data_type *xval = (const data_type *)px_i->pointer();
190  xstrd=get_stride<BLAS_VEC2D>(px_i);
191 
192  if ( ytype != BLAS_VOID && !y->is_windowed()) {
193  Attribute *py_i=ynum_dims==1?py:(*yit)->attribute(y->id()+i+1);
194  yval = reinterpret_cast<data_type *>( py_i->pointer());
195  ystrd = get_stride<ytype>( py_i);
196  }
197 
198  if ( mval != NULL) {
199  //Loop for each element/node.
200  for(int j=0; j<length; ++j, xval+=xstrd,zval+=zstrd)
201  getref<data_type,ytype,1>( yval,j,i,ystrd) += *xval* *zval / mval[j];
202  }
203  else
204  for(int j=0; j<length; ++j, xval+=xstrd,zval+=zstrd)
205  getref<data_type,ytype,1>( yval,j,i,ystrd) += *xval* *zval;
206  }
207  }
208  }
209 
210  if ( ( ytype==BLAS_VOID || ytype==BLAS_SCALAR || ytype==BLAS_VEC)
211  && comm && *comm!=MPI_COMM_NULL && COMMPI_Initialized()) {
212  int n = (ytype == BLAS_VEC) ? num_dims : 1;
213  COM_Type att_type = x->data_type();
214 
215  data_type t = *yval;
216  if ( att_type == COM_INT || att_type == COM_INTEGER) {
217  MPI_Allreduce( &t, yval, n, MPI_INT, MPI_SUM, *comm);
218  }
219  else {
220  MPI_Allreduce( &t, yval, n, MPI_DOUBLE, MPI_SUM, *comm);
221  }
222  }
223 }
int COM_Type
Indices for derived data types.
Definition: roccom_basic.h:122
A Pane object contains a mesh, pane attribute, and field variables.
Definition: Pane.h:43
An Attribute object is a data member of a window.
Definition: Attribute.h:51
void int int REAL REAL * y
Definition: read.cpp:74
#define COM_assertion_msg(EX, msg)
double s
Definition: blastest.C:80
bool is_windowed() const
Checks whether the attribute is associated with the window.
Definition: Attribute.h:188
const std::string & name() const
Obtain the window&#39;s name.
Definition: Window.h:92
const Window * window() const
Obtain a constant pointer to the parent window of the attribute.
Definition: Attribute.C:80
double length(Vector3D *const v, int n)
const void * pointer() const
Obtain a constant pointer to the physical address.
Definition: Attribute.h:150
void int int int REAL REAL REAL * z
Definition: write.cpp:76
int COM_compatible_types(COM_Type type1, COM_Type type2)
Definition: roccom_c++.h:563
blockLoc i
Definition: read.cpp:79
const NT & n
int stride() const
Obtain the stride of the attribute in base datatype.
Definition: Attribute.h:233
static std::string to_str(int i)
Definition: Rocblas.h:283
unsigned int Size
Definition: Rocblas.h:38
j indices j
Definition: Indexing.h:6
void int int REAL REAL REAL *z blockDim dim * ni
Definition: read.cpp:77
void int * nj
Definition: read.cpp:74
COM_Type data_type() const
Obtain the data type of each component of the attribute.
Definition: Attribute.h:197
int id() const
Obtain the id (or index) of the attribute.
Definition: Attribute.h:120
int COMMPI_Initialized()
Definition: commpi.h:168
void panes(std::vector< int > &ps, int rank=-2)
Obtain all the local panes of the window.
Definition: Window.C:809
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_GROUP_EMPTY INTEGER MPI_SUM
int size_of_items() const
Obtain the number of items in the attribute.
Definition: Attribute.C:111
std::string fullname() const
Obtain the full name of the attribute including window name suitable for printing out error messages...
Definition: Attribute.C:82
int size_of_components() const
Obtain the number of components in the attribute.
Definition: Attribute.h:203

Here is the call graph for this function:

void copy ( const Attribute x,
Attribute y 
)
static

Wrapper for copy.

Definition at line 333 of file op2args.C.

References Window::attributes(), COM_ALL, COM_assertion_msg, COM_ATTS, COM_CHAR, COM_CONN, COM_DOUBLE, COM_DOUBLE_PRECISION, COM_INT, COM_INTEGER, COM_MESH, COM_PMESH, Attribute::data_type(), Attribute::fullname(), i, Attribute::id(), Window::name(), Attribute::window(), x, and z.

Referenced by Rocmop::add_aspect_ratios(), FaceOffset_3::balance_mass(), FaceOffset_3::compute_quadrics(), FaceOffset_3::filter_and_identify_ridge_edges(), init(), Rocprop::propagate(), Propagation_3::set_constraints(), Rocmop::smooth_surf_medial(), Rocmop::smooth_vol_mesq_ng(), and FaceOffset_3::time_stepping().

333  {
334  switch ( x->id()) {
335  case COM::COM_ATTS: {
337  "Aggregate attributes for copy must match.");
338 
339  // Obtain all the attributes of their corresponding windows
340  std::vector< const Attribute*> x_attrs;
341  x->window()->attributes( x_attrs);
342 
343  std::vector< Attribute*> z_attrs;
344  z->window()->attributes( z_attrs);
345 
346  // Copy all the individual attributes
347  COM_assertion_msg( x_attrs.size() == z_attrs.size(),
348  (std::string("Numbers of attributes do not match between ")+
349  x->window()->name()+" and "+z->window()->name()).c_str());
350 
351  for ( int i=x_attrs.size()-1; i>=0; --i)
352  copy( x_attrs[i], z_attrs[i]);
353  return;
354  }
355  case COM::COM_MESH:
356  case COM::COM_PMESH:
357  case COM::COM_CONN:
358  case COM::COM_ALL:
359  COM_assertion_msg(false, "Only the aggregate attribute atts is supported");
360  default: ;
361  }
362 
363  COM_Type src_type = x->data_type(), trg_type = z->data_type();
364 
365  if ( src_type == COM_INT || src_type == COM_INTEGER) {
366  if ( trg_type == COM_DOUBLE || trg_type == COM_DOUBLE_PRECISION)
367  copy_helper<assn<int,double> >( x, z);
368  else
369  copy_helper<assn<int,int> >( x, z);
370  }
371  else if ( src_type == COM_CHAR) {
372  if ( trg_type == COM_INT || trg_type == COM_INTEGER)
373  copy_helper<assn<char,int> >( x, z);
374  else if ( trg_type == COM_DOUBLE || trg_type == COM_DOUBLE_PRECISION)
375  copy_helper<assn<char,double> >( x, z);
376  else
377  copy_helper<assn<char,char> >( x, z);
378  }
379  else {
380  COM_assertion_msg( src_type==COM_DOUBLE || src_type==COM_DOUBLE_PRECISION,
381  (std::string("Unsupported data type in ")+
382  x->fullname()).c_str());
383  copy_helper<assn<double,double> >( x, z);
384  }
385 }
int COM_Type
Indices for derived data types.
Definition: roccom_basic.h:122
#define COM_assertion_msg(EX, msg)
C/C++ Data types.
Definition: roccom_basic.h:129
const std::string & name() const
Obtain the window&#39;s name.
Definition: Window.h:92
const Window * window() const
Obtain a constant pointer to the parent window of the attribute.
Definition: Attribute.C:80
void attributes(std::vector< Attribute * > &as)
Obtain all the attributes of the pane.
Definition: Window.h:328
void int int int REAL REAL REAL * z
Definition: write.cpp:76
blockLoc i
Definition: read.cpp:79
void int int REAL * x
Definition: read.cpp:74
static void copy(const Attribute *x, Attribute *y)
Wrapper for copy.
Definition: op2args.C:333
COM_Type data_type() const
Obtain the data type of each component of the attribute.
Definition: Attribute.h:197
int id() const
Obtain the id (or index) of the attribute.
Definition: Attribute.h:120

Here is the call graph for this function:

Here is the caller graph for this function:

void copy_helper ( const Attribute x,
Attribute z 
)
staticprotected

Definition at line 315 of file op2args.C.

References Attribute::is_windowed(), Attribute::size_of_components(), x, and z.

315  {
316  int xncomp = x->size_of_components();
317 
318  if ( x->is_windowed()) {
319  if ( xncomp == 1)
320  gen2arg<Op,BLAS_SCALAR>(z, const_cast<Attribute*>(x), Op());
321  else
322  gen2arg<Op,BLAS_VEC>(z, const_cast<Attribute*>(x), Op());
323  }
324  else {
325  if ( xncomp == 1)
326  gen2arg<Op,BLAS_SCNE>(z, const_cast<Attribute*>(x), Op());
327  else
328  gen2arg<Op,BLAS_VEC2D>(z, const_cast<Attribute*>(x), Op());
329  }
330 }
An Attribute object is a data member of a window.
Definition: Attribute.h:51
bool is_windowed() const
Checks whether the attribute is associated with the window.
Definition: Attribute.h:188
void int int int REAL REAL REAL * z
Definition: write.cpp:76
void int int REAL * x
Definition: read.cpp:74
int size_of_components() const
Obtain the number of components in the attribute.
Definition: Attribute.h:203

Here is the call graph for this function:

void copy_scalar ( const void *  x,
Attribute y 
)
static

Operation wrapper for copy (x is a scalar pointer).

Definition at line 583 of file op2args.C.

References COM_assertion_msg, COM_CHAR, COM_DOUBLE, COM_DOUBLE_PRECISION, COM_INT, COM_INTEGER, Attribute::data_type(), x, and z.

Referenced by FaceOffset_3::balance_mass(), FaceOffset_3::build_ridge_neighbor_list(), FaceOffset_3::compute_anisotropic_vertex_centers(), Window_manifold_2::compute_mcn(), Rocmop::compute_medial_quadric(), FaceOffset_3::compute_quadrics(), Window_manifold_2::compute_shortest_edgelen_nodes(), Propagation_3::convert_constraints(), FaceOffset_3::denoise_surface(), Propagation_3::determine_constraint_boundary(), FaceOffset_3::distribute_volume_e2n(), FaceOffset_3::filter_and_identify_ridge_edges(), Rocmop::get_redist_safe_factor(), init(), FaceOffset_3::mark_weak_vertices(), FaceOffset_3::nulaplacian_smooth(), FaceOffset_3::reclassify_ridge_vertices(), Rocmop::redistribute_vertices_ridge(), Rocmop::redistribute_vertices_smooth(), reduce_MPI(), Rocmop::smooth_vol_mesq_ng(), and FaceOffset_3::time_stepping().

583  {
584  COM_Type att_type = z->data_type();
585 
586  typedef assn<int,int> assn_int;
587  typedef assn<char,char> assn_chr;
588  typedef assn<double,double> assn_dbl;
589 
590  if ( att_type == COM_INT || att_type == COM_INTEGER)
591  gen2arg<assn_int,BLAS_VOID>(z, const_cast<void*>(x), assn_int());
592  else if ( att_type == COM_DOUBLE || att_type == COM_DOUBLE_PRECISION) {
593  gen2arg<assn_dbl,BLAS_VOID>(z, const_cast<void*>(x), assn_dbl());
594  }
595  else {
596  COM_assertion_msg( att_type==COM_CHAR,
597  (std::string("Unsupported data type in ")+
598  z->fullname()).c_str());
599  gen2arg<assn_chr,BLAS_VOID>(z, const_cast<void*>(x), assn_chr());
600  }
601 }
int COM_Type
Indices for derived data types.
Definition: roccom_basic.h:122
#define COM_assertion_msg(EX, msg)
C/C++ Data types.
Definition: roccom_basic.h:129
void int int int REAL REAL REAL * z
Definition: write.cpp:76
void int int REAL * x
Definition: read.cpp:74

Here is the call graph for this function:

Here is the caller graph for this function:

void div ( const Attribute x,
const Attribute y,
Attribute z 
)
static

Operation wrapper for division.

Definition at line 269 of file op3args.C.

References calcChoose(), COM_assertion_msg, COM_DOUBLE, COM_DOUBLE_PRECISION, COM_INT, COM_INTEGER, Attribute::data_type(), and Attribute::fullname().

Referenced by rflu_modrepair3d::angfnd(), FaceOffset_3::compute_anisotropic_vertex_centers(), Window_manifold_2::compute_mcn(), FaceOffset_3::compute_quadrics(), computeflux(), FaceOffset_3::denoise_surface(), init(), rflo_viscousfluxpatch(), and Rocmop::smooth_vol_mesq_ng().

270 {
271  COM_Type att_type = z->data_type();
272 
273  if(att_type == COM_INT || att_type == COM_INTEGER)
274  calcChoose(x, y, z, std::divides<int>());
275  else {
276  COM_assertion_msg(att_type == COM_DOUBLE||att_type == COM_DOUBLE_PRECISION,
277  (std::string("Unsupported data type in ")+
278  z->fullname()).c_str());
279  calcChoose(x, y, z, std::divides<double>());
280  }
281 }
int COM_Type
Indices for derived data types.
Definition: roccom_basic.h:122
#define COM_assertion_msg(EX, msg)
static void calcChoose(const Attribute *x, const Attribute *y, Attribute *z, FuncType opp)
Chooses which calc function to call based on type of y.
Definition: op3args.C:192
COM_Type data_type() const
Obtain the data type of each component of the attribute.
Definition: Attribute.h:197
std::string fullname() const
Obtain the full name of the attribute including window name suitable for printing out error messages...
Definition: Attribute.C:82

Here is the call graph for this function:

Here is the caller graph for this function:

void div_scalar ( const Attribute x,
const void *  y,
Attribute z,
int  swap = 0 
)
static

Operation wrapper for division with y as a scalar pointer.

Definition at line 363 of file op3args.C.

References BLAS_VOID, COM_assertion_msg, COM_DOUBLE, COM_DOUBLE_PRECISION, COM_INT, COM_INTEGER, Attribute::data_type(), x, y, and z.

Referenced by Rocmop::constrain_displacements(), Rocmop::get_usr_disp(), and init().

365 {
366  COM_Type att_type = z->data_type();
367 
368  if(att_type == COM_INT || att_type == COM_INTEGER)
369  calc<std::divides<int>,BLAS_VOID>(z, x, y, std::divides<int>(), swap);
370  else {
371  COM_assertion_msg(att_type == COM_DOUBLE||att_type == COM_DOUBLE_PRECISION,
372  (std::string("Unsupported data type in ")+
373  z->fullname()).c_str());
374  calc<std::divides<double>,BLAS_VOID>(z, x, y, std::divides<double>(), swap);
375  }
376 }
int COM_Type
Indices for derived data types.
Definition: roccom_basic.h:122
void int int REAL REAL * y
Definition: read.cpp:74
#define COM_assertion_msg(EX, msg)
void int int int REAL REAL REAL * z
Definition: write.cpp:76
void int int REAL * x
Definition: read.cpp:74
static void swap(Attribute *x, Attribute *y)
Wrapper for swap.
Definition: op2args.C:271
COM_Type data_type() const
Obtain the data type of each component of the attribute.
Definition: Attribute.h:197
std::string fullname() const
Obtain the full name of the attribute including window name suitable for printing out error messages...
Definition: Attribute.C:82

Here is the call graph for this function:

Here is the caller graph for this function:

void dot ( const Attribute x,
const Attribute y,
Attribute z,
const Attribute mults = NULL 
)
static

Wrapper for dot product.

Wrapper for 2-norm.

Definition at line 279 of file dots.C.

References dot_MPI().

Referenced by angle_rad_3d(), FaceOffset_3::balance_mass(), and init().

281 { dot_MPI( x, y, z, NULL, mults); }
static void dot_MPI(const Attribute *x, const Attribute *y, Attribute *z, const MPI_Comm *comm=NULL, const Attribute *mults=NULL)
Wrapper for dot product.
Definition: dots.C:226

Here is the call graph for this function:

Here is the caller graph for this function:

void dot_MPI ( const Attribute x,
const Attribute y,
Attribute z,
const MPI_Comm *  comm = NULL,
const Attribute mults = NULL 
)
static

Wrapper for dot product.

Definition at line 226 of file dots.C.

References COM_assertion_msg, COM_DOUBLE, COM_DOUBLE_PRECISION, COM_INT, COM_INTEGER, Attribute::data_type(), Attribute::fullname(), Attribute::is_windowed(), Attribute::size_of_components(), x, y, and z.

Referenced by dot(), init(), nrm2(), and nrm2_MPI().

227  {
228  COM_Type att_type = x->data_type();
229  const int zncomp = z->size_of_components();
230 
231  if ( att_type == COM_INT || att_type == COM_INTEGER) {
232  if ( z->is_windowed()) {
233  if ( zncomp == 1)
234  calcDot<int,BLAS_SCALAR>(z, x, y, comm, mults);
235  else
236  calcDot<int,BLAS_VEC>(z, x, y, comm, mults);
237  }
238  else {
239  if ( zncomp == 1)
240  calcDot<int,BLAS_SCNE>(z, x, y, comm, mults);
241  else
242  calcDot<int,BLAS_VEC2D>(z, x, y, comm, mults);
243  }
244  }
245  else {
246  COM_assertion_msg( att_type==COM_DOUBLE || att_type==COM_DOUBLE_PRECISION,
247  (std::string("Unsupported data type in ")+
248  x->fullname()).c_str());
249  if ( z->is_windowed()) {
250  if ( zncomp == 1)
251  calcDot<double,BLAS_SCALAR>(z, x, y, comm, mults);
252  else
253  calcDot<double,BLAS_VEC>(z, x, y, comm, mults);
254  }
255  else {
256  if ( zncomp == 1)
257  calcDot<double,BLAS_SCNE>(z, x, y, comm, mults);
258  else
259  calcDot<double,BLAS_VEC2D>(z, x, y, comm, mults);
260  }
261  }
262 }
int COM_Type
Indices for derived data types.
Definition: roccom_basic.h:122
void int int REAL REAL * y
Definition: read.cpp:74
#define COM_assertion_msg(EX, msg)
bool is_windowed() const
Checks whether the attribute is associated with the window.
Definition: Attribute.h:188
void int int int REAL REAL REAL * z
Definition: write.cpp:76
void int int REAL * x
Definition: read.cpp:74
COM_Type data_type() const
Obtain the data type of each component of the attribute.
Definition: Attribute.h:197
std::string fullname() const
Obtain the full name of the attribute including window name suitable for printing out error messages...
Definition: Attribute.C:82
int size_of_components() const
Obtain the number of components in the attribute.
Definition: Attribute.h:203

Here is the call graph for this function:

Here is the caller graph for this function:

void dot_scalar ( const Attribute x,
const Attribute y,
void *  z,
const Attribute mults = NULL 
)
static

Wrapper for 2-norm with z as a scalar pointer.

Definition at line 283 of file dots.C.

References dot_scalar_MPI().

Referenced by init().

285 { dot_scalar_MPI( x, y, z, NULL, mults); }
static void dot_scalar_MPI(const Attribute *x, const Attribute *y, void *z, const MPI_Comm *comm=NULL, const Attribute *mults=NULL)
Wrapper for 2-norm with z as a scalar pointer.
Definition: dots.C:264
void int int int REAL REAL REAL * z
Definition: write.cpp:76

Here is the call graph for this function:

Here is the caller graph for this function:

void dot_scalar_MPI ( const Attribute x,
const Attribute y,
void *  z,
const MPI_Comm *  comm = NULL,
const Attribute mults = NULL 
)
static

Wrapper for 2-norm with z as a scalar pointer.

Definition at line 264 of file dots.C.

References COM_assertion_msg, COM_DOUBLE, COM_DOUBLE_PRECISION, COM_INT, COM_INTEGER, Attribute::data_type(), x, y, and z.

Referenced by dot_scalar(), init(), nrm2_scalar(), and nrm2_scalar_MPI().

265  {
266  COM_Type att_type = x->data_type();
267 
268  if(att_type == COM_INT || att_type == COM_INTEGER)
269  calcDot<int,BLAS_VOID>(z, x, y, comm, mults);
270  else {
271  COM_assertion_msg(att_type == COM_DOUBLE||att_type == COM_DOUBLE_PRECISION,
272  (std::string("Unsupported data type in ")+
273  x->fullname()).c_str());
274  calcDot<double,BLAS_VOID>(z, x, y, comm, mults);
275  }
276 }
int COM_Type
Indices for derived data types.
Definition: roccom_basic.h:122
void int int REAL REAL * y
Definition: read.cpp:74
#define COM_assertion_msg(EX, msg)
void int int int REAL REAL REAL * z
Definition: write.cpp:76
void int int REAL * x
Definition: read.cpp:74
COM_Type data_type() const
Obtain the data type of each component of the attribute.
Definition: Attribute.h:197

Here is the call graph for this function:

Here is the caller graph for this function:

void finalize ( const std::string &  name)
static

Delete window for Rocblas.

Definition at line 112 of file Rocblas.C.

References COM_delete_window().

Referenced by Rocblas_unload_module(), rocblas_unload_module(), ROCBLAS_UNLOAD_MODULE(), rocblas_unload_module_(), and ROCBLAS_UNLOAD_MODULE_().

112  {
113  COM_delete_window( name.c_str());
114 }
void COM_delete_window(const char *wname)
Definition: roccom_c++.h:94

Here is the call graph for this function:

Here is the caller graph for this function:

void gen2arg ( Attribute z,
void *  yin,
FuncType  opp 
)
staticprotected

Performs the operation opp(x, y)

Definition at line 114 of file op2args.C.

References BLAS_SCNE, BLAS_VEC, BLAS_VEC2D, BLAS_VOID, COM_assertion_msg, COM_compatible_types(), Attribute::data_type(), Attribute::fullname(), i, Pane::id(), Attribute::id(), Attribute::is_windowed(), j, Mesquite::length(), Window::name(), Attribute::pane(), Window::panes(), Attribute::pointer(), s, Attribute::size_of_components(), Attribute::size_of_items(), to_str(), Attribute::window(), y, and z.

114  {
115  typedef typename FuncType::argument_type argument_type;
116  typedef typename FuncType::result_type result_type;
117 
118  int num_dims = z->size_of_components();
119 
120  std::vector<Pane*> zpanes;
121  std::vector<Pane*>::iterator zit, zend;
122  z->window()->panes(zpanes);
123 
124  std::vector<Pane*> ypanes;
125  Pane **yit=NULL;
126  Attribute *y=NULL;
127  argument_type *yval=NULL;
128 
129  if ( ytype == BLAS_VOID) {
130  yval = reinterpret_cast<argument_type *>( yin);
131 
132  COM_assertion_msg( yval, std::string("Caught NULL pointer in scalar \
133 operand when processing "+z->fullname()).c_str());
134  }
135  else {
136  y = reinterpret_cast<Attribute *>(yin);
137  bool type_coercion = compare_types<argument_type,result_type>();
138 
139  COM_assertion_msg( type_coercion ||
141  (std::string("Incompatible data types between ")+
142  z->fullname()+" and "+y->fullname()).c_str());
143 
144  if ( !y->is_windowed()) {
145  y->window()->panes(ypanes);
146  COM_assertion_msg(zpanes.size() == ypanes.size(),
147  (std::string("Numbers of panes do not match between ")+
148  y->window()->name()+" and "+z->window()->name()).c_str());
149  yit = &ypanes[0];
150  }
151  else {
152  if ( y->size_of_items()!=1) {
153  std::cout << "Rocbals Error: The size-of-items of attribute "
154  << y->fullname() << " on pane " << y->pane()->id()
155  << " is " << y->size_of_items() << std::endl;
156  COM_assertion_msg( y->size_of_items()==1, "If an argument is a window \
157 attribute, then its number of items must be 1.");
158  }
159 
160  yval = reinterpret_cast<argument_type *>( y->pointer());
161 
162  COM_assertion_msg( yval, (std::string("Caught NULL pointer in ")+
163  y->fullname()).c_str());
164  }
165  }
166 
167  const int ynum_dims = ytype != BLAS_VOID?y->size_of_components():0;
168  COM_assertion_msg( ytype==BLAS_VOID || (ynum_dims==1 || ynum_dims==num_dims),
169  (std::string("Numbers of components do not match between ")+
170  y->fullname()+" and "+z->fullname()).c_str());
171 
172  if ( z->is_windowed()) {
173  COM_assertion_msg( ytype == BLAS_VOID || y->is_windowed(),
174  (std::string("Wrong type of operand")+
175  y->fullname()).c_str());
176  int zs=get_stride<BLAS_VEC2D>(z);
177  int ys=get_stride<ytype>(y);
178  result_type *zval = (result_type *)z->pointer();
179  int length = z->size_of_items();
180 
181  COM_assertion_msg( length==0 || ytype == BLAS_VOID || zval && yval,
182  (std::string("Caught NULL pointer in w-attribute ")+
183  z->fullname()+" or "+y->fullname()).c_str());
184 
185  if ( (length==1 || num_dims == zs) && ytype != BLAS_VEC) {
186  for ( Size i = 0, s = num_dims*length; i < s; ++i, ++zval)
187  opp( *zval, getref<argument_type,ytype,0>(yval,i,0,1));
188  }
189  else {
190  for(int i = 0; i < num_dims; ++i) {
191  Attribute *z_i = num_dims==1?z:z+i+1;
192  zval = (result_type *)z_i->pointer();
193  zs = get_stride<BLAS_VEC2D>(z_i);
194 
195  if ( ytype != BLAS_VOID) {
196  Attribute *y_i=ynum_dims==1?y:y+i+1;
197  yval = reinterpret_cast<argument_type *>( y_i->pointer());
198  ys = get_stride<ytype>( y_i);
199  }
200 
201  for(int j=0; j<length; ++j, zval+=zs)
202  opp( *zval, getref<argument_type,ytype,1>(yval,j,i,ys));
203  }
204  }
205  return;
206  }
207  // otherwise:
208 
209  for( zit=zpanes.begin(), zend=zpanes.end(); zit!=zend;
210  ++zit, yit+=( ytype!=BLAS_VOID&&yit)) {
211  Attribute *pz = (*zit)->attribute(z->id());
212  const int length = pz->size_of_items();
213  int zstrd=get_stride<BLAS_VEC2D>(pz);
214  const bool zstg = length>1 && num_dims!=zstrd;
215 
216  Attribute *py = ytype!=BLAS_VOID&&yit?(*yit)->attribute(y->id()):y;
217  int ystrd = get_stride<ytype>(py);
218  const bool ystg = py && (ynum_dims!=num_dims || ynum_dims!=ystrd);
219  COM_assertion_msg( ytype!=BLAS_SCNE && ytype!=BLAS_VEC2D ||
220  length == int(py->size_of_items()) || ystrd==0,
221  (std::string("Numbers of items do not match between ")+
222  y->fullname()+" and "+z->fullname()+
223  " on pane "+to_str((*zit)->id())).c_str());
224 
225  // Optimized version for contiguous attributes
226  if ( !zstg && !ystg && ytype != BLAS_VEC &&
227  (ytype != BLAS_SCNE || num_dims==1)) {
228  result_type *zval = reinterpret_cast<result_type *>(pz->pointer());
229 
230  if ( ytype != BLAS_VOID && yit)
231  yval = reinterpret_cast<argument_type *>(py->pointer());
232 
233  COM_assertion_msg( length==0 || ytype == BLAS_VOID || zval && yval,
234  (std::string("Caught NULL pointer in ")+
235  z->fullname()+" or "+y->fullname()+" on pane "+
236  to_str( (*zit)->id())).c_str());
237 
238  if ( zval)
239  //Loop for each element/node and for each dimension
240  for(int i = 0, s = length*num_dims; i < s; ++i, ++zval)
241  opp(*zval, getref<argument_type,ytype,0>(yval,i,0,1));
242  }
243  else { // General version
244  //Loop for each dimension.
245  for(int i = 0; i < num_dims; ++i) {
246  Attribute *pz_i = num_dims==1?pz:(*zit)->attribute(z->id()+i+1);
247  result_type *zval = (result_type *)pz_i->pointer();
248  zstrd=get_stride<BLAS_VEC2D>(pz_i);
249 
250  if ( ytype != BLAS_VOID && yit) {
251  Attribute *py_i=ynum_dims==1?py:(*yit)->attribute(y->id()+i+1);
252  yval = reinterpret_cast<argument_type *>( py_i->pointer());
253  ystrd = get_stride<ytype>( py_i);
254  }
255 
256  COM_assertion_msg( length==0 || ytype == BLAS_VOID || zval && yval,
257  (std::string("Caught NULL pointer in ")+
258  z->fullname()+" or "+y->fullname()+" on pane "+
259  to_str( (*zit)->id())).c_str());
260 
261  if ( zval)
262  for(int j=0; j < length; ++j, zval+=zstrd)
263  opp( *zval, getref<argument_type,ytype,1>(yval,j,i,ystrd));
264  }
265  }
266  }
267 }
A Pane object contains a mesh, pane attribute, and field variables.
Definition: Pane.h:43
An Attribute object is a data member of a window.
Definition: Attribute.h:51
void int int REAL REAL * y
Definition: read.cpp:74
#define COM_assertion_msg(EX, msg)
double s
Definition: blastest.C:80
bool is_windowed() const
Checks whether the attribute is associated with the window.
Definition: Attribute.h:188
const std::string & name() const
Obtain the window&#39;s name.
Definition: Window.h:92
const Window * window() const
Obtain a constant pointer to the parent window of the attribute.
Definition: Attribute.C:80
double length(Vector3D *const v, int n)
const void * pointer() const
Obtain a constant pointer to the physical address.
Definition: Attribute.h:150
void int int int REAL REAL REAL * z
Definition: write.cpp:76
int COM_compatible_types(COM_Type type1, COM_Type type2)
Definition: roccom_c++.h:563
blockLoc i
Definition: read.cpp:79
static std::string to_str(int i)
Definition: Rocblas.h:283
const Pane * pane() const
Obtain a constant pointer to the owner pane of the attribute.
Definition: Attribute.h:172
unsigned int Size
Definition: Rocblas.h:38
j indices j
Definition: Indexing.h:6
COM_Type data_type() const
Obtain the data type of each component of the attribute.
Definition: Attribute.h:197
int id() const
Obtain the id (or index) of the attribute.
Definition: Attribute.h:120
void panes(std::vector< int > &ps, int rank=-2)
Obtain all the local panes of the window.
Definition: Window.C:809
int id() const
Get the ID of the pane.
Definition: Pane.h:96
int size_of_items() const
Obtain the number of items in the attribute.
Definition: Attribute.C:111
std::string fullname() const
Obtain the full name of the attribute including window name suitable for printing out error messages...
Definition: Attribute.C:82
int size_of_components() const
Obtain the number of components in the attribute.
Definition: Attribute.h:203

Here is the call graph for this function:

int get_stride ( const Attribute attr)
inlinestaticprotected

Definition at line 291 of file Rocblas.h.

References BLAS_SCNE, BLAS_VEC, BLAS_VEC2D, Attribute::size_of_items(), and Attribute::stride().

291  {
292  if ( attr_type == BLAS_SCNE || attr_type == BLAS_VEC2D) {
293  if ( attr->size_of_items()>1)
294  return attr->stride();
295  else
296  return 0;
297  }
298  else if ( attr_type == BLAS_VEC)
299  return 0;
300  else
301  return 1;
302 }
int stride() const
Obtain the stride of the attribute in base datatype.
Definition: Attribute.h:233
int size_of_items() const
Obtain the number of items in the attribute.
Definition: Attribute.C:111

Here is the call graph for this function:

data_type & getref ( data_type *  base,
const int  r,
const int  c,
const int  nc 
)
inlinestaticprotected

Definition at line 306 of file Rocblas.h.

References BLAS_SCNE, BLAS_VEC, and BLAS_VEC2D.

306  {
307  if ( attr_type == BLAS_SCNE || attr_type == BLAS_VEC2D && is_staggered)
308  return base[r*nc];
309  else if ( attr_type == BLAS_VEC2D)
310  return base[r*nc+c];
311  else if ( attr_type == BLAS_VEC)
312  return base[c];
313  else
314  return *base;
315 }
const data_type & getref ( const data_type *  base,
const int  r,
const int  c,
const int  nc 
)
inlinestaticprotected

Definition at line 319 of file Rocblas.h.

References BLAS_SCNE, BLAS_VEC, and BLAS_VEC2D.

320  {
321  if ( attr_type == BLAS_SCNE || attr_type == BLAS_VEC2D && is_staggered)
322  return base[r*nc];
323  else if ( attr_type == BLAS_VEC2D)
324  return base[r*nc+c];
325  else if ( attr_type == BLAS_VEC)
326  return base[c];
327  else
328  return *base;
329 }
void init ( const std::string &  name)
static

Creates window for Rocblas and registers functions.

Definition at line 37 of file Rocblas.C.

References acos(), add(), add_scalar(), axpy(), axpy_scalar(), COM_INT, COM_METADATA, COM_MPI_COMM, COM_new_window(), COM_set_function(), COM_VOID, COM_window_init_done(), copy(), copy_scalar(), div(), div_scalar(), dot(), dot_MPI(), dot_scalar(), dot_scalar_MPI(), limit1(), max_MPI(), max_scalar_MPI(), maxof_scalar(), min_MPI(), min_scalar_MPI(), mul(), mul_scalar(), neg(), nrm2(), nrm2_MPI(), nrm2_scalar(), nrm2_scalar_MPI(), rand(), rand_scalar(), sqrt(), sub(), sub_scalar(), sum_MPI(), sum_scalar_MPI(), and swap().

Referenced by Rocblas_load_module(), rocblas_load_module(), ROCBLAS_LOAD_MODULE(), rocblas_load_module_(), and ROCBLAS_LOAD_MODULE_().

37  {
38 
39  const COM_Type arg4_types[] = { COM_METADATA, COM_METADATA, COM_METADATA, COM_METADATA };
40  const COM_Type arg4c_types[] = { COM_METADATA, COM_METADATA, COM_METADATA, COM_MPI_COMM, COM_METADATA };
41  const COM_Type arg4a_types[] = { COM_VOID, COM_METADATA, COM_METADATA, COM_METADATA };
42  const COM_Type arg3_types[] = { COM_METADATA, COM_METADATA, COM_METADATA };
43  const COM_Type arg4cso_types[] = { COM_METADATA, COM_VOID, COM_METADATA, COM_INT };
44  const COM_Type arg4mmvm_types[] = { COM_METADATA, COM_METADATA, COM_VOID, COM_METADATA };
45  const COM_Type arg4mmvcm_types[] = { COM_METADATA, COM_METADATA, COM_VOID, COM_MPI_COMM, COM_METADATA };
46  const COM_Type arg2_types[] = { COM_METADATA, COM_METADATA };
47  const COM_Type arg2s_types[] = { COM_VOID, COM_METADATA };
48 
49  COM_new_window(name.c_str());
50  COM_set_function((name+".add").c_str(), (Func_ptr)add, "iio", arg3_types);
51  COM_set_function((name+".sub").c_str(), (Func_ptr)sub, "iio", arg3_types);
52  COM_set_function((name+".mul").c_str(), (Func_ptr)mul, "iio", arg3_types);
53  COM_set_function((name+".div").c_str(), (Func_ptr)div, "iio", arg3_types);
54  COM_set_function((name+".limit1").c_str(),
55  (Func_ptr)limit1, "iio", arg3_types);
56 
57  COM_set_function((name+".add_scalar").c_str(), (Func_ptr)add_scalar, "iioI",
58  arg4cso_types);
59  COM_set_function((name+".sub_scalar").c_str(), (Func_ptr)sub_scalar, "iioI",
60  arg4cso_types);
61  COM_set_function((name+".mul_scalar").c_str(), (Func_ptr)mul_scalar, "iioI",
62  arg4cso_types);
63  COM_set_function((name+".div_scalar").c_str(), (Func_ptr)div_scalar, "iioI",
64  arg4cso_types);
65 
66  COM_set_function((name+".maxof_scalar").c_str(), (Func_ptr)maxof_scalar, "iioI", arg4cso_types);
67 
68  COM_set_function((name+".neg").c_str(), (Func_ptr)neg, "io", arg2_types);
69  COM_set_function((name+".sqrt").c_str(), (Func_ptr)sqrt, "io", arg2_types);
70  COM_set_function((name+".acos").c_str(), (Func_ptr)acos, "io", arg2_types);
71  COM_set_function((name+".dot").c_str(), (Func_ptr)dot, "iioI", arg4_types);
72  COM_set_function((name+".dot_scalar").c_str(), (Func_ptr)dot_scalar, "iioI", arg4mmvm_types);
73  COM_set_function((name+".dot_MPI").c_str(), (Func_ptr)dot_MPI, "iioII", arg4c_types);
74  COM_set_function((name+".dot_scalar_MPI").c_str(), (Func_ptr)dot_scalar_MPI, "iioII", arg4mmvcm_types);
75  COM_set_function((name+".nrm2").c_str(), (Func_ptr)nrm2, "ioI", &arg4_types[1]);
76  COM_set_function((name+".nrm2_scalar").c_str(), (Func_ptr)nrm2_scalar, "ioI", &arg4mmvm_types[1]);
77 
78  COM_set_function((name+".nrm2_MPI").c_str(), (Func_ptr)nrm2_MPI, "ioII", &arg4c_types[1]);
79  COM_set_function((name+".nrm2_scalar_MPI").c_str(), (Func_ptr)nrm2_scalar_MPI, "ioII", &arg4mmvcm_types[1]);
80 
81  COM_set_function((name+".swap").c_str(), (Func_ptr)swap, "bb", arg2_types);
82  COM_set_function((name+".copy").c_str(), (Func_ptr)copy, "io", arg2_types);
83  COM_set_function((name+".rand").c_str(), (Func_ptr)rand, "io", arg2_types);
84  COM_set_function((name+".copy_scalar").c_str(), (Func_ptr)copy_scalar,
85  "io", arg2s_types);
86  COM_set_function((name+".rand_scalar").c_str(), (Func_ptr)rand_scalar,
87  "io", arg2s_types);
88  COM_set_function((name+".axpy").c_str(), (Func_ptr)axpy, "iiio",
89  arg4_types);
90  COM_set_function((name+".axpy_scalar").c_str(), (Func_ptr)axpy_scalar,
91  "iiio", arg4a_types);
92 
94  COM_set_function((name+".min_MPI").c_str(),
95  (Func_ptr)min_MPI, "ioI", types);
96  COM_set_function((name+".max_MPI").c_str(),
97  (Func_ptr)max_MPI, "ioI", types);
98  COM_set_function((name+".sum_MPI").c_str(),
99  (Func_ptr)sum_MPI, "ioI", types);
100 
101  types[1] = COM_VOID;
102  COM_set_function((name+".min_scalar_MPI").c_str(),
103  (Func_ptr)min_scalar_MPI, "ioI", types);
104  COM_set_function((name+".max_scalar_MPI").c_str(),
105  (Func_ptr)max_scalar_MPI, "ioI", types);
106  COM_set_function((name+".sum_scalar_MPI").c_str(),
107  (Func_ptr)sum_scalar_MPI, "ioI", types);
108 
109  COM_window_init_done(name.c_str());
110 }
static void div_scalar(const Attribute *x, const void *y, Attribute *z, int swap=0)
Operation wrapper for division with y as a scalar pointer.
Definition: op3args.C:363
static void sub(const Attribute *x, const Attribute *y, Attribute *z)
Operation wrapper for subtraction.
Definition: op3args.C:237
int COM_Type
Indices for derived data types.
Definition: roccom_basic.h:122
static void nrm2_scalar(const Attribute *x, void *y, const Attribute *mults=NULL)
Wrapper for 2-norm with y as a scalar pointer.
Definition: dots.C:293
static void nrm2_MPI(const Attribute *x, Attribute *y, const MPI_Comm *comm=NULL, const Attribute *mults=NULL)
Wrapper for 2-norm with MPI.
Definition: dots.C:298
static void rand(const Attribute *a, Attribute *z)
Generate a random number between 0 and $a$ for each entry in z.
Definition: op2args.C:388
void COM_set_function(const char *wf_str, Func_ptr func, const char *intents, const COM_Type *types)
Definition: roccom_c++.h:323
static void max_scalar_MPI(const Attribute *x, void *y, const MPI_Comm *comm=NULL)
Operation wrapper for max (y is a scalar pointer).
Definition: op2args.C:763
static void limit1(const Attribute *x, const Attribute *y, Attribute *z)
Operation wrapper for limit1.
Definition: op3args.C:284
static void dot_scalar_MPI(const Attribute *x, const Attribute *y, void *z, const MPI_Comm *comm=NULL, const Attribute *mults=NULL)
Wrapper for 2-norm with z as a scalar pointer.
Definition: dots.C:264
static void axpy(const Attribute *a, const Attribute *x, const Attribute *y, Attribute *z)
Operation wrapper for z = a * x + y.
Definition: axpy.C:170
static void min_MPI(const Attribute *x, Attribute *y, const MPI_Comm *comm=NULL)
Wrapper for min.
Definition: op2args.C:714
static void max_MPI(const Attribute *x, Attribute *y, const MPI_Comm *comm=NULL)
Wrapper for max.
Definition: op2args.C:708
static void acos(const Attribute *x, Attribute *y)
Wrapper for acos (y=acos(x)).
Definition: op2args.C:545
static void add(const Attribute *x, const Attribute *y, Attribute *z)
Operation wrapper for addition.
Definition: op3args.C:221
static void mul_scalar(const Attribute *x, const void *y, Attribute *z, int swap=0)
Operation wrapper for multiplication with y as a scalar pointer.
Definition: op3args.C:347
static void dot_scalar(const Attribute *x, const Attribute *y, void *z, const Attribute *mults=NULL)
Wrapper for 2-norm with z as a scalar pointer.
Definition: dots.C:283
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).
Definition: axpy.C:210
void(* Func_ptr)()
Pointer of functions.
Definition: roccom_basic.h:123
static void min_scalar_MPI(const Attribute *x, void *y, const MPI_Comm *comm=NULL)
Operation wrapper for min (y is a scalar pointer).
Definition: op2args.C:771
static void sum_scalar_MPI(const Attribute *x, void *y, const MPI_Comm *comm=NULL)
Operation wrapper for sum (y is a scalar pointer).
Definition: op2args.C:778
static void div(const Attribute *x, const Attribute *y, Attribute *z)
Operation wrapper for division.
Definition: op3args.C:269
void COM_window_init_done(const char *w_str, int pane_changed=true)
Definition: roccom_c++.h:102
static void sum_MPI(const Attribute *x, Attribute *y, const MPI_Comm *comm=NULL)
Wrapper for sum.
Definition: op2args.C:720
void COM_new_window(const char *wname, MPI_Comm c=MPI_COMM_NULL)
Definition: roccom_c++.h:86
static void neg(const Attribute *x, Attribute *y)
Wrapper for neg (y=-x).
Definition: op2args.C:455
static void nrm2_scalar_MPI(const Attribute *x, void *y, const MPI_Comm *comm, const Attribute *mults=NULL)
Wrapper for 2-norm with y as a scalar pointer with MPI.
Definition: dots.C:303
static void copy_scalar(const void *x, Attribute *y)
Operation wrapper for copy (x is a scalar pointer).
Definition: op2args.C:583
static void rand_scalar(const void *a, Attribute *z)
Generate a random number between 0 and $a$ for each entry in z.
Definition: op2args.C:604
static void swap(Attribute *x, Attribute *y)
Wrapper for swap.
Definition: op2args.C:271
static void copy(const Attribute *x, Attribute *y)
Wrapper for copy.
Definition: op2args.C:333
static void nrm2(const Attribute *x, Attribute *y, const Attribute *mults=NULL)
Wrapper for 2-norm.
Definition: dots.C:288
static void sqrt(const Attribute *x, Attribute *y)
Wrapper for sqrt (y=sqrt(x)).
Definition: op2args.C:507
static void dot(const Attribute *x, const Attribute *y, Attribute *z, const Attribute *mults=NULL)
Wrapper for dot product.
Definition: dots.C:279
static void maxof_scalar(const Attribute *x, const void *y, Attribute *z, int swap=0)
Operation wrapper for addition with y as a scalar pointer.
Definition: op3args.C:315
static void dot_MPI(const Attribute *x, const Attribute *y, Attribute *z, const MPI_Comm *comm=NULL, const Attribute *mults=NULL)
Wrapper for dot product.
Definition: dots.C:226
static void add_scalar(const Attribute *x, const void *y, Attribute *z, int swap=0)
Operation wrapper for addition with y as a scalar pointer.
Definition: op3args.C:299
static void mul(const Attribute *x, const Attribute *y, Attribute *z)
Operation wrapper for multiplication.
Definition: op3args.C:253
static void sub_scalar(const Attribute *x, const void *y, Attribute *z, int swap=0)
Operation wrapper for subtraction with y as a scalar pointer.
Definition: op3args.C:331

Here is the call graph for this function:

Here is the caller graph for this function:

void limit1 ( const Attribute x,
const Attribute y,
Attribute z 
)
static

Operation wrapper for limit1.

Definition at line 284 of file op3args.C.

References calcChoose(), COM_assertion_msg, COM_DOUBLE, COM_DOUBLE_PRECISION, COM_INT, COM_INTEGER, Attribute::data_type(), and Attribute::fullname().

Referenced by init().

285 {
286  COM_Type att_type = z->data_type();
287 
288  if(att_type == COM_INT || att_type == COM_INTEGER)
289  calcChoose(x, y, z, limit1v<int>());
290  else {
291  COM_assertion_msg(att_type == COM_DOUBLE||att_type == COM_DOUBLE_PRECISION,
292  (std::string("Unsupported data type in ")+
293  z->fullname()).c_str());
294  calcChoose(x, y, z, limit1v<double>());
295  }
296 }
int COM_Type
Indices for derived data types.
Definition: roccom_basic.h:122
#define COM_assertion_msg(EX, msg)
static void calcChoose(const Attribute *x, const Attribute *y, Attribute *z, FuncType opp)
Chooses which calc function to call based on type of y.
Definition: op3args.C:192
COM_Type data_type() const
Obtain the data type of each component of the attribute.
Definition: Attribute.h:197
std::string fullname() const
Obtain the full name of the attribute including window name suitable for printing out error messages...
Definition: Attribute.C:82

Here is the call graph for this function:

Here is the caller graph for this function:

void max_MPI ( const Attribute x,
Attribute y,
const MPI_Comm *  comm = NULL 
)
static

Wrapper for max.

Definition at line 708 of file op2args.C.

References BLAS_MAX, x, and z.

Referenced by init().

708  {
709  reduce_MPI< maxv<int>, maxv<double>, BLAS_MAX>( x, z, comm,
710  -0x7FFFFFFF, -HUGE_VAL);
711 }
void int int int REAL REAL REAL * z
Definition: write.cpp:76
void int int REAL * x
Definition: read.cpp:74

Here is the caller graph for this function:

void max_scalar_MPI ( const Attribute x,
void *  y,
const MPI_Comm *  comm = NULL 
)
static

Operation wrapper for max (y is a scalar pointer).

Definition at line 763 of file op2args.C.

References BLAS_MAX, x, and y.

Referenced by init().

764  {
765  reduce_scalar_MPI< maxv<int>, maxv<double>, BLAS_MAX>(x, y, comm,
766  -0x7FFFFFFF, -HUGE_VAL);
767 
768 }
void int int REAL REAL * y
Definition: read.cpp:74
void int int REAL * x
Definition: read.cpp:74

Here is the caller graph for this function:

void maxof_scalar ( const Attribute x,
const void *  y,
Attribute z,
int  swap = 0 
)
static

Operation wrapper for addition with y as a scalar pointer.

Definition at line 315 of file op3args.C.

References BLAS_VOID, COM_assertion_msg, COM_DOUBLE, COM_DOUBLE_PRECISION, COM_INT, COM_INTEGER, Attribute::data_type(), x, y, and z.

Referenced by init().

317 {
318  COM_Type att_type = z->data_type();
319 
320  if(att_type == COM_INT || att_type == COM_INTEGER)
321  calc<maxof<int>,BLAS_VOID>(z, x, y, maxof<int>(), swap);
322  else {
323  COM_assertion_msg(att_type == COM_DOUBLE||att_type == COM_DOUBLE_PRECISION,
324  (std::string("Unsupported data type in ")+
325  z->fullname()).c_str());
326  calc<maxof<double>,BLAS_VOID>(z, x, y, maxof<double>(), swap);
327  }
328 }
int COM_Type
Indices for derived data types.
Definition: roccom_basic.h:122
void int int REAL REAL * y
Definition: read.cpp:74
#define COM_assertion_msg(EX, msg)
void int int int REAL REAL REAL * z
Definition: write.cpp:76
void int int REAL * x
Definition: read.cpp:74
static void swap(Attribute *x, Attribute *y)
Wrapper for swap.
Definition: op2args.C:271
COM_Type data_type() const
Obtain the data type of each component of the attribute.
Definition: Attribute.h:197
std::string fullname() const
Obtain the full name of the attribute including window name suitable for printing out error messages...
Definition: Attribute.C:82

Here is the call graph for this function:

Here is the caller graph for this function:

void min_MPI ( const Attribute x,
Attribute y,
const MPI_Comm *  comm = NULL 
)
static

Wrapper for min.

Definition at line 714 of file op2args.C.

References BLAS_MIN, x, and z.

Referenced by init().

714  {
715  reduce_MPI< minv<int>, minv<double>, BLAS_MIN>( x, z, comm,
716  0x7FFFFFFF, HUGE_VAL);
717 }
void int int int REAL REAL REAL * z
Definition: write.cpp:76
void int int REAL * x
Definition: read.cpp:74

Here is the caller graph for this function:

void min_scalar_MPI ( const Attribute x,
void *  y,
const MPI_Comm *  comm = NULL 
)
static

Operation wrapper for min (y is a scalar pointer).

Definition at line 771 of file op2args.C.

References BLAS_MIN, x, and y.

Referenced by init().

772  {
773  reduce_scalar_MPI< minv<int>, minv<double>, BLAS_MIN>( x, y, comm,
774  0x7FFFFFFF, HUGE_VAL);
775 }
void int int REAL REAL * y
Definition: read.cpp:74
void int int REAL * x
Definition: read.cpp:74

Here is the caller graph for this function:

void mul ( const Attribute x,
const Attribute y,
Attribute z 
)
static

Operation wrapper for multiplication.

Definition at line 253 of file op3args.C.

References calcChoose(), COM_assertion_msg, COM_DOUBLE, COM_DOUBLE_PRECISION, COM_INT, COM_INTEGER, Attribute::data_type(), and Attribute::fullname().

Referenced by init(), MarkerParticles_3::multiply_nodal_normals(), Window_manifold_2::perturb_mesh(), and turb_flowlmupdateloglay().

254 {
255  COM_Type att_type = z->data_type();
256 
257  if(att_type == COM_INT || att_type == COM_INTEGER)
258  calcChoose(x, y, z, std::multiplies<int>());
259  else {
260  COM_assertion_msg(att_type == COM_DOUBLE||att_type == COM_DOUBLE_PRECISION,
261  (std::string("Unsupported data type in ")+
262  z->fullname()).c_str());
263 
264  calcChoose(x, y, z, std::multiplies<double>());
265  }
266 }
int COM_Type
Indices for derived data types.
Definition: roccom_basic.h:122
#define COM_assertion_msg(EX, msg)
static void calcChoose(const Attribute *x, const Attribute *y, Attribute *z, FuncType opp)
Chooses which calc function to call based on type of y.
Definition: op3args.C:192
COM_Type data_type() const
Obtain the data type of each component of the attribute.
Definition: Attribute.h:197
std::string fullname() const
Obtain the full name of the attribute including window name suitable for printing out error messages...
Definition: Attribute.C:82

Here is the call graph for this function:

Here is the caller graph for this function:

void mul_scalar ( const Attribute x,
const void *  y,
Attribute z,
int  swap = 0 
)
static

Operation wrapper for multiplication with y as a scalar pointer.

Definition at line 347 of file op3args.C.

References BLAS_VOID, COM_assertion_msg, COM_DOUBLE, COM_DOUBLE_PRECISION, COM_INT, COM_INTEGER, Attribute::data_type(), x, y, and z.

Referenced by init(), FaceOffset_3::rescale_displacements(), rescale_object(), MarkerParticles_3::time_stepping(), and FaceOffset_3::time_stepping().

349 {
350  COM_Type att_type = z->data_type();
351 
352  if(att_type == COM_INT || att_type == COM_INTEGER)
353  calc<std::multiplies<int>,BLAS_VOID>(z, x, y, std::multiplies<int>(), swap);
354  else {
355  COM_assertion_msg(att_type == COM_DOUBLE||att_type == COM_DOUBLE_PRECISION,
356  (std::string("Unsupported data type in ")+
357  z->fullname()).c_str());
358  calc<std::multiplies<double>,BLAS_VOID>(z, x, y, std::multiplies<double>(), swap);
359  }
360 }
int COM_Type
Indices for derived data types.
Definition: roccom_basic.h:122
void int int REAL REAL * y
Definition: read.cpp:74
#define COM_assertion_msg(EX, msg)
void int int int REAL REAL REAL * z
Definition: write.cpp:76
void int int REAL * x
Definition: read.cpp:74
static void swap(Attribute *x, Attribute *y)
Wrapper for swap.
Definition: op2args.C:271
COM_Type data_type() const
Obtain the data type of each component of the attribute.
Definition: Attribute.h:197
std::string fullname() const
Obtain the full name of the attribute including window name suitable for printing out error messages...
Definition: Attribute.C:82

Here is the call graph for this function:

Here is the caller graph for this function:

void neg ( const Attribute x,
Attribute y 
)
static

Wrapper for neg (y=-x).

Definition at line 455 of file op2args.C.

References BLAS_SCALAR, BLAS_SCNE, BLAS_VEC, BLAS_VEC2D, COM_assertion_msg, COM_CHAR, COM_DOUBLE, COM_DOUBLE_PRECISION, COM_INT, COM_INTEGER, Attribute::data_type(), Attribute::fullname(), Attribute::is_windowed(), Attribute::size_of_components(), x, and z.

Referenced by init().

455  {
456  COM_Type att_type = x->data_type();
457  const int xncomp = x->size_of_components();
458 
459  if ( att_type == COM_INT || att_type == COM_INTEGER) {
460  if ( x->is_windowed()) {
461  if ( xncomp == 1)
462  gen2arg<nega<int>,BLAS_SCALAR>(z, const_cast<Attribute*>(x), nega<int>());
463  else
464  gen2arg<nega<int>,BLAS_VEC>(z, const_cast<Attribute*>(x), nega<int>());
465  }
466  else {
467  if ( xncomp == 1)
468  gen2arg<nega<int>,BLAS_SCNE>(z, const_cast<Attribute*>(x), nega<int>());
469  else
470  gen2arg<nega<int>,BLAS_VEC2D>(z, const_cast<Attribute*>(x), nega<int>());
471  }
472  }
473  else if ( att_type == COM_CHAR) {
474  if ( x->is_windowed()) {
475  if ( xncomp == 1)
476  gen2arg<nega<char>,BLAS_SCALAR>(z, const_cast<Attribute*>(x), nega<char>());
477  else
478  gen2arg<nega<char>,BLAS_VEC>(z, const_cast<Attribute*>(x), nega<char>());
479  }
480  else {
481  if ( xncomp == 1)
482  gen2arg<nega<char>,BLAS_SCNE>(z, const_cast<Attribute*>(x), nega<char>());
483  else
484  gen2arg<nega<char>,BLAS_VEC2D>(z, const_cast<Attribute*>(x), nega<char>());
485  }
486  }
487  else {
488  COM_assertion_msg( att_type==COM_DOUBLE || att_type==COM_DOUBLE_PRECISION,
489  (std::string("Unsupported data type in ")+
490  x->fullname()).c_str());
491  if ( x->is_windowed()) {
492  if ( xncomp == 1)
493  gen2arg<nega<double>,BLAS_SCALAR>(z, const_cast<Attribute*>(x), nega<double>());
494  else
495  gen2arg<nega<double>,BLAS_VEC>(z, const_cast<Attribute*>(x), nega<double>());
496  }
497  else {
498  if ( xncomp == 1)
499  gen2arg<nega<double>,BLAS_SCNE>(z, const_cast<Attribute*>(x), nega<double>());
500  else
501  gen2arg<nega<double>,BLAS_VEC2D>(z, const_cast<Attribute*>(x), nega<double>());
502  }
503  }
504 }
int COM_Type
Indices for derived data types.
Definition: roccom_basic.h:122
An Attribute object is a data member of a window.
Definition: Attribute.h:51
#define COM_assertion_msg(EX, msg)
bool is_windowed() const
Checks whether the attribute is associated with the window.
Definition: Attribute.h:188
C/C++ Data types.
Definition: roccom_basic.h:129
void int int int REAL REAL REAL * z
Definition: write.cpp:76
void int int REAL * x
Definition: read.cpp:74
COM_Type data_type() const
Obtain the data type of each component of the attribute.
Definition: Attribute.h:197
std::string fullname() const
Obtain the full name of the attribute including window name suitable for printing out error messages...
Definition: Attribute.C:82
int size_of_components() const
Obtain the number of components in the attribute.
Definition: Attribute.h:203

Here is the call graph for this function:

Here is the caller graph for this function:

void nrm2 ( const Attribute x,
Attribute y,
const Attribute mults = NULL 
)
static

Wrapper for 2-norm.

Definition at line 288 of file dots.C.

References dot_MPI().

Referenced by init().

290 { dot_MPI( x, x, y, NULL, mults); }
static void dot_MPI(const Attribute *x, const Attribute *y, Attribute *z, const MPI_Comm *comm=NULL, const Attribute *mults=NULL)
Wrapper for dot product.
Definition: dots.C:226

Here is the call graph for this function:

Here is the caller graph for this function:

void nrm2_MPI ( const Attribute x,
Attribute y,
const MPI_Comm *  comm = NULL,
const Attribute mults = NULL 
)
static

Wrapper for 2-norm with MPI.

Definition at line 298 of file dots.C.

References dot_MPI().

Referenced by init().

300 { dot_MPI ( x, x, y, comm, mults); }
static void dot_MPI(const Attribute *x, const Attribute *y, Attribute *z, const MPI_Comm *comm=NULL, const Attribute *mults=NULL)
Wrapper for dot product.
Definition: dots.C:226

Here is the call graph for this function:

Here is the caller graph for this function:

void nrm2_scalar ( const Attribute x,
void *  y,
const Attribute mults = NULL 
)
static

Wrapper for 2-norm with y as a scalar pointer.

Definition at line 293 of file dots.C.

References dot_scalar_MPI().

Referenced by init().

295 { dot_scalar_MPI ( x, x, y, NULL, mults); }
void int int REAL REAL * y
Definition: read.cpp:74
static void dot_scalar_MPI(const Attribute *x, const Attribute *y, void *z, const MPI_Comm *comm=NULL, const Attribute *mults=NULL)
Wrapper for 2-norm with z as a scalar pointer.
Definition: dots.C:264

Here is the call graph for this function:

Here is the caller graph for this function:

void nrm2_scalar_MPI ( const Attribute x,
void *  y,
const MPI_Comm *  comm,
const Attribute mults = NULL 
)
static

Wrapper for 2-norm with y as a scalar pointer with MPI.

Definition at line 303 of file dots.C.

References dot_scalar_MPI().

Referenced by init().

305 { dot_scalar_MPI ( x, x, y, comm, mults); }
void int int REAL REAL * y
Definition: read.cpp:74
static void dot_scalar_MPI(const Attribute *x, const Attribute *y, void *z, const MPI_Comm *comm=NULL, const Attribute *mults=NULL)
Wrapper for 2-norm with z as a scalar pointer.
Definition: dots.C:264

Here is the call graph for this function:

Here is the caller graph for this function:

void rand ( const Attribute a,
Attribute z 
)
static

Generate a random number between 0 and $a$ for each entry in z.

Definition at line 388 of file op2args.C.

References Window::attributes(), BLAS_SCALAR, BLAS_SCNE, BLAS_VEC, BLAS_VEC2D, COM_ALL, COM_assertion_msg, COM_ATTS, COM_CONN, COM_DOUBLE, COM_DOUBLE_PRECISION, COM_INT, COM_INTEGER, COM_MESH, COM_PMESH, Attribute::data_type(), Attribute::fullname(), i, Attribute::id(), Attribute::is_windowed(), Window::name(), Attribute::size_of_components(), Attribute::window(), x, and z.

Referenced by init().

388  {
389  switch ( x->id()) {
390  case COM::COM_ATTS: {
392  "Aggregate attributes for copy must match.");
393 
394  // Obtain all the attributes of their corresponding windows
395  std::vector< const Attribute*> x_attrs;
396  x->window()->attributes( x_attrs);
397 
398  std::vector< Attribute*> z_attrs;
399  z->window()->attributes( z_attrs);
400 
401  // Copy all the individual attributes
402  COM_assertion_msg( x_attrs.size() == z_attrs.size(),
403  (std::string("Numbers of attributes do not match between ")+
404  x->window()->name()+" and "+z->window()->name()).c_str());
405 
406  for ( int i=x_attrs.size()-1; i>=0; --i)
407  rand( x_attrs[i], z_attrs[i]);
408  return;
409  }
410  case COM::COM_MESH:
411  case COM::COM_PMESH:
412  case COM::COM_CONN:
413  case COM::COM_ALL:
414  COM_assertion_msg(false, "Only the aggregate attribute atts is supported");
415  default: ;
416  }
417 
418  COM_Type att_type = x->data_type();
419  const int xncomp = x->size_of_components();
420 
421  if ( att_type == COM_INT || att_type == COM_INTEGER) {
422  if ( x->is_windowed()) {
423  if ( xncomp == 1)
424  gen2arg<random<int>,BLAS_SCALAR>(z, const_cast<Attribute*>(x), random<int>());
425  else
426  gen2arg<random<int>,BLAS_VEC>(z, const_cast<Attribute*>(x), random<int>());
427  }
428  else {
429  if ( xncomp == 1)
430  gen2arg<random<int>,BLAS_SCNE>(z, const_cast<Attribute*>(x), random<int>());
431  else
432  gen2arg<random<int>,BLAS_VEC2D>(z, const_cast<Attribute*>(x), random<int>());
433  }
434  }
435  else {
436  COM_assertion_msg( att_type==COM_DOUBLE || att_type==COM_DOUBLE_PRECISION,
437  (std::string("Unsupported data type in ")+
438  x->fullname()).c_str());
439  if ( x->is_windowed()) {
440  if ( xncomp == 1)
441  gen2arg<random<double>,BLAS_SCALAR>(z, const_cast<Attribute*>(x), random<double>());
442  else
443  gen2arg<random<double>,BLAS_VEC>(z, const_cast<Attribute*>(x), random<double>());
444  }
445  else {
446  if ( xncomp == 1)
447  gen2arg<random<double>,BLAS_SCNE>(z, const_cast<Attribute*>(x), random<double>());
448  else
449  gen2arg<random<double>,BLAS_VEC2D>(z, const_cast<Attribute*>(x), random<double>());
450  }
451  }
452 }
int COM_Type
Indices for derived data types.
Definition: roccom_basic.h:122
An Attribute object is a data member of a window.
Definition: Attribute.h:51
#define COM_assertion_msg(EX, msg)
static void rand(const Attribute *a, Attribute *z)
Generate a random number between 0 and $a$ for each entry in z.
Definition: op2args.C:388
const std::string & name() const
Obtain the window&#39;s name.
Definition: Window.h:92
const Window * window() const
Obtain a constant pointer to the parent window of the attribute.
Definition: Attribute.C:80
void attributes(std::vector< Attribute * > &as)
Obtain all the attributes of the pane.
Definition: Window.h:328
void int int int REAL REAL REAL * z
Definition: write.cpp:76
blockLoc i
Definition: read.cpp:79
void int int REAL * x
Definition: read.cpp:74
int id() const
Obtain the id (or index) of the attribute.
Definition: Attribute.h:120

Here is the call graph for this function:

Here is the caller graph for this function:

void rand_scalar ( const void *  a,
Attribute z 
)
static

Generate a random number between 0 and $a$ for each entry in z.

Definition at line 604 of file op2args.C.

References BLAS_VOID, COM_assertion_msg, COM_DOUBLE, COM_DOUBLE_PRECISION, COM_INT, COM_INTEGER, Attribute::data_type(), and z.

Referenced by init(), and Window_manifold_2::perturb_mesh().

604  {
605  COM_Type att_type = z->data_type();
606 
607  if ( att_type == COM_INT || att_type == COM_INTEGER)
608  gen2arg<random<int>,BLAS_VOID>(z, const_cast<void*>(a), random<int>());
609  else {
610  COM_assertion_msg( att_type==COM_DOUBLE || att_type==COM_DOUBLE_PRECISION,
611  (std::string("Unsupported data type in ")+
612  z->fullname()).c_str());
613  gen2arg<random<double>,BLAS_VOID>(z, const_cast<void*>(a), random<double>());
614  }
615 }
int COM_Type
Indices for derived data types.
Definition: roccom_basic.h:122
#define COM_assertion_msg(EX, msg)
void int int int REAL REAL REAL * z
Definition: write.cpp:76
COM_Type data_type() const
Obtain the data type of each component of the attribute.
Definition: Attribute.h:197

Here is the call graph for this function:

Here is the caller graph for this function:

void reduce_MPI ( const Attribute x,
Attribute z,
const MPI_Comm *  comm,
int  initialI,
double  initialD 
)
inlinestaticprotected

Definition at line 630 of file op2args.C.

References COM_assertion_msg, COM_CHAR, COM_DOUBLE, COM_DOUBLE_PRECISION, COM_INT, COM_INTEGER, COMMPI_Initialized(), convert2mpiop(), copy_scalar(), Attribute::data_type(), Attribute::fullname(), Attribute::is_windowed(), Attribute::pointer(), Attribute::size_of_components(), and x.

631  {
632  COM_Type att_type = z->data_type();
633  const int zncomp = z->size_of_components();
634 
635  if ( att_type == COM_INT || att_type == COM_INTEGER) {
636  copy_scalar( &initialI, z);
637 
638  if ( z->is_windowed()) {
639  if ( zncomp == 1)
640  gen2arg<OPint,BLAS_SCALAR>(const_cast<Attribute*>(x), z, OPint());
641  else
642  gen2arg<OPint,BLAS_VEC>(const_cast<Attribute*>(x), z, OPint());
643 
644  if ( comm && *comm!=MPI_COMM_NULL && COMMPI_Initialized()) {
645  std::vector<int> t((int*)z->pointer(), ((int*)z->pointer())+zncomp);
646  MPI_Allreduce( &t[0], z->pointer(), zncomp, MPI_INT,
647  convert2mpiop(OPMPI), *comm);
648  }
649  }
650  else {
651  if ( zncomp == 1)
652  gen2arg<OPint,BLAS_SCNE>(const_cast<Attribute*>(x), z, OPint());
653  else
654  gen2arg<OPint,BLAS_VEC2D>(const_cast<Attribute*>(x), z, OPint());
655  }
656  }
657  else if ( att_type == COM_CHAR) {
658  copy_scalar( &initialI, z);
659 
660  if ( z->is_windowed()) {
661  if ( zncomp == 1)
662  gen2arg<OPint,BLAS_SCALAR>(const_cast<Attribute*>(x), z, OPint());
663  else
664  gen2arg<OPint,BLAS_VEC>(const_cast<Attribute*>(x), z, OPint());
665 
666  if ( comm && *comm!=MPI_COMM_NULL && COMMPI_Initialized()) {
667  std::vector<char> t((char*)z->pointer(), ((char*)z->pointer())+zncomp);
668  MPI_Allreduce( &t[0], z->pointer(), zncomp, MPI_CHAR,
669  convert2mpiop(OPMPI), *comm);
670  }
671  }
672  else {
673  if ( zncomp == 1)
674  gen2arg<OPint,BLAS_SCNE>(const_cast<Attribute*>(x), z, OPint());
675  else
676  gen2arg<OPint,BLAS_VEC2D>(const_cast<Attribute*>(x), z, OPint());
677  }
678  }
679  else {
680  COM_assertion_msg( att_type==COM_DOUBLE || att_type==COM_DOUBLE_PRECISION,
681  (std::string("Unsupported data type in ")+
682  z->fullname()).c_str());
683  copy_scalar( &initialD, z);
684 
685  if ( z->is_windowed()) {
686  if ( zncomp == 1)
687  gen2arg<OPdbl,BLAS_SCALAR>(const_cast<Attribute*>(x), z, OPdbl());
688  else
689  gen2arg<OPdbl,BLAS_VEC>(const_cast<Attribute*>(x), z, OPdbl());
690 
691  if ( comm && *comm!=MPI_COMM_NULL && COMMPI_Initialized()) {
692  std::vector<double> t( (double*)z->pointer(),
693  ((double*)z->pointer())+zncomp);
694  MPI_Allreduce( &t[0], z->pointer(), zncomp, MPI_DOUBLE,
695  convert2mpiop(OPMPI), *comm);
696  }
697  }
698  else {
699  if ( zncomp == 1)
700  gen2arg<OPdbl,BLAS_SCNE>(const_cast<Attribute*>(x), z, OPdbl());
701  else
702  gen2arg<OPdbl,BLAS_VEC2D>(const_cast<Attribute*>(x), z, OPdbl());
703  }
704  }
705 }
int COM_Type
Indices for derived data types.
Definition: roccom_basic.h:122
An Attribute object is a data member of a window.
Definition: Attribute.h:51
#define COM_assertion_msg(EX, msg)
bool is_windowed() const
Checks whether the attribute is associated with the window.
Definition: Attribute.h:188
C/C++ Data types.
Definition: roccom_basic.h:129
const void * pointer() const
Obtain a constant pointer to the physical address.
Definition: Attribute.h:150
void int int REAL * x
Definition: read.cpp:74
static void copy_scalar(const void *x, Attribute *y)
Operation wrapper for copy (x is a scalar pointer).
Definition: op2args.C:583
COM_Type data_type() const
Obtain the data type of each component of the attribute.
Definition: Attribute.h:197
int COMMPI_Initialized()
Definition: commpi.h:168
std::string fullname() const
Obtain the full name of the attribute including window name suitable for printing out error messages...
Definition: Attribute.C:82
MPI_Op convert2mpiop(int i)
Definition: op2args.C:619
int size_of_components() const
Obtain the number of components in the attribute.
Definition: Attribute.h:203

Here is the call graph for this function:

void reduce_scalar_MPI ( const Attribute x,
void *  y,
const MPI_Comm *  comm,
int  initialI,
double  initialD 
)
inlinestaticprotected

Definition at line 726 of file op2args.C.

References COM_assertion_msg, COM_CHAR, COM_DOUBLE, COM_DOUBLE_PRECISION, COM_INT, COM_INTEGER, COMMPI_Initialized(), convert2mpiop(), Attribute::data_type(), Attribute::fullname(), and x.

727  {
728  COM_Type att_type = x->data_type();
729 
730  if ( att_type == COM_INT || att_type == COM_INTEGER) {
731  *(int*)y = initialI;
732  gen2arg<OPint,BLAS_VOID>(const_cast<Attribute*>(x), y, OPint());
733 
734  if ( comm && *comm!=MPI_COMM_NULL && COMMPI_Initialized()) {
735  int t = *(int*)y;
736  MPI_Allreduce( &t, y, 1, MPI_INT, convert2mpiop(OPMPI), *comm);
737  }
738  }
739  else if ( att_type == COM_CHAR) {
740  *(char*)y = initialI;
741  gen2arg<OPint,BLAS_VOID>(const_cast<Attribute*>(x), y, OPint());
742 
743  if ( comm && *comm!=MPI_COMM_NULL && COMMPI_Initialized()) {
744  char t = *(char*)y;
745  MPI_Allreduce( &t, y, 1, MPI_CHAR, convert2mpiop(OPMPI), *comm);
746  }
747  }
748  else {
749  COM_assertion_msg( att_type==COM_DOUBLE || att_type==COM_DOUBLE_PRECISION,
750  (std::string("Unsupported data type in ")+
751  x->fullname()).c_str());
752  *(double*)y = initialD;
753  gen2arg<OPdbl,BLAS_VOID>(const_cast<Attribute*>(x), y, OPdbl());
754 
755  if ( comm && *comm!=MPI_COMM_NULL && COMMPI_Initialized()) {
756  double t = *(double*)y;
757  MPI_Allreduce( &t, y, 1, MPI_DOUBLE, convert2mpiop(OPMPI), *comm);
758  }
759  }
760 }
int COM_Type
Indices for derived data types.
Definition: roccom_basic.h:122
An Attribute object is a data member of a window.
Definition: Attribute.h:51
void int int REAL REAL * y
Definition: read.cpp:74
#define COM_assertion_msg(EX, msg)
C/C++ Data types.
Definition: roccom_basic.h:129
void int int REAL * x
Definition: read.cpp:74
COM_Type data_type() const
Obtain the data type of each component of the attribute.
Definition: Attribute.h:197
int COMMPI_Initialized()
Definition: commpi.h:168
std::string fullname() const
Obtain the full name of the attribute including window name suitable for printing out error messages...
Definition: Attribute.C:82
MPI_Op convert2mpiop(int i)
Definition: op2args.C:619

Here is the call graph for this function:

void sqrt ( const Attribute x,
Attribute y 
)
static

Wrapper for sqrt (y=sqrt(x)).

Definition at line 507 of file op2args.C.

References BLAS_SCALAR, BLAS_SCNE, BLAS_VEC, BLAS_VEC2D, COM_assertion_msg, COM_DOUBLE, COM_DOUBLE_PRECISION, COM_INT, COM_INTEGER, Attribute::data_type(), Attribute::fullname(), Attribute::is_windowed(), Attribute::size_of_components(), x, and z.

Referenced by Window_manifold_2::compute_shortest_edgelen_nodes(), and init().

507  {
508  COM_Type att_type = x->data_type();
509  const int xncomp = x->size_of_components();
510 
511  if ( att_type == COM_INT || att_type == COM_INTEGER) {
512  if ( x->is_windowed()) {
513  if ( xncomp == 1)
514  gen2arg<sqrta<int>,BLAS_SCALAR>(z, const_cast<Attribute*>(x), sqrta<int>());
515  else
516  gen2arg<sqrta<int>,BLAS_VEC>(z, const_cast<Attribute*>(x), sqrta<int>());
517  }
518  else {
519  if ( xncomp == 1)
520  gen2arg<sqrta<int>,BLAS_SCNE>(z, const_cast<Attribute*>(x), sqrta<int>());
521  else
522  gen2arg<sqrta<int>,BLAS_VEC2D>(z, const_cast<Attribute*>(x), sqrta<int>());
523  }
524  }
525  else {
526  COM_assertion_msg( att_type==COM_DOUBLE || att_type==COM_DOUBLE_PRECISION,
527  (std::string("Unsupported data type in ")+
528  x->fullname()).c_str());
529  if ( x->is_windowed()) {
530  if ( xncomp == 1)
531  gen2arg<sqrta<double>,BLAS_SCALAR>(z, const_cast<Attribute*>(x), sqrta<double>());
532  else
533  gen2arg<sqrta<double>,BLAS_VEC>(z, const_cast<Attribute*>(x), sqrta<double>());
534  }
535  else {
536  if ( xncomp == 1)
537  gen2arg<sqrta<double>,BLAS_SCNE>(z, const_cast<Attribute*>(x), sqrta<double>());
538  else
539  gen2arg<sqrta<double>,BLAS_VEC2D>(z, const_cast<Attribute*>(x), sqrta<double>());
540  }
541  }
542 }
int COM_Type
Indices for derived data types.
Definition: roccom_basic.h:122
An Attribute object is a data member of a window.
Definition: Attribute.h:51
#define COM_assertion_msg(EX, msg)
bool is_windowed() const
Checks whether the attribute is associated with the window.
Definition: Attribute.h:188
void int int int REAL REAL REAL * z
Definition: write.cpp:76
void int int REAL * x
Definition: read.cpp:74
COM_Type data_type() const
Obtain the data type of each component of the attribute.
Definition: Attribute.h:197
std::string fullname() const
Obtain the full name of the attribute including window name suitable for printing out error messages...
Definition: Attribute.C:82
int size_of_components() const
Obtain the number of components in the attribute.
Definition: Attribute.h:203

Here is the call graph for this function:

Here is the caller graph for this function:

void sub ( const Attribute x,
const Attribute y,
Attribute z 
)
static

Operation wrapper for subtraction.

Definition at line 237 of file op3args.C.

References calcChoose(), COM_assertion_msg, COM_DOUBLE, COM_DOUBLE_PRECISION, COM_INT, COM_INTEGER, Attribute::data_type(), and Attribute::fullname().

Referenced by FaceOffset_3::balance_mass(), Rocmop::get_usr_disp(), init(), Rocprop::propagate(), and Rocmop::smooth().

238 {
239  COM_Type att_type = z->data_type();
240 
241  if(att_type == COM_INT || att_type == COM_INTEGER)
242  calcChoose(x, y, z, std::minus<int>());
243  else {
244  COM_assertion_msg(att_type == COM_DOUBLE||att_type == COM_DOUBLE_PRECISION,
245  (std::string("Unsupported data type in ")+
246  z->fullname()).c_str());
247 
248  calcChoose(x, y, z, std::minus<double>());
249  }
250 }
int COM_Type
Indices for derived data types.
Definition: roccom_basic.h:122
#define COM_assertion_msg(EX, msg)
static void calcChoose(const Attribute *x, const Attribute *y, Attribute *z, FuncType opp)
Chooses which calc function to call based on type of y.
Definition: op3args.C:192
COM_Type data_type() const
Obtain the data type of each component of the attribute.
Definition: Attribute.h:197
std::string fullname() const
Obtain the full name of the attribute including window name suitable for printing out error messages...
Definition: Attribute.C:82

Here is the call graph for this function:

Here is the caller graph for this function:

void sub_scalar ( const Attribute x,
const void *  y,
Attribute z,
int  swap = 0 
)
static

Operation wrapper for subtraction with y as a scalar pointer.

Definition at line 331 of file op3args.C.

References BLAS_VOID, COM_assertion_msg, COM_DOUBLE, COM_DOUBLE_PRECISION, COM_INT, COM_INTEGER, Attribute::data_type(), x, y, and z.

Referenced by init(), and Window_manifold_2::perturb_mesh().

333 {
334  COM_Type att_type = z->data_type();
335 
336  if(att_type == COM_INT || att_type == COM_INTEGER)
337  calc<std::minus<int>,BLAS_VOID>(z, x, y, std::minus<int>(), swap);
338  else {
339  COM_assertion_msg(att_type == COM_DOUBLE||att_type == COM_DOUBLE_PRECISION,
340  (std::string("Unsupported data type in ")+
341  z->fullname()).c_str());
342  calc<std::minus<double>,BLAS_VOID>(z, x, y, std::minus<double>(), swap);
343  }
344 }
int COM_Type
Indices for derived data types.
Definition: roccom_basic.h:122
void int int REAL REAL * y
Definition: read.cpp:74
#define COM_assertion_msg(EX, msg)
void int int int REAL REAL REAL * z
Definition: write.cpp:76
void int int REAL * x
Definition: read.cpp:74
static void swap(Attribute *x, Attribute *y)
Wrapper for swap.
Definition: op2args.C:271
COM_Type data_type() const
Obtain the data type of each component of the attribute.
Definition: Attribute.h:197
std::string fullname() const
Obtain the full name of the attribute including window name suitable for printing out error messages...
Definition: Attribute.C:82

Here is the call graph for this function:

Here is the caller graph for this function:

void sum_MPI ( const Attribute x,
Attribute y,
const MPI_Comm *  comm = NULL 
)
static

Wrapper for sum.

Definition at line 720 of file op2args.C.

References BLAS_SUM, x, and z.

Referenced by init().

720  {
721  reduce_MPI< sumv<int>, sumv<double>, BLAS_SUM>( x, z, comm, 0, 0);
722 }
void int int int REAL REAL REAL * z
Definition: write.cpp:76
void int int REAL * x
Definition: read.cpp:74

Here is the caller graph for this function:

void sum_scalar_MPI ( const Attribute x,
void *  y,
const MPI_Comm *  comm = NULL 
)
static

Operation wrapper for sum (y is a scalar pointer).

Definition at line 778 of file op2args.C.

References BLAS_SUM, x, and y.

Referenced by init().

779  {
780  reduce_scalar_MPI< sumv<int>, sumv<double>, BLAS_SUM>( x, y, comm, 0, 0);
781 }
void int int REAL REAL * y
Definition: read.cpp:74
void int int REAL * x
Definition: read.cpp:74

Here is the caller graph for this function:

void swap ( Attribute x,
Attribute y 
)
static

Wrapper for swap.

Definition at line 271 of file op2args.C.

References Window::attributes(), BLAS_VEC2D, COM_ALL, COM_assertion_msg, COM_ATTS, COM_CHAR, COM_CONN, COM_DOUBLE, COM_DOUBLE_PRECISION, COM_INT, COM_INTEGER, COM_MESH, COM_PMESH, Attribute::data_type(), i, Attribute::id(), Window::name(), Attribute::window(), x, and y.

Referenced by init().

271  {
272  switch ( x->id()) {
273  case COM::COM_ATTS: {
275  "Aggregate attributes for swap must match.");
276 
277  // Obtain all the attributes of their corresponding windows
278  std::vector< Attribute*> x_attrs;
279  x->window()->attributes( x_attrs);
280 
281  std::vector< Attribute*> y_attrs;
282  y->window()->attributes( y_attrs);
283 
284  COM_assertion_msg( x_attrs.size() == y_attrs.size(),
285  (std::string("Numbers of attributes do not match between ")+
286  x->window()->name()+" and "+y->window()->name()).c_str());
287  // Copy all the individual attributes
288  for ( int i=x_attrs.size()-1; i>=0; --i)
289  swap( x_attrs[i], y_attrs[i]);
290  return;
291  }
292  case COM::COM_MESH:
293  case COM::COM_PMESH:
294  case COM::COM_CONN:
295  case COM::COM_ALL:
296  COM_assertion_msg(false, "Only the aggregate attribute atts is supported");
297  default: ;
298  }
299 
300  COM_Type att_type = x->data_type();
301 
302  if(att_type == COM_INT || att_type == COM_INTEGER)
303  gen2arg<swapp<int>,BLAS_VEC2D>(x, y, swapp<int>());
304  else if(att_type == COM_CHAR)
305  gen2arg<swapp<char>,BLAS_VEC2D>(x, y, swapp<char>());
306  else {
307  COM_assertion_msg(att_type == COM_DOUBLE || att_type == COM_DOUBLE_PRECISION,
308  (std::string("Unsupported data type in ")+
309  x->fullname()).c_str());
310  gen2arg<swapp<double>,BLAS_VEC2D>(x, y, swapp<double>());
311  }
312 }
int COM_Type
Indices for derived data types.
Definition: roccom_basic.h:122
void int int REAL REAL * y
Definition: read.cpp:74
#define COM_assertion_msg(EX, msg)
C/C++ Data types.
Definition: roccom_basic.h:129
const std::string & name() const
Obtain the window&#39;s name.
Definition: Window.h:92
const Window * window() const
Obtain a constant pointer to the parent window of the attribute.
Definition: Attribute.C:80
void attributes(std::vector< Attribute * > &as)
Obtain all the attributes of the pane.
Definition: Window.h:328
blockLoc i
Definition: read.cpp:79
void int int REAL * x
Definition: read.cpp:74
static void swap(Attribute *x, Attribute *y)
Wrapper for swap.
Definition: op2args.C:271
COM_Type data_type() const
Obtain the data type of each component of the attribute.
Definition: Attribute.h:197
int id() const
Obtain the id (or index) of the attribute.
Definition: Attribute.h:120
std::string fullname() const
Obtain the full name of the attribute including window name suitable for printing out error messages...
Definition: Attribute.C:82

Here is the call graph for this function:

Here is the caller graph for this function:

static std::string to_str ( int  i)
inlinestaticprotected

Definition at line 283 of file Rocblas.h.

Referenced by axpy_gen(), calc(), calcDot(), and gen2arg().

283  {
284  char buf[10];
285  std::sprintf( buf, "%d", i);
286  return buf;
287  }
blockLoc i
Definition: read.cpp:79

Here is the caller graph for this function:


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