MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
HopFunc2< A1, A2 > Class Template Reference

#include <HopFunc.h>

+ Inheritance diagram for HopFunc2< A1, A2 >:
+ Collaboration diagram for HopFunc2< A1, A2 >:

Public Member Functions

 HopFunc2 (HopIndex hopIndex)
 
void op (const Eref &e, A1 arg1, A2 arg2) const
 
void opVec (const Eref &e, const vector< A1 > &arg1, const vector< A1 > &arg2, const OpFunc2Base< A1, A2 > *op) const
 
- Public Member Functions inherited from OpFunc2Base< A1, A2 >
bool checkFinfo (const Finfo *s) const
 
const OpFuncmakeHopFunc (HopIndex hopIndex) const
 
void opBuffer (const Eref &e, double *buf) const
 Executes the OpFunc by converting args. More...
 
virtual void opVec (const Eref &e, const vector< A1 > &arg1, const vector< A2 > &arg2, const OpFunc2Base< A1, A2 > *op) const
 
void opVecBuffer (const Eref &e, double *buf) const
 Executes the OpFunc for all data by converting a vector of args. More...
 
string rttiType () const
 
- Public Member Functions inherited from OpFunc
 OpFunc ()
 
unsigned int opIndex () const
 
bool setIndex (unsigned int i)
 Used when rebuilding the Fid->OpFunc mapping. More...
 
virtual ~OpFunc ()
 

Private Attributes

HopIndex hopIndex_
 

Additional Inherited Members

- Static Public Member Functions inherited from OpFunc
static const OpFunclookop (unsigned int opIndex)
 
static unsigned int rebuildOpIndex ()
 cleans out the entire Ops vector. Returns size of orig vector. More...
 

Detailed Description

template<class A1, class A2>
class HopFunc2< A1, A2 >

Definition at line 189 of file HopFunc.h.

Constructor & Destructor Documentation

template<class A1, class A2>
HopFunc2< A1, A2 >::HopFunc2 ( HopIndex  hopIndex)
inline

Definition at line 194 of file HopFunc.h.

195  : hopIndex_( hopIndex )
196  {;}
HopIndex hopIndex_
Definition: HopFunc.h:265

Member Function Documentation

template<class A1, class A2>
void HopFunc2< A1, A2 >::op ( const Eref e,
A1  arg1,
A2  arg2 
) const
inlinevirtual

Implements OpFunc2Base< A1, A2 >.

Definition at line 197 of file HopFunc.h.

References addToBuf(), dispatchBuffers(), HopFunc2< A1, A2 >::hopIndex_, and Conv< T >::val2buf().

Referenced by testHopFunc().

198  {
199  double* buf = addToBuf( e, hopIndex_,
200  Conv< A1 >::size( arg1 ) + Conv< A2 >::size( arg2 ) );
201  /*
202  Conv< A1 >::val2buf( arg1, buf );
203  Conv< A2 >::val2buf( arg2, buf + Conv< A1 >.size( arg1 ) );
204  or
205  buf = Conv< A1 >.val2buf( arg1, buf );
206  Conv< A2 >::val2buf( arg2, buf );
207  or
208  */
209  Conv< A1 >::val2buf( arg1, &buf );
210  Conv< A2 >::val2buf( arg2, &buf );
212  }
static void val2buf(const T &val, double **buf)
Definition: Conv.h:56
double * addToBuf(const Eref &e, HopIndex hopIndex, unsigned int size)
Definition: HopFunc.cpp:29
Definition: Conv.h:30
void dispatchBuffers(const Eref &e, HopIndex hopIndex)
Definition: HopFunc.cpp:47
HopIndex hopIndex_
Definition: HopFunc.h:265

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<class A1, class A2>
void HopFunc2< A1, A2 >::opVec ( const Eref e,
const vector< A1 > &  arg1,
const vector< A1 > &  arg2,
const OpFunc2Base< A1, A2 > *  op 
) const
inline

Definition at line 214 of file HopFunc.h.

References addToBuf(), dataIndex, dispatchBuffers(), Eref::element(), Element::getNumOnNode(), HopFunc2< A1, A2 >::hopIndex_, Element::isGlobal(), mooseMyNode(), mooseNumNodes(), Element::numField(), Element::numLocalData(), and OpFunc2Base< A1, A2 >::op().

218  {
219  Element* elm = e.element();
220  unsigned int k = 0; // counter for index to arg vector.
221  if ( elm->isGlobal() ) {
222  // Need to ensure that all nodes get the same args,
223  // as opposed to below, where they are serial.
224  }
225  for ( unsigned int i = 0; i < mooseNumNodes(); ++i ) {
226  if ( i == mooseMyNode() ) {
227  unsigned int numData = elm->numLocalData();
228  for ( unsigned int p = 0; p < numData; ++p ) {
229  unsigned int numField = elm->numField( p );
230  for ( unsigned int q = 0; q < numField; ++q ) {
231  Eref er( elm, p, q );
232  unsigned int x = k % arg1.size();
233  unsigned int y = k % arg2.size();
234  op->op( er, arg1[x], arg2[y] );
235  k++;
236  }
237  }
238  } else {
239  unsigned int dataIndex = k;
240  // nn includes dataIndices and if present fieldIndices
241  // too. It may involve a query to the remote node.
242  unsigned int nn = elm->getNumOnNode( i );
243  vector< A1 > temp1( nn );
244  vector< A2 > temp2( nn );
245  // Have to do the insertion entry by entry because the
246  // argument vectors may wrap around.
247  for ( unsigned int j = 0; j < nn; ++j ) {
248  unsigned int x = k % arg1.size();
249  unsigned int y = k % arg2.size();
250  temp1[j] = arg1[x];
251  temp2[j] = arg2[y];
252  k++;
253  }
254  double* buf = addToBuf( e, hopIndex_,
255  Conv< vector< A1 > >::size( temp1 ) +
256  Conv< vector< A2 > >::size( temp2 ) );
257  Conv< vector< A1 > >::val2buf( temp1, &buf );
258  Conv< vector< A2 > >::val2buf( temp2, &buf );
259  dispatchBuffers( Eref( elm, dataIndex ), hopIndex_ );
260  // HopIndex says that it is a SetVec call.
261  }
262  }
263  }
double * addToBuf(const Eref &e, HopIndex hopIndex, unsigned int size)
Definition: HopFunc.cpp:29
Element * element() const
Definition: Eref.h:42
Definition: Conv.h:30
unsigned int mooseNumNodes()
Definition: HopFunc.cpp:87
virtual unsigned int getNumOnNode(unsigned int node) const =0
static char dataIndex[]
Definition: mfield.cpp:406
void dispatchBuffers(const Eref &e, HopIndex hopIndex)
Definition: HopFunc.cpp:47
HopIndex hopIndex_
Definition: HopFunc.h:265
virtual void op(const Eref &e, A1 arg1, A2 arg2) const =0
virtual unsigned int numField(unsigned int rawIndex) const =0
Returns number of field entries for specified data.
Definition: Eref.h:26
unsigned int mooseMyNode()
Definition: HopFunc.cpp:92
virtual bool isGlobal() const =0
True if there is a copy of every dataEntry on all nodes.
virtual unsigned int numLocalData() const =0
Returns number of local data entries on this node.

+ Here is the call graph for this function:

Member Data Documentation

template<class A1, class A2>
HopIndex HopFunc2< A1, A2 >::hopIndex_
private

Definition at line 265 of file HopFunc.h.

Referenced by HopFunc2< A1, A2 >::op(), and HopFunc2< A1, A2 >::opVec().


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